diff --git a/.github/workflows/jobs.yaml b/.github/workflows/jobs.yaml index 3b5389453b..42dbe99754 100644 --- a/.github/workflows/jobs.yaml +++ b/.github/workflows/jobs.yaml @@ -441,54 +441,6 @@ jobs: timeout-minutes: 10 run: npx testcafe "firefox:headless" web-app/tests/permissions-4/ --skip-js-errors - all-permissions-5: - name: Permissions Tests Part 5 - needs: - - compile-binary - runs-on: [ubuntu-latest] - strategy: - matrix: - go-version: [1.23.x] - os: [ubuntu-latest] - steps: - - name: Check out code - uses: actions/checkout@v3 - - name: Read .nvmrc - id: node_version - run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV - - name: Enable Corepack - run: corepack enable - - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NVMRC }} - - name: Install MinIO JS - working-directory: ./ - continue-on-error: false - run: | - yarn add minio - - uses: actions/cache@v4 - name: Console Binary Cache - with: - path: | - ./console - key: ${{ runner.os }}-binary-${{ github.run_id }} - - - name: clean-previous-containers-if-any - run: | - docker stop minio || true; - docker container prune -f || true; - - - name: Start Console, front-end app and initialize users/policies - run: | - (./console server) & (make initialize-permissions) - - - name: Install TestCafe - run: npm install testcafe@3.5.0 - - - name: Run TestCafe Tests - timeout-minutes: 5 - run: npx testcafe "firefox:headless" web-app/tests/permissions-5/ --skip-js-errors - all-permissions-6: name: Permissions Tests Part 6 needs: @@ -537,57 +489,6 @@ jobs: timeout-minutes: 5 run: npx testcafe "firefox:headless" web-app/tests/permissions-6/ --skip-js-errors - all-permissions-A: - name: Permissions Tests Part A - needs: - - compile-binary - runs-on: [ubuntu-latest] - strategy: - matrix: - go-version: [1.23.x] - os: [ubuntu-latest] - steps: - - name: Check out code - uses: actions/checkout@v3 - - name: Read .nvmrc - id: node_version - run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV - - name: Enable Corepack - run: corepack enable - - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NVMRC }} - - name: Install MinIO JS - working-directory: ./ - continue-on-error: false - run: | - yarn add minio - - uses: actions/cache@v4 - name: Console Binary Cache - with: - path: | - ./console - key: ${{ runner.os }}-binary-${{ github.run_id }} - - - name: clean-previous-containers-if-any - run: | - docker stop minio || true; - docker container prune -f || true; - - - name: Start Console, front-end app and initialize users/policies - run: | - (./console server) & (make initialize-permissions) - - - name: Install TestCafe - run: npm install testcafe@3.5.0 - - - name: Run TestCafe Tests - run: npx testcafe "firefox:headless" web-app/tests/permissions-A/ --skip-js-errors -c 3 - - - name: Clean up users & policies - run: | - make cleanup-permissions - all-permissions-B: name: Permissions Tests Part B needs: @@ -1282,20 +1183,4 @@ jobs: yarn remove playwright yarn add --dev @playwright/test echo "npx playwright test" - npx playwright test # To run the tests - echo "npx nyc report" - npx nyc report # To see report printed in logs as text - echo "npx nyc report --reporter=html" - npx nyc report --reporter=html # to see report in ./coverage/index.html - - uses: actions/upload-artifact@v4 - if: always() - with: - name: playwright-report - path: playwright-report/ - retention-days: 30 - - uses: actions/upload-artifact@v4 - if: always() - with: - name: coverage - path: coverage/ - retention-days: 30 + npx playwright test --reporter github # To run the tests \ No newline at end of file diff --git a/Makefile b/Makefile index f41ec2cdca..6fdf88ff28 100644 --- a/Makefile +++ b/Makefile @@ -206,11 +206,6 @@ test-permissions-4: @(env bash $(PWD)/web-app/tests/scripts/permissions.sh "web-app/tests/permissions-4/") @(docker stop minio) -test-permissions-5: - @(docker run -v /data1 -v /data2 -v /data3 -v /data4 -d --name minio --rm -p 9000:9000 quay.io/minio/minio:latest server /data{1...4}) - @(env bash $(PWD)/web-app/tests/scripts/permissions.sh "web-app/tests/permissions-5/") - @(docker stop minio) - test-permissions-6: @(docker run -v /data1 -v /data2 -v /data3 -v /data4 -d --name minio --rm -p 9000:9000 quay.io/minio/minio:latest server /data{1...4}) @(env bash $(PWD)/web-app/tests/scripts/permissions.sh "web-app/tests/permissions-6/") diff --git a/api/admin_arns.go b/api/admin_arns.go deleted file mode 100644 index dc7ba9483a..0000000000 --- a/api/admin_arns.go +++ /dev/null @@ -1,70 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 api - -import ( - "context" - - systemApi "github.com/minio/console/api/operations/system" - - "github.com/go-openapi/runtime/middleware" - "github.com/minio/console/api/operations" - "github.com/minio/console/models" -) - -func registerAdminArnsHandlers(api *operations.ConsoleAPI) { - // return a list of arns - api.SystemArnListHandler = systemApi.ArnListHandlerFunc(func(params systemApi.ArnListParams, session *models.Principal) middleware.Responder { - arnsResp, err := getArnsResponse(session, params) - if err != nil { - return systemApi.NewArnListDefault(err.Code).WithPayload(err.APIError) - } - return systemApi.NewArnListOK().WithPayload(arnsResp) - }) -} - -// getArns invokes admin info and returns a list of arns -func getArns(ctx context.Context, client MinioAdmin) (*models.ArnsResponse, error) { - serverInfo, err := client.serverInfo(ctx) - if err != nil { - return nil, err - } - // build response - return &models.ArnsResponse{ - Arns: serverInfo.SQSARN, - }, nil -} - -// getArnsResponse returns a list of active arns in the instance -func getArnsResponse(session *models.Principal, params systemApi.ArnListParams) (*models.ArnsResponse, *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) - } - // create a minioClient interface implementation - // defining the client to be used - adminClient := AdminClient{Client: mAdmin} - - // serialize output - arnsList, err := getArns(ctx, adminClient) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return arnsList, nil -} diff --git a/api/admin_arns_test.go b/api/admin_arns_test.go deleted file mode 100644 index 28dd2951dc..0000000000 --- a/api/admin_arns_test.go +++ /dev/null @@ -1,97 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 api - -import ( - "context" - "errors" - "fmt" - "net/http" - "strings" - "testing" - - "github.com/go-openapi/runtime/middleware" - "github.com/minio/console/api/operations/system" - "github.com/minio/console/models" - - "github.com/go-openapi/loads" - "github.com/minio/console/api/operations" - "github.com/minio/madmin-go/v3" - - asrt "github.com/stretchr/testify/assert" -) - -func TestArnsList(t *testing.T) { - assert := asrt.New(t) - adminClient := AdminClientMock{} - // Test-1 : getArns() returns proper arn list - MinioServerInfoMock = func(_ context.Context) (madmin.InfoMessage, error) { - return madmin.InfoMessage{ - SQSARN: []string{"uno"}, - }, nil - } - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - arnsList, err := getArns(ctx, adminClient) - assert.NotNil(arnsList, "arn list was returned nil") - if arnsList != nil { - assert.Equal(len(arnsList.Arns), 1, "Incorrect arns count") - } - assert.Nil(err, "Error should have been nil") - - // Test-2 : getArns(ctx) fails for whatever reason - MinioServerInfoMock = func(_ context.Context) (madmin.InfoMessage, error) { - return madmin.InfoMessage{}, errors.New("some reason") - } - - arnsList, err = getArns(ctx, adminClient) - assert.Nil(arnsList, "arn list was not returned nil") - assert.NotNil(err, "An error should have been returned") -} - -func TestRegisterAdminArnsHandlers(t *testing.T) { - assert := asrt.New(t) - swaggerSpec, err := loads.Embedded(SwaggerJSON, FlatSwaggerJSON) - if err != nil { - assert.Fail("Error") - } - api := operations.NewConsoleAPI(swaggerSpec) - api.SystemArnListHandler = nil - registerAdminArnsHandlers(api) - if api.SystemArnListHandler == nil { - assert.Fail("Assignment should happen") - } else { - fmt.Println("Function got assigned: ", api.SystemArnListHandler) - } - - // To test error case in registerAdminArnsHandlers - request, _ := http.NewRequest( - "GET", - "http://localhost:9090/api/v1/buckets/", - nil, - ) - ArnListParamsStruct := system.ArnListParams{ - HTTPRequest: request, - } - modelsPrincipal := models.Principal{ - STSAccessKeyID: "accesskey", - } - var value middleware.Responder = api.SystemArnListHandler.Handle(ArnListParamsStruct, &modelsPrincipal) - str := fmt.Sprintf("%#v", value) - fmt.Println("value: ", str) - assert.Equal(strings.Contains(str, "_statusCode:500"), true) -} diff --git a/api/admin_config.go b/api/admin_config.go deleted file mode 100644 index 647cb1e9d5..0000000000 --- a/api/admin_config.go +++ /dev/null @@ -1,316 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 api - -import ( - "context" - "encoding/base64" - "fmt" - "strings" - - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/swag" - "github.com/minio/console/api/operations" - "github.com/minio/console/models" - madmin "github.com/minio/madmin-go/v3" - - cfgApi "github.com/minio/console/api/operations/configuration" -) - -func registerConfigHandlers(api *operations.ConsoleAPI) { - // List Configurations - api.ConfigurationListConfigHandler = cfgApi.ListConfigHandlerFunc(func(params cfgApi.ListConfigParams, session *models.Principal) middleware.Responder { - configListResp, err := getListConfigResponse(session, params) - if err != nil { - return cfgApi.NewListConfigDefault(err.Code).WithPayload(err.APIError) - } - return cfgApi.NewListConfigOK().WithPayload(configListResp) - }) - // Configuration Info - api.ConfigurationConfigInfoHandler = cfgApi.ConfigInfoHandlerFunc(func(params cfgApi.ConfigInfoParams, session *models.Principal) middleware.Responder { - config, err := getConfigResponse(session, params) - if err != nil { - return cfgApi.NewConfigInfoDefault(err.Code).WithPayload(err.APIError) - } - return cfgApi.NewConfigInfoOK().WithPayload(config) - }) - // Set Configuration - api.ConfigurationSetConfigHandler = cfgApi.SetConfigHandlerFunc(func(params cfgApi.SetConfigParams, session *models.Principal) middleware.Responder { - resp, err := setConfigResponse(session, params) - if err != nil { - return cfgApi.NewSetConfigDefault(err.Code).WithPayload(err.APIError) - } - return cfgApi.NewSetConfigOK().WithPayload(resp) - }) - // Reset Configuration - api.ConfigurationResetConfigHandler = cfgApi.ResetConfigHandlerFunc(func(params cfgApi.ResetConfigParams, session *models.Principal) middleware.Responder { - resp, err := resetConfigResponse(session, params) - if err != nil { - return cfgApi.NewResetConfigDefault(err.Code).WithPayload(err.APIError) - } - return cfgApi.NewResetConfigOK().WithPayload(resp) - }) - // Export Configuration as base64 string. - api.ConfigurationExportConfigHandler = cfgApi.ExportConfigHandlerFunc(func(params cfgApi.ExportConfigParams, session *models.Principal) middleware.Responder { - resp, err := exportConfigResponse(session, params) - if err != nil { - return cfgApi.NewExportConfigDefault(err.Code).WithPayload(err.APIError) - } - return cfgApi.NewExportConfigOK().WithPayload(resp) - }) - api.ConfigurationPostConfigsImportHandler = cfgApi.PostConfigsImportHandlerFunc(func(params cfgApi.PostConfigsImportParams, session *models.Principal) middleware.Responder { - _, err := importConfigResponse(session, params) - if err != nil { - return cfgApi.NewPostConfigsImportDefault(err.Code).WithPayload(err.APIError) - } - return cfgApi.NewPostConfigsImportDefault(200) - }) -} - -// listConfig gets all configurations' names and their descriptions -func listConfig(client MinioAdmin) ([]*models.ConfigDescription, error) { - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - configKeysHelp, err := client.helpConfigKV(ctx, "", "", false) - if err != nil { - return nil, err - } - var configDescs []*models.ConfigDescription - for _, c := range configKeysHelp.KeysHelp { - desc := &models.ConfigDescription{ - Key: c.Key, - Description: c.Description, - } - configDescs = append(configDescs, desc) - } - return configDescs, nil -} - -// getListConfigResponse performs listConfig() and serializes it to the handler's output -func getListConfigResponse(session *models.Principal, params cfgApi.ListConfigParams) (*models.ListConfigResponse, *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) - } - // create a MinIO Admin Client interface implementation - // defining the client to be used - adminClient := AdminClient{Client: mAdmin} - - configDescs, err := listConfig(adminClient) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - listGroupsResponse := &models.ListConfigResponse{ - Configurations: configDescs, - Total: int64(len(configDescs)), - } - return listGroupsResponse, nil -} - -// getConfig gets the key values for a defined configuration. -func getConfig(ctx context.Context, client MinioAdmin, name string) ([]*models.Configuration, error) { - configBytes, err := client.getConfigKV(ctx, name) - if err != nil { - return nil, err - } - subSysConfigs, err := madmin.ParseServerConfigOutput(string(configBytes)) - if err != nil { - return nil, err - } - var configSubSysList []*models.Configuration - for _, scfg := range subSysConfigs { - if !madmin.SubSystems.Contains(scfg.SubSystem) { - return nil, fmt.Errorf("no sub-systems found") - } - var confkv []*models.ConfigurationKV - for _, kv := range scfg.KV { - var envOverride *models.EnvOverride - - if kv.EnvOverride != nil { - envOverride = &models.EnvOverride{ - Name: kv.EnvOverride.Name, - Value: kv.EnvOverride.Value, - } - } - - confkv = append(confkv, &models.ConfigurationKV{Key: kv.Key, Value: kv.Value, EnvOverride: envOverride}) - } - if len(confkv) == 0 { - continue - } - var fullConfigName string - if scfg.Target == "" { - fullConfigName = scfg.SubSystem - } else { - fullConfigName = scfg.SubSystem + ":" + scfg.Target - } - configSubSysList = append(configSubSysList, &models.Configuration{KeyValues: confkv, Name: fullConfigName}) - } - return configSubSysList, nil -} - -// getConfigResponse performs getConfig() and serializes it to the handler's output -func getConfigResponse(session *models.Principal, params cfgApi.ConfigInfoParams) ([]*models.Configuration, *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) - } - // create a MinIO Admin Client interface implementation - // defining the client to be used - adminClient := AdminClient{Client: mAdmin} - - configurations, err := getConfig(ctx, adminClient, params.Name) - if err != nil { - errorVal := ErrorWithContext(ctx, err) - minioError := madmin.ToErrorResponse(err) - if minioError.Code == "XMinioConfigError" { - errorVal.Code = 404 - } - return nil, errorVal - } - return configurations, nil -} - -// setConfig sets a configuration with the defined key values -func setConfig(ctx context.Context, client MinioAdmin, configName *string, kvs []*models.ConfigurationKV) (restart bool, err error) { - config := buildConfig(configName, kvs) - restart, err = client.setConfigKV(ctx, *config) - if err != nil { - return false, err - } - return restart, nil -} - -func setConfigWithARNAccountID(ctx context.Context, client MinioAdmin, configName *string, kvs []*models.ConfigurationKV, arnAccountID string) (restart bool, err error) { - // if arnAccountID is not empty the configuration will be treated as a notification target - // arnAccountID will be used as an identifier for that specific target - // docs: https://min.io/docs/minio/linux/administration/monitoring/bucket-notifications.html - if arnAccountID != "" { - configName = swag.String(fmt.Sprintf("%s:%s", *configName, arnAccountID)) - } - return setConfig(ctx, client, configName, kvs) -} - -// buildConfig builds a concatenated string including name and keyvalues -// e.g. `region name=us-west-1` -func buildConfig(configName *string, kvs []*models.ConfigurationKV) *string { - var builder strings.Builder - builder.WriteString(*configName) - for _, kv := range kvs { - key := strings.TrimSpace(kv.Key) - if key == "" { - continue - } - builder.WriteString(" ") - builder.WriteString(key) - builder.WriteString("=") - // All newlines must be converted to ',' - builder.WriteString(strings.ReplaceAll(strings.TrimSpace(fmt.Sprintf("\"%s\"", kv.Value)), "\n", ",")) - } - config := builder.String() - return &config -} - -// setConfigResponse implements setConfig() to be used by handler -func setConfigResponse(session *models.Principal, params cfgApi.SetConfigParams) (*models.SetConfigResponse, *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) - } - // create a MinIO Admin Client interface implementation - // defining the client to be used - adminClient := AdminClient{Client: mAdmin} - configName := params.Name - - needsRestart, err := setConfigWithARNAccountID(ctx, adminClient, &configName, params.Body.KeyValues, params.Body.ArnResourceID) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return &models.SetConfigResponse{Restart: needsRestart}, nil -} - -func resetConfig(ctx context.Context, client MinioAdmin, configName *string) (err error) { - err = client.delConfigKV(ctx, *configName) - return err -} - -// resetConfigResponse implements resetConfig() to be used by handler -func resetConfigResponse(session *models.Principal, params cfgApi.ResetConfigParams) (*models.SetConfigResponse, *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) - } - // create a MinIO Admin Client interface implementation - // defining the client to be used - adminClient := AdminClient{Client: mAdmin} - - err = resetConfig(ctx, adminClient, ¶ms.Name) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - - return &models.SetConfigResponse{Restart: true}, nil -} - -func exportConfigResponse(session *models.Principal, params cfgApi.ExportConfigParams) (*models.ConfigExportResponse, *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) - } - configRes, err := mAdmin.GetConfig(ctx) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - // may contain sensitive information so unpack only when required. - return &models.ConfigExportResponse{ - Status: "success", - Value: base64.StdEncoding.EncodeToString(configRes), - }, nil -} - -func importConfigResponse(session *models.Principal, params cfgApi.PostConfigsImportParams) (*cfgApi.PostConfigsImportDefault, *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) - } - file, _, err := params.HTTPRequest.FormFile("file") - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - defer file.Close() - - err = mAdmin.SetConfig(ctx, file) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return &cfgApi.PostConfigsImportDefault{}, nil -} diff --git a/api/admin_config_test.go b/api/admin_config_test.go deleted file mode 100644 index eacd53d4f3..0000000000 --- a/api/admin_config_test.go +++ /dev/null @@ -1,609 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 api - -import ( - "context" - "encoding/json" - "errors" - "fmt" - "reflect" - "testing" - - "github.com/go-openapi/swag" - "github.com/stretchr/testify/assert" - - "github.com/minio/console/models" - "github.com/minio/madmin-go/v3" -) - -const ( - NotifyPostgresSubSys = "notify_postgres" - PostgresFormat = "format" - PostgresConnectionString = "connection_string" - PostgresTable = "table" - PostgresQueueDir = "queue_dir" - PostgresQueueLimit = "queue_limit" -) - -func TestListConfig(t *testing.T) { - assert := assert.New(t) - adminClient := AdminClientMock{} - function := "listConfig()" - // Test-1 : listConfig() get list of two configurations and ensure is output correctly - configListMock := []madmin.HelpKV{ - { - Key: "region", - Description: "label the location of the server", - }, - { - Key: "notify_nsq", - Description: "publish bucket notifications to NSQ endpoints", - }, - } - mockConfigList := madmin.Help{ - SubSys: "sys", - Description: "desc", - MultipleTargets: false, - KeysHelp: configListMock, - } - expectedKeysDesc := mockConfigList.KeysHelp - // mock function response from listConfig() - minioHelpConfigKVMock = func(_, _ string, _ bool) (madmin.Help, error) { - return mockConfigList, nil - } - configList, err := listConfig(adminClient) - if err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - // verify length of keys is correct - assert.Equal(len(expectedKeysDesc), len(configList), fmt.Sprintf("Failed on %s: length of Configs's lists is not the same", function)) - // verify KeysHelp content - for i, kv := range configList { - assert.Equal(expectedKeysDesc[i].Key, kv.Key) - assert.Equal(expectedKeysDesc[i].Description, kv.Description) - } - - // Test-2 : listConfig() Return error and see that the error is handled correctly and returned - // mock function response from listConfig() - minioHelpConfigKVMock = func(_, _ string, _ bool) (madmin.Help, error) { - return madmin.Help{}, errors.New("error") - } - _, err = listConfig(adminClient) - if assert.Error(err) { - assert.Equal("error", err.Error()) - } -} - -func TestSetConfig(t *testing.T) { - assert := assert.New(t) - adminClient := AdminClientMock{} - function := "setConfig()" - // mock function response from setConfig() - minioSetConfigKVMock = func(_ string) (restart bool, err error) { - return false, nil - } - configName := "notify_postgres" - kvs := []*models.ConfigurationKV{ - { - Key: "enable", - Value: "off", - }, - { - Key: "connection_string", - Value: "", - }, - } - - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - // Test-1 : setConfig() sets a config with two key value pairs - restart, err := setConfig(ctx, adminClient, &configName, kvs) - if err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - assert.Equal(restart, false) - - // Test-2 : setConfig() returns error, handle properly - minioSetConfigKVMock = func(_ string) (restart bool, err error) { - return false, errors.New("error") - } - restart, err = setConfig(ctx, adminClient, &configName, kvs) - if assert.Error(err) { - assert.Equal("error", err.Error()) - } - assert.Equal(restart, false) - - // Test-4 : setConfig() set config, need restart - minioSetConfigKVMock = func(_ string) (restart bool, err error) { - return true, nil - } - restart, err = setConfig(ctx, adminClient, &configName, kvs) - if err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - assert.Equal(restart, true) -} - -func TestDelConfig(t *testing.T) { - assert := assert.New(t) - adminClient := AdminClientMock{} - function := "resetConfig()" - // mock function response from setConfig() - minioDelConfigKVMock = func(_ string) (err error) { - return nil - } - configName := "region" - - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - // Test-1 : resetConfig() resets a config with the config name - err := resetConfig(ctx, adminClient, &configName) - if err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - - // Test-2 : resetConfig() returns error, handle properly - minioDelConfigKVMock = func(_ string) (err error) { - return errors.New("error") - } - - err = resetConfig(ctx, adminClient, &configName) - if assert.Error(err) { - assert.Equal("error", err.Error()) - } -} - -func Test_buildConfig(t *testing.T) { - type args struct { - configName *string - kvs []*models.ConfigurationKV - } - tests := []struct { - name string - args args - want *string - }{ - // Test-1: buildConfig() format correctly configuration as "config_name k=v k2=v2" - { - name: "format correctly", - args: args{ - configName: swag.String("notify_postgres"), - kvs: []*models.ConfigurationKV{ - { - Key: "enable", - Value: "off", - }, - { - Key: "connection_string", - Value: "", - }, - }, - }, - want: swag.String("notify_postgres enable=\"off\" connection_string=\"\""), - }, - // Test-2: buildConfig() format correctly configuration as "config_name k=v k2=v2 k2=v3" with duplicate keys - { - name: "duplicated keys in config", - args: args{ - configName: swag.String("notify_postgres"), - kvs: []*models.ConfigurationKV{ - { - Key: "enable", - Value: "off", - }, - { - Key: "connection_string", - Value: "", - }, - { - Key: "connection_string", - Value: "x", - }, - }, - }, - want: swag.String("notify_postgres enable=\"off\" connection_string=\"\" connection_string=\"x\""), - }, - } - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - if got := buildConfig(tt.args.configName, tt.args.kvs); !reflect.DeepEqual(got, tt.want) { - t.Errorf("buildConfig() = %s, want %s", *got, *tt.want) - } - }) - } -} - -func Test_setConfigWithARN(t *testing.T) { - assert := assert.New(t) - client := AdminClientMock{} - - type args struct { - ctx context.Context - client MinioAdmin - configName *string - kvs []*models.ConfigurationKV - arn string - } - tests := []struct { - name string - args args - mockSetConfig func(kv string) (restart bool, err error) - wantErr bool - expected bool - }{ - { - name: "Set valid config with arn", - args: args{ - ctx: context.Background(), - client: client, - configName: swag.String("notify_kafka"), - kvs: []*models.ConfigurationKV{ - { - Key: "brokers", - Value: "http://localhost:8080/broker1,http://localhost:8080/broker2", - }, - }, - arn: "1", - }, - mockSetConfig: func(_ string) (restart bool, err error) { - return false, nil - }, - wantErr: false, - expected: false, - }, - { - name: "Set valid config, expect restart", - args: args{ - ctx: context.Background(), - client: client, - configName: swag.String("notify_kafka"), - kvs: []*models.ConfigurationKV{ - { - Key: "brokers", - Value: "http://localhost:8080/broker1,http://localhost:8080/broker2", - }, - }, - arn: "1", - }, - mockSetConfig: func(_ string) (restart bool, err error) { - return true, nil - }, - wantErr: false, - expected: true, - }, - { - name: "Set valid config without arn", - args: args{ - ctx: context.Background(), - client: client, - configName: swag.String("region"), - kvs: []*models.ConfigurationKV{ - { - Key: "name", - Value: "us-west-1", - }, - }, - arn: "", - }, - mockSetConfig: func(_ string) (restart bool, err error) { - return false, nil - }, - wantErr: false, - expected: false, - }, - { - name: "Setting an incorrect config", - args: args{ - ctx: context.Background(), - client: client, - configName: swag.String("oorgle"), - kvs: []*models.ConfigurationKV{ - { - Key: "name", - Value: "us-west-1", - }, - }, - arn: "", - }, - mockSetConfig: func(_ string) (restart bool, err error) { - return false, errors.New("error") - }, - wantErr: true, - expected: false, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - // mock function response from setConfig() - minioSetConfigKVMock = tt.mockSetConfig - restart, err := setConfigWithARNAccountID(tt.args.ctx, tt.args.client, tt.args.configName, tt.args.kvs, tt.args.arn) - if (err != nil) != tt.wantErr { - t.Errorf("setConfigWithARNAccountID() error = %v, wantErr %v", err, tt.wantErr) - } - assert.Equal(restart, tt.expected) - }) - } -} - -func Test_getConfig(t *testing.T) { - client := AdminClientMock{} - type args struct { - client MinioAdmin - name string - } - tests := []struct { - name string - args args - mock func() - want []*models.Configuration - wantErr bool - }{ - { - name: "get config", - args: args{ - client: client, - name: "notify_postgres", - }, - mock: func() { - // mock function response from getConfig() - minioGetConfigKVMock = func(_ string) ([]byte, error) { - return []byte(`notify_postgres:_ connection_string="host=localhost dbname=minio_events user=postgres password=password port=5432 sslmode=disable" table=bucketevents`), nil - } - - configListMock := []madmin.HelpKV{ - { - Key: PostgresConnectionString, - Description: `Postgres server connection-string e.g. "host=localhost port=5432 dbname=minio_events user=postgres password=password sslmode=disable"`, - Type: "string", - }, - { - Key: PostgresTable, - Description: "DB table name to store/update events, table is auto-created", - Type: "string", - }, - { - Key: PostgresFormat, - Description: "desc", - Type: "namespace*|access", - }, - { - Key: PostgresQueueDir, - Description: "des", - Optional: true, - Type: "path", - }, - { - Key: PostgresQueueLimit, - Description: "desc", - Optional: true, - Type: "number", - }, - { - Key: madmin.CommentKey, - Description: "", - Optional: true, - Type: "sentence", - }, - } - mockConfigList := madmin.Help{ - SubSys: NotifyPostgresSubSys, - Description: "publish bucket notifications to Postgres databases", - MultipleTargets: true, - KeysHelp: configListMock, - } - // mock function response from listConfig() - minioHelpConfigKVMock = func(_, _ string, _ bool) (madmin.Help, error) { - return mockConfigList, nil - } - }, - want: []*models.Configuration{ - { - KeyValues: []*models.ConfigurationKV{ - { - Key: PostgresConnectionString, - Value: "host=localhost dbname=minio_events user=postgres password=password port=5432 sslmode=disable", - }, - { - Key: PostgresTable, - Value: "bucketevents", - }, - }, Name: "notify_postgres", - }, - }, - wantErr: false, - }, - { - name: "valid config, but server returned empty", - args: args{ - client: client, - name: NotifyPostgresSubSys, - }, - mock: func() { - // mock function response from getConfig() - minioGetConfigKVMock = func(_ string) ([]byte, error) { - return []byte(`notify_postgres:_`), nil - } - - configListMock := []madmin.HelpKV{ - { - Key: PostgresConnectionString, - Description: `Postgres server connection-string e.g. "host=localhost port=5432 dbname=minio_events user=postgres password=password sslmode=disable"`, - Type: "string", - }, - { - Key: PostgresTable, - Description: "DB table name to store/update events, table is auto-created", - Type: "string", - }, - { - Key: PostgresFormat, - Description: "desc", - Type: "namespace*|access", - }, - { - Key: PostgresQueueDir, - Description: "des", - Optional: true, - Type: "path", - }, - { - Key: PostgresQueueLimit, - Description: "desc", - Optional: true, - Type: "number", - }, - { - Key: madmin.CommentKey, - Description: "optionally add a comment to this setting", - Optional: true, - Type: "sentence", - }, - } - mockConfigList := madmin.Help{ - SubSys: NotifyPostgresSubSys, - Description: "publish bucket notifications to Postgres databases", - MultipleTargets: true, - KeysHelp: configListMock, - } - // mock function response from listConfig() - minioHelpConfigKVMock = func(_, _ string, _ bool) (madmin.Help, error) { - return mockConfigList, nil - } - }, - want: nil, - wantErr: false, - }, - { - name: "random bytes coming out of getConfigKv", - args: args{ - client: client, - name: "notify_postgres", - }, - mock: func() { - // mock function response from getConfig() - minioGetConfigKVMock = func(_ string) ([]byte, error) { - x := make(map[string]string) - x["x"] = "x" - j, _ := json.Marshal(x) - return j, nil - } - - configListMock := []madmin.HelpKV{ - { - Key: PostgresConnectionString, - Description: `Postgres server connection-string e.g. "host=localhost port=5432 dbname=minio_events user=postgres password=password sslmode=disable"`, - Type: "string", - }, - { - Key: PostgresTable, - Description: "DB table name to store/update events, table is auto-created", - Type: "string", - }, - { - Key: PostgresFormat, - Description: "desc", - Type: "namespace*|access", - }, - { - Key: PostgresQueueDir, - Description: "des", - Optional: true, - Type: "path", - }, - { - Key: PostgresQueueLimit, - Description: "desc", - Optional: true, - Type: "number", - }, - { - Key: madmin.CommentKey, - Description: "optionally add a comment to this setting", - Optional: true, - Type: "sentence", - }, - } - mockConfigList := madmin.Help{ - SubSys: NotifyPostgresSubSys, - Description: "publish bucket notifications to Postgres databases", - MultipleTargets: true, - KeysHelp: configListMock, - } - // mock function response from listConfig() - minioHelpConfigKVMock = func(_, _ string, _ bool) (madmin.Help, error) { - return mockConfigList, nil - } - }, - want: nil, - wantErr: true, - }, - { - name: "bad config", - args: args{ - client: client, - name: "notify_postgresx", - }, - mock: func() { - // mock function response from getConfig() - minioGetConfigKVMock = func(_ string) ([]byte, error) { - return nil, errors.New("invalid config") - } - - mockConfigList := madmin.Help{} - // mock function response from listConfig() - minioHelpConfigKVMock = func(_, _ string, _ bool) (madmin.Help, error) { - return mockConfigList, nil - } - }, - want: nil, - wantErr: true, - }, - { - name: "no help", - args: args{ - client: client, - name: "notify_postgresx", - }, - mock: func() { - // mock function response from getConfig() - minioGetConfigKVMock = func(_ string) ([]byte, error) { - return nil, errors.New("invalid config") - } - // mock function response from listConfig() - minioHelpConfigKVMock = func(_, _ string, _ bool) (madmin.Help, error) { - return madmin.Help{}, errors.New("no help") - } - }, - want: nil, - wantErr: true, - }, - } - for _, tt := range tests { - tt.mock() - t.Run(tt.name, func(_ *testing.T) { - got, err := getConfig(context.Background(), tt.args.client, tt.args.name) - if (err != nil) != tt.wantErr { - t.Errorf("getConfig() error = %v, wantErr %v", err, tt.wantErr) - return - } - if !reflect.DeepEqual(got, tt.want) { - t.Errorf("getConfig() got = %v, want %v", got, tt.want) - } - }) - } -} diff --git a/api/admin_groups.go b/api/admin_groups.go deleted file mode 100644 index 94c1f37e62..0000000000 --- a/api/admin_groups.go +++ /dev/null @@ -1,339 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 api - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/minio/console/api/operations" - "github.com/minio/madmin-go/v3" - - groupApi "github.com/minio/console/api/operations/group" - - "github.com/minio/console/models" -) - -func registerGroupsHandlers(api *operations.ConsoleAPI) { - // List Groups - api.GroupListGroupsHandler = groupApi.ListGroupsHandlerFunc(func(params groupApi.ListGroupsParams, session *models.Principal) middleware.Responder { - listGroupsResponse, err := getListGroupsResponse(session, params) - if err != nil { - return groupApi.NewListGroupsDefault(err.Code).WithPayload(err.APIError) - } - return groupApi.NewListGroupsOK().WithPayload(listGroupsResponse) - }) - // Group Info - api.GroupGroupInfoHandler = groupApi.GroupInfoHandlerFunc(func(params groupApi.GroupInfoParams, session *models.Principal) middleware.Responder { - groupInfo, err := getGroupInfoResponse(session, params) - if err != nil { - return groupApi.NewGroupInfoDefault(err.Code).WithPayload(err.APIError) - } - return groupApi.NewGroupInfoOK().WithPayload(groupInfo) - }) - // Add Group - api.GroupAddGroupHandler = groupApi.AddGroupHandlerFunc(func(params groupApi.AddGroupParams, session *models.Principal) middleware.Responder { - if err := getAddGroupResponse(session, params); err != nil { - return groupApi.NewAddGroupDefault(err.Code).WithPayload(err.APIError) - } - return groupApi.NewAddGroupCreated() - }) - // Remove Group - api.GroupRemoveGroupHandler = groupApi.RemoveGroupHandlerFunc(func(params groupApi.RemoveGroupParams, session *models.Principal) middleware.Responder { - if err := getRemoveGroupResponse(session, params); err != nil { - return groupApi.NewRemoveGroupDefault(err.Code).WithPayload(err.APIError) - } - return groupApi.NewRemoveGroupNoContent() - }) - // Update Group - api.GroupUpdateGroupHandler = groupApi.UpdateGroupHandlerFunc(func(params groupApi.UpdateGroupParams, session *models.Principal) middleware.Responder { - groupUpdateResp, err := getUpdateGroupResponse(session, params) - if err != nil { - return groupApi.NewUpdateGroupDefault(err.Code).WithPayload(err.APIError) - } - return groupApi.NewUpdateGroupOK().WithPayload(groupUpdateResp) - }) -} - -// getListGroupsResponse performs listGroups() and serializes it to the handler's output -func getListGroupsResponse(session *models.Principal, params groupApi.ListGroupsParams) (*models.ListGroupsResponse, *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) - } - // create a MinIO Admin Client interface implementation - // defining the client to be used - adminClient := AdminClient{Client: mAdmin} - - groups, err := adminClient.listGroups(ctx) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - - // serialize output - listGroupsResponse := &models.ListGroupsResponse{ - Groups: groups, - Total: int64(len(groups)), - } - - return listGroupsResponse, nil -} - -// groupInfo calls MinIO server get Group's info -func groupInfo(ctx context.Context, client MinioAdmin, group string) (*madmin.GroupDesc, error) { - groupDesc, err := client.getGroupDescription(ctx, group) - if err != nil { - return nil, err - } - return groupDesc, nil -} - -// getGroupInfoResponse performs groupInfo() and serializes it to the handler's output -func getGroupInfoResponse(session *models.Principal, params groupApi.GroupInfoParams) (*models.Group, *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) - } - // create a MinIO Admin Client interface implementation - // defining the client to be used - adminClient := AdminClient{Client: mAdmin} - - groupDesc, err := groupInfo(ctx, adminClient, params.Name) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - - groupResponse := &models.Group{ - Members: groupDesc.Members, - Name: groupDesc.Name, - Policy: groupDesc.Policy, - Status: groupDesc.Status, - } - - return groupResponse, nil -} - -// addGroupAdd a MinIO group with the defined members -func addGroup(ctx context.Context, client MinioAdmin, group string, members []string) error { - gAddRemove := madmin.GroupAddRemove{ - Group: group, - Members: members, - IsRemove: false, - } - err := client.updateGroupMembers(ctx, gAddRemove) - if err != nil { - return err - } - return nil -} - -// getAddGroupResponse performs addGroup() and serializes it to the handler's output -func getAddGroupResponse(session *models.Principal, params groupApi.AddGroupParams) *CodedAPIError { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - // AddGroup request needed to proceed - if params.Body == nil { - return ErrorWithContext(ctx, ErrGroupBodyNotInRequest) - } - groupRequest := params.Body - mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return ErrorWithContext(ctx, err) - } - // create a MinIO Admin Client interface implementation - // defining the client to be used - adminClient := AdminClient{Client: mAdmin} - - groupList, _ := adminClient.listGroups(ctx) - - for _, b := range groupList { - if b == *groupRequest.Group { - return ErrorWithContext(ctx, ErrGroupAlreadyExists) - } - } - - if err := addGroup(ctx, adminClient, *groupRequest.Group, groupRequest.Members); err != nil { - return ErrorWithContext(ctx, err) - } - return nil -} - -// removeGroup deletes a minIO group only if it has no members -func removeGroup(ctx context.Context, client MinioAdmin, group string) error { - gAddRemove := madmin.GroupAddRemove{ - Group: group, - Members: []string{}, - IsRemove: true, - } - err := client.updateGroupMembers(ctx, gAddRemove) - if err != nil { - return err - } - return nil -} - -// getRemoveGroupResponse performs removeGroup() and serializes it to the handler's output -func getRemoveGroupResponse(session *models.Principal, params groupApi.RemoveGroupParams) *CodedAPIError { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - if params.Name == "" { - return ErrorWithContext(ctx, ErrGroupNameNotInRequest) - } - mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return ErrorWithContext(ctx, err) - } - // Create a MinIO Admin Client interface implementation - // defining the client to be used - adminClient := AdminClient{Client: mAdmin} - - if err := removeGroup(ctx, adminClient, params.Name); err != nil { - minioError := madmin.ToErrorResponse(err) - err2 := ErrorWithContext(ctx, err) - if minioError.Code == "XMinioAdminNoSuchGroup" { - err2.Code = 404 - } - return err2 - } - return nil -} - -// updateGroup updates a group by adding/removing members and setting the status to the desired one -// -// isRemove: whether remove members or not -func updateGroupMembers(ctx context.Context, client MinioAdmin, group string, members []string, isRemove bool) error { - gAddRemove := madmin.GroupAddRemove{ - Group: group, - Members: members, - IsRemove: isRemove, - } - err := client.updateGroupMembers(ctx, gAddRemove) - if err != nil { - return err - } - return nil -} - -// addOrDeleteMembers updates a group members by adding or deleting them based on the expectedMembers -func addOrDeleteMembers(ctx context.Context, client MinioAdmin, group *madmin.GroupDesc, expectedMembers []string) error { - // get members to delete/add - membersToDelete := DifferenceArrays(group.Members, expectedMembers) - membersToAdd := DifferenceArrays(expectedMembers, group.Members) - // delete members if any to be deleted - if len(membersToDelete) > 0 { - err := updateGroupMembers(ctx, client, group.Name, membersToDelete, true) - if err != nil { - return err - } - } - // add members if any to be added - if len(membersToAdd) > 0 { - err := updateGroupMembers(ctx, client, group.Name, membersToAdd, false) - if err != nil { - return err - } - } - return nil -} - -func setGroupStatus(ctx context.Context, client MinioAdmin, group, status string) error { - var setStatus madmin.GroupStatus - switch status { - case "enabled": - setStatus = madmin.GroupEnabled - case "disabled": - setStatus = madmin.GroupDisabled - default: - return errors.New(500, "status not valid") - } - return client.setGroupStatus(ctx, group, setStatus) -} - -// getUpdateGroupResponse updates a group by adding or removing it's members depending on the request, -// also sets the group's status if status in the request is different than the current one. -// Then serializes the output to be used by the handler. -func getUpdateGroupResponse(session *models.Principal, params groupApi.UpdateGroupParams) (*models.Group, *CodedAPIError) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - if params.Name == "" { - return nil, ErrorWithContext(ctx, ErrGroupNameNotInRequest) - } - if params.Body == nil { - return nil, ErrorWithContext(ctx, ErrGroupBodyNotInRequest) - } - expectedGroupUpdate := params.Body - - mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - // create a MinIO Admin Client interface implementation - // defining the client to be used - adminClient := AdminClient{Client: mAdmin} - - groupUpdated, err := groupUpdate(ctx, adminClient, params.Name, expectedGroupUpdate) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - groupResponse := &models.Group{ - Name: groupUpdated.Name, - Members: groupUpdated.Members, - Policy: groupUpdated.Policy, - Status: groupUpdated.Status, - } - return groupResponse, nil -} - -// groupUpdate updates a group given the expected parameters, compares the expected parameters against the current ones -// and updates them accordingly, status is only updated if the expected status is different than the current one. -// Then fetches the group again to return the object updated. -func groupUpdate(ctx context.Context, client MinioAdmin, groupName string, expectedGroup *models.UpdateGroupRequest) (*madmin.GroupDesc, error) { - expectedMembers := expectedGroup.Members - expectedStatus := *expectedGroup.Status - // get current members and status - groupDescription, err := groupInfo(ctx, client, groupName) - if err != nil { - LogInfo("error getting group info: %v", err) - return nil, err - } - // update group members - err = addOrDeleteMembers(ctx, client, groupDescription, expectedMembers) - if err != nil { - LogInfo("error updating group: %v", err) - return nil, err - } - // update group status only if different from current status - if expectedStatus != groupDescription.Status { - err = setGroupStatus(ctx, client, groupDescription.Name, expectedStatus) - if err != nil { - LogInfo("error updating group's status: %v", err) - return nil, err - } - } - // return latest group info to verify that changes were applied correctly - groupDescription, err = groupInfo(ctx, client, groupName) - if err != nil { - LogInfo("error getting group info: %v", err) - return nil, err - } - return groupDescription, nil -} diff --git a/api/admin_groups_test.go b/api/admin_groups_test.go deleted file mode 100644 index a9893266ad..0000000000 --- a/api/admin_groups_test.go +++ /dev/null @@ -1,291 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 api - -import ( - "context" - "errors" - "fmt" - "testing" - - "github.com/go-openapi/swag" - "github.com/minio/console/models" - "github.com/minio/madmin-go/v3" - "github.com/stretchr/testify/assert" -) - -func TestListGroups(t *testing.T) { - assert := assert.New(t) - adminClient := AdminClientMock{} - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - // Test-1 : listGroups() Get response from minio client with two Groups and return the same number on listGroups() - mockGroupsList := []string{"group1", "group2"} - - // mock function response from listGroups() - minioListGroupsMock = func() ([]string, error) { - return mockGroupsList, nil - } - // get list Groups response this response should have Name, CreationDate, Size and Access - // as part of of each Groups - function := "listGroups()" - groupsList, err := adminClient.listGroups(ctx) - if err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - // verify length of Groupss is correct - assert.Equal(len(mockGroupsList), len(groupsList), fmt.Sprintf("Failed on %s: length of Groups's lists is not the same", function)) - - for i, g := range groupsList { - assert.Equal(mockGroupsList[i], g) - } - - // Test-2 : listGroups() Return error and see that the error is handled correctly and returned - minioListGroupsMock = func() ([]string, error) { - return nil, errors.New("error") - } - _, err = adminClient.listGroups(ctx) - if assert.Error(err) { - assert.Equal("error", err.Error()) - } -} - -func TestAddGroup(t *testing.T) { - assert := assert.New(t) - adminClient := AdminClientMock{} - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - // Test-1 : addGroup() add a new group with two members - newGroup := "acmeGroup" - groupMembers := []string{"user1", "user2"} - // mock function response from updateGroupMembers() - minioUpdateGroupMembersMock = func(madmin.GroupAddRemove) error { - return nil - } - function := "addGroup()" - if err := addGroup(ctx, adminClient, newGroup, groupMembers); err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - - // Test-2 : addGroup() Return error and see that the error is handled correctly and returned - minioUpdateGroupMembersMock = func(madmin.GroupAddRemove) error { - return errors.New("error") - } - - if err := addGroup(ctx, adminClient, newGroup, groupMembers); assert.Error(err) { - assert.Equal("error", err.Error()) - } -} - -func TestRemoveGroup(t *testing.T) { - assert := assert.New(t) - adminClient := AdminClientMock{} - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - // Test-1 : removeGroup() remove group assume it has no members - groupToRemove := "acmeGroup" - // mock function response from updateGroupMembers() - minioUpdateGroupMembersMock = func(madmin.GroupAddRemove) error { - return nil - } - function := "removeGroup()" - if err := removeGroup(ctx, adminClient, groupToRemove); err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - - // Test-2 : removeGroup() Return error and see that the error is handled correctly and returned - minioUpdateGroupMembersMock = func(madmin.GroupAddRemove) error { - return errors.New("error") - } - if err := removeGroup(ctx, adminClient, groupToRemove); assert.Error(err) { - assert.Equal("error", err.Error()) - } -} - -func TestGroupInfo(t *testing.T) { - assert := assert.New(t) - adminClient := AdminClientMock{} - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - // Test-1 : groupInfo() get group info - groupName := "acmeGroup" - mockResponse := &madmin.GroupDesc{ - Name: groupName, - Policy: "policyTest", - Members: []string{"user1", "user2"}, - Status: "enabled", - } - // mock function response from updateGroupMembers() - minioGetGroupDescriptionMock = func(_ string) (*madmin.GroupDesc, error) { - return mockResponse, nil - } - function := "groupInfo()" - info, err := groupInfo(ctx, adminClient, groupName) - if err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - assert.Equal(groupName, info.Name) - assert.Equal("policyTest", info.Policy) - assert.ElementsMatch([]string{"user1", "user2"}, info.Members) - assert.Equal("enabled", info.Status) - - // Test-2 : groupInfo() Return error and see that the error is handled correctly and returned - minioGetGroupDescriptionMock = func(_ string) (*madmin.GroupDesc, error) { - return nil, errors.New("error") - } - _, err = groupInfo(ctx, adminClient, groupName) - if assert.Error(err) { - assert.Equal("error", err.Error()) - } -} - -func TestUpdateGroup(t *testing.T) { - assert := assert.New(t) - adminClient := AdminClientMock{} - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - // Test-1 : addOrDeleteMembers() update group members add user3 and delete user2 - function := "addOrDeleteMembers()" - groupName := "acmeGroup" - mockGroupDesc := &madmin.GroupDesc{ - Name: groupName, - Policy: "policyTest", - Members: []string{"user1", "user2"}, - Status: "enabled", - } - membersDesired := []string{"user3", "user1"} - minioUpdateGroupMembersMock = func(madmin.GroupAddRemove) error { - return nil - } - if err := addOrDeleteMembers(ctx, adminClient, mockGroupDesc, membersDesired); err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - - // Test-2 : addOrDeleteMembers() handle error correctly - minioUpdateGroupMembersMock = func(madmin.GroupAddRemove) error { - return errors.New("error") - } - if err := addOrDeleteMembers(ctx, adminClient, mockGroupDesc, membersDesired); assert.Error(err) { - assert.Equal("error", err.Error()) - } - - // Test-3 : addOrDeleteMembers() only add members but handle error on adding - minioUpdateGroupMembersMock = func(madmin.GroupAddRemove) error { - return errors.New("error") - } - membersDesired = []string{"user3", "user1", "user2"} - if err := addOrDeleteMembers(ctx, adminClient, mockGroupDesc, membersDesired); assert.Error(err) { - assert.Equal("error", err.Error()) - } - - // Test-4: addOrDeleteMembers() no updates needed so error shall not be triggered or handled. - minioUpdateGroupMembersMock = func(madmin.GroupAddRemove) error { - return errors.New("error") - } - membersDesired = []string{"user1", "user2"} - if err := addOrDeleteMembers(ctx, adminClient, mockGroupDesc, membersDesired); err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - - // Test-5 : groupUpdate() integrate all from getting current group to update it and see if it changed. - // This test mocks one function twice and makes sure it returns different content on each call. - function = "groupUpdate()" - groupName = "acmeGroup" - membersDesired = []string{"user1", "user2", "user3"} - expectedGroupUpdate := &models.UpdateGroupRequest{ - Members: membersDesired, - Status: swag.String("disabled"), - } - mockResponseBeforeUpdate := &madmin.GroupDesc{ - Name: groupName, - Policy: "policyTest", - Members: []string{"user1", "user2"}, - Status: "enabled", - } - mockResponseAfterUpdate := &madmin.GroupDesc{ - Name: groupName, - Policy: "policyTest", - Members: []string{"user1", "user2", "user3"}, - Status: "disabled", - } - // groupUpdate uses getInfo() twice which uses getGroupDescription() so we need to mock as if it called - // the function twice but the second time returned an error - is2ndRunGroupInfo := false - // mock function response from updateGroupMembers() - minioGetGroupDescriptionMock = func(_ string) (*madmin.GroupDesc, error) { - if is2ndRunGroupInfo { - return mockResponseAfterUpdate, nil - } - is2ndRunGroupInfo = true - return mockResponseBeforeUpdate, nil - } - minioUpdateGroupMembersMock = func(madmin.GroupAddRemove) error { - return nil - } - minioSetGroupStatusMock = func(_ string, _ madmin.GroupStatus) error { - return nil - } - groupUpdated, err := groupUpdate(ctx, adminClient, groupName, expectedGroupUpdate) - if err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - // assert elements were updated as expected - assert.ElementsMatch(membersDesired, groupUpdated.Members) - assert.Equal(groupName, groupUpdated.Name) - assert.Equal(*expectedGroupUpdate.Status, groupUpdated.Status) -} - -func TestSetGroupStatus(t *testing.T) { - assert := assert.New(t) - adminClient := AdminClientMock{} - function := "setGroupStatus()" - groupName := "acmeGroup" - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - // Test-1: setGroupStatus() update valid disabled status - expectedStatus := "disabled" - minioSetGroupStatusMock = func(_ string, _ madmin.GroupStatus) error { - return nil - } - if err := setGroupStatus(ctx, adminClient, groupName, expectedStatus); err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - // Test-2: setGroupStatus() update valid enabled status - expectedStatus = "enabled" - minioSetGroupStatusMock = func(_ string, _ madmin.GroupStatus) error { - return nil - } - if err := setGroupStatus(ctx, adminClient, groupName, expectedStatus); err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - // Test-3: setGroupStatus() update invalid status, should send error - expectedStatus = "invalid" - minioSetGroupStatusMock = func(_ string, _ madmin.GroupStatus) error { - return nil - } - if err := setGroupStatus(ctx, adminClient, groupName, expectedStatus); assert.Error(err) { - assert.Equal("status not valid", err.Error()) - } - // Test-4: setGroupStatus() handler error correctly - expectedStatus = "enabled" - minioSetGroupStatusMock = func(_ string, _ madmin.GroupStatus) error { - return errors.New("error") - } - if err := setGroupStatus(ctx, adminClient, groupName, expectedStatus); assert.Error(err) { - assert.Equal("error", err.Error()) - } -} diff --git a/api/admin_idp.go b/api/admin_idp.go deleted file mode 100644 index df23562981..0000000000 --- a/api/admin_idp.go +++ /dev/null @@ -1,290 +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 . -// - -package api - -import ( - "context" - "fmt" - "time" - - "github.com/go-openapi/runtime/middleware" - "github.com/minio/console/api/operations" - "github.com/minio/console/api/operations/idp" - "github.com/minio/console/models" - "github.com/minio/madmin-go/v3" -) - -var errInvalidIDPType = fmt.Errorf("IDP type must be one of %v", madmin.ValidIDPConfigTypes) - -func registerIDPHandlers(api *operations.ConsoleAPI) { - api.IdpCreateConfigurationHandler = idp.CreateConfigurationHandlerFunc(func(params idp.CreateConfigurationParams, session *models.Principal) middleware.Responder { - response, err := createIDPConfigurationResponse(session, params) - if err != nil { - return idp.NewCreateConfigurationDefault(err.Code).WithPayload(err.APIError) - } - return idp.NewCreateConfigurationCreated().WithPayload(response) - }) - api.IdpUpdateConfigurationHandler = idp.UpdateConfigurationHandlerFunc(func(params idp.UpdateConfigurationParams, session *models.Principal) middleware.Responder { - response, err := updateIDPConfigurationResponse(session, params) - if err != nil { - return idp.NewUpdateConfigurationDefault(err.Code).WithPayload(err.APIError) - } - return idp.NewUpdateConfigurationOK().WithPayload(response) - }) - api.IdpListConfigurationsHandler = idp.ListConfigurationsHandlerFunc(func(params idp.ListConfigurationsParams, session *models.Principal) middleware.Responder { - response, err := listIDPConfigurationsResponse(session, params) - if err != nil { - return idp.NewListConfigurationsDefault(err.Code).WithPayload(err.APIError) - } - return idp.NewListConfigurationsOK().WithPayload(response) - }) - api.IdpDeleteConfigurationHandler = idp.DeleteConfigurationHandlerFunc(func(params idp.DeleteConfigurationParams, session *models.Principal) middleware.Responder { - response, err := deleteIDPConfigurationResponse(session, params) - if err != nil { - return idp.NewDeleteConfigurationDefault(err.Code).WithPayload(err.APIError) - } - return idp.NewDeleteConfigurationOK().WithPayload(response) - }) - api.IdpGetConfigurationHandler = idp.GetConfigurationHandlerFunc(func(params idp.GetConfigurationParams, session *models.Principal) middleware.Responder { - response, err := getIDPConfigurationsResponse(session, params) - if err != nil { - return idp.NewGetConfigurationDefault(err.Code).WithPayload(err.APIError) - } - return idp.NewGetConfigurationOK().WithPayload(response) - }) - api.IdpGetLDAPEntitiesHandler = idp.GetLDAPEntitiesHandlerFunc(func(params idp.GetLDAPEntitiesParams, session *models.Principal) middleware.Responder { - response, err := getLDAPEntitiesResponse(session, params) - if err != nil { - return idp.NewGetLDAPEntitiesDefault(err.Code).WithPayload(err.APIError) - } - return idp.NewGetLDAPEntitiesOK().WithPayload(response) - }) -} - -func createIDPConfigurationResponse(session *models.Principal, params idp.CreateConfigurationParams) (*models.SetIDPResponse, *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) - } - restart, err := createOrUpdateIDPConfig(ctx, params.Type, params.Body.Name, params.Body.Input, false, AdminClient{Client: mAdmin}) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return &models.SetIDPResponse{Restart: restart}, nil -} - -func updateIDPConfigurationResponse(session *models.Principal, params idp.UpdateConfigurationParams) (*models.SetIDPResponse, *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) - } - restart, err := createOrUpdateIDPConfig(ctx, params.Type, params.Name, params.Body.Input, true, AdminClient{Client: mAdmin}) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return &models.SetIDPResponse{Restart: restart}, nil -} - -func createOrUpdateIDPConfig(ctx context.Context, idpType, name, input string, update bool, client MinioAdmin) (bool, error) { - if !madmin.ValidIDPConfigTypes.Contains(idpType) { - return false, errInvalidIDPType - } - restart, err := client.addOrUpdateIDPConfig(ctx, idpType, name, input, update) - if err != nil { - return false, err - } - return restart, nil -} - -func listIDPConfigurationsResponse(session *models.Principal, params idp.ListConfigurationsParams) (*models.IdpListConfigurationsResponse, *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) - } - results, err := listIDPConfigurations(ctx, params.Type, AdminClient{Client: mAdmin}) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return &models.IdpListConfigurationsResponse{Results: results}, nil -} - -func listIDPConfigurations(ctx context.Context, idpType string, client MinioAdmin) ([]*models.IdpServerConfiguration, error) { - if !madmin.ValidIDPConfigTypes.Contains(idpType) { - return nil, errInvalidIDPType - } - results, err := client.listIDPConfig(ctx, idpType) - if err != nil { - return nil, err - } - return parseIDPConfigurations(results), nil -} - -func parseIDPConfigurations(configs []madmin.IDPListItem) (serverConfigs []*models.IdpServerConfiguration) { - for _, c := range configs { - serverConfigs = append(serverConfigs, &models.IdpServerConfiguration{ - Name: c.Name, - Enabled: c.Enabled, - Type: c.Type, - }) - } - return serverConfigs -} - -func deleteIDPConfigurationResponse(session *models.Principal, params idp.DeleteConfigurationParams) (*models.SetIDPResponse, *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) - } - restart, err := deleteIDPConfig(ctx, params.Type, params.Name, AdminClient{Client: mAdmin}) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return &models.SetIDPResponse{Restart: restart}, nil -} - -func deleteIDPConfig(ctx context.Context, idpType, name string, client MinioAdmin) (bool, error) { - if !madmin.ValidIDPConfigTypes.Contains(idpType) { - return false, errInvalidIDPType - } - restart, err := client.deleteIDPConfig(ctx, idpType, name) - if err != nil { - return false, err - } - return restart, nil -} - -func getIDPConfigurationsResponse(session *models.Principal, params idp.GetConfigurationParams) (*models.IdpServerConfiguration, *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) - } - result, err := getIDPConfiguration(ctx, params.Type, params.Name, AdminClient{Client: mAdmin}) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return result, nil -} - -func getIDPConfiguration(ctx context.Context, idpType, name string, client MinioAdmin) (*models.IdpServerConfiguration, error) { - if !madmin.ValidIDPConfigTypes.Contains(idpType) { - return nil, errInvalidIDPType - } - config, err := client.getIDPConfig(ctx, idpType, name) - if err != nil { - return nil, err - } - - return &models.IdpServerConfiguration{ - Name: config.Name, - Type: config.Type, - Info: parseIDPConfigurationsInfo(config.Info), - }, nil -} - -func parseIDPConfigurationsInfo(infoList []madmin.IDPCfgInfo) (results []*models.IdpServerConfigurationInfo) { - for _, info := range infoList { - results = append(results, &models.IdpServerConfigurationInfo{ - Key: info.Key, - Value: info.Value, - IsCfg: info.IsCfg, - IsEnv: info.IsEnv, - }) - } - return results -} - -func getLDAPEntitiesResponse(session *models.Principal, params idp.GetLDAPEntitiesParams) (*models.LdapEntities, *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) - } - - result, err := getEntitiesResult(ctx, AdminClient{Client: mAdmin}, params.Body.Users, params.Body.Groups, params.Body.Policies) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - - return result, nil -} - -func getEntitiesResult(ctx context.Context, client MinioAdmin, users, groups, policies []string) (*models.LdapEntities, error) { - entities, err := client.getLDAPPolicyEntities(ctx, madmin.PolicyEntitiesQuery{ - Users: users, - Groups: groups, - Policy: policies, - }) - if err != nil { - return nil, err - } - - var result models.LdapEntities - - var usersEntity []*models.LdapUserPolicyEntity - var groupsEntity []*models.LdapGroupPolicyEntity - var policiesEntity []*models.LdapPolicyEntity - - result.Timestamp = entities.Timestamp.Format(time.RFC3339) - - for _, userMapping := range entities.UserMappings { - mapItem := models.LdapUserPolicyEntity{ - User: userMapping.User, - Policies: userMapping.Policies, - } - - usersEntity = append(usersEntity, &mapItem) - } - - result.Users = usersEntity - - for _, groupsMapping := range entities.GroupMappings { - mapItem := models.LdapGroupPolicyEntity{ - Group: groupsMapping.Group, - Policies: groupsMapping.Policies, - } - - groupsEntity = append(groupsEntity, &mapItem) - } - - result.Groups = groupsEntity - - for _, policyMapping := range entities.PolicyMappings { - mapItem := models.LdapPolicyEntity{ - Policy: policyMapping.Policy, - Users: policyMapping.Users, - Groups: policyMapping.Groups, - } - - policiesEntity = append(policiesEntity, &mapItem) - } - - result.Policies = policiesEntity - - return &result, nil -} diff --git a/api/admin_idp_test.go b/api/admin_idp_test.go deleted file mode 100644 index 0471bd13bb..0000000000 --- a/api/admin_idp_test.go +++ /dev/null @@ -1,319 +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 . - -package api - -import ( - "context" - "errors" - "fmt" - "net/http" - "net/http/httptest" - "os" - "testing" - - "github.com/minio/madmin-go/v3" - - "github.com/minio/console/api/operations" - "github.com/minio/console/api/operations/idp" - "github.com/minio/console/models" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/suite" -) - -type IDPTestSuite struct { - suite.Suite - assert *assert.Assertions - currentServer string - isServerSet bool - server *httptest.Server - adminClient AdminClientMock -} - -func (suite *IDPTestSuite) SetupSuite() { - suite.assert = assert.New(suite.T()) - suite.adminClient = AdminClientMock{} - minioServiceRestartMock = func(_ context.Context) error { - return nil - } -} - -func (suite *IDPTestSuite) SetupTest() { - suite.server = httptest.NewServer(http.HandlerFunc(suite.serverHandler)) - suite.currentServer, suite.isServerSet = os.LookupEnv(ConsoleMinIOServer) - os.Setenv(ConsoleMinIOServer, suite.server.URL) -} - -func (suite *IDPTestSuite) serverHandler(w http.ResponseWriter, _ *http.Request) { - w.WriteHeader(400) -} - -func (suite *IDPTestSuite) TearDownSuite() { -} - -func (suite *IDPTestSuite) TearDownTest() { - if suite.isServerSet { - os.Setenv(ConsoleMinIOServer, suite.currentServer) - } else { - os.Unsetenv(ConsoleMinIOServer) - } -} - -func (suite *IDPTestSuite) TestRegisterIDPHandlers() { - api := &operations.ConsoleAPI{} - suite.assertHandlersAreNil(api) - registerIDPHandlers(api) - suite.assertHandlersAreNotNil(api) -} - -func (suite *IDPTestSuite) assertHandlersAreNil(api *operations.ConsoleAPI) { - suite.assert.Nil(api.IdpCreateConfigurationHandler) - suite.assert.Nil(api.IdpListConfigurationsHandler) - suite.assert.Nil(api.IdpUpdateConfigurationHandler) - suite.assert.Nil(api.IdpGetConfigurationHandler) - suite.assert.Nil(api.IdpGetConfigurationHandler) - suite.assert.Nil(api.IdpDeleteConfigurationHandler) -} - -func (suite *IDPTestSuite) assertHandlersAreNotNil(api *operations.ConsoleAPI) { - suite.assert.NotNil(api.IdpCreateConfigurationHandler) - suite.assert.NotNil(api.IdpListConfigurationsHandler) - suite.assert.NotNil(api.IdpUpdateConfigurationHandler) - suite.assert.NotNil(api.IdpGetConfigurationHandler) - suite.assert.NotNil(api.IdpGetConfigurationHandler) - suite.assert.NotNil(api.IdpDeleteConfigurationHandler) -} - -func (suite *IDPTestSuite) TestCreateIDPConfigurationHandlerWithError() { - params, api := suite.initCreateIDPConfigurationRequest() - response := api.IdpCreateConfigurationHandler.Handle(params, &models.Principal{}) - _, ok := response.(*idp.CreateConfigurationDefault) - suite.assert.True(ok) -} - -func (suite *IDPTestSuite) initCreateIDPConfigurationRequest() (params idp.CreateConfigurationParams, api operations.ConsoleAPI) { - registerIDPHandlers(&api) - params.HTTPRequest = &http.Request{} - params.Body = &models.IdpServerConfiguration{} - params.Type = "ldap" - return params, api -} - -func (suite *IDPTestSuite) TestCreateIDPConfigurationWithoutError() { - ctx := context.Background() - _, err := createOrUpdateIDPConfig(ctx, "ldap", "", "", false, suite.adminClient) - suite.assert.Nil(err) -} - -func (suite *IDPTestSuite) TestCreateIDPConfigurationWithWrongType() { - ctx := context.Background() - _, err := createOrUpdateIDPConfig(ctx, "", "", "", false, suite.adminClient) - suite.assert.NotNil(err) -} - -func (suite *IDPTestSuite) TestUpdateIDPConfigurationHandlerWithError() { - params, api := suite.initUpdateIDPConfigurationRequest() - response := api.IdpUpdateConfigurationHandler.Handle(params, &models.Principal{}) - _, ok := response.(*idp.UpdateConfigurationDefault) - suite.assert.True(ok) -} - -func (suite *IDPTestSuite) initUpdateIDPConfigurationRequest() (params idp.UpdateConfigurationParams, api operations.ConsoleAPI) { - registerIDPHandlers(&api) - params.HTTPRequest = &http.Request{} - params.Body = &models.IdpServerConfiguration{} - params.Type = "ldap" - return params, api -} - -func (suite *IDPTestSuite) TestUpdateIDPConfigurationWithoutError() { - ctx := context.Background() - _, err := createOrUpdateIDPConfig(ctx, "ldap", "", "", true, suite.adminClient) - suite.assert.Nil(err) -} - -func (suite *IDPTestSuite) TestUpdateIDPConfigurationWithWrongType() { - ctx := context.Background() - _, err := createOrUpdateIDPConfig(ctx, "", "", "", true, suite.adminClient) - suite.assert.NotNil(err) -} - -func (suite *IDPTestSuite) TestListIDPConfigurationHandlerWithError() { - params, api := suite.initListIDPConfigurationsRequest() - response := api.IdpListConfigurationsHandler.Handle(params, &models.Principal{}) - _, ok := response.(*idp.ListConfigurationsDefault) - suite.assert.True(ok) -} - -func (suite *IDPTestSuite) initListIDPConfigurationsRequest() (params idp.ListConfigurationsParams, api operations.ConsoleAPI) { - registerIDPHandlers(&api) - params.HTTPRequest = &http.Request{} - params.Type = "ldap" - return params, api -} - -func (suite *IDPTestSuite) TestListIDPConfigurationsWithoutError() { - ctx := context.Background() - res, err := listIDPConfigurations(ctx, "ldap", suite.adminClient) - suite.assert.NotNil(res) - suite.assert.Nil(err) -} - -func (suite *IDPTestSuite) TestListIDPConfigurationsWithWrongType() { - ctx := context.Background() - res, err := listIDPConfigurations(ctx, "", suite.adminClient) - suite.assert.Nil(res) - suite.assert.NotNil(err) -} - -func (suite *IDPTestSuite) TestDeleteIDPConfigurationHandlerWithError() { - params, api := suite.initDeleteIDPConfigurationRequest() - response := api.IdpDeleteConfigurationHandler.Handle(params, &models.Principal{}) - _, ok := response.(*idp.DeleteConfigurationDefault) - suite.assert.True(ok) -} - -func (suite *IDPTestSuite) initDeleteIDPConfigurationRequest() (params idp.DeleteConfigurationParams, api operations.ConsoleAPI) { - registerIDPHandlers(&api) - params.HTTPRequest = &http.Request{} - params.Type = "ldap" - return params, api -} - -func (suite *IDPTestSuite) TestDeleteIDPConfigurationWithoutError() { - ctx := context.Background() - _, err := deleteIDPConfig(ctx, "ldap", "", suite.adminClient) - suite.assert.Nil(err) -} - -func (suite *IDPTestSuite) TestDeleteIDPConfigurationWithWrongType() { - ctx := context.Background() - _, err := deleteIDPConfig(ctx, "", "", suite.adminClient) - suite.assert.NotNil(err) -} - -func (suite *IDPTestSuite) TestGetIDPConfigurationHandlerWithError() { - params, api := suite.initGetIDPConfigurationRequest() - response := api.IdpGetConfigurationHandler.Handle(params, &models.Principal{}) - _, ok := response.(*idp.GetConfigurationDefault) - suite.assert.True(ok) -} - -func (suite *IDPTestSuite) initGetIDPConfigurationRequest() (params idp.GetConfigurationParams, api operations.ConsoleAPI) { - registerIDPHandlers(&api) - params.HTTPRequest = &http.Request{} - params.Type = "ldap" - return params, api -} - -func (suite *IDPTestSuite) TestGetIDPConfigurationWithoutError() { - ctx := context.Background() - res, err := getIDPConfiguration(ctx, "ldap", "", suite.adminClient) - suite.assert.NotNil(res) - suite.assert.Nil(err) -} - -func (suite *IDPTestSuite) TestGetIDPConfigurationWithWrongType() { - ctx := context.Background() - res, err := getIDPConfiguration(ctx, "", "", suite.adminClient) - suite.assert.Nil(res) - suite.assert.NotNil(err) -} - -func TestIDP(t *testing.T) { - suite.Run(t, new(IDPTestSuite)) -} - -func TestGetEntitiesResult(t *testing.T) { - assert := assert.New(t) - // mock minIO client - client := AdminClientMock{} - function := "getEntitiesResult()" - - usersList := []string{"user1", "user2", "user3"} - policiesList := []string{"policy1", "policy2", "policy3"} - groupsList := []string{"group1", "group3", "group5"} - - policyMap := []madmin.PolicyEntities{ - {Policy: "testPolicy0", Groups: groupsList, Users: usersList}, - {Policy: "testPolicy1", Groups: groupsList, Users: usersList}, - } - - usersMap := []madmin.UserPolicyEntities{ - {User: "testUser0", Policies: policiesList}, - {User: "testUser1", Policies: policiesList}, - } - - groupsMap := []madmin.GroupPolicyEntities{ - {Group: "group0", Policies: policiesList}, - {Group: "group1", Policies: policiesList}, - } - - // Test-1: getEntitiesResult list all information provided - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - mockResponse := madmin.PolicyEntitiesResult{ - PolicyMappings: policyMap, - GroupMappings: groupsMap, - UserMappings: usersMap, - } - minioGetLDAPPolicyEntitiesMock = func(_ context.Context, _ madmin.PolicyEntitiesQuery) (madmin.PolicyEntitiesResult, error) { - return mockResponse, nil - } - - entities, err := getEntitiesResult(ctx, client, usersList, groupsList, policiesList) - if err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - - for i, groupIt := range entities.Groups { - assert.Equal(fmt.Sprintf("group%d", i), groupIt.Group) - - for i, polItm := range groupIt.Policies { - assert.Equal(policiesList[i], polItm) - } - } - - for i, usrIt := range entities.Users { - assert.Equal(fmt.Sprintf("testUser%d", i), usrIt.User) - - for i, polItm := range usrIt.Policies { - assert.Equal(policiesList[i], polItm) - } - } - - for i, policyIt := range entities.Policies { - assert.Equal(fmt.Sprintf("testPolicy%d", i), policyIt.Policy) - - for i, userItm := range policyIt.Users { - assert.Equal(usersList[i], userItm) - } - - for i, grItm := range policyIt.Groups { - assert.Equal(groupsList[i], grItm) - } - } - - // Test-2: getEntitiesResult error is returned from getLDAPPolicyEntities() - minioGetLDAPPolicyEntitiesMock = func(_ context.Context, _ madmin.PolicyEntitiesQuery) (madmin.PolicyEntitiesResult, error) { - return madmin.PolicyEntitiesResult{}, errors.New("error") - } - - _, err = getEntitiesResult(ctx, client, usersList, groupsList, policiesList) - if assert.Error(err) { - assert.Equal("error", err.Error()) - } -} diff --git a/api/admin_info.go b/api/admin_info.go deleted file mode 100644 index 6ad3ac3390..0000000000 --- a/api/admin_info.go +++ /dev/null @@ -1,1193 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 api - -import ( - "context" - "encoding/json" - "errors" - "fmt" - "net/http" - "net/url" - "regexp" - "strings" - "sync" - "time" - - "github.com/minio/console/pkg/utils" - - "github.com/go-openapi/runtime/middleware" - "github.com/minio/console/api/operations" - systemApi "github.com/minio/console/api/operations/system" - "github.com/minio/console/models" -) - -func registerAdminInfoHandlers(api *operations.ConsoleAPI) { - // return usage stats - api.SystemAdminInfoHandler = systemApi.AdminInfoHandlerFunc(func(params systemApi.AdminInfoParams, session *models.Principal) middleware.Responder { - infoResp, err := getAdminInfoResponse(session, params) - if err != nil { - return systemApi.NewAdminInfoDefault(err.Code).WithPayload(err.APIError) - } - return systemApi.NewAdminInfoOK().WithPayload(infoResp) - }) - // return single widget results - api.SystemDashboardWidgetDetailsHandler = systemApi.DashboardWidgetDetailsHandlerFunc(func(params systemApi.DashboardWidgetDetailsParams, _ *models.Principal) middleware.Responder { - infoResp, err := getAdminInfoWidgetResponse(params) - if err != nil { - return systemApi.NewDashboardWidgetDetailsDefault(err.Code).WithPayload(err.APIError) - } - return systemApi.NewDashboardWidgetDetailsOK().WithPayload(infoResp) - }) -} - -type UsageInfo struct { - Buckets int64 - Objects int64 - Usage int64 - DrivesUsage int64 - Servers []*models.ServerProperties - EndpointNotReady bool - Backend *models.BackendProperties -} - -// GetAdminInfo invokes admin info and returns a parsed `UsageInfo` structure -func GetAdminInfo(ctx context.Context, client MinioAdmin) (*UsageInfo, error) { - serverInfo, err := client.serverInfo(ctx) - if err != nil { - return nil, err - } - // we are trimming uint64 to int64 this will report an incorrect measurement for numbers greater than - // 9,223,372,036,854,775,807 - - backendType := serverInfo.Backend.Type - rrSCParity := serverInfo.Backend.RRSCParity - standardSCParity := serverInfo.Backend.StandardSCParity - onlineDrives := serverInfo.Backend.OnlineDisks - offlineDrives := serverInfo.Backend.OfflineDisks - - var usedSpace int64 - // serverArray contains the serverProperties which describe the servers in the network - var serverArray []*models.ServerProperties - for _, serv := range serverInfo.Servers { - drives := []*models.ServerDrives{} - - for _, drive := range serv.Disks { - usedSpace += int64(drive.UsedSpace) - drives = append(drives, &models.ServerDrives{ - State: drive.State, - UUID: drive.UUID, - Endpoint: drive.Endpoint, - RootDisk: drive.RootDisk, - DrivePath: drive.DrivePath, - Healing: drive.Healing, - Model: drive.Model, - TotalSpace: int64(drive.TotalSpace), - UsedSpace: int64(drive.UsedSpace), - AvailableSpace: int64(drive.AvailableSpace), - }) - } - - newServer := &models.ServerProperties{ - State: serv.State, - Endpoint: serv.Endpoint, - Uptime: serv.Uptime, - Version: serv.Version, - CommitID: serv.CommitID, - PoolNumber: int64(serv.PoolNumber), - Network: serv.Network, - Drives: drives, - } - - serverArray = append(serverArray, newServer) - } - - backendData := &models.BackendProperties{ - BackendType: string(backendType), - RrSCParity: int64(rrSCParity), - StandardSCParity: int64(standardSCParity), - OnlineDrives: int64(onlineDrives), - OfflineDrives: int64(offlineDrives), - } - return &UsageInfo{ - Buckets: int64(serverInfo.Buckets.Count), - Objects: int64(serverInfo.Objects.Count), - Usage: int64(serverInfo.Usage.Size), - DrivesUsage: usedSpace, - Servers: serverArray, - Backend: backendData, - }, nil -} - -type Target struct { - Expr string - Interval string - LegendFormat string - Step int32 - InitialTime int64 -} - -type ReduceOptions struct { - Calcs []string -} - -type MetricOptions struct { - ReduceOptions ReduceOptions -} - -type Metric struct { - ID int32 - Title string - Type string - Options MetricOptions - Targets []Target - GridPos GridPos - MaxDataPoints int32 -} - -type GridPos struct { - H int32 - W int32 - X int32 - Y int32 -} - -type WidgetLabel struct { - Name string -} - -var labels = []WidgetLabel{ - {Name: "instance"}, - {Name: "drive"}, - {Name: "server"}, - {Name: "api"}, -} - -var widgets = []Metric{ - { - ID: 1, - Title: "Uptime", - Type: "stat", - MaxDataPoints: 100, - GridPos: GridPos{ - H: 6, - W: 3, - X: 0, - Y: 0, - }, - Options: MetricOptions{ - ReduceOptions: ReduceOptions{ - Calcs: []string{ - "mean", - }, - }, - }, - Targets: []Target{ - { - Expr: `time() - max(minio_node_process_starttime_seconds{$__query})`, - LegendFormat: "{{instance}}", - Step: 60, - }, - }, - }, - { - ID: 65, - Title: "Total S3 Traffic Inbound", - Type: "stat", - MaxDataPoints: 100, - GridPos: GridPos{ - H: 3, - W: 3, - X: 3, - Y: 0, - }, - Options: MetricOptions{ - ReduceOptions: ReduceOptions{ - Calcs: []string{ - "last", - }, - }, - }, - Targets: []Target{ - { - Expr: `sum by (instance) (minio_s3_traffic_received_bytes{$__query})`, - LegendFormat: "{{instance}}", - Step: 60, - }, - }, - }, - { - ID: 50, - Title: "Current Usable Free Capacity", - Type: "gauge", - MaxDataPoints: 100, - GridPos: GridPos{ - H: 6, - W: 3, - X: 6, - Y: 0, - }, - Options: MetricOptions{ - ReduceOptions: ReduceOptions{ - Calcs: []string{ - "lastNotNull", - }, - }, - }, - Targets: []Target{ - { - Expr: `topk(1, sum(minio_cluster_capacity_usable_total_bytes{$__query}) by (instance))`, - LegendFormat: "Total Usable", - Step: 300, - }, - { - Expr: `topk(1, sum(minio_cluster_capacity_usable_free_bytes{$__query}) by (instance))`, - LegendFormat: "Usable Free", - Step: 300, - }, - { - Expr: `topk(1, sum(minio_cluster_capacity_usable_total_bytes{$__query}) by (instance)) - topk(1, sum(minio_cluster_capacity_usable_free_bytes{$__query}) by (instance))`, - LegendFormat: "Used Space", - Step: 300, - }, - }, - }, - { - ID: 51, - Title: "Current Usable Total Bytes", - Type: "gauge", - MaxDataPoints: 100, - GridPos: GridPos{ - H: 6, - W: 3, - X: 6, - Y: 0, - }, - Options: MetricOptions{ - ReduceOptions: ReduceOptions{ - Calcs: []string{ - "lastNotNull", - }, - }, - }, - Targets: []Target{ - { - Expr: `topk(1, sum(minio_cluster_capacity_usable_total_bytes{$__query}) by (instance))`, - LegendFormat: "", - Step: 300, - }, - }, - }, - { - ID: 68, - Title: "Data Usage Growth", - Type: "graph", - GridPos: GridPos{ - H: 6, - W: 7, - X: 9, - Y: 0, - }, - Targets: []Target{ - { - Expr: `minio_cluster_usage_total_bytes{$__query}`, - LegendFormat: "Used Capacity", - InitialTime: -180, - Step: 10, - }, - }, - }, - { - ID: 52, - Title: "Object size distribution", - Type: "bargauge", - GridPos: GridPos{ - H: 6, - W: 5, - X: 16, - Y: 0, - }, - Options: MetricOptions{ - ReduceOptions: ReduceOptions{ - Calcs: []string{ - "mean", - }, - }, - }, - Targets: []Target{ - { - Expr: `minio_cluster_objects_size_distribution{$__query}`, - LegendFormat: "{{range}}", - Step: 300, - }, - }, - }, - { - ID: 61, - Title: "Total Open FDs", - Type: "stat", - MaxDataPoints: 100, - GridPos: GridPos{ - H: 3, - W: 3, - X: 21, - Y: 0, - }, - Options: MetricOptions{ - ReduceOptions: ReduceOptions{ - Calcs: []string{ - "last", - }, - }, - }, - Targets: []Target{ - { - Expr: `sum(minio_node_file_descriptor_open_total{$__query})`, - LegendFormat: "", - Step: 60, - }, - }, - }, - { - ID: 64, - Title: "Total S3 Traffic Outbound", - Type: "stat", - MaxDataPoints: 100, - GridPos: GridPos{ - H: 3, - W: 3, - X: 3, - Y: 3, - }, - Options: MetricOptions{ - ReduceOptions: ReduceOptions{ - Calcs: []string{ - "last", - }, - }, - }, - Targets: []Target{ - { - Expr: `sum by (instance) (minio_s3_traffic_sent_bytes{$__query})`, - LegendFormat: "", - Step: 60, - }, - }, - }, - { - ID: 62, - Title: "Total Goroutines", - Type: "stat", - MaxDataPoints: 100, - GridPos: GridPos{ - H: 3, - W: 3, - X: 21, - Y: 3, - }, - Options: MetricOptions{ - ReduceOptions: ReduceOptions{ - Calcs: []string{ - "last", - }, - }, - }, - Targets: []Target{ - { - Expr: `sum without (server,instance) (minio_node_go_routine_total{$__query})`, - LegendFormat: "", - Step: 60, - }, - }, - }, - { - ID: 53, - Title: "Total Online Servers", - Type: "stat", - MaxDataPoints: 100, - GridPos: GridPos{ - H: 2, - W: 3, - X: 0, - Y: 6, - }, - Options: MetricOptions{ - ReduceOptions: ReduceOptions{ - Calcs: []string{ - "mean", - }, - }, - }, - Targets: []Target{ - { - Expr: `minio_cluster_nodes_online_total{$__query}`, - LegendFormat: "", - Step: 60, - }, - }, - }, - { - ID: 9, - Title: "Total Online Drives", - Type: "stat", - MaxDataPoints: 100, - GridPos: GridPos{ - H: 2, - W: 3, - X: 3, - Y: 6, - }, - Options: MetricOptions{ - ReduceOptions: ReduceOptions{ - Calcs: []string{ - "mean", - }, - }, - }, - Targets: []Target{ - { - Expr: `minio_cluster_drive_online_total{$__query}`, - LegendFormat: "Total online drives in MinIO Cluster", - Step: 60, - }, - }, - }, - { - ID: 66, - Title: "Number of Buckets", - Type: "stat", - MaxDataPoints: 5, - GridPos: GridPos{ - H: 3, - W: 3, - X: 6, - Y: 6, - }, - Options: MetricOptions{ - ReduceOptions: ReduceOptions{ - Calcs: []string{ - "lastNotNull", - }, - }, - }, - Targets: []Target{ - { - Expr: `minio_cluster_bucket_total{$__query}`, - LegendFormat: "", - Step: 100, - }, - }, - }, - { - ID: 63, - Title: "S3 API Data Received Rate ", - Type: "graph", - GridPos: GridPos{ - H: 6, - W: 7, - X: 9, - Y: 6, - }, - Targets: []Target{ - { - Expr: `sum by (server) (rate(minio_s3_traffic_received_bytes{$__query}[$__rate_interval]))`, - LegendFormat: "Data Received [{{server}}]", - }, - }, - }, - { - ID: 70, - Title: "S3 API Data Sent Rate ", - Type: "graph", - GridPos: GridPos{ - H: 6, - W: 8, - X: 16, - Y: 6, - }, - Targets: []Target{ - { - Expr: `sum by (server) (rate(minio_s3_traffic_sent_bytes{$__query}[$__rate_interval]))`, - LegendFormat: "Data Sent [{{server}}]", - }, - }, - }, - { - ID: 69, - Title: "Total Offline Servers", - Type: "stat", - MaxDataPoints: 100, - GridPos: GridPos{ - H: 2, - W: 3, - X: 0, - Y: 8, - }, - Options: MetricOptions{ - ReduceOptions: ReduceOptions{ - Calcs: []string{ - "mean", - }, - }, - }, - Targets: []Target{ - { - Expr: `minio_cluster_nodes_offline_total{$__query}`, - LegendFormat: "", - Step: 60, - }, - }, - }, - { - ID: 78, - Title: "Total Offline Drives", - Type: "stat", - MaxDataPoints: 100, - GridPos: GridPos{ - H: 2, - W: 3, - X: 3, - Y: 8, - }, - Options: MetricOptions{ - ReduceOptions: ReduceOptions{ - Calcs: []string{ - "mean", - }, - }, - }, - Targets: []Target{ - { - Expr: `minio_cluster_drive_offline_total{$__query}`, - LegendFormat: "", - Step: 60, - }, - }, - }, - { - ID: 44, - Title: "Number of Objects", - Type: "stat", - MaxDataPoints: 100, - GridPos: GridPos{ - H: 3, - W: 3, - X: 6, - Y: 9, - }, - Options: MetricOptions{ - ReduceOptions: ReduceOptions{ - Calcs: []string{ - "lastNotNull", - }, - }, - }, - Targets: []Target{ - { - Expr: `minio_cluster_usage_object_total{$__query}`, - LegendFormat: "", - }, - }, - }, - { - ID: 80, - Title: "Time Since Last Heal Activity", - Type: "stat", - MaxDataPoints: 100, - GridPos: GridPos{ - H: 2, - W: 3, - X: 0, - Y: 10, - }, - Options: MetricOptions{ - ReduceOptions: ReduceOptions{ - Calcs: []string{ - "last", - }, - }, - }, - Targets: []Target{ - { - Expr: `minio_heal_time_last_activity_nano_seconds{$__query}`, - LegendFormat: "{{server}}", - Step: 60, - }, - }, - }, - { - ID: 81, - Title: "Time Since Last Scan Activity", - Type: "stat", - MaxDataPoints: 100, - GridPos: GridPos{ - H: 2, - W: 3, - X: 3, - Y: 10, - }, - Options: MetricOptions{ - ReduceOptions: ReduceOptions{ - Calcs: []string{ - "last", - }, - }, - }, - Targets: []Target{ - { - Expr: `minio_usage_last_activity_nano_seconds{$__query}`, - LegendFormat: "{{server}}", - Step: 60, - }, - }, - }, - { - ID: 60, - Title: "S3 API Request Rate", - Type: "graph", - GridPos: GridPos{ - H: 10, - W: 12, - X: 0, - Y: 12, - }, - Targets: []Target{ - { - Expr: `sum by (server,api) (increase(minio_s3_requests_total{$__query}[$__rate_interval]))`, - LegendFormat: "{{server,api}}", - }, - }, - }, - { - ID: 71, - Title: "S3 API Request Error Rate", - Type: "graph", - GridPos: GridPos{ - H: 10, - W: 12, - X: 12, - Y: 12, - }, - Targets: []Target{ - { - Expr: `sum by (server,api) (increase(minio_s3_requests_errors_total{$__query}[$__rate_interval]))`, - LegendFormat: "{{server,api}}", - }, - }, - }, - { - ID: 17, - Title: "Internode Data Transfer", - Type: "graph", - GridPos: GridPos{ - H: 8, - W: 24, - X: 0, - Y: 22, - }, - Targets: []Target{ - { - Expr: `rate(minio_inter_node_traffic_sent_bytes{$__query}[$__rate_interval])`, - LegendFormat: "Internode Bytes Received [{{server}}]", - Step: 4, - }, - - { - Expr: `rate(minio_inter_node_traffic_sent_bytes{$__query}[$__rate_interval])`, - LegendFormat: "Internode Bytes Received [{{server}}]", - }, - }, - }, - { - ID: 77, - Title: "Node CPU Usage", - Type: "graph", - GridPos: GridPos{ - H: 9, - W: 12, - X: 0, - Y: 30, - }, - Targets: []Target{ - { - Expr: `rate(minio_node_process_cpu_total_seconds{$__query}[$__rate_interval])`, - LegendFormat: "CPU Usage Rate [{{server}}]", - }, - }, - }, - { - ID: 76, - Title: "Node Memory Usage", - Type: "graph", - GridPos: GridPos{ - H: 9, - W: 12, - X: 12, - Y: 30, - }, - Targets: []Target{ - { - Expr: `minio_node_process_resident_memory_bytes{$__query}`, - LegendFormat: "Memory Used [{{server}}]", - }, - }, - }, - { - ID: 74, - Title: "Drive Used Capacity", - Type: "graph", - GridPos: GridPos{ - H: 8, - W: 12, - X: 0, - Y: 39, - }, - Targets: []Target{ - { - Expr: `minio_node_drive_used_bytes{$__query}`, - LegendFormat: "Used Capacity [{{server}}:{{drive}}]", - }, - }, - }, - { - ID: 82, - Title: "Drives Free Inodes", - Type: "graph", - GridPos: GridPos{ - H: 8, - W: 12, - X: 12, - Y: 39, - }, - Targets: []Target{ - { - Expr: `minio_node_drive_free_inodes{$__query}`, - LegendFormat: "Free Inodes [{{server}}:{{drive}}]", - }, - }, - }, - { - ID: 11, - Title: "Node Syscalls", - Type: "graph", - GridPos: GridPos{ - H: 9, - W: 12, - X: 0, - Y: 47, - }, - Targets: []Target{ - { - Expr: `rate(minio_node_syscall_read_total{$__query}[$__rate_interval])`, - LegendFormat: "Read Syscalls [{{server}}]", - Step: 60, - }, - - { - Expr: `rate(minio_node_syscall_read_total{$__query}[$__rate_interval])`, - LegendFormat: "Read Syscalls [{{server}}]", - }, - }, - }, - { - ID: 8, - Title: "Node File Descriptors", - Type: "graph", - GridPos: GridPos{ - H: 9, - W: 12, - X: 12, - Y: 47, - }, - Targets: []Target{ - { - Expr: `minio_node_file_descriptor_open_total{$__query}`, - LegendFormat: "Open FDs [{{server}}]", - }, - }, - }, - { - ID: 73, - Title: "Node IO", - Type: "graph", - GridPos: GridPos{ - H: 8, - W: 24, - X: 0, - Y: 56, - }, - Targets: []Target{ - { - Expr: `rate(minio_node_io_rchar_bytes{$__query}[$__rate_interval])`, - LegendFormat: "Node RChar [{{server}}]", - }, - - { - Expr: `rate(minio_node_io_wchar_bytes{$__query}[$__rate_interval])`, - LegendFormat: "Node WChar [{{server}}]", - }, - }, - }, -} - -type Widget struct { - Title string - Type string -} - -type DataResult struct { - Metric map[string]string `json:"metric"` - Values []interface{} `json:"values"` -} - -type PromRespData struct { - ResultType string `json:"resultType"` - Result []DataResult `json:"result"` -} - -type PromResp struct { - Status string `json:"status"` - Data PromRespData `json:"data"` -} - -type LabelResponse struct { - Status string `json:"status"` - Data []string `json:"data"` -} - -type LabelResults struct { - Label string - Response LabelResponse -} - -// getAdminInfoResponse returns the response containing total buckets, objects and usage. -func getAdminInfoResponse(session *models.Principal, params systemApi.AdminInfoParams) (*models.AdminInfoResponse, *CodedAPIError) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - prometheusURL := "" - - if !*params.DefaultOnly { - promURL := getPrometheusURL() - if promURL != "" { - prometheusURL = promURL - } - } - - mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - - sessionResp, err2 := getUsageWidgetsForDeployment(ctx, prometheusURL, AdminClient{Client: mAdmin}) - if err2 != nil { - return nil, ErrorWithContext(ctx, err2) - } - - return sessionResp, nil -} - -func getUsageWidgetsForDeployment(ctx context.Context, prometheusURL string, adminClient MinioAdmin) (*models.AdminInfoResponse, error) { - prometheusStatus := models.AdminInfoResponseAdvancedMetricsStatusAvailable - if prometheusURL == "" { - prometheusStatus = models.AdminInfoResponseAdvancedMetricsStatusNotConfigured - } - if prometheusURL != "" && !testPrometheusURL(ctx, prometheusURL) { - prometheusStatus = models.AdminInfoResponseAdvancedMetricsStatusUnavailable - } - sessionResp := &models.AdminInfoResponse{ - AdvancedMetricsStatus: prometheusStatus, - } - doneCh := make(chan error) - go func() { - defer close(doneCh) - // serialize output - usage, err := GetAdminInfo(ctx, adminClient) - if err != nil { - doneCh <- err - } - if usage != nil { - sessionResp.Buckets = usage.Buckets - sessionResp.Objects = usage.Objects - sessionResp.Usage = usage.Usage - sessionResp.Servers = usage.Servers - sessionResp.Backend = usage.Backend - } - }() - - var wdgts []*models.Widget - if prometheusStatus == models.AdminInfoResponseAdvancedMetricsStatusAvailable { - // We will tell the frontend about a list of widgets so it can fetch the ones it wants - for _, m := range widgets { - wdgtResult := models.Widget{ - ID: m.ID, - Title: m.Title, - Type: m.Type, - } - if len(m.Options.ReduceOptions.Calcs) > 0 { - wdgtResult.Options = &models.WidgetOptions{ - ReduceOptions: &models.WidgetOptionsReduceOptions{ - Calcs: m.Options.ReduceOptions.Calcs, - }, - } - } - - wdgts = append(wdgts, &wdgtResult) - } - sessionResp.Widgets = wdgts - } - - // wait for mc admin info - err := <-doneCh - if err != nil { - return nil, err - } - - return sessionResp, nil -} - -func unmarshalPrometheus(ctx context.Context, httpClnt *http.Client, endpoint string, data interface{}) bool { - req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint, nil) - if err != nil { - ErrorWithContext(ctx, fmt.Errorf("Unable to create the request to fetch labels from prometheus: %w", err)) - return true - } - - prometheusBearer := getPrometheusAuthToken() - - if prometheusBearer != "" { - req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", prometheusBearer)) - } - - resp, err := httpClnt.Do(req) - if err != nil { - ErrorWithContext(ctx, fmt.Errorf("Unable to fetch labels from prometheus: %w", err)) - return true - } - - defer resp.Body.Close() - - if resp.StatusCode != http.StatusOK { - ErrorWithContext(ctx, fmt.Errorf("Unexpected status code from prometheus (%s)", resp.Status)) - return true - } - - if err = json.NewDecoder(resp.Body).Decode(data); err != nil { - ErrorWithContext(ctx, fmt.Errorf("Unexpected error from prometheus: %w", err)) - return true - } - - return false -} - -func testPrometheusURL(ctx context.Context, url string) bool { - req, err := http.NewRequestWithContext(ctx, http.MethodGet, url+"/-/healthy", nil) - if err != nil { - ErrorWithContext(ctx, fmt.Errorf("error Building Request: (%v)", err)) - return false - } - - prometheusBearer := getPrometheusAuthToken() - if prometheusBearer != "" { - req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", prometheusBearer)) - } - - clientIP := utils.ClientIPFromContext(ctx) - httpClnt := GetConsoleHTTPClient(clientIP) - - response, err := httpClnt.Do(req) - if err != nil { - ErrorWithContext(ctx, fmt.Errorf("default Prometheus URL not reachable, trying root testing: (%v)", err)) - newTestURL := req.URL.Scheme + "://" + req.URL.Host + "/-/healthy" - req2, err := http.NewRequestWithContext(ctx, http.MethodGet, newTestURL, nil) - if err != nil { - ErrorWithContext(ctx, fmt.Errorf("error Building Root Request: (%v)", err)) - return false - } - rootResponse, err := httpClnt.Do(req2) - if err != nil { - // URL & Root tests didn't work. Prometheus not reachable - ErrorWithContext(ctx, fmt.Errorf("root Prometheus URL not reachable: (%v)", err)) - return false - } - return rootResponse.StatusCode == http.StatusOK - } - return response.StatusCode == http.StatusOK -} - -func getAdminInfoWidgetResponse(params systemApi.DashboardWidgetDetailsParams) (*models.WidgetDetails, *CodedAPIError) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - prometheusURL := getPrometheusURL() - prometheusJobID := getPrometheusJobID() - prometheusExtraLabels := getPrometheusExtraLabels() - - selector := fmt.Sprintf(`job="%s"`, prometheusJobID) - if strings.TrimSpace(prometheusExtraLabels) != "" { - selector = fmt.Sprintf(`job="%s",%s`, prometheusJobID, prometheusExtraLabels) - } - clientIP := getClientIP(params.HTTPRequest) - ctx = context.WithValue(ctx, utils.ContextClientIP, clientIP) - return getWidgetDetails(ctx, prometheusURL, selector, params.WidgetID, params.Step, params.Start, params.End) -} - -func getWidgetDetails(ctx context.Context, prometheusURL string, selector string, widgetID int32, step *int32, start *int64, end *int64) (*models.WidgetDetails, *CodedAPIError) { - // We test if prometheus URL is reachable. this is meant to avoid unuseful calls and application hang. - if !testPrometheusURL(ctx, prometheusURL) { - return nil, ErrorWithContext(ctx, errors.New("prometheus URL is unreachable")) - } - clientIP := utils.ClientIPFromContext(ctx) - httpClnt := GetConsoleHTTPClient(clientIP) - - labelResultsCh := make(chan LabelResults) - - for _, lbl := range labels { - go func(lbl WidgetLabel) { - endpoint := fmt.Sprintf("%s/api/v1/label/%s/values", prometheusURL, lbl.Name) - - var response LabelResponse - if unmarshalPrometheus(ctx, httpClnt, endpoint, &response) { - return - } - - labelResultsCh <- LabelResults{Label: lbl.Name, Response: response} - }(lbl) - } - - labelMap := make(map[string][]string) - - // wait for as many goroutines that come back in less than 1 second -LabelsWaitLoop: - for { - select { - case <-time.After(1 * time.Second): - break LabelsWaitLoop - case res := <-labelResultsCh: - labelMap[res.Label] = res.Response.Data - if len(labelMap) >= len(labels) { - break LabelsWaitLoop - } - } - } - - // launch a goroutines per widget - - for _, m := range widgets { - if m.ID != widgetID { - continue - } - - var ( - wg sync.WaitGroup - targetResults = make([]*models.ResultTarget, len(m.Targets)) - ) - - // for each target we will launch another goroutine to fetch the values - for idx, target := range m.Targets { - wg.Add(1) - go func(idx int, target Target, inStep *int32, inStart *int64, inEnd *int64) { - defer wg.Done() - - apiType := "query_range" - now := time.Now() - - var initTime int64 = -15 - - if target.InitialTime != 0 { - initTime = target.InitialTime - } - - timeCalculated := time.Duration(initTime * int64(time.Minute)) - - extraParamters := fmt.Sprintf("&start=%d&end=%d", now.Add(timeCalculated).Unix(), now.Unix()) - - var step int32 = 60 - if target.Step > 0 { - step = target.Step - } - if inStep != nil && *inStep > 0 { - step = *inStep - } - - if inStart != nil && inEnd != nil { - extraParamters = fmt.Sprintf("&start=%d&end=%d", *inStart, *inEnd) - } - - if step > 0 { - extraParamters = fmt.Sprintf("%s&step=%d", extraParamters, step) - } - - // replace the `$__rate_interval` global for step with unit (s for seconds) - queryExpr := strings.ReplaceAll(target.Expr, "$__rate_interval", fmt.Sprintf("%ds", 240)) - if strings.Contains(queryExpr, "$") { - re := regexp.MustCompile(`\$([a-z]+)`) - - for _, match := range re.FindAllStringSubmatch(queryExpr, -1) { - if val, ok := labelMap[match[1]]; ok { - queryExpr = strings.ReplaceAll(queryExpr, "$"+match[1], fmt.Sprintf("(%s)", strings.Join(val, "|"))) - } - } - } - - queryExpr = strings.ReplaceAll(queryExpr, "$__query", selector) - endpoint := fmt.Sprintf("%s/api/v1/%s?query=%s%s", prometheusURL, apiType, url.QueryEscape(queryExpr), extraParamters) - - var response PromResp - if unmarshalPrometheus(ctx, httpClnt, endpoint, &response) { - return - } - - targetResult := models.ResultTarget{ - LegendFormat: target.LegendFormat, - ResultType: response.Data.ResultType, - } - - for _, r := range response.Data.Result { - targetResult.Result = append(targetResult.Result, &models.WidgetResult{ - Metric: r.Metric, - Values: r.Values, - }) - } - - targetResults[idx] = &targetResult - }(idx, target, step, start, end) - } - - wg.Wait() - - wdgtResult := models.WidgetDetails{ - ID: m.ID, - Title: m.Title, - Type: m.Type, - } - if len(m.Options.ReduceOptions.Calcs) > 0 { - wdgtResult.Options = &models.WidgetDetailsOptions{ - ReduceOptions: &models.WidgetDetailsOptionsReduceOptions{ - Calcs: m.Options.ReduceOptions.Calcs, - }, - } - } - - for _, res := range targetResults { - if res != nil { - wdgtResult.Targets = append(wdgtResult.Targets, res) - } - } - return &wdgtResult, nil - } - - return nil, &CodedAPIError{Code: 404, APIError: &models.APIError{Message: "Widget not found"}} -} diff --git a/api/admin_info_test.go b/api/admin_info_test.go deleted file mode 100644 index 7c93b7b1b0..0000000000 --- a/api/admin_info_test.go +++ /dev/null @@ -1,152 +0,0 @@ -// 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 api - -import ( - "context" - "net/http" - "net/http/httptest" - "os" - "testing" - - "github.com/minio/console/pkg/utils" - - "github.com/minio/console/api/operations" - systemApi "github.com/minio/console/api/operations/system" - "github.com/minio/console/models" - "github.com/minio/madmin-go/v3" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/suite" -) - -type AdminInfoTestSuite struct { - suite.Suite - assert *assert.Assertions - currentServer string - isServerSet bool - isPrometheusRequest bool - server *httptest.Server - adminClient AdminClientMock -} - -func (suite *AdminInfoTestSuite) SetupSuite() { - suite.assert = assert.New(suite.T()) - suite.adminClient = AdminClientMock{} - MinioServerInfoMock = func(_ context.Context) (madmin.InfoMessage, error) { - return madmin.InfoMessage{ - Servers: []madmin.ServerProperties{{ - Disks: []madmin.Disk{{}}, - }}, - Backend: madmin.ErasureBackend{Type: "mock"}, - }, nil - } -} - -func (suite *AdminInfoTestSuite) SetupTest() { - suite.server = httptest.NewServer(http.HandlerFunc(suite.serverHandler)) - suite.currentServer, suite.isServerSet = os.LookupEnv(ConsoleMinIOServer) - os.Setenv(ConsoleMinIOServer, suite.server.URL) -} - -func (suite *AdminInfoTestSuite) serverHandler(w http.ResponseWriter, _ *http.Request) { - if suite.isPrometheusRequest { - w.WriteHeader(200) - } else { - w.WriteHeader(400) - } -} - -func (suite *AdminInfoTestSuite) TearDownSuite() { -} - -func (suite *AdminInfoTestSuite) TearDownTest() { - if suite.isServerSet { - os.Setenv(ConsoleMinIOServer, suite.currentServer) - } else { - os.Unsetenv(ConsoleMinIOServer) - } -} - -func (suite *AdminInfoTestSuite) TestRegisterAdminInfoHandlers() { - api := &operations.ConsoleAPI{} - suite.assertHandlersAreNil(api) - registerAdminInfoHandlers(api) - suite.assertHandlersAreNotNil(api) -} - -func (suite *AdminInfoTestSuite) assertHandlersAreNil(api *operations.ConsoleAPI) { - suite.assert.Nil(api.SystemAdminInfoHandler) - suite.assert.Nil(api.SystemDashboardWidgetDetailsHandler) -} - -func (suite *AdminInfoTestSuite) assertHandlersAreNotNil(api *operations.ConsoleAPI) { - suite.assert.NotNil(api.SystemAdminInfoHandler) - suite.assert.NotNil(api.SystemDashboardWidgetDetailsHandler) -} - -func (suite *AdminInfoTestSuite) TestSystemAdminInfoHandlerWithError() { - params, api := suite.initSystemAdminInfoRequest() - response := api.SystemAdminInfoHandler.Handle(params, &models.Principal{}) - _, ok := response.(*systemApi.AdminInfoDefault) - suite.assert.True(ok) -} - -func (suite *AdminInfoTestSuite) initSystemAdminInfoRequest() (params systemApi.AdminInfoParams, api operations.ConsoleAPI) { - registerAdminInfoHandlers(&api) - params.HTTPRequest = &http.Request{} - defaultOnly := false - params.DefaultOnly = &defaultOnly - return params, api -} - -func (suite *AdminInfoTestSuite) TestSystemDashboardWidgetDetailsHandlerWithError() { - params, api := suite.initSystemDashboardWidgetDetailsRequest() - response := api.SystemDashboardWidgetDetailsHandler.Handle(params, &models.Principal{}) - _, ok := response.(*systemApi.DashboardWidgetDetailsDefault) - suite.assert.True(ok) -} - -func (suite *AdminInfoTestSuite) initSystemDashboardWidgetDetailsRequest() (params systemApi.DashboardWidgetDetailsParams, api operations.ConsoleAPI) { - registerAdminInfoHandlers(&api) - params.HTTPRequest = &http.Request{} - return params, api -} - -func (suite *AdminInfoTestSuite) TestGetUsageWidgetsForDeploymentWithoutError() { - ctx := context.WithValue(context.Background(), utils.ContextClientIP, "127.0.0.1") - suite.isPrometheusRequest = true - res, err := getUsageWidgetsForDeployment(ctx, suite.server.URL, suite.adminClient) - suite.assert.Nil(err) - suite.assert.NotNil(res) - suite.isPrometheusRequest = false -} - -func (suite *AdminInfoTestSuite) TestGetWidgetDetailsWithoutError() { - ctx := context.WithValue(context.Background(), utils.ContextClientIP, "127.0.0.1") - suite.isPrometheusRequest = true - var step int32 = 1 - var start int64 - var end int64 = 1 - res, err := getWidgetDetails(ctx, suite.server.URL, "mock", 1, &step, &start, &end) - suite.assert.Nil(err) - suite.assert.NotNil(res) - suite.isPrometheusRequest = false -} - -func TestAdminInfo(t *testing.T) { - suite.Run(t, new(AdminInfoTestSuite)) -} diff --git a/api/admin_inspect.go b/api/admin_inspect.go deleted file mode 100644 index dc0bab75a5..0000000000 --- a/api/admin_inspect.go +++ /dev/null @@ -1,117 +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 . - -package api - -import ( - "encoding/base64" - "fmt" - "io" - "net/http" - "strings" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/minio/console/api/operations" - inspectApi "github.com/minio/console/api/operations/inspect" - "github.com/minio/console/models" - "github.com/minio/madmin-go/v3" - "github.com/secure-io/sio-go" -) - -func registerInspectHandler(api *operations.ConsoleAPI) { - api.InspectInspectHandler = inspectApi.InspectHandlerFunc(func(params inspectApi.InspectParams, principal *models.Principal) middleware.Responder { - k, r, err := getInspectResult(principal, ¶ms) - if err != nil { - return inspectApi.NewInspectDefault(err.Code).WithPayload(err.APIError) - } - - return middleware.ResponderFunc(processInspectResponse(¶ms, k, r)) - }) -} - -func getInspectResult(session *models.Principal, params *inspectApi.InspectParams) ([]byte, io.ReadCloser, *CodedAPIError) { - ctx := params.HTTPRequest.Context() - mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return nil, nil, ErrorWithContext(ctx, err) - } - - cfg := madmin.InspectOptions{ - File: params.File, - Volume: params.Volume, - } - - // TODO: Remove encryption option and always encrypt. - // Maybe also add public key field. - if params.Encrypt != nil && *params.Encrypt { - cfg.PublicKey, _ = base64.StdEncoding.DecodeString("MIIBCgKCAQEAs/128UFS9A8YSJY1XqYKt06dLVQQCGDee69T+0Tip/1jGAB4z0/3QMpH0MiS8Wjs4BRWV51qvkfAHzwwdU7y6jxU05ctb/H/WzRj3FYdhhHKdzear9TLJftlTs+xwj2XaADjbLXCV1jGLS889A7f7z5DgABlVZMQd9BjVAR8ED3xRJ2/ZCNuQVJ+A8r7TYPGMY3wWvhhPgPk3Lx4WDZxDiDNlFs4GQSaESSsiVTb9vyGe/94CsCTM6Cw9QG6ifHKCa/rFszPYdKCabAfHcS3eTr0GM+TThSsxO7KfuscbmLJkfQev1srfL2Ii2RbnysqIJVWKEwdW05ID8ryPkuTuwIDAQAB") - } - - // create a MinIO Admin Client interface implementation - // defining the client to be used - adminClient := AdminClient{Client: mAdmin} - - k, r, err := adminClient.inspect(ctx, cfg) - if err != nil { - return nil, nil, ErrorWithContext(ctx, err) - } - return k, r, nil -} - -// borrowed from mc cli -func decryptInspectV1(key [32]byte, r io.Reader) io.ReadCloser { - stream, err := sio.AES_256_GCM.Stream(key[:]) - if err != nil { - return nil - } - nonce := make([]byte, stream.NonceSize()) - return io.NopCloser(stream.DecryptReader(r, nonce, nil)) -} - -func processInspectResponse(params *inspectApi.InspectParams, k []byte, r io.ReadCloser) func(w http.ResponseWriter, _ runtime.Producer) { - isEnc := params.Encrypt != nil && *params.Encrypt - return func(w http.ResponseWriter, _ runtime.Producer) { - ext := "enc" - if len(k) == 32 && !isEnc { - ext = "zip" - r = decryptInspectV1(*(*[32]byte)(k), r) - } - fileName := fmt.Sprintf("inspect-%s-%s.%s", params.Volume, params.File, ext) - fileName = strings.Map(func(r rune) rune { - switch { - case r >= 'A' && r <= 'Z': - return r - case r >= 'a' && r <= 'z': - return r - case r >= '0' && r <= '9': - return r - default: - if strings.ContainsAny(string(r), "-+._") { - return r - } - return '_' - } - }, fileName) - w.Header().Set("Content-Type", "application/octet-stream") - w.Header().Set("Content-Disposition", fmt.Sprintf("attachment; filename=\"%s\"", fileName)) - - _, err := io.Copy(w, r) - if err != nil { - LogError("unable to write all the data: %v", err) - } - } -} diff --git a/api/admin_kms.go b/api/admin_kms.go deleted file mode 100644 index e50cac0e65..0000000000 --- a/api/admin_kms.go +++ /dev/null @@ -1,296 +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 . -// - -package api - -import ( - "context" - "sort" - - "github.com/go-openapi/runtime/middleware" - "github.com/minio/console/api/operations" - kmsAPI "github.com/minio/console/api/operations/k_m_s" - "github.com/minio/console/models" - "github.com/minio/madmin-go/v3" -) - -func registerKMSHandlers(api *operations.ConsoleAPI) { - registerKMSStatusHandlers(api) - registerKMSKeyHandlers(api) -} - -func registerKMSStatusHandlers(api *operations.ConsoleAPI) { - api.KmsKMSStatusHandler = kmsAPI.KMSStatusHandlerFunc(func(params kmsAPI.KMSStatusParams, session *models.Principal) middleware.Responder { - resp, err := GetKMSStatusResponse(session, params) - if err != nil { - return kmsAPI.NewKMSStatusDefault(err.Code).WithPayload(err.APIError) - } - return kmsAPI.NewKMSStatusOK().WithPayload(resp) - }) - - api.KmsKMSMetricsHandler = kmsAPI.KMSMetricsHandlerFunc(func(params kmsAPI.KMSMetricsParams, session *models.Principal) middleware.Responder { - resp, err := GetKMSMetricsResponse(session, params) - if err != nil { - return kmsAPI.NewKMSMetricsDefault(err.Code).WithPayload(err.APIError) - } - return kmsAPI.NewKMSMetricsOK().WithPayload(resp) - }) - - api.KmsKMSAPIsHandler = kmsAPI.KMSAPIsHandlerFunc(func(params kmsAPI.KMSAPIsParams, session *models.Principal) middleware.Responder { - resp, err := GetKMSAPIsResponse(session, params) - if err != nil { - return kmsAPI.NewKMSAPIsDefault(err.Code).WithPayload(err.APIError) - } - return kmsAPI.NewKMSAPIsOK().WithPayload(resp) - }) - - api.KmsKMSVersionHandler = kmsAPI.KMSVersionHandlerFunc(func(params kmsAPI.KMSVersionParams, session *models.Principal) middleware.Responder { - resp, err := GetKMSVersionResponse(session, params) - if err != nil { - return kmsAPI.NewKMSVersionDefault(err.Code).WithPayload(err.APIError) - } - return kmsAPI.NewKMSVersionOK().WithPayload(resp) - }) -} - -func GetKMSStatusResponse(session *models.Principal, params kmsAPI.KMSStatusParams) (*models.KmsStatusResponse, *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 kmsStatus(ctx, AdminClient{Client: mAdmin}) -} - -func kmsStatus(ctx context.Context, minioClient MinioAdmin) (*models.KmsStatusResponse, *CodedAPIError) { - st, err := minioClient.kmsStatus(ctx) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return &models.KmsStatusResponse{ - DefaultKeyID: st.DefaultKeyID, - Name: st.Name, - Endpoints: parseStatusEndpoints(st.Endpoints), - }, nil -} - -func parseStatusEndpoints(endpoints map[string]madmin.ItemState) (kmsEndpoints []*models.KmsEndpoint) { - for key, value := range endpoints { - kmsEndpoints = append(kmsEndpoints, &models.KmsEndpoint{URL: key, Status: string(value)}) - } - return kmsEndpoints -} - -func GetKMSMetricsResponse(session *models.Principal, params kmsAPI.KMSMetricsParams) (*models.KmsMetricsResponse, *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 kmsMetrics(ctx, AdminClient{Client: mAdmin}) -} - -func kmsMetrics(ctx context.Context, minioClient MinioAdmin) (*models.KmsMetricsResponse, *CodedAPIError) { - metrics, err := minioClient.kmsMetrics(ctx) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return &models.KmsMetricsResponse{ - RequestOK: &metrics.RequestOK, - RequestErr: &metrics.RequestErr, - RequestFail: &metrics.RequestFail, - RequestActive: &metrics.RequestActive, - AuditEvents: &metrics.AuditEvents, - ErrorEvents: &metrics.ErrorEvents, - LatencyHistogram: parseHistogram(metrics.LatencyHistogram), - Uptime: &metrics.UpTime, - Cpus: &metrics.CPUs, - UsableCPUs: &metrics.UsableCPUs, - Threads: &metrics.Threads, - HeapAlloc: &metrics.HeapAlloc, - HeapObjects: metrics.HeapObjects, - StackAlloc: &metrics.StackAlloc, - }, nil -} - -func parseHistogram(histogram map[int64]int64) (records []*models.KmsLatencyHistogram) { - for duration, total := range histogram { - records = append(records, &models.KmsLatencyHistogram{Duration: duration, Total: total}) - } - cp := func(i, j int) bool { - return records[i].Duration < records[j].Duration - } - sort.Slice(records, cp) - return records -} - -func GetKMSAPIsResponse(session *models.Principal, params kmsAPI.KMSAPIsParams) (*models.KmsAPIsResponse, *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 kmsAPIs(ctx, AdminClient{Client: mAdmin}) -} - -func kmsAPIs(ctx context.Context, minioClient MinioAdmin) (*models.KmsAPIsResponse, *CodedAPIError) { - apis, err := minioClient.kmsAPIs(ctx) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return &models.KmsAPIsResponse{ - Results: parseApis(apis), - }, nil -} - -func parseApis(apis []madmin.KMSAPI) (data []*models.KmsAPI) { - for _, api := range apis { - data = append(data, &models.KmsAPI{ - Method: api.Method, - Path: api.Path, - MaxBody: api.MaxBody, - Timeout: api.Timeout, - }) - } - return data -} - -func GetKMSVersionResponse(session *models.Principal, params kmsAPI.KMSVersionParams) (*models.KmsVersionResponse, *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 kmsVersion(ctx, AdminClient{Client: mAdmin}) -} - -func kmsVersion(ctx context.Context, minioClient MinioAdmin) (*models.KmsVersionResponse, *CodedAPIError) { - version, err := minioClient.kmsVersion(ctx) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return &models.KmsVersionResponse{ - Version: version.Version, - }, nil -} - -func registerKMSKeyHandlers(api *operations.ConsoleAPI) { - api.KmsKMSCreateKeyHandler = kmsAPI.KMSCreateKeyHandlerFunc(func(params kmsAPI.KMSCreateKeyParams, session *models.Principal) middleware.Responder { - err := GetKMSCreateKeyResponse(session, params) - if err != nil { - return kmsAPI.NewKMSCreateKeyDefault(err.Code).WithPayload(err.APIError) - } - return kmsAPI.NewKMSCreateKeyCreated() - }) - - api.KmsKMSListKeysHandler = kmsAPI.KMSListKeysHandlerFunc(func(params kmsAPI.KMSListKeysParams, session *models.Principal) middleware.Responder { - resp, err := GetKMSListKeysResponse(session, params) - if err != nil { - return kmsAPI.NewKMSListKeysDefault(err.Code).WithPayload(err.APIError) - } - return kmsAPI.NewKMSListKeysOK().WithPayload(resp) - }) - - api.KmsKMSKeyStatusHandler = kmsAPI.KMSKeyStatusHandlerFunc(func(params kmsAPI.KMSKeyStatusParams, session *models.Principal) middleware.Responder { - resp, err := GetKMSKeyStatusResponse(session, params) - if err != nil { - return kmsAPI.NewKMSKeyStatusDefault(err.Code).WithPayload(err.APIError) - } - return kmsAPI.NewKMSKeyStatusOK().WithPayload(resp) - }) -} - -func GetKMSCreateKeyResponse(session *models.Principal, params kmsAPI.KMSCreateKeyParams) *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 createKey(ctx, *params.Body.Key, AdminClient{Client: mAdmin}) -} - -func createKey(ctx context.Context, key string, minioClient MinioAdmin) *CodedAPIError { - if err := minioClient.createKey(ctx, key); 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() - mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - pattern := "" - if params.Pattern != nil { - pattern = *params.Pattern - } - return listKeys(ctx, pattern, AdminClient{Client: mAdmin}) -} - -func listKeys(ctx context.Context, pattern string, minioClient MinioAdmin) (*models.KmsListKeysResponse, *CodedAPIError) { - results, err := minioClient.listKeys(ctx, pattern) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return &models.KmsListKeysResponse{Results: parseKeys(results)}, nil -} - -// printDate - human friendly formatted date. -const ( - printDate = "2006-01-02 15:04:05 MST" -) - -func parseKeys(results []madmin.KMSKeyInfo) (data []*models.KmsKeyInfo) { - for _, key := range results { - data = append(data, &models.KmsKeyInfo{ - CreatedAt: key.CreatedAt.Format(printDate), - CreatedBy: key.CreatedBy, - Name: key.Name, - }) - } - return data -} - -func GetKMSKeyStatusResponse(session *models.Principal, params kmsAPI.KMSKeyStatusParams) (*models.KmsKeyStatusResponse, *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 keyStatus(ctx, params.Name, AdminClient{Client: mAdmin}) -} - -func keyStatus(ctx context.Context, key string, minioClient MinioAdmin) (*models.KmsKeyStatusResponse, *CodedAPIError) { - ks, err := minioClient.keyStatus(ctx, key) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return &models.KmsKeyStatusResponse{ - KeyID: ks.KeyID, - EncryptionErr: ks.EncryptionErr, - DecryptionErr: ks.DecryptionErr, - }, nil -} diff --git a/api/admin_kms_test.go b/api/admin_kms_test.go deleted file mode 100644 index bd32078bf2..0000000000 --- a/api/admin_kms_test.go +++ /dev/null @@ -1,238 +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 . - -package api - -import ( - "context" - "net/http" - "net/http/httptest" - "os" - "testing" - - "github.com/minio/console/api/operations" - kmsAPI "github.com/minio/console/api/operations/k_m_s" - "github.com/minio/console/models" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/suite" -) - -type KMSTestSuite struct { - suite.Suite - assert *assert.Assertions - currentServer string - isServerSet bool - server *httptest.Server - adminClient AdminClientMock -} - -func (suite *KMSTestSuite) SetupSuite() { - suite.assert = assert.New(suite.T()) - suite.adminClient = AdminClientMock{} -} - -func (suite *KMSTestSuite) SetupTest() { - suite.server = httptest.NewServer(http.HandlerFunc(suite.serverHandler)) - suite.currentServer, suite.isServerSet = os.LookupEnv(ConsoleMinIOServer) - os.Setenv(ConsoleMinIOServer, suite.server.URL) -} - -func (suite *KMSTestSuite) serverHandler(w http.ResponseWriter, _ *http.Request) { - w.WriteHeader(400) -} - -func (suite *KMSTestSuite) TearDownSuite() { -} - -func (suite *KMSTestSuite) TearDownTest() { - if suite.isServerSet { - os.Setenv(ConsoleMinIOServer, suite.currentServer) - } else { - os.Unsetenv(ConsoleMinIOServer) - } -} - -func (suite *KMSTestSuite) TestRegisterKMSHandlers() { - api := &operations.ConsoleAPI{} - suite.assertHandlersAreNil(api) - registerKMSHandlers(api) - suite.assertHandlersAreNotNil(api) -} - -func (suite *KMSTestSuite) assertHandlersAreNil(api *operations.ConsoleAPI) { - suite.assert.Nil(api.KmsKMSStatusHandler) - suite.assert.Nil(api.KmsKMSMetricsHandler) - suite.assert.Nil(api.KmsKMSAPIsHandler) - suite.assert.Nil(api.KmsKMSVersionHandler) - suite.assert.Nil(api.KmsKMSCreateKeyHandler) - suite.assert.Nil(api.KmsKMSListKeysHandler) - suite.assert.Nil(api.KmsKMSKeyStatusHandler) -} - -func (suite *KMSTestSuite) assertHandlersAreNotNil(api *operations.ConsoleAPI) { - suite.assert.NotNil(api.KmsKMSStatusHandler) - suite.assert.NotNil(api.KmsKMSMetricsHandler) - suite.assert.NotNil(api.KmsKMSAPIsHandler) - suite.assert.NotNil(api.KmsKMSVersionHandler) - suite.assert.NotNil(api.KmsKMSCreateKeyHandler) - suite.assert.NotNil(api.KmsKMSListKeysHandler) - suite.assert.NotNil(api.KmsKMSKeyStatusHandler) -} - -func (suite *KMSTestSuite) TestKMSStatusHandlerWithError() { - params, api := suite.initKMSStatusRequest() - response := api.KmsKMSStatusHandler.Handle(params, &models.Principal{}) - _, ok := response.(*kmsAPI.KMSStatusDefault) - suite.assert.True(ok) -} - -func (suite *KMSTestSuite) initKMSStatusRequest() (params kmsAPI.KMSStatusParams, api operations.ConsoleAPI) { - registerKMSHandlers(&api) - params.HTTPRequest = &http.Request{} - return params, api -} - -func (suite *KMSTestSuite) TestKMSStatusWithoutError() { - ctx := context.Background() - res, err := kmsStatus(ctx, suite.adminClient) - suite.assert.NotNil(res) - suite.assert.Nil(err) -} - -func (suite *KMSTestSuite) TestKMSMetricsHandlerWithError() { - params, api := suite.initKMSMetricsRequest() - response := api.KmsKMSMetricsHandler.Handle(params, &models.Principal{}) - _, ok := response.(*kmsAPI.KMSMetricsDefault) - suite.assert.True(ok) -} - -func (suite *KMSTestSuite) initKMSMetricsRequest() (params kmsAPI.KMSMetricsParams, api operations.ConsoleAPI) { - registerKMSHandlers(&api) - params.HTTPRequest = &http.Request{} - return params, api -} - -func (suite *KMSTestSuite) TestKMSMetricsWithoutError() { - ctx := context.Background() - res, err := kmsMetrics(ctx, suite.adminClient) - suite.assert.NotNil(res) - suite.assert.Nil(err) -} - -func (suite *KMSTestSuite) TestKMSAPIsHandlerWithError() { - params, api := suite.initKMSAPIsRequest() - response := api.KmsKMSAPIsHandler.Handle(params, &models.Principal{}) - _, ok := response.(*kmsAPI.KMSAPIsDefault) - suite.assert.True(ok) -} - -func (suite *KMSTestSuite) initKMSAPIsRequest() (params kmsAPI.KMSAPIsParams, api operations.ConsoleAPI) { - registerKMSHandlers(&api) - params.HTTPRequest = &http.Request{} - return params, api -} - -func (suite *KMSTestSuite) TestKMSAPIsWithoutError() { - ctx := context.Background() - res, err := kmsAPIs(ctx, suite.adminClient) - suite.assert.NotNil(res) - suite.assert.Nil(err) -} - -func (suite *KMSTestSuite) TestKMSVersionHandlerWithError() { - params, api := suite.initKMSVersionRequest() - response := api.KmsKMSVersionHandler.Handle(params, &models.Principal{}) - _, ok := response.(*kmsAPI.KMSVersionDefault) - suite.assert.True(ok) -} - -func (suite *KMSTestSuite) initKMSVersionRequest() (params kmsAPI.KMSVersionParams, api operations.ConsoleAPI) { - registerKMSHandlers(&api) - params.HTTPRequest = &http.Request{} - return params, api -} - -func (suite *KMSTestSuite) TestKMSVersionWithoutError() { - ctx := context.Background() - res, err := kmsVersion(ctx, suite.adminClient) - suite.assert.NotNil(res) - suite.assert.Nil(err) -} - -func (suite *KMSTestSuite) TestKMSCreateKeyHandlerWithError() { - params, api := suite.initKMSCreateKeyRequest() - response := api.KmsKMSCreateKeyHandler.Handle(params, &models.Principal{}) - _, ok := response.(*kmsAPI.KMSCreateKeyDefault) - suite.assert.True(ok) -} - -func (suite *KMSTestSuite) initKMSCreateKeyRequest() (params kmsAPI.KMSCreateKeyParams, api operations.ConsoleAPI) { - registerKMSHandlers(&api) - params.HTTPRequest = &http.Request{} - key := "key" - params.Body = &models.KmsCreateKeyRequest{Key: &key} - return params, api -} - -func (suite *KMSTestSuite) TestKMSCreateKeyWithoutError() { - ctx := context.Background() - err := createKey(ctx, "key", suite.adminClient) - suite.assert.Nil(err) -} - -func (suite *KMSTestSuite) TestKMSListKeysHandlerWithError() { - params, api := suite.initKMSListKeysRequest() - response := api.KmsKMSListKeysHandler.Handle(params, &models.Principal{}) - _, ok := response.(*kmsAPI.KMSListKeysDefault) - suite.assert.True(ok) -} - -func (suite *KMSTestSuite) initKMSListKeysRequest() (params kmsAPI.KMSListKeysParams, api operations.ConsoleAPI) { - registerKMSHandlers(&api) - params.HTTPRequest = &http.Request{} - return params, api -} - -func (suite *KMSTestSuite) TestKMSListKeysWithoutError() { - ctx := context.Background() - res, err := listKeys(ctx, "", suite.adminClient) - suite.assert.NotNil(res) - suite.assert.Nil(err) -} - -func (suite *KMSTestSuite) TestKMSKeyStatusHandlerWithError() { - params, api := suite.initKMSKeyStatusRequest() - response := api.KmsKMSKeyStatusHandler.Handle(params, &models.Principal{}) - _, ok := response.(*kmsAPI.KMSKeyStatusDefault) - suite.assert.True(ok) -} - -func (suite *KMSTestSuite) initKMSKeyStatusRequest() (params kmsAPI.KMSKeyStatusParams, api operations.ConsoleAPI) { - registerKMSHandlers(&api) - params.HTTPRequest = &http.Request{} - return params, api -} - -func (suite *KMSTestSuite) TestKMSKeyStatusWithoutError() { - ctx := context.Background() - res, err := keyStatus(ctx, "key", suite.adminClient) - suite.assert.NotNil(res) - suite.assert.Nil(err) -} - -func TestKMS(t *testing.T) { - suite.Run(t, new(KMSTestSuite)) -} diff --git a/api/admin_nodes.go b/api/admin_nodes.go deleted file mode 100644 index a503259ac7..0000000000 --- a/api/admin_nodes.go +++ /dev/null @@ -1,55 +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 . - -package api - -import ( - "context" - - "github.com/go-openapi/runtime/middleware" - "github.com/minio/console/api/operations" - systemApi "github.com/minio/console/api/operations/system" - "github.com/minio/console/models" -) - -func registerNodesHandler(api *operations.ConsoleAPI) { - api.SystemListNodesHandler = systemApi.ListNodesHandlerFunc(func(params systemApi.ListNodesParams, session *models.Principal) middleware.Responder { - listNodesResponse, err := getListNodesResponse(session, params) - if err != nil { - return systemApi.NewListNodesDefault(err.Code).WithPayload(err.APIError) - } - return systemApi.NewListNodesOK().WithPayload(listNodesResponse) - }) -} - -// getListNodesResponse returns a list of available node endpoints . -func getListNodesResponse(session *models.Principal, params systemApi.ListNodesParams) ([]string, *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) - } - var nodeList []string - - adminResources, _ := mAdmin.ServerInfo(ctx) - - for _, n := range adminResources.Servers { - nodeList = append(nodeList, n.Endpoint) - } - - return nodeList, nil -} diff --git a/api/admin_notification_endpoints.go b/api/admin_notification_endpoints.go deleted file mode 100644 index b43013d7bb..0000000000 --- a/api/admin_notification_endpoints.go +++ /dev/null @@ -1,162 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 api - -import ( - "context" - "errors" - - "github.com/go-openapi/runtime/middleware" - "github.com/minio/console/api/operations" - configurationApi "github.com/minio/console/api/operations/configuration" - "github.com/minio/console/models" -) - -func registerAdminNotificationEndpointsHandlers(api *operations.ConsoleAPI) { - // return a list of notification endpoints - api.ConfigurationNotificationEndpointListHandler = configurationApi.NotificationEndpointListHandlerFunc(func(params configurationApi.NotificationEndpointListParams, session *models.Principal) middleware.Responder { - notifEndpoints, err := getNotificationEndpointsResponse(session, params) - if err != nil { - return configurationApi.NewNotificationEndpointListDefault(err.Code).WithPayload(err.APIError) - } - return configurationApi.NewNotificationEndpointListOK().WithPayload(notifEndpoints) - }) - // add a new notification endpoints - api.ConfigurationAddNotificationEndpointHandler = configurationApi.AddNotificationEndpointHandlerFunc(func(params configurationApi.AddNotificationEndpointParams, session *models.Principal) middleware.Responder { - notifEndpoints, err := getAddNotificationEndpointResponse(session, params) - if err != nil { - return configurationApi.NewAddNotificationEndpointDefault(err.Code).WithPayload(err.APIError) - } - return configurationApi.NewAddNotificationEndpointCreated().WithPayload(notifEndpoints) - }) -} - -// getNotificationEndpoints invokes admin info and returns a list of notification endpoints -func getNotificationEndpoints(ctx context.Context, client MinioAdmin) (*models.NotifEndpointResponse, error) { - serverInfo, err := client.serverInfo(ctx) - if err != nil { - return nil, err - } - var listEndpoints []*models.NotificationEndpointItem - for i := range serverInfo.Services.Notifications { - for service, endpointStatus := range serverInfo.Services.Notifications[i] { - for j := range endpointStatus { - for account, status := range endpointStatus[j] { - listEndpoints = append(listEndpoints, &models.NotificationEndpointItem{ - Service: models.NofiticationService(service), - AccountID: account, - Status: status.Status, - }) - } - } - } - } - - // build response - return &models.NotifEndpointResponse{ - NotificationEndpoints: listEndpoints, - }, nil -} - -// getNotificationEndpointsResponse returns a list of notification endpoints in the instance -func getNotificationEndpointsResponse(session *models.Principal, params configurationApi.NotificationEndpointListParams) (*models.NotifEndpointResponse, *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) - } - // create a minioClient interface implementation - // defining the client to be used - adminClient := AdminClient{Client: mAdmin} - // serialize output - notfEndpointResp, err := getNotificationEndpoints(ctx, adminClient) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return notfEndpointResp, nil -} - -func addNotificationEndpoint(ctx context.Context, client MinioAdmin, params *configurationApi.AddNotificationEndpointParams) (*models.SetNotificationEndpointResponse, error) { - configs := []*models.ConfigurationKV{} - var configName string - - // we have different add validations for each service - switch *params.Body.Service { - case models.NofiticationServiceAmqp: - configName = "notify_amqp" - case models.NofiticationServiceMqtt: - configName = "notify_mqtt" - case models.NofiticationServiceElasticsearch: - configName = "notify_elasticsearch" - case models.NofiticationServiceRedis: - configName = "notify_redis" - case models.NofiticationServiceNats: - configName = "notify_nats" - case models.NofiticationServicePostgres: - configName = "notify_postgres" - case models.NofiticationServiceMysql: - configName = "notify_mysql" - case models.NofiticationServiceKafka: - configName = "notify_kafka" - case models.NofiticationServiceWebhook: - configName = "notify_webhook" - case models.NofiticationServiceNsq: - configName = "notify_nsq" - default: - return nil, errors.New("provided service is not supported") - } - - // set all the config values if found on the param.Body.Properties - for k, val := range params.Body.Properties { - configs = append(configs, &models.ConfigurationKV{ - Key: k, - Value: val, - }) - } - - needsRestart, err := setConfigWithARNAccountID(ctx, client, &configName, configs, *params.Body.AccountID) - if err != nil { - return nil, err - } - - return &models.SetNotificationEndpointResponse{ - AccountID: params.Body.AccountID, - Properties: params.Body.Properties, - Service: params.Body.Service, - Restart: needsRestart, - }, nil -} - -// getNotificationEndpointsResponse returns a list of notification endpoints in the instance -func getAddNotificationEndpointResponse(session *models.Principal, params configurationApi.AddNotificationEndpointParams) (*models.SetNotificationEndpointResponse, *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) - } - // create a minioClient interface implementation - // defining the client to be used - adminClient := AdminClient{Client: mAdmin} - // serialize output - notfEndpointResp, err := addNotificationEndpoint(ctx, adminClient, ¶ms) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return notfEndpointResp, nil -} diff --git a/api/admin_notification_endpoints_test.go b/api/admin_notification_endpoints_test.go deleted file mode 100644 index 9564054738..0000000000 --- a/api/admin_notification_endpoints_test.go +++ /dev/null @@ -1,454 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 api - -import ( - "context" - "errors" - "reflect" - "testing" - - "github.com/go-openapi/swag" - - cfgApi "github.com/minio/console/api/operations/configuration" - "github.com/minio/console/models" -) - -func Test_addNotificationEndpoint(t *testing.T) { - client := AdminClientMock{} - - type args struct { - ctx context.Context - client MinioAdmin - params *cfgApi.AddNotificationEndpointParams - } - tests := []struct { - name string - args args - mockSetConfig func(kv string) (restart bool, err error) - want *models.SetNotificationEndpointResponse - wantErr bool - }{ - { - name: "valid postgres", - args: args{ - ctx: context.Background(), - client: client, - params: &cfgApi.AddNotificationEndpointParams{ - HTTPRequest: nil, - Body: &models.NotificationEndpoint{ - AccountID: swag.String("1"), - Properties: map[string]string{ - "host": "localhost", - "user": "user", - "password": "passwrd", - }, - Service: models.NewNofiticationService("postgres"), - }, - }, - }, - mockSetConfig: func(_ string) (restart bool, err error) { - return false, nil - }, - want: &models.SetNotificationEndpointResponse{ - AccountID: swag.String("1"), - Properties: map[string]string{ - "host": "localhost", - "user": "user", - "password": "passwrd", - }, - Service: models.NewNofiticationService("postgres"), - Restart: false, - }, - wantErr: false, - }, - { - name: "set config returns error", - args: args{ - ctx: context.Background(), - client: client, - params: &cfgApi.AddNotificationEndpointParams{ - HTTPRequest: nil, - Body: &models.NotificationEndpoint{ - AccountID: swag.String("1"), - Properties: map[string]string{ - "host": "localhost", - "user": "user", - "password": "passwrd", - }, - Service: models.NewNofiticationService("postgres"), - }, - }, - }, - mockSetConfig: func(_ string) (restart bool, err error) { - return false, errors.New("error") - }, - want: nil, - wantErr: true, - }, - { - name: "valid mysql", - args: args{ - ctx: context.Background(), - client: client, - params: &cfgApi.AddNotificationEndpointParams{ - HTTPRequest: nil, - Body: &models.NotificationEndpoint{ - AccountID: swag.String("1"), - Properties: map[string]string{ - "host": "localhost", - "user": "user", - "password": "passwrd", - }, - Service: models.NewNofiticationService("mysql"), - }, - }, - }, - mockSetConfig: func(_ string) (restart bool, err error) { - return false, nil - }, - want: &models.SetNotificationEndpointResponse{ - AccountID: swag.String("1"), - Properties: map[string]string{ - "host": "localhost", - "user": "user", - "password": "passwrd", - }, - Service: models.NewNofiticationService("mysql"), - Restart: false, - }, - wantErr: false, - }, - { - name: "valid kafka", - args: args{ - ctx: context.Background(), - client: client, - params: &cfgApi.AddNotificationEndpointParams{ - HTTPRequest: nil, - Body: &models.NotificationEndpoint{ - AccountID: swag.String("1"), - Properties: map[string]string{ - "brokers": "http://localhost:8080/broker1", - }, - Service: models.NewNofiticationService("kafka"), - }, - }, - }, - mockSetConfig: func(_ string) (restart bool, err error) { - return false, nil - }, - want: &models.SetNotificationEndpointResponse{ - AccountID: swag.String("1"), - Properties: map[string]string{ - "brokers": "http://localhost:8080/broker1", - }, - Service: models.NewNofiticationService("kafka"), - Restart: false, - }, - wantErr: false, - }, - { - name: "valid amqp", - args: args{ - ctx: context.Background(), - client: client, - params: &cfgApi.AddNotificationEndpointParams{ - HTTPRequest: nil, - Body: &models.NotificationEndpoint{ - AccountID: swag.String("1"), - Properties: map[string]string{ - "url": "http://localhost:8080/broker1", - }, - Service: models.NewNofiticationService("amqp"), - }, - }, - }, - mockSetConfig: func(_ string) (restart bool, err error) { - return false, nil - }, - want: &models.SetNotificationEndpointResponse{ - AccountID: swag.String("1"), - Properties: map[string]string{ - "url": "http://localhost:8080/broker1", - }, - Service: models.NewNofiticationService("amqp"), - Restart: false, - }, - wantErr: false, - }, - { - name: "valid mqtt", - args: args{ - ctx: context.Background(), - client: client, - params: &cfgApi.AddNotificationEndpointParams{ - HTTPRequest: nil, - Body: &models.NotificationEndpoint{ - AccountID: swag.String("1"), - Properties: map[string]string{ - "broker": "http://localhost:8080/broker1", - "topic": "minio", - }, - Service: models.NewNofiticationService("mqtt"), - }, - }, - }, - mockSetConfig: func(_ string) (restart bool, err error) { - return false, nil - }, - want: &models.SetNotificationEndpointResponse{ - AccountID: swag.String("1"), - Properties: map[string]string{ - "broker": "http://localhost:8080/broker1", - "topic": "minio", - }, - Service: models.NewNofiticationService("mqtt"), - Restart: false, - }, - wantErr: false, - }, - { - name: "valid elasticsearch", - args: args{ - ctx: context.Background(), - client: client, - params: &cfgApi.AddNotificationEndpointParams{ - HTTPRequest: nil, - Body: &models.NotificationEndpoint{ - AccountID: swag.String("1"), - Properties: map[string]string{ - "url": "http://localhost:8080/broker1", - "index": "minio", - "format": "namespace", - }, - Service: models.NewNofiticationService("elasticsearch"), - }, - }, - }, - mockSetConfig: func(_ string) (restart bool, err error) { - return false, nil - }, - want: &models.SetNotificationEndpointResponse{ - AccountID: swag.String("1"), - Properties: map[string]string{ - "url": "http://localhost:8080/broker1", - "index": "minio", - "format": "namespace", - }, - Service: models.NewNofiticationService("elasticsearch"), - Restart: false, - }, - wantErr: false, - }, - { - name: "valid redis", - args: args{ - ctx: context.Background(), - client: client, - params: &cfgApi.AddNotificationEndpointParams{ - HTTPRequest: nil, - Body: &models.NotificationEndpoint{ - AccountID: swag.String("1"), - Properties: map[string]string{ - "address": "http://localhost:8080/broker1", - "key": "minio", - "format": "namespace", - }, - Service: models.NewNofiticationService("redis"), - }, - }, - }, - mockSetConfig: func(_ string) (restart bool, err error) { - return false, nil - }, - want: &models.SetNotificationEndpointResponse{ - AccountID: swag.String("1"), - Properties: map[string]string{ - "address": "http://localhost:8080/broker1", - "key": "minio", - "format": "namespace", - }, - Service: models.NewNofiticationService("redis"), - Restart: false, - }, - wantErr: false, - }, - { - name: "valid nats", - args: args{ - ctx: context.Background(), - client: client, - params: &cfgApi.AddNotificationEndpointParams{ - HTTPRequest: nil, - Body: &models.NotificationEndpoint{ - AccountID: swag.String("1"), - Properties: map[string]string{ - "address": "http://localhost:8080/broker1", - "subject": "minio", - }, - Service: models.NewNofiticationService("nats"), - }, - }, - }, - mockSetConfig: func(_ string) (restart bool, err error) { - return false, nil - }, - want: &models.SetNotificationEndpointResponse{ - AccountID: swag.String("1"), - Properties: map[string]string{ - "address": "http://localhost:8080/broker1", - "subject": "minio", - }, - Service: models.NewNofiticationService("nats"), - Restart: false, - }, - wantErr: false, - }, - { - name: "valid webhook", - args: args{ - ctx: context.Background(), - client: client, - params: &cfgApi.AddNotificationEndpointParams{ - HTTPRequest: nil, - Body: &models.NotificationEndpoint{ - AccountID: swag.String("1"), - Properties: map[string]string{ - "endpoint": "http://localhost:8080/broker1", - }, - Service: models.NewNofiticationService("webhook"), - }, - }, - }, - mockSetConfig: func(_ string) (restart bool, err error) { - return false, nil - }, - want: &models.SetNotificationEndpointResponse{ - AccountID: swag.String("1"), - Properties: map[string]string{ - "endpoint": "http://localhost:8080/broker1", - }, - Service: models.NewNofiticationService("webhook"), - Restart: false, - }, - wantErr: false, - }, - { - name: "valid nsq", - args: args{ - ctx: context.Background(), - client: client, - params: &cfgApi.AddNotificationEndpointParams{ - HTTPRequest: nil, - Body: &models.NotificationEndpoint{ - AccountID: swag.String("1"), - Properties: map[string]string{ - "nsqd_address": "http://localhost:8080/broker1", - "topic": "minio", - }, - Service: models.NewNofiticationService("nsq"), - }, - }, - }, - mockSetConfig: func(_ string) (restart bool, err error) { - return false, nil - }, - want: &models.SetNotificationEndpointResponse{ - AccountID: swag.String("1"), - Properties: map[string]string{ - "nsqd_address": "http://localhost:8080/broker1", - "topic": "minio", - }, - Service: models.NewNofiticationService("nsq"), - Restart: false, - }, - wantErr: false, - }, - { - name: "invalid service", - args: args{ - ctx: context.Background(), - client: client, - params: &cfgApi.AddNotificationEndpointParams{ - HTTPRequest: nil, - Body: &models.NotificationEndpoint{ - AccountID: swag.String("1"), - Properties: map[string]string{ - "host": "localhost", - "user": "user", - "password": "passwrd", - }, - Service: models.NewNofiticationService("oorgle"), - }, - }, - }, - mockSetConfig: func(_ string) (restart bool, err error) { - return false, errors.New("invalid config") - }, - want: nil, - wantErr: true, - }, - { - name: "valid config, restart required", - args: args{ - ctx: context.Background(), - client: client, - params: &cfgApi.AddNotificationEndpointParams{ - HTTPRequest: nil, - Body: &models.NotificationEndpoint{ - AccountID: swag.String("1"), - Properties: map[string]string{ - "host": "localhost", - "user": "user", - "password": "passwrd", - }, - Service: models.NewNofiticationService("postgres"), - }, - }, - }, - mockSetConfig: func(_ string) (restart bool, err error) { - return true, nil - }, - want: &models.SetNotificationEndpointResponse{ - AccountID: swag.String("1"), - Properties: map[string]string{ - "host": "localhost", - "user": "user", - "password": "passwrd", - }, - Service: models.NewNofiticationService("postgres"), - Restart: true, - }, - wantErr: false, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - // mock function response from setConfig() - minioSetConfigKVMock = tt.mockSetConfig - got, err := addNotificationEndpoint(tt.args.ctx, tt.args.client, tt.args.params) - if (err != nil) != tt.wantErr { - t.Errorf("addNotificationEndpoint() error = %v, wantErr %v", err, tt.wantErr) - return - } - if !reflect.DeepEqual(got, tt.want) { - t.Errorf("addNotificationEndpoint() got = %v, want %v", got, tt.want) - } - }) - } -} diff --git a/api/admin_policies.go b/api/admin_policies.go deleted file mode 100644 index 7d163e97eb..0000000000 --- a/api/admin_policies.go +++ /dev/null @@ -1,695 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 api - -import ( - "bytes" - "context" - "encoding/json" - "fmt" - "sort" - "strings" - - bucketApi "github.com/minio/console/api/operations/bucket" - policyApi "github.com/minio/console/api/operations/policy" - s3 "github.com/minio/minio-go/v7" - - "github.com/go-openapi/runtime/middleware" - "github.com/minio/console/api/operations" - "github.com/minio/console/models" - iampolicy "github.com/minio/pkg/v3/policy" - - policies "github.com/minio/console/api/policy" -) - -func registersPoliciesHandler(api *operations.ConsoleAPI) { - // List Policies - api.PolicyListPoliciesHandler = policyApi.ListPoliciesHandlerFunc(func(params policyApi.ListPoliciesParams, session *models.Principal) middleware.Responder { - listPoliciesResponse, err := getListPoliciesResponse(session, params) - if err != nil { - return policyApi.NewListPoliciesDefault(err.Code).WithPayload(err.APIError) - } - return policyApi.NewListPoliciesOK().WithPayload(listPoliciesResponse) - }) - // Policy Info - api.PolicyPolicyInfoHandler = policyApi.PolicyInfoHandlerFunc(func(params policyApi.PolicyInfoParams, session *models.Principal) middleware.Responder { - policyInfo, err := getPolicyInfoResponse(session, params) - if err != nil { - return policyApi.NewPolicyInfoDefault(err.Code).WithPayload(err.APIError) - } - return policyApi.NewPolicyInfoOK().WithPayload(policyInfo) - }) - // Add Policy - api.PolicyAddPolicyHandler = policyApi.AddPolicyHandlerFunc(func(params policyApi.AddPolicyParams, session *models.Principal) middleware.Responder { - policyResponse, err := getAddPolicyResponse(session, params) - if err != nil { - return policyApi.NewAddPolicyDefault(err.Code).WithPayload(err.APIError) - } - return policyApi.NewAddPolicyCreated().WithPayload(policyResponse) - }) - // Remove Policy - api.PolicyRemovePolicyHandler = policyApi.RemovePolicyHandlerFunc(func(params policyApi.RemovePolicyParams, session *models.Principal) middleware.Responder { - if err := getRemovePolicyResponse(session, params); err != nil { - return policyApi.NewRemovePolicyDefault(err.Code).WithPayload(err.APIError) - } - return policyApi.NewRemovePolicyNoContent() - }) - // Set Policy - api.PolicySetPolicyHandler = policyApi.SetPolicyHandlerFunc(func(params policyApi.SetPolicyParams, session *models.Principal) middleware.Responder { - if err := getSetPolicyResponse(session, params); err != nil { - return policyApi.NewSetPolicyDefault(err.Code).WithPayload(err.APIError) - } - return policyApi.NewSetPolicyNoContent() - }) - // Set Policy Multiple User/Groups - api.PolicySetPolicyMultipleHandler = policyApi.SetPolicyMultipleHandlerFunc(func(params policyApi.SetPolicyMultipleParams, session *models.Principal) middleware.Responder { - if err := getSetPolicyMultipleResponse(session, params); err != nil { - return policyApi.NewSetPolicyMultipleDefault(err.Code).WithPayload(err.APIError) - } - return policyApi.NewSetPolicyMultipleNoContent() - }) - api.BucketListPoliciesWithBucketHandler = bucketApi.ListPoliciesWithBucketHandlerFunc(func(params bucketApi.ListPoliciesWithBucketParams, session *models.Principal) middleware.Responder { - policyResponse, err := getListPoliciesWithBucketResponse(session, params) - if err != nil { - return bucketApi.NewListPoliciesWithBucketDefault(err.Code).WithPayload(err.APIError) - } - return bucketApi.NewListPoliciesWithBucketOK().WithPayload(policyResponse) - }) - api.BucketListAccessRulesWithBucketHandler = bucketApi.ListAccessRulesWithBucketHandlerFunc(func(params bucketApi.ListAccessRulesWithBucketParams, session *models.Principal) middleware.Responder { - policyResponse, err := getListAccessRulesWithBucketResponse(session, params) - if err != nil { - return bucketApi.NewListAccessRulesWithBucketDefault(err.Code).WithPayload(err.APIError) - } - return bucketApi.NewListAccessRulesWithBucketOK().WithPayload(policyResponse) - }) - api.BucketSetAccessRuleWithBucketHandler = bucketApi.SetAccessRuleWithBucketHandlerFunc(func(params bucketApi.SetAccessRuleWithBucketParams, session *models.Principal) middleware.Responder { - policyResponse, err := getSetAccessRuleWithBucketResponse(session, params) - if err != nil { - return bucketApi.NewSetAccessRuleWithBucketDefault(err.Code).WithPayload(err.APIError) - } - return bucketApi.NewSetAccessRuleWithBucketOK().WithPayload(policyResponse) - }) - api.BucketDeleteAccessRuleWithBucketHandler = bucketApi.DeleteAccessRuleWithBucketHandlerFunc(func(params bucketApi.DeleteAccessRuleWithBucketParams, session *models.Principal) middleware.Responder { - policyResponse, err := getDeleteAccessRuleWithBucketResponse(session, params) - if err != nil { - return bucketApi.NewDeleteAccessRuleWithBucketDefault(err.Code).WithPayload(err.APIError) - } - return bucketApi.NewDeleteAccessRuleWithBucketOK().WithPayload(policyResponse) - }) - api.PolicyListUsersForPolicyHandler = policyApi.ListUsersForPolicyHandlerFunc(func(params policyApi.ListUsersForPolicyParams, session *models.Principal) middleware.Responder { - policyUsersResponse, err := getListUsersForPolicyResponse(session, params) - if err != nil { - return policyApi.NewListUsersForPolicyDefault(err.Code).WithPayload(err.APIError) - } - return policyApi.NewListUsersForPolicyOK().WithPayload(policyUsersResponse) - }) - api.PolicyListGroupsForPolicyHandler = policyApi.ListGroupsForPolicyHandlerFunc(func(params policyApi.ListGroupsForPolicyParams, session *models.Principal) middleware.Responder { - policyGroupsResponse, err := getListGroupsForPolicyResponse(session, params) - if err != nil { - return policyApi.NewListGroupsForPolicyDefault(err.Code).WithPayload(err.APIError) - } - return policyApi.NewListGroupsForPolicyOK().WithPayload(policyGroupsResponse) - }) - // Gets policies for currently logged in user - api.PolicyGetUserPolicyHandler = policyApi.GetUserPolicyHandlerFunc(func(params policyApi.GetUserPolicyParams, session *models.Principal) middleware.Responder { - userPolicyResponse, err := getUserPolicyResponse(params.HTTPRequest.Context(), session) - if err != nil { - return policyApi.NewGetUserPolicyDefault(err.Code).WithPayload(err.APIError) - } - return policyApi.NewGetUserPolicyOK().WithPayload(userPolicyResponse) - }) - // Gets policies for specified user - api.PolicyGetSAUserPolicyHandler = policyApi.GetSAUserPolicyHandlerFunc(func(params policyApi.GetSAUserPolicyParams, session *models.Principal) middleware.Responder { - userPolicyResponse, err := getSAUserPolicyResponse(session, params) - if err != nil { - return policyApi.NewGetSAUserPolicyDefault(err.Code).WithPayload(err.APIError) - } - return policyApi.NewGetSAUserPolicyOK().WithPayload(userPolicyResponse) - }) -} - -func getListAccessRulesWithBucketResponse(session *models.Principal, params bucketApi.ListAccessRulesWithBucketParams) (*models.ListAccessRulesResponse, *CodedAPIError) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - bucket := params.Bucket - client, err := newS3BucketClient(session, bucket, "", getClientIP(params.HTTPRequest)) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - accessRules, _ := client.GetAccessRules(ctx) - var accessRuleList []*models.AccessRule - for k, v := range accessRules { - accessRuleList = append(accessRuleList, &models.AccessRule{Prefix: k[len(bucket)+1 : len(k)-1], Access: v}) - } - return &models.ListAccessRulesResponse{AccessRules: accessRuleList}, nil -} - -func getSetAccessRuleWithBucketResponse(session *models.Principal, params bucketApi.SetAccessRuleWithBucketParams) (bool, *CodedAPIError) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - prefixAccess := params.Prefixaccess - client, err := newS3BucketClient(session, params.Bucket, prefixAccess.Prefix, getClientIP(params.HTTPRequest)) - if err != nil { - return false, ErrorWithContext(ctx, err) - } - errorVal := client.SetAccess(ctx, prefixAccess.Access, false) - if errorVal != nil { - returnError := ErrorWithContext(ctx, errorVal.Cause) - minioError := s3.ToErrorResponse(errorVal.Cause) - if minioError.Code == "NoSuchBucket" { - returnError.Code = 404 - } - return false, returnError - } - return true, nil -} - -func getDeleteAccessRuleWithBucketResponse(session *models.Principal, params bucketApi.DeleteAccessRuleWithBucketParams) (bool, *CodedAPIError) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - bucket := params.Bucket - prefix := params.Prefix - client, err := newS3BucketClient(session, bucket, prefix.Prefix, getClientIP(params.HTTPRequest)) - if err != nil { - return false, ErrorWithContext(ctx, err) - } - errorVal := client.SetAccess(ctx, "none", false) - if errorVal != nil { - return false, ErrorWithContext(ctx, errorVal.Cause) - } - return true, nil -} - -func getListPoliciesWithBucketResponse(session *models.Principal, params bucketApi.ListPoliciesWithBucketParams) (*models.ListPoliciesResponse, *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) - } - // create a MinIO Admin Client interface implementation - // defining the client to be used - adminClient := AdminClient{Client: mAdmin} - - policies, err := listPoliciesWithBucket(ctx, params.Bucket, adminClient) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - // serialize output - listPoliciesResponse := &models.ListPoliciesResponse{ - Policies: policies, - Total: int64(len(policies)), - } - return listPoliciesResponse, nil -} - -// listPoliciesWithBucket calls MinIO server to list all policy names present on the server that apply to a particular bucket. -// listPoliciesWithBucket() converts the map[string][]byte returned by client.listPolicies() -// to []*models.Policy by iterating over each key in policyRawMap and -// then using Unmarshal on the raw bytes to create a *models.Policy -func listPoliciesWithBucket(ctx context.Context, bucket string, client MinioAdmin) ([]*models.Policy, error) { - policyMap, err := client.listPolicies(ctx) - var policies []*models.Policy - if err != nil { - return nil, err - } - for name, policy := range policyMap { - policy, err := parsePolicy(name, policy) - if err != nil { - return nil, err - } - if policyMatchesBucket(ctx, policy, bucket) { - policies = append(policies, policy) - } - } - return policies, nil -} - -func policyMatchesBucket(ctx context.Context, policy *models.Policy, bucket string) bool { - policyData := &iampolicy.Policy{} - err := json.Unmarshal([]byte(policy.Policy), policyData) - if err != nil { - ErrorWithContext(ctx, fmt.Errorf("error parsing policy: %v", err)) - return false - } - policyStatements := policyData.Statements - for i := 0; i < len(policyStatements); i++ { - resources := policyStatements[i].Resources - if resources.Match(bucket, map[string][]string{}) { - return true - } - if resources.Match(fmt.Sprintf("%s/*", bucket), map[string][]string{}) { - return true - } - } - return false -} - -// listPolicies calls MinIO server to list all policy names present on the server. -// listPolicies() converts the map[string][]byte returned by client.listPolicies() -// to []*models.Policy by iterating over each key in policyRawMap and -// then using Unmarshal on the raw bytes to create a *models.Policy -func listPolicies(ctx context.Context, client MinioAdmin) ([]*models.Policy, error) { - policyMap, err := client.listPolicies(ctx) - var policies []*models.Policy - if err != nil { - return nil, err - } - for name, policy := range policyMap { - policy, err := parsePolicy(name, policy) - if err != nil { - return nil, err - } - policies = append(policies, policy) - } - return policies, nil -} - -// getListPoliciesResponse performs listPolicies() and serializes it to the handler's output -func getListPoliciesResponse(session *models.Principal, params policyApi.ListPoliciesParams) (*models.ListPoliciesResponse, *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) - } - // create a MinIO Admin Client interface implementation - // defining the client to be used - adminClient := AdminClient{Client: mAdmin} - - policies, err := listPolicies(ctx, adminClient) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - // serialize output - listPoliciesResponse := &models.ListPoliciesResponse{ - Policies: policies, - Total: int64(len(policies)), - } - return listPoliciesResponse, nil -} - -// getListUsersForPoliciesResponse performs lists users affected by a given policy. -func getListUsersForPolicyResponse(session *models.Principal, params policyApi.ListUsersForPolicyParams) ([]string, *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) - } - // create a minioClient interface implementation - // defining the client to be used - adminClient := AdminClient{Client: mAdmin} - policies, err := listPolicies(ctx, adminClient) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - found := false - for i := range policies { - if policies[i].Name == params.Policy { - found = true - } - } - if !found { - return nil, ErrorWithContext(ctx, ErrPolicyNotFound, fmt.Errorf("the policy %s does not exist", params.Policy)) - } - users, err := listUsers(ctx, adminClient) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - - var filteredUsers []string - for _, user := range users { - for _, upolicy := range user.Policy { - if upolicy == params.Policy { - filteredUsers = append(filteredUsers, user.AccessKey) - break - } - } - } - sort.Strings(filteredUsers) - return filteredUsers, nil -} - -func getUserPolicyResponse(ctx context.Context, session *models.Principal) (string, *CodedAPIError) { - ctx, cancel := context.WithCancel(ctx) - defer cancel() - // serialize output - if session == nil { - return "nil", ErrorWithContext(ctx, ErrPolicyNotFound) - } - tokenClaims, _ := getClaimsFromToken(session.STSSessionToken) - - // initialize admin client - mAdminClient, err := NewMinioAdminClient(ctx, &models.Principal{ - STSAccessKeyID: session.STSAccessKeyID, - STSSecretAccessKey: session.STSSecretAccessKey, - STSSessionToken: session.STSSessionToken, - }) - if err != nil { - return "nil", ErrorWithContext(ctx, err) - } - userAdminClient := AdminClient{Client: mAdminClient} - // Obtain the current policy assigned to this user - // necessary for generating the list of allowed endpoints - accountInfo, err := getAccountInfo(ctx, userAdminClient) - if err != nil { - return "nil", ErrorWithContext(ctx, err) - } - rawPolicy := policies.ReplacePolicyVariables(tokenClaims, accountInfo) - return string(rawPolicy), nil -} - -func getSAUserPolicyResponse(session *models.Principal, params policyApi.GetSAUserPolicyParams) (*models.AUserPolicyResponse, *CodedAPIError) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - // serialize output - if session == nil { - return nil, ErrorWithContext(ctx, ErrPolicyNotFound) - } - // initialize admin client - mAdminClient, err := NewMinioAdminClient(params.HTTPRequest.Context(), &models.Principal{ - STSAccessKeyID: session.STSAccessKeyID, - STSSecretAccessKey: session.STSSecretAccessKey, - STSSessionToken: session.STSSessionToken, - }) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - userAdminClient := AdminClient{Client: mAdminClient} - - user, err := getUserInfo(ctx, userAdminClient, params.Name) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - var userPolicies []string - if len(user.PolicyName) > 0 { - userPolicies = strings.Split(user.PolicyName, ",") - } - - for _, group := range user.MemberOf { - groupDesc, err := groupInfo(ctx, userAdminClient, group) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - if groupDesc.Policy != "" { - userPolicies = append(userPolicies, strings.Split(groupDesc.Policy, ",")...) - } - } - - allKeys := make(map[string]bool) - var userPolicyList []string - - for _, item := range userPolicies { - if _, value := allKeys[item]; !value { - allKeys[item] = true - userPolicyList = append(userPolicyList, item) - } - } - var userStatements []iampolicy.Statement - - for _, pol := range userPolicyList { - policy, err := getPolicyStatements(ctx, userAdminClient, pol) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - userStatements = append(userStatements, policy...) - } - - combinedPolicy := iampolicy.Policy{ - Version: "2012-10-17", - Statements: userStatements, - } - - stringPolicy, err := json.Marshal(combinedPolicy) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - parsedPolicy := string(stringPolicy) - - getUserPoliciesResponse := &models.AUserPolicyResponse{ - Policy: parsedPolicy, - } - - return getUserPoliciesResponse, nil -} - -func getListGroupsForPolicyResponse(session *models.Principal, params policyApi.ListGroupsForPolicyParams) ([]string, *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) - } - // create a minioClient interface implementation - // defining the client to be used - adminClient := AdminClient{Client: mAdmin} - policies, err := listPolicies(ctx, adminClient) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - found := false - for i := range policies { - if policies[i].Name == params.Policy { - found = true - } - } - if !found { - return nil, ErrorWithContext(ctx, ErrPolicyNotFound, fmt.Errorf("the policy %s does not exist", params.Policy)) - } - - groups, err := adminClient.listGroups(ctx) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - - var filteredGroups []string - for _, group := range groups { - info, err := groupInfo(ctx, adminClient, group) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - groupPolicies := strings.Split(info.Policy, ",") - for _, groupPolicy := range groupPolicies { - if groupPolicy == params.Policy { - filteredGroups = append(filteredGroups, group) - } - } - } - sort.Strings(filteredGroups) - return filteredGroups, nil -} - -// removePolicy() calls MinIO server to remove a policy based on name. -func removePolicy(ctx context.Context, client MinioAdmin, name string) error { - err := client.removePolicy(ctx, name) - if err != nil { - return err - } - return nil -} - -// getRemovePolicyResponse() performs removePolicy() and serializes it to the handler's output -func getRemovePolicyResponse(session *models.Principal, params policyApi.RemovePolicyParams) *CodedAPIError { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - if params.Name == "" { - return ErrorWithContext(ctx, ErrPolicyNameNotInRequest) - } - mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return ErrorWithContext(ctx, err) - } - // create a MinIO Admin Client interface implementation - // defining the client to be used - adminClient := AdminClient{Client: mAdmin} - - if err := removePolicy(ctx, adminClient, params.Name); err != nil { - return ErrorWithContext(ctx, err) - } - return nil -} - -// addPolicy calls MinIO server to add a canned policy. -// addPolicy() takes name and policy in string format, policy -// policy must be string in json format, in the future this will change -// to a Policy struct{} - https://github.com/minio/minio/issues/9171 -func addPolicy(ctx context.Context, client MinioAdmin, name, policy string) (*models.Policy, error) { - iamp, err := iampolicy.ParseConfig(bytes.NewReader([]byte(policy))) - if err != nil { - return nil, err - } - if err := client.addPolicy(ctx, name, iamp); err != nil { - return nil, err - } - policyObject, err := policyInfo(ctx, client, name) - if err != nil { - return nil, err - } - return policyObject, nil -} - -// getAddPolicyResponse performs addPolicy() and serializes it to the handler's output -func getAddPolicyResponse(session *models.Principal, params policyApi.AddPolicyParams) (*models.Policy, *CodedAPIError) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - if params.Body == nil { - return nil, ErrorWithContext(ctx, ErrPolicyBodyNotInRequest) - } - mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - // create a MinIO Admin Client interface implementation - // defining the client to be used - adminClient := AdminClient{Client: mAdmin} - policy, err := addPolicy(ctx, adminClient, *params.Body.Name, *params.Body.Policy) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return policy, nil -} - -// policyInfo calls MinIO server to retrieve information of a canned policy. -// policyInfo() takes a policy name, obtains the []byte (represents a string in JSON format) -// and return it as *models.Policy , in the future this will change -// to a Policy struct{} - https://github.com/minio/minio/issues/9171 -func policyInfo(ctx context.Context, client MinioAdmin, name string) (*models.Policy, error) { - policyRaw, err := client.getPolicy(ctx, name) - if err != nil { - return nil, err - } - policy, err := parsePolicy(name, policyRaw) - if err != nil { - return nil, err - } - return policy, nil -} - -// getPolicy Statements calls MinIO server to retrieve information of a canned policy. -// and returns the associated Statements -func getPolicyStatements(ctx context.Context, client MinioAdmin, name string) ([]iampolicy.Statement, error) { - policyRaw, err := client.getPolicy(ctx, name) - if err != nil { - return nil, err - } - - return policyRaw.Statements, nil -} - -// getPolicyInfoResponse performs policyInfo() and serializes it to the handler's output -func getPolicyInfoResponse(session *models.Principal, params policyApi.PolicyInfoParams) (*models.Policy, *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) - } - // create a MinIO Admin Client interface implementation - // defining the client to be used - adminClient := AdminClient{Client: mAdmin} - policy, err := policyInfo(ctx, adminClient, params.Name) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return policy, nil -} - -// SetPolicy calls MinIO server to assign policy to a group or user. -func SetPolicy(ctx context.Context, client MinioAdmin, name, entityName string, entityType models.PolicyEntity) error { - isGroup := false - if entityType == models.PolicyEntityGroup { - isGroup = true - } - return client.setPolicy(ctx, name, entityName, isGroup) -} - -// getSetPolicyResponse() performs SetPolicy() and serializes it to the handler's output -func getSetPolicyResponse(session *models.Principal, params policyApi.SetPolicyParams) *CodedAPIError { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - // Removing this section - mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return ErrorWithContext(ctx, err) - } - // create a MinIO Admin Client interface implementation - // defining the client to be used - adminClient := AdminClient{Client: mAdmin} - - if err := SetPolicy(ctx, adminClient, strings.Join(params.Body.Name, ","), *params.Body.EntityName, *params.Body.EntityType); err != nil { - return ErrorWithContext(ctx, err) - } - return nil -} - -func getSetPolicyMultipleResponse(session *models.Principal, params policyApi.SetPolicyMultipleParams) *CodedAPIError { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return ErrorWithContext(ctx, err) - } - // create a MinIO Admin Client interface implementation - // defining the client to be used - adminClient := AdminClient{Client: mAdmin} - - if err := setPolicyMultipleEntities(ctx, adminClient, strings.Join(params.Body.Name, ","), params.Body.Users, params.Body.Groups); err != nil { - return ErrorWithContext(ctx, err) - } - return nil -} - -// setPolicyMultipleEntities sets a policy to multiple users/groups -func setPolicyMultipleEntities(ctx context.Context, client MinioAdmin, policyName string, users, groups []models.IamEntity) error { - for _, user := range users { - if err := client.setPolicy(ctx, policyName, string(user), false); err != nil { - return err - } - } - for _, group := range groups { - groupDesc, err := groupInfo(ctx, client, string(group)) - if err != nil { - return err - } - allGroupPolicies := "" - if len(groups) > 1 { - allGroupPolicies = groupDesc.Policy + "," + policyName - s := strings.Split(allGroupPolicies, ",") - allGroupPolicies = strings.Join(UniqueKeys(s), ",") - } else { - allGroupPolicies = policyName - } - if err := client.setPolicy(ctx, allGroupPolicies, string(group), true); err != nil { - return err - } - } - return nil -} - -// parsePolicy() converts from *rawPolicy to *models.Policy -func parsePolicy(name string, rawPolicy *iampolicy.Policy) (*models.Policy, error) { - stringPolicy, err := json.Marshal(rawPolicy) - if err != nil { - return nil, err - } - policy := &models.Policy{ - Name: name, - Policy: string(stringPolicy), - } - return policy, nil -} diff --git a/api/admin_policies_test.go b/api/admin_policies_test.go deleted file mode 100644 index c0380f7426..0000000000 --- a/api/admin_policies_test.go +++ /dev/null @@ -1,382 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 api - -import ( - "bytes" - "context" - "encoding/json" - "errors" - "fmt" - "reflect" - "testing" - - "github.com/minio/console/models" - iampolicy "github.com/minio/pkg/v3/policy" - "github.com/stretchr/testify/assert" -) - -func TestListPolicies(t *testing.T) { - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - funcAssert := assert.New(t) - adminClient := AdminClientMock{} - // mock function response from listPolicies() - minioListPoliciesMock = func() (map[string]*iampolicy.Policy, error) { - var readonly iampolicy.Policy - var readwrite iampolicy.Policy - var diagnostis iampolicy.Policy - - for _, p := range iampolicy.DefaultPolicies { - switch p.Name { - case "readonly": - readonly = p.Definition - case "readwrite": - readwrite = p.Definition - case "diagnostics": - diagnostis = p.Definition - } - } - - return map[string]*iampolicy.Policy{ - "readonly": &readonly, - "readwrite": &readwrite, - "diagnostics": &diagnostis, - }, nil - } - // Test-1 : listPolicies() Get response from minio client with three Canned Policies and return the same number on listPolicies() - function := "listPolicies()" - policiesList, err := listPolicies(ctx, adminClient) - if err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - // verify length of Policies is correct - funcAssert.Equal(3, len(policiesList), fmt.Sprintf("Failed on %s: length of Policies's lists is not the same", function)) - // Test-2 : listPolicies() Return error and see that the error is handled correctly and returned - minioListPoliciesMock = func() (map[string]*iampolicy.Policy, error) { - return nil, errors.New("error") - } - _, err = listPolicies(ctx, adminClient) - if funcAssert.Error(err) { - funcAssert.Equal("error", err.Error()) - } -} - -func TestRemovePolicy(t *testing.T) { - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - funcAssert := assert.New(t) - adminClient := AdminClientMock{} - // Test-1 : removePolicy() remove an existing policy - policyToRemove := "console-policy" - minioRemovePolicyMock = func(_ string) error { - return nil - } - function := "removePolicy()" - if err := removePolicy(ctx, adminClient, policyToRemove); err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - // Test-2 : removePolicy() Return error and see that the error is handled correctly and returned - minioRemovePolicyMock = func(_ string) error { - return errors.New("error") - } - if err := removePolicy(ctx, adminClient, policyToRemove); funcAssert.Error(err) { - funcAssert.Equal("error", err.Error()) - } -} - -func TestAddPolicy(t *testing.T) { - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - funcAssert := assert.New(t) - adminClient := AdminClientMock{} - policyName := "new-policy" - policyDefinition := "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"s3:GetBucketLocation\",\"s3:GetObject\",\"s3:ListAllMyBuckets\"],\"Resource\":[\"arn:aws:s3:::*\"]}]}" - minioAddPolicyMock = func(_ string, _ *iampolicy.Policy) error { - return nil - } - minioGetPolicyMock = func(_ string) (*iampolicy.Policy, error) { - policy := "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"s3:GetBucketLocation\",\"s3:GetObject\",\"s3:ListAllMyBuckets\"],\"Resource\":[\"arn:aws:s3:::*\"]}]}" - iamp, err := iampolicy.ParseConfig(bytes.NewReader([]byte(policy))) - if err != nil { - return nil, err - } - return iamp, nil - } - assertPolicy := models.Policy{ - Name: "new-policy", - Policy: "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"s3:GetBucketLocation\",\"s3:GetObject\",\"s3:ListAllMyBuckets\"],\"Resource\":[\"arn:aws:s3:::*\"]}]}", - } - // Test-1 : addPolicy() adds a new policy - function := "addPolicy()" - policy, err := addPolicy(ctx, adminClient, policyName, policyDefinition) - if err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } else { - funcAssert.Equal(policy.Name, assertPolicy.Name) - - var expectedPolicy iampolicy.Policy - var actualPolicy iampolicy.Policy - err1 := json.Unmarshal([]byte(policy.Policy), &expectedPolicy) - funcAssert.NoError(err1) - err2 := json.Unmarshal([]byte(assertPolicy.Policy), &actualPolicy) - funcAssert.NoError(err2) - funcAssert.Equal(expectedPolicy, actualPolicy) - } - // Test-2 : addPolicy() got an error while adding policy - minioAddPolicyMock = func(_ string, _ *iampolicy.Policy) error { - return errors.New("error") - } - if _, err := addPolicy(ctx, adminClient, policyName, policyDefinition); funcAssert.Error(err) { - funcAssert.Equal("error", err.Error()) - } - // Test-3 : addPolicy() got an error while retrieving policy - minioAddPolicyMock = func(_ string, _ *iampolicy.Policy) error { - return nil - } - minioGetPolicyMock = func(_ string) (*iampolicy.Policy, error) { - return nil, errors.New("error") - } - if _, err := addPolicy(ctx, adminClient, policyName, policyDefinition); funcAssert.Error(err) { - funcAssert.Equal("error", err.Error()) - } -} - -func TestSetPolicy(t *testing.T) { - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - funcAssert := assert.New(t) - adminClient := AdminClientMock{} - policyName := "readOnly" - entityName := "alevsk" - entityObject := models.PolicyEntityUser - minioSetPolicyMock = func(_, _ string, _ bool) error { - return nil - } - // Test-1 : SetPolicy() set policy to user - function := "SetPolicy()" - err := SetPolicy(ctx, adminClient, policyName, entityName, entityObject) - if err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - // Test-2 : SetPolicy() set policy to group - entityObject = models.PolicyEntityGroup - err = SetPolicy(ctx, adminClient, policyName, entityName, entityObject) - if err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - // Test-3 : SetPolicy() set policy to user and get error - entityObject = models.PolicyEntityUser - minioSetPolicyMock = func(_, _ string, _ bool) error { - return errors.New("error") - } - if err := SetPolicy(ctx, adminClient, policyName, entityName, entityObject); funcAssert.Error(err) { - funcAssert.Equal("error", err.Error()) - } - // Test-4 : SetPolicy() set policy to group and get error - entityObject = models.PolicyEntityGroup - minioSetPolicyMock = func(_, _ string, _ bool) error { - return errors.New("error") - } - if err := SetPolicy(ctx, adminClient, policyName, entityName, entityObject); funcAssert.Error(err) { - funcAssert.Equal("error", err.Error()) - } -} - -func Test_SetPolicyMultiple(t *testing.T) { - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - adminClient := AdminClientMock{} - - type args struct { - policyName string - users []models.IamEntity - groups []models.IamEntity - setPolicyFunc func(policyName, entityName string, isGroup bool) error - } - tests := []struct { - name string - args args - errorExpected error - }{ - { - name: "Set policy to multiple users and groups", - args: args{ - policyName: "readonly", - users: []models.IamEntity{"user1", "user2"}, - groups: []models.IamEntity{"group1", "group2"}, - setPolicyFunc: func(_, _ string, _ bool) error { - return nil - }, - }, - errorExpected: nil, - }, - { - name: "Return error on set policy function", - args: args{ - policyName: "readonly", - users: []models.IamEntity{"user1", "user2"}, - groups: []models.IamEntity{"group1", "group2"}, - setPolicyFunc: func(_, _ string, _ bool) error { - return errors.New("error set") - }, - }, - errorExpected: errors.New("error set"), - }, - { - // Description: Empty lists of users and groups are acceptable - name: "Empty lists of users and groups", - args: args{ - policyName: "readonly", - users: []models.IamEntity{}, - groups: []models.IamEntity{}, - setPolicyFunc: func(_, _ string, _ bool) error { - return nil - }, - }, - errorExpected: nil, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - minioSetPolicyMock = tt.args.setPolicyFunc - got := setPolicyMultipleEntities(ctx, adminClient, tt.args.policyName, tt.args.users, tt.args.groups) - if !reflect.DeepEqual(got, tt.errorExpected) { - ji, _ := json.Marshal(got) - vi, _ := json.Marshal(tt.errorExpected) - t.Errorf("got %s want %s", ji, vi) - } - }) - } -} - -func Test_policyMatchesBucket(t *testing.T) { - type args struct { - ctx context.Context - policy *models.Policy - bucket string - } - tests := []struct { - name string - args args - want bool - }{ - { - name: "Test1", - args: args{ctx: context.Background(), policy: &models.Policy{Name: "consoleAdmin", Policy: `{ - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "admin:*" - ] - }, - { - "Effect": "Allow", - "Action": [ - "s3:*" - ], - "Resource": [ - "arn:aws:s3:::*" - ] - } - ] -}`}, bucket: "test1"}, - want: true, - }, - { - name: "Test2", - args: args{ctx: context.Background(), policy: &models.Policy{Name: "consoleAdmin", Policy: `{ - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "s3:*" - ], - "Resource": [ - "arn:aws:s3:::bucket1" - ] - } - ] - }`}, bucket: "test1"}, - want: false, - }, - { - name: "Test3", - args: args{ctx: context.Background(), policy: &models.Policy{Name: "consoleAdmin", Policy: `{ - "Version": "2012-10-17", - "Statement": [ - { - "Sid": "VisualEditor0", - "Effect": "Allow", - "Action": [ - "s3:ListStorageLensConfigurations", - "s3:GetAccessPoint", - "s3:PutAccountPublicAccessBlock", - "s3:GetAccountPublicAccessBlock", - "s3:ListAllMyBuckets", - "s3:ListAccessPoints", - "s3:ListJobs", - "s3:PutStorageLensConfiguration", - "s3:CreateJob" - ], - "Resource": "*" - }, - { - "Sid": "VisualEditor1", - "Effect": "Allow", - "Action": "s3:*", - "Resource": [ - "arn:aws:s3:::test", - "arn:aws:s3:::test/*", - "arn:aws:s3:::lkasdkljasd090901", - "arn:aws:s3:::lkasdkljasd090901/*" - ] - } - ] - }`}, bucket: "test1"}, - want: false, - }, - { - name: "Test4", - args: args{ctx: context.Background(), policy: &models.Policy{Name: "consoleAdmin", Policy: `{ - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "s3:*" - ], - "Resource": [ - "arn:aws:s3:::bucket1" - ] - } - ] - }`}, bucket: "bucket1"}, - want: true, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - if got := policyMatchesBucket(tt.args.ctx, tt.args.policy, tt.args.bucket); got != tt.want { - t.Errorf("policyMatchesBucket() = %v, want %v", got, tt.want) - } - }) - } -} diff --git a/api/admin_releases.go b/api/admin_releases.go deleted file mode 100644 index d706589039..0000000000 --- a/api/admin_releases.go +++ /dev/null @@ -1,116 +0,0 @@ -// 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 api - -import ( - "context" - "encoding/json" - "fmt" - "net/http" - "net/url" - "time" - - "github.com/minio/console/pkg/utils" - - "github.com/go-openapi/runtime/middleware" - "github.com/minio/console/api/operations" - release "github.com/minio/console/api/operations/release" - "github.com/minio/console/models" - "github.com/minio/pkg/v3/env" -) - -var ( - releaseServiceHostEnvVar = "RELEASE_SERVICE_HOST" - defaultReleaseServiceHost = "https://enterprise-updates.ic.min.dev" -) - -func registerReleasesHandlers(api *operations.ConsoleAPI) { - api.ReleaseListReleasesHandler = release.ListReleasesHandlerFunc(func(params release.ListReleasesParams, session *models.Principal) middleware.Responder { - resp, err := GetReleaseListResponse(session, params) - if err != nil { - return release.NewListReleasesDefault(err.Code).WithPayload(err.APIError) - } - return release.NewListReleasesOK().WithPayload(resp) - }) -} - -func GetReleaseListResponse(_ *models.Principal, params release.ListReleasesParams) (*models.ReleaseListResponse, *CodedAPIError) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - repo := params.Repo - currentRelease := "" - if params.Current != nil { - currentRelease = *params.Current - } - search := "" - if params.Search != nil { - search = *params.Search - } - filter := "" - if params.Filter != nil { - filter = *params.Filter - } - ctx = context.WithValue(ctx, utils.ContextClientIP, getClientIP(params.HTTPRequest)) - return releaseList(ctx, repo, currentRelease, search, filter) -} - -func releaseList(ctx context.Context, repo, currentRelease, search, filter string) (*models.ReleaseListResponse, *CodedAPIError) { - serviceURL := getReleaseServiceURL() - clientIP := utils.ClientIPFromContext(ctx) - releases, err := getReleases(serviceURL, repo, currentRelease, search, filter, clientIP) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return releases, nil -} - -func getReleaseServiceURL() string { - host := env.Get(releaseServiceHostEnvVar, defaultReleaseServiceHost) - return fmt.Sprintf("%s/releases", host) -} - -func getReleases(endpoint, repo, currentRelease, search, filter, clientIP string) (*models.ReleaseListResponse, error) { - rl := &models.ReleaseListResponse{} - req, err := http.NewRequest(http.MethodGet, endpoint, nil) - if err != nil { - return nil, err - } - q := &url.Values{} - q.Add("repo", repo) - q.Add("search", search) - q.Add("filter", filter) - q.Add("current", currentRelease) - req.URL.RawQuery = q.Encode() - req.Header.Set("Content-Type", "application/json") - - client := GetConsoleHTTPClient(clientIP) - client.Timeout = time.Second * 5 - - resp, err := client.Do(req) - if err != nil { - return nil, err - } - defer resp.Body.Close() - if resp.StatusCode != http.StatusOK { - return nil, fmt.Errorf("error getting releases: %s", resp.Status) - } - err = json.NewDecoder(resp.Body).Decode(&rl) - if err != nil { - return nil, err - } - return rl, nil -} diff --git a/api/admin_releases_test.go b/api/admin_releases_test.go deleted file mode 100644 index 6754f9c025..0000000000 --- a/api/admin_releases_test.go +++ /dev/null @@ -1,104 +0,0 @@ -// 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 api - -import ( - "encoding/json" - "fmt" - "net/http" - "net/http/httptest" - "os" - "testing" - - "github.com/minio/console/api/operations" - release "github.com/minio/console/api/operations/release" - "github.com/minio/console/models" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/suite" -) - -type ReleasesTestSuite struct { - suite.Suite - assert *assert.Assertions - currentServer string - isServerSet bool - getServer *httptest.Server - withError bool -} - -func (suite *ReleasesTestSuite) SetupSuite() { - suite.assert = assert.New(suite.T()) - suite.getServer = httptest.NewServer(http.HandlerFunc(suite.getHandler)) - suite.currentServer, suite.isServerSet = os.LookupEnv(releaseServiceHostEnvVar) - os.Setenv(releaseServiceHostEnvVar, suite.getServer.URL) -} - -func (suite *ReleasesTestSuite) TearDownSuite() { - if suite.isServerSet { - os.Setenv(releaseServiceHostEnvVar, suite.currentServer) - } else { - os.Unsetenv(releaseServiceHostEnvVar) - } -} - -func (suite *ReleasesTestSuite) getHandler( - w http.ResponseWriter, _ *http.Request, -) { - if suite.withError { - w.WriteHeader(400) - } else { - w.WriteHeader(200) - response := &models.ReleaseListResponse{} - bytes, _ := json.Marshal(response) - fmt.Fprint(w, string(bytes)) - } -} - -func (suite *ReleasesTestSuite) TestRegisterReleasesHandlers() { - api := &operations.ConsoleAPI{} - suite.assert.Nil(api.ReleaseListReleasesHandler) - registerReleasesHandlers(api) - suite.assert.NotNil(api.ReleaseListReleasesHandler) -} - -func (suite *ReleasesTestSuite) TestGetReleasesWithError() { - api := &operations.ConsoleAPI{} - current := "mock" - registerReleasesHandlers(api) - params := release.NewListReleasesParams() - params.Current = ¤t - params.HTTPRequest = &http.Request{} - suite.withError = true - response := api.ReleaseListReleasesHandler.Handle(params, &models.Principal{}) - _, ok := response.(*release.ListReleasesDefault) - suite.assert.True(ok) -} - -func (suite *ReleasesTestSuite) TestGetReleasesWithoutError() { - api := &operations.ConsoleAPI{} - registerReleasesHandlers(api) - params := release.NewListReleasesParams() - params.HTTPRequest = &http.Request{} - suite.withError = false - response := api.ReleaseListReleasesHandler.Handle(params, &models.Principal{}) - _, ok := response.(*release.ListReleasesOK) - suite.assert.True(ok) -} - -func TestReleases(t *testing.T) { - suite.Run(t, new(ReleasesTestSuite)) -} diff --git a/api/admin_remote_buckets.go b/api/admin_remote_buckets.go deleted file mode 100644 index f05ec73681..0000000000 --- a/api/admin_remote_buckets.go +++ /dev/null @@ -1,810 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 api - -import ( - "context" - "errors" - "fmt" - "net/url" - "strconv" - "time" - - "github.com/minio/console/pkg/utils" - - "github.com/minio/madmin-go/v3" - - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/swag" - "github.com/minio/console/api/operations" - bucketApi "github.com/minio/console/api/operations/bucket" - "github.com/minio/console/models" - "github.com/minio/minio-go/v7/pkg/replication" -) - -type RemoteBucketResult struct { - OriginBucket string - TargetBucket string - Error string -} - -func registerAdminBucketRemoteHandlers(api *operations.ConsoleAPI) { - // return list of remote buckets - api.BucketListRemoteBucketsHandler = bucketApi.ListRemoteBucketsHandlerFunc(func(params bucketApi.ListRemoteBucketsParams, session *models.Principal) middleware.Responder { - listResp, err := getListRemoteBucketsResponse(session, params) - if err != nil { - return bucketApi.NewListRemoteBucketsDefault(err.Code).WithPayload(err.APIError) - } - return bucketApi.NewListRemoteBucketsOK().WithPayload(listResp) - }) - - // return information about a specific bucket - api.BucketRemoteBucketDetailsHandler = bucketApi.RemoteBucketDetailsHandlerFunc(func(params bucketApi.RemoteBucketDetailsParams, session *models.Principal) middleware.Responder { - response, err := getRemoteBucketDetailsResponse(session, params) - if err != nil { - return bucketApi.NewRemoteBucketDetailsDefault(err.Code).WithPayload(err.APIError) - } - return bucketApi.NewRemoteBucketDetailsOK().WithPayload(response) - }) - - // delete remote bucket - api.BucketDeleteRemoteBucketHandler = bucketApi.DeleteRemoteBucketHandlerFunc(func(params bucketApi.DeleteRemoteBucketParams, session *models.Principal) middleware.Responder { - err := getDeleteRemoteBucketResponse(session, params) - if err != nil { - return bucketApi.NewDeleteRemoteBucketDefault(err.Code).WithPayload(err.APIError) - } - return bucketApi.NewDeleteRemoteBucketNoContent() - }) - - // set remote bucket - api.BucketAddRemoteBucketHandler = bucketApi.AddRemoteBucketHandlerFunc(func(params bucketApi.AddRemoteBucketParams, session *models.Principal) middleware.Responder { - err := getAddRemoteBucketResponse(session, params) - if err != nil { - return bucketApi.NewAddRemoteBucketDefault(err.Code).WithPayload(err.APIError) - } - return bucketApi.NewAddRemoteBucketCreated() - }) - - // set multi-bucket replication - api.BucketSetMultiBucketReplicationHandler = bucketApi.SetMultiBucketReplicationHandlerFunc(func(params bucketApi.SetMultiBucketReplicationParams, session *models.Principal) middleware.Responder { - response, err := setMultiBucketReplicationResponse(session, params) - if err != nil { - return bucketApi.NewSetMultiBucketReplicationDefault(err.Code).WithPayload(err.APIError) - } - - return bucketApi.NewSetMultiBucketReplicationOK().WithPayload(response) - }) - - // list external buckets - api.BucketListExternalBucketsHandler = bucketApi.ListExternalBucketsHandlerFunc(func(params bucketApi.ListExternalBucketsParams, _ *models.Principal) middleware.Responder { - response, err := listExternalBucketsResponse(params) - if err != nil { - return bucketApi.NewListExternalBucketsDefault(err.Code).WithPayload(err.APIError) - } - - return bucketApi.NewListExternalBucketsOK().WithPayload(response) - }) - - // delete replication rule - api.BucketDeleteBucketReplicationRuleHandler = bucketApi.DeleteBucketReplicationRuleHandlerFunc(func(params bucketApi.DeleteBucketReplicationRuleParams, session *models.Principal) middleware.Responder { - err := deleteReplicationRuleResponse(session, params) - if err != nil { - return bucketApi.NewDeleteBucketReplicationRuleDefault(err.Code).WithPayload(err.APIError) - } - - return bucketApi.NewDeleteBucketReplicationRuleNoContent() - }) - - // delete all replication rules for a bucket - api.BucketDeleteAllReplicationRulesHandler = bucketApi.DeleteAllReplicationRulesHandlerFunc(func(params bucketApi.DeleteAllReplicationRulesParams, session *models.Principal) middleware.Responder { - err := deleteBucketReplicationRulesResponse(session, params) - if err != nil { - if err.Code == 500 && err.APIError.DetailedMessage == "The remote target does not exist" { - // We should ignore this MinIO error when deleting all replication rules - return bucketApi.NewDeleteAllReplicationRulesNoContent() // This will return 204 as per swagger spec - } - // If there is a different error, then we should handle it - // This will return a generic error with err.Code (likely a 500 or 404) and its *err.DetailedMessage - return bucketApi.NewDeleteAllReplicationRulesDefault(err.Code).WithPayload(err.APIError) - } - return bucketApi.NewDeleteAllReplicationRulesNoContent() - }) - - // delete selected replication rules for a bucket - api.BucketDeleteSelectedReplicationRulesHandler = bucketApi.DeleteSelectedReplicationRulesHandlerFunc(func(params bucketApi.DeleteSelectedReplicationRulesParams, session *models.Principal) middleware.Responder { - err := deleteSelectedReplicationRulesResponse(session, params) - if err != nil { - return bucketApi.NewDeleteSelectedReplicationRulesDefault(err.Code).WithPayload(err.APIError) - } - - return bucketApi.NewDeleteSelectedReplicationRulesNoContent() - }) - - // update local bucket replication config item - api.BucketUpdateMultiBucketReplicationHandler = bucketApi.UpdateMultiBucketReplicationHandlerFunc(func(params bucketApi.UpdateMultiBucketReplicationParams, session *models.Principal) middleware.Responder { - err := updateBucketReplicationResponse(session, params) - if err != nil { - return bucketApi.NewUpdateMultiBucketReplicationDefault(err.Code).WithPayload(err.APIError) - } - return bucketApi.NewUpdateMultiBucketReplicationCreated() - }) -} - -func getListRemoteBucketsResponse(session *models.Principal, params bucketApi.ListRemoteBucketsParams) (*models.ListRemoteBucketsResponse, *CodedAPIError) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return nil, ErrorWithContext(ctx, fmt.Errorf("error creating Madmin Client: %v", err)) - } - adminClient := AdminClient{Client: mAdmin} - return listRemoteBuckets(ctx, adminClient) -} - -func getRemoteBucketDetailsResponse(session *models.Principal, params bucketApi.RemoteBucketDetailsParams) (*models.RemoteBucket, *CodedAPIError) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return nil, ErrorWithContext(ctx, fmt.Errorf("error creating Madmin Client: %v", err)) - } - adminClient := AdminClient{Client: mAdmin} - return getRemoteBucket(ctx, adminClient, params.Name) -} - -func getDeleteRemoteBucketResponse(session *models.Principal, params bucketApi.DeleteRemoteBucketParams) *CodedAPIError { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return ErrorWithContext(ctx, fmt.Errorf("error creating Madmin Client: %v", err)) - } - adminClient := AdminClient{Client: mAdmin} - err = deleteRemoteBucket(ctx, adminClient, params.SourceBucketName, params.Arn) - if err != nil { - return ErrorWithContext(ctx, fmt.Errorf("error deleting remote bucket: %v", err)) - } - return nil -} - -func getAddRemoteBucketResponse(session *models.Principal, params bucketApi.AddRemoteBucketParams) *CodedAPIError { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return ErrorWithContext(ctx, fmt.Errorf("error creating Madmin Client: %v", err)) - } - adminClient := AdminClient{Client: mAdmin} - _, err = addRemoteBucket(ctx, adminClient, *params.Body) - if err != nil { - return ErrorWithContext(ctx, fmt.Errorf("error adding remote bucket: %v", err)) - } - return nil -} - -func listRemoteBuckets(ctx context.Context, client MinioAdmin) (*models.ListRemoteBucketsResponse, *CodedAPIError) { - var remoteBuckets []*models.RemoteBucket - buckets, err := client.listRemoteBuckets(ctx, "", "") - if err != nil { - return nil, ErrorWithContext(ctx, fmt.Errorf("error listing remote buckets: %v", err)) - } - for _, bucket := range buckets { - remoteBucket := &models.RemoteBucket{ - AccessKey: swag.String(bucket.Credentials.AccessKey), - RemoteARN: swag.String(bucket.Arn), - SecretKey: bucket.Credentials.SecretKey, - Service: "replication", - SourceBucket: swag.String(bucket.SourceBucket), - Status: "", - TargetBucket: bucket.TargetBucket, - TargetURL: bucket.Endpoint, - SyncMode: "async", - Bandwidth: bucket.BandwidthLimit, - HealthCheckPeriod: int64(bucket.HealthCheckDuration.Seconds()), - } - if bucket.ReplicationSync { - remoteBucket.SyncMode = "sync" - } - remoteBuckets = append(remoteBuckets, remoteBucket) - } - - return &models.ListRemoteBucketsResponse{ - Buckets: remoteBuckets, - Total: int64(len(remoteBuckets)), - }, nil -} - -func getRemoteBucket(ctx context.Context, client MinioAdmin, name string) (*models.RemoteBucket, *CodedAPIError) { - remoteBucket, err := client.getRemoteBucket(ctx, name, "") - if err != nil { - return nil, ErrorWithContext(ctx, fmt.Errorf("error getting remote bucket details: %v", err)) - } - if remoteBucket == nil { - return nil, ErrorWithContext(ctx, "error getting remote bucket details: bucket not found") - } - return &models.RemoteBucket{ - AccessKey: &remoteBucket.Credentials.AccessKey, - RemoteARN: &remoteBucket.Arn, - SecretKey: remoteBucket.Credentials.SecretKey, - Service: "replication", - SourceBucket: &remoteBucket.SourceBucket, - Status: "", - TargetBucket: remoteBucket.TargetBucket, - TargetURL: remoteBucket.Endpoint, - }, nil -} - -func deleteRemoteBucket(ctx context.Context, client MinioAdmin, sourceBucketName, arn string) error { - return client.removeRemoteBucket(ctx, sourceBucketName, arn) -} - -func addRemoteBucket(ctx context.Context, client MinioAdmin, params models.CreateRemoteBucket) (string, error) { - TargetURL := *params.TargetURL - accessKey := *params.AccessKey - secretKey := *params.SecretKey - u, err := url.Parse(TargetURL) - if err != nil { - return "", errors.New("malformed Remote target URL") - } - secure := u.Scheme == "https" - host := u.Host - if u.Port() == "" { - port := 80 - if secure { - port = 443 - } - host = host + ":" + strconv.Itoa(port) - } - creds := &madmin.Credentials{AccessKey: accessKey, SecretKey: secretKey} - remoteBucket := &madmin.BucketTarget{ - TargetBucket: *params.TargetBucket, - Secure: secure, - Credentials: creds, - Endpoint: host, - Path: "", - API: "s3v4", - Type: "replication", - Region: params.Region, - ReplicationSync: *params.SyncMode == "sync", - } - if *params.SyncMode == "async" { - remoteBucket.BandwidthLimit = params.Bandwidth - } - if params.HealthCheckPeriod > 0 { - remoteBucket.HealthCheckDuration = time.Duration(params.HealthCheckPeriod) * time.Second - } - bucketARN, err := client.addRemoteBucket(ctx, *params.SourceBucket, remoteBucket) - - return bucketARN, err -} - -func addBucketReplicationItem(ctx context.Context, session *models.Principal, minClient minioClient, bucketName, prefix, destinationARN string, repExistingObj, repDelMark, repDels, repMeta bool, tags string, priority int32, storageClass string) error { - // we will tolerate this call failing - cfg, err := minClient.getBucketReplication(ctx, bucketName) - if err != nil { - ErrorWithContext(ctx, fmt.Errorf("error fetching replication configuration for bucket %s: %v", bucketName, err)) - } - - // add rule - maxPrio := 0 - - if priority <= 0 { // We pick next priority by default - for _, r := range cfg.Rules { - if r.Priority > maxPrio { - maxPrio = r.Priority - } - } - maxPrio++ - } else { // User picked priority, we try to set this manually - maxPrio = int(priority) - } - clientIP := utils.ClientIPFromContext(ctx) - s3Client, err := newS3BucketClient(session, bucketName, prefix, clientIP) - if err != nil { - ErrorWithContext(ctx, fmt.Errorf("error creating S3Client: %v", err)) - return err - } - // create a mc S3Client interface implementation - // defining the client to be used - mcClient := mcClient{client: s3Client} - - repDelMarkStatus := "disable" - if repDelMark { - repDelMarkStatus = "enable" - } - - repDelsStatus := "disable" - if repDels { - repDelsStatus = "enable" - } - - repMetaStatus := "disable" - if repMeta { - repMetaStatus = "enable" - } - - existingRepStatus := "disable" - if repExistingObj { - existingRepStatus = "enable" - } - - opts := replication.Options{ - Priority: fmt.Sprintf("%d", maxPrio), - RuleStatus: "enable", - DestBucket: destinationARN, - Op: replication.AddOption, - TagString: tags, - ExistingObjectReplicate: existingRepStatus, - ReplicateDeleteMarkers: repDelMarkStatus, - ReplicateDeletes: repDelsStatus, - ReplicaSync: repMetaStatus, - StorageClass: storageClass, - } - - err2 := mcClient.setReplication(ctx, &cfg, opts) - if err2 != nil { - ErrorWithContext(ctx, fmt.Errorf("error creating replication for bucket: %v", err2.Cause)) - return err2.Cause - } - return nil -} - -func editBucketReplicationItem(ctx context.Context, session *models.Principal, minClient minioClient, ruleID, bucketName, prefix, destinationARN string, ruleStatus, repDelMark, repDels, repMeta, existingObjectRep bool, tags string, priority int32, storageClass string) error { - // we will tolerate this call failing - cfg, err := minClient.getBucketReplication(ctx, bucketName) - if err != nil { - ErrorWithContext(ctx, fmt.Errorf("error fetching replication configuration for bucket %s: %v", bucketName, err)) - } - - maxPrio := int(priority) - - clientIP := utils.ClientIPFromContext(ctx) - s3Client, err := newS3BucketClient(session, bucketName, prefix, clientIP) - if err != nil { - return fmt.Errorf("error creating S3Client: %v", err) - } - // create a mc S3Client interface implementation - // defining the client to be used - mcClient := mcClient{client: s3Client} - - ruleState := "disable" - if ruleStatus { - ruleState = "enable" - } - - repDelMarkStatus := "disable" - if repDelMark { - repDelMarkStatus = "enable" - } - - repDelsStatus := "disable" - if repDels { - repDelsStatus = "enable" - } - - repMetaStatus := "disable" - if repMeta { - repMetaStatus = "enable" - } - - existingRepStatus := "disable" - if existingObjectRep { - existingRepStatus = "enable" - } - - opts := replication.Options{ - ID: ruleID, - Priority: fmt.Sprintf("%d", maxPrio), - RuleStatus: ruleState, - DestBucket: destinationARN, - Op: replication.SetOption, - TagString: tags, - IsTagSet: true, - ExistingObjectReplicate: existingRepStatus, - ReplicateDeleteMarkers: repDelMarkStatus, - ReplicateDeletes: repDelsStatus, - ReplicaSync: repMetaStatus, - StorageClass: storageClass, - IsSCSet: true, - } - - err2 := mcClient.setReplication(ctx, &cfg, opts) - if err2 != nil { - return fmt.Errorf("error modifying replication for bucket: %v", err2.Cause) - } - return nil -} - -func setMultiBucketReplication(ctx context.Context, session *models.Principal, client MinioAdmin, minClient minioClient, params bucketApi.SetMultiBucketReplicationParams) []RemoteBucketResult { - bucketsRelation := params.Body.BucketsRelation - - // Parallel remote bucket adding - parallelRemoteBucket := func(bucketRelationData *models.MultiBucketsRelation) chan RemoteBucketResult { - remoteProc := make(chan RemoteBucketResult) - sourceBucket := bucketRelationData.OriginBucket - targetBucket := bucketRelationData.DestinationBucket - - go func() { - defer close(remoteProc) - - createRemoteBucketParams := models.CreateRemoteBucket{ - AccessKey: params.Body.AccessKey, - SecretKey: params.Body.SecretKey, - SourceBucket: &sourceBucket, - TargetBucket: &targetBucket, - Region: params.Body.Region, - TargetURL: params.Body.TargetURL, - SyncMode: params.Body.SyncMode, - Bandwidth: params.Body.Bandwidth, - HealthCheckPeriod: params.Body.HealthCheckPeriod, - } - - // We add the remote bucket reference & store the arn or errors returned - arn, err := addRemoteBucket(ctx, client, createRemoteBucketParams) - - if err == nil { - err = addBucketReplicationItem( - ctx, - session, - minClient, - sourceBucket, - params.Body.Prefix, - arn, - params.Body.ReplicateExistingObjects, - params.Body.ReplicateDeleteMarkers, - params.Body.ReplicateDeletes, - params.Body.ReplicateMetadata, - params.Body.Tags, - params.Body.Priority, - params.Body.StorageClass) - } - - errorReturn := "" - - if err != nil { - deleteRemoteBucket(ctx, client, sourceBucket, arn) - errorReturn = err.Error() - } - - retParams := RemoteBucketResult{ - OriginBucket: sourceBucket, - TargetBucket: targetBucket, - Error: errorReturn, - } - - remoteProc <- retParams - }() - return remoteProc - } - - var bucketsManagement []chan RemoteBucketResult - - for _, bucketName := range bucketsRelation { - // We generate the ARNs for each bucket - rBucket := parallelRemoteBucket(bucketName) - bucketsManagement = append(bucketsManagement, rBucket) - } - - resultsList := []RemoteBucketResult{} - for _, result := range bucketsManagement { - res := <-result - resultsList = append(resultsList, res) - } - - return resultsList -} - -func setMultiBucketReplicationResponse(session *models.Principal, params bucketApi.SetMultiBucketReplicationParams) (*models.MultiBucketResponseState, *CodedAPIError) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - - mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return nil, ErrorWithContext(ctx, fmt.Errorf("error creating Madmin Client: %v", err)) - } - adminClient := AdminClient{Client: mAdmin} - - mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) - if err != nil { - return nil, ErrorWithContext(ctx, fmt.Errorf("error creating MinIO Client: %v", err)) - } - // create a minioClient interface implementation - // defining the client to be used - mnClient := minioClient{client: mClient} - - replicationResults := setMultiBucketReplication(ctx, session, adminClient, mnClient, params) - - if replicationResults == nil { - return nil, ErrorWithContext(ctx, errors.New("error setting buckets replication")) - } - - resParsed := []*models.MultiBucketResponseItem{} - - for _, repResult := range replicationResults { - responseItem := models.MultiBucketResponseItem{ - ErrorString: repResult.Error, - OriginBucket: repResult.OriginBucket, - TargetBucket: repResult.TargetBucket, - } - - resParsed = append(resParsed, &responseItem) - } - - resultsParsed := models.MultiBucketResponseState{ - ReplicationState: resParsed, - } - - return &resultsParsed, nil -} - -func listExternalBucketsResponse(params bucketApi.ListExternalBucketsParams) (*models.ListBucketsResponse, *CodedAPIError) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - remoteAdmin, err := newAdminFromCreds(*params.Body.AccessKey, *params.Body.SecretKey, *params.Body.TargetURL, *params.Body.UseTLS) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return listExternalBuckets(ctx, AdminClient{Client: remoteAdmin}) -} - -func listExternalBuckets(ctx context.Context, client MinioAdmin) (*models.ListBucketsResponse, *CodedAPIError) { - buckets, err := getAccountBuckets(ctx, client) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - - return &models.ListBucketsResponse{ - Buckets: buckets, - Total: int64(len(buckets)), - }, nil -} - -func getARNFromID(conf *replication.Config, rule string) string { - for i := range conf.Rules { - if conf.Rules[i].ID == rule { - return conf.Rules[i].Destination.Bucket - } - } - return "" -} - -func getARNsFromIDs(conf *replication.Config, rules []string) []string { - temp := make(map[string]string) - for i := range conf.Rules { - temp[conf.Rules[i].ID] = conf.Rules[i].Destination.Bucket - } - var retval []string - for i := range rules { - if val, ok := temp[rules[i]]; ok { - retval = append(retval, val) - } - } - return retval -} - -func deleteReplicationRule(ctx context.Context, session *models.Principal, bucketName, ruleID string) error { - clientIP := utils.ClientIPFromContext(ctx) - mClient, err := newMinioClient(session, clientIP) - if err != nil { - return fmt.Errorf("error creating MinIO Client: %v", err) - } - // create a minioClient interface implementation - // defining the client to be used - minClient := minioClient{client: mClient} - - cfg, err := minClient.getBucketReplication(ctx, bucketName) - if err != nil { - ErrorWithContext(ctx, fmt.Errorf("error versioning bucket: %v", err)) - } - - s3Client, err := newS3BucketClient(session, bucketName, "", clientIP) - if err != nil { - return fmt.Errorf("error creating S3Client: %v", err) - } - mAdmin, err := NewMinioAdminClient(ctx, session) - if err != nil { - return fmt.Errorf("error creating Admin Client: %v", err) - } - admClient := AdminClient{Client: mAdmin} - - // create a mc S3Client interface implementation - // defining the client to be used - mcClient := mcClient{client: s3Client} - - opts := replication.Options{ - ID: ruleID, - Op: replication.RemoveOption, - } - - err2 := mcClient.setReplication(ctx, &cfg, opts) - if err2 != nil { - return err2.Cause - } - - // Replication rule was successfully deleted. We remove remote bucket - err3 := deleteRemoteBucket(ctx, admClient, bucketName, getARNFromID(&cfg, ruleID)) - if err3 != nil { - return err3 - } - - return nil -} - -func deleteAllReplicationRules(ctx context.Context, session *models.Principal, bucketName string) error { - clientIP := utils.ClientIPFromContext(ctx) - - s3Client, err := newS3BucketClient(session, bucketName, "", clientIP) - if err != nil { - return fmt.Errorf("error creating S3Client: %v", err) - } - // create a mc S3Client interface implementation - // defining the client to be used - mcClient := mcClient{client: s3Client} - mClient, err := newMinioClient(session, clientIP) - if err != nil { - return fmt.Errorf("error creating MinIO Client: %v", err) - } - // create a minioClient interface implementation - // defining the client to be used - minClient := minioClient{client: mClient} - - cfg, err := minClient.getBucketReplication(ctx, bucketName) - if err != nil { - ErrorWithContext(ctx, fmt.Errorf("error versioning bucket: %v", err)) - } - - mAdmin, err := NewMinioAdminClient(ctx, session) - if err != nil { - return fmt.Errorf("error creating Admin Client: %v", err) - } - admClient := AdminClient{Client: mAdmin} - - err2 := mcClient.deleteAllReplicationRules(ctx) - - if err2 != nil { - return err2.ToGoError() - } - - for i := range cfg.Rules { - err3 := deleteRemoteBucket(ctx, admClient, bucketName, cfg.Rules[i].Destination.Bucket) - if err3 != nil { - return err3 - } - } - - return nil -} - -func deleteSelectedReplicationRules(ctx context.Context, session *models.Principal, bucketName string, rules []string) error { - clientIP := utils.ClientIPFromContext(ctx) - mClient, err := newMinioClient(session, clientIP) - if err != nil { - return fmt.Errorf("error creating MinIO Client: %v", err) - } - // create a minioClient interface implementation - // defining the client to be used - minClient := minioClient{client: mClient} - - cfg, err := minClient.getBucketReplication(ctx, bucketName) - if err != nil { - ErrorWithContext(ctx, fmt.Errorf("error versioning bucket: %v", err)) - } - - s3Client, err := newS3BucketClient(session, bucketName, "", clientIP) - if err != nil { - return fmt.Errorf("error creating S3Client: %v", err) - } - // create a mc S3Client interface implementation - // defining the client to be used - mcClient := mcClient{client: s3Client} - - mAdmin, err := NewMinioAdminClient(ctx, session) - if err != nil { - return fmt.Errorf("error creating Admin Client: %v", err) - } - admClient := AdminClient{Client: mAdmin} - - ARNs := getARNsFromIDs(&cfg, rules) - - for i := range rules { - opts := replication.Options{ - ID: rules[i], - Op: replication.RemoveOption, - } - err2 := mcClient.setReplication(ctx, &cfg, opts) - if err2 != nil { - return err2.Cause - } - - // In case replication rule was deleted successfully, we remove the remote bucket ARN - err3 := deleteRemoteBucket(ctx, admClient, bucketName, ARNs[i]) - if err3 != nil { - return err3 - } - } - return nil -} - -func deleteReplicationRuleResponse(session *models.Principal, params bucketApi.DeleteBucketReplicationRuleParams) *CodedAPIError { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - ctx = context.WithValue(ctx, utils.ContextClientIP, getClientIP(params.HTTPRequest)) - err := deleteReplicationRule(ctx, session, params.BucketName, params.RuleID) - if err != nil { - return ErrorWithContext(ctx, err) - } - return nil -} - -func deleteBucketReplicationRulesResponse(session *models.Principal, params bucketApi.DeleteAllReplicationRulesParams) *CodedAPIError { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - ctx = context.WithValue(ctx, utils.ContextClientIP, getClientIP(params.HTTPRequest)) - err := deleteAllReplicationRules(ctx, session, params.BucketName) - if err != nil { - return ErrorWithContext(ctx, err) - } - return nil -} - -func deleteSelectedReplicationRulesResponse(session *models.Principal, params bucketApi.DeleteSelectedReplicationRulesParams) *CodedAPIError { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - - ctx = context.WithValue(ctx, utils.ContextClientIP, getClientIP(params.HTTPRequest)) - - err := deleteSelectedReplicationRules(ctx, session, params.BucketName, params.Rules.Rules) - if err != nil { - return ErrorWithContext(ctx, err) - } - return nil -} - -func updateBucketReplicationResponse(session *models.Principal, params bucketApi.UpdateMultiBucketReplicationParams) *CodedAPIError { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - - mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) - if err != nil { - return ErrorWithContext(ctx, err) - } - // create a minioClient interface implementation - // defining the client to be used - minClient := minioClient{client: mClient} - - err = editBucketReplicationItem( - ctx, - session, - minClient, - params.RuleID, - params.BucketName, - params.Body.Prefix, - params.Body.Arn, - params.Body.RuleState, - params.Body.ReplicateDeleteMarkers, - params.Body.ReplicateDeletes, - params.Body.ReplicateMetadata, - params.Body.ReplicateExistingObjects, - params.Body.Tags, - params.Body.Priority, - params.Body.StorageClass) - if err != nil { - return ErrorWithContext(ctx, err) - } - - return nil -} diff --git a/api/admin_remote_buckets_test.go b/api/admin_remote_buckets_test.go deleted file mode 100644 index ec57fcc744..0000000000 --- a/api/admin_remote_buckets_test.go +++ /dev/null @@ -1,386 +0,0 @@ -// 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 api - -import ( - "context" - "errors" - "net/http" - "net/http/httptest" - "os" - "testing" - - "github.com/minio/console/pkg/utils" - - "github.com/go-openapi/swag" - "github.com/minio/console/api/operations" - bucketApi "github.com/minio/console/api/operations/bucket" - "github.com/minio/console/models" - "github.com/minio/madmin-go/v3" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/suite" -) - -type RemoteBucketsTestSuite struct { - suite.Suite - assert *assert.Assertions - currentServer string - isServerSet bool - server *httptest.Server - adminClient AdminClientMock - minioClient minioClientMock - mockRemoteBucket *models.RemoteBucket - mockBucketTarget *madmin.BucketTarget - mockListBuckets *models.ListBucketsResponse -} - -func (suite *RemoteBucketsTestSuite) SetupSuite() { - suite.assert = assert.New(suite.T()) - suite.adminClient = AdminClientMock{} - suite.minioClient = minioClientMock{} - suite.mockObjects() -} - -func (suite *RemoteBucketsTestSuite) mockObjects() { - suite.mockListBuckets = &models.ListBucketsResponse{ - Buckets: []*models.Bucket{}, - Total: 0, - } - suite.mockRemoteBucket = &models.RemoteBucket{ - AccessKey: swag.String("accessKey"), - SecretKey: "secretKey", - RemoteARN: swag.String("remoteARN"), - Service: "replication", - SourceBucket: swag.String("sourceBucket"), - TargetBucket: "targetBucket", - TargetURL: "targetURL", - Status: "", - } - suite.mockBucketTarget = &madmin.BucketTarget{ - Credentials: &madmin.Credentials{ - AccessKey: *suite.mockRemoteBucket.AccessKey, - SecretKey: suite.mockRemoteBucket.SecretKey, - }, - Arn: *suite.mockRemoteBucket.RemoteARN, - SourceBucket: *suite.mockRemoteBucket.SourceBucket, - TargetBucket: suite.mockRemoteBucket.TargetBucket, - Endpoint: suite.mockRemoteBucket.TargetURL, - } -} - -func (suite *RemoteBucketsTestSuite) SetupTest() { - suite.server = httptest.NewServer(http.HandlerFunc(suite.serverHandler)) - suite.currentServer, suite.isServerSet = os.LookupEnv(ConsoleMinIOServer) - os.Setenv(ConsoleMinIOServer, suite.server.URL) -} - -func (suite *RemoteBucketsTestSuite) serverHandler(w http.ResponseWriter, _ *http.Request) { - w.WriteHeader(400) -} - -func (suite *RemoteBucketsTestSuite) TearDownSuite() { -} - -func (suite *RemoteBucketsTestSuite) TearDownTest() { - if suite.isServerSet { - os.Setenv(ConsoleMinIOServer, suite.currentServer) - } else { - os.Unsetenv(ConsoleMinIOServer) - } -} - -func (suite *RemoteBucketsTestSuite) TestRegisterRemoteBucketsHandlers() { - api := &operations.ConsoleAPI{} - suite.assertHandlersAreNil(api) - registerAdminBucketRemoteHandlers(api) - suite.assertHandlersAreNotNil(api) -} - -func (suite *RemoteBucketsTestSuite) assertHandlersAreNil(api *operations.ConsoleAPI) { - suite.assert.Nil(api.BucketListRemoteBucketsHandler) - suite.assert.Nil(api.BucketRemoteBucketDetailsHandler) - suite.assert.Nil(api.BucketDeleteRemoteBucketHandler) - suite.assert.Nil(api.BucketAddRemoteBucketHandler) - suite.assert.Nil(api.BucketSetMultiBucketReplicationHandler) - suite.assert.Nil(api.BucketListExternalBucketsHandler) - suite.assert.Nil(api.BucketDeleteBucketReplicationRuleHandler) - suite.assert.Nil(api.BucketDeleteAllReplicationRulesHandler) - suite.assert.Nil(api.BucketDeleteSelectedReplicationRulesHandler) - suite.assert.Nil(api.BucketUpdateMultiBucketReplicationHandler) -} - -func (suite *RemoteBucketsTestSuite) assertHandlersAreNotNil(api *operations.ConsoleAPI) { - suite.assert.NotNil(api.BucketListRemoteBucketsHandler) - suite.assert.NotNil(api.BucketRemoteBucketDetailsHandler) - suite.assert.NotNil(api.BucketDeleteRemoteBucketHandler) - suite.assert.NotNil(api.BucketAddRemoteBucketHandler) - suite.assert.NotNil(api.BucketSetMultiBucketReplicationHandler) - suite.assert.NotNil(api.BucketListExternalBucketsHandler) - suite.assert.NotNil(api.BucketDeleteBucketReplicationRuleHandler) - suite.assert.NotNil(api.BucketDeleteAllReplicationRulesHandler) - suite.assert.NotNil(api.BucketDeleteSelectedReplicationRulesHandler) - suite.assert.NotNil(api.BucketUpdateMultiBucketReplicationHandler) -} - -func (suite *RemoteBucketsTestSuite) TestListRemoteBucketsHandlerWithError() { - params, api := suite.initListRemoteBucketsRequest() - response := api.BucketListRemoteBucketsHandler.Handle(params, &models.Principal{}) - _, ok := response.(*bucketApi.ListRemoteBucketsDefault) - suite.assert.True(ok) -} - -func (suite *RemoteBucketsTestSuite) initListRemoteBucketsRequest() (params bucketApi.ListRemoteBucketsParams, api operations.ConsoleAPI) { - registerAdminBucketRemoteHandlers(&api) - params.HTTPRequest = &http.Request{} - return params, api -} - -func (suite *RemoteBucketsTestSuite) TestListRemoteBucketsWithoutError() { - ctx := context.Background() - minioListRemoteBucketsMock = func(_ context.Context, _, _ string) (targets []madmin.BucketTarget, err error) { - return []madmin.BucketTarget{{ - Credentials: &madmin.Credentials{ - AccessKey: "accessKey", - SecretKey: "secretKey", - }, - }}, nil - } - res, err := listRemoteBuckets(ctx, &suite.adminClient) - suite.assert.NotNil(res) - suite.assert.Nil(err) -} - -func (suite *RemoteBucketsTestSuite) TestRemoteBucketDetailsHandlerWithError() { - params, api := suite.initRemoteBucketDetailsRequest() - response := api.BucketRemoteBucketDetailsHandler.Handle(params, &models.Principal{}) - _, ok := response.(*bucketApi.RemoteBucketDetailsDefault) - suite.assert.True(ok) -} - -func (suite *RemoteBucketsTestSuite) initRemoteBucketDetailsRequest() (params bucketApi.RemoteBucketDetailsParams, api operations.ConsoleAPI) { - registerAdminBucketRemoteHandlers(&api) - params.HTTPRequest = &http.Request{} - return params, api -} - -func (suite *RemoteBucketsTestSuite) TestGetRemoteBucketWithoutError() { - ctx := context.Background() - minioGetRemoteBucketMock = func(_ context.Context, _, _ string) (targets *madmin.BucketTarget, err error) { - return suite.mockBucketTarget, nil - } - res, err := getRemoteBucket(ctx, &suite.adminClient, "bucketName") - suite.assert.Nil(err) - suite.assert.NotNil(res) - suite.assert.Equal(suite.mockRemoteBucket, res) -} - -func (suite *RemoteBucketsTestSuite) TestDeleteRemoteBucketHandlerWithError() { - params, api := suite.initDeleteRemoteBucketRequest() - response := api.BucketDeleteRemoteBucketHandler.Handle(params, &models.Principal{}) - _, ok := response.(*bucketApi.DeleteRemoteBucketDefault) - suite.assert.True(ok) -} - -func (suite *RemoteBucketsTestSuite) initDeleteRemoteBucketRequest() (params bucketApi.DeleteRemoteBucketParams, api operations.ConsoleAPI) { - registerAdminBucketRemoteHandlers(&api) - params.HTTPRequest = &http.Request{} - return params, api -} - -func (suite *RemoteBucketsTestSuite) TestAddRemoteBucketHandlerWithError() { - params, api := suite.initAddRemoteBucketRequest() - response := api.BucketAddRemoteBucketHandler.Handle(params, &models.Principal{}) - _, ok := response.(*bucketApi.AddRemoteBucketDefault) - suite.assert.True(ok) -} - -func (suite *RemoteBucketsTestSuite) initAddRemoteBucketRequest() (params bucketApi.AddRemoteBucketParams, api operations.ConsoleAPI) { - registerAdminBucketRemoteHandlers(&api) - url := "^&*&^%^" - accessKey := "accessKey" - secretKey := "secretKey" - params.HTTPRequest = &http.Request{} - params.Body = &models.CreateRemoteBucket{ - TargetURL: &url, - AccessKey: &accessKey, - SecretKey: &secretKey, - } - return params, api -} - -func (suite *RemoteBucketsTestSuite) TestAddRemoteBucketWithoutError() { - ctx := context.Background() - minioAddRemoteBucketMock = func(_ context.Context, _ string, _ *madmin.BucketTarget) (string, error) { - return "bucketName", nil - } - url := "https://localhost" - accessKey := "accessKey" - secretKey := "secretKey" - targetBucket := "targetBucket" - syncMode := "async" - sourceBucket := "sourceBucket" - data := models.CreateRemoteBucket{ - TargetURL: &url, - TargetBucket: &targetBucket, - AccessKey: &accessKey, - SecretKey: &secretKey, - SyncMode: &syncMode, - HealthCheckPeriod: 10, - SourceBucket: &sourceBucket, - } - res, err := addRemoteBucket(ctx, &suite.adminClient, data) - suite.assert.NotNil(res) - suite.assert.Nil(err) -} - -func (suite *RemoteBucketsTestSuite) TestSetMultiBucketReplicationHandlerWithError() { - params, api := suite.initSetMultiBucketReplicationRequest() - response := api.BucketSetMultiBucketReplicationHandler.Handle(params, &models.Principal{}) - _, ok := response.(*bucketApi.SetMultiBucketReplicationOK) - suite.assert.True(ok) -} - -func (suite *RemoteBucketsTestSuite) initSetMultiBucketReplicationRequest() (params bucketApi.SetMultiBucketReplicationParams, api operations.ConsoleAPI) { - registerAdminBucketRemoteHandlers(&api) - accessKey := "accessKey" - secretKey := "secretKey" - targetURL := "https://localhost" - syncMode := "async" - params.HTTPRequest = &http.Request{} - params.Body = &models.MultiBucketReplication{ - BucketsRelation: []*models.MultiBucketsRelation{{}}, - AccessKey: &accessKey, - SecretKey: &secretKey, - Region: "region", - TargetURL: &targetURL, - SyncMode: &syncMode, - Bandwidth: 10, - HealthCheckPeriod: 10, - } - return params, api -} - -func (suite *RemoteBucketsTestSuite) TestListExternalBucketsHandlerWithError() { - params, api := suite.initListExternalBucketsRequest() - response := api.BucketListExternalBucketsHandler.Handle(params, &models.Principal{}) - _, ok := response.(*bucketApi.ListExternalBucketsDefault) - suite.assert.True(ok) -} - -func (suite *RemoteBucketsTestSuite) initListExternalBucketsRequest() (params bucketApi.ListExternalBucketsParams, api operations.ConsoleAPI) { - registerAdminBucketRemoteHandlers(&api) - url := "http://localhost:9000" - accessKey := "accessKey" - secretKey := "secretKey" - tls := false - params.HTTPRequest = &http.Request{} - params.Body = &models.ListExternalBucketsParams{ - TargetURL: &url, - AccessKey: &accessKey, - SecretKey: &secretKey, - UseTLS: &tls, - } - return params, api -} - -func (suite *RemoteBucketsTestSuite) TestListExternalBucketsWithError() { - ctx := context.Background() - minioAccountInfoMock = func(_ context.Context) (madmin.AccountInfo, error) { - return madmin.AccountInfo{}, errors.New("error") - } - res, err := listExternalBuckets(ctx, &suite.adminClient) - suite.assert.NotNil(err) - suite.assert.Nil(res) -} - -func (suite *RemoteBucketsTestSuite) TestListExternalBucketsWithoutError() { - ctx := context.Background() - minioAccountInfoMock = func(_ context.Context) (madmin.AccountInfo, error) { - return madmin.AccountInfo{ - Buckets: []madmin.BucketAccessInfo{}, - }, nil - } - res, err := listExternalBuckets(ctx, &suite.adminClient) - suite.assert.Nil(err) - suite.assert.NotNil(res) - suite.assert.Equal(suite.mockListBuckets, res) -} - -func (suite *RemoteBucketsTestSuite) TestDeleteBucketReplicationRuleHandlerWithError() { - params, api := suite.initDeleteBucketReplicationRuleRequest() - response := api.BucketDeleteBucketReplicationRuleHandler.Handle(params, &models.Principal{}) - _, ok := response.(*bucketApi.DeleteBucketReplicationRuleDefault) - suite.assert.True(ok) -} - -func (suite *RemoteBucketsTestSuite) initDeleteBucketReplicationRuleRequest() (params bucketApi.DeleteBucketReplicationRuleParams, api operations.ConsoleAPI) { - registerAdminBucketRemoteHandlers(&api) - params.HTTPRequest = &http.Request{} - return params, api -} - -func (suite *RemoteBucketsTestSuite) TestDeleteAllReplicationRulesHandlerWithError() { - params, api := suite.initDeleteAllReplicationRulesRequest() - response := api.BucketDeleteAllReplicationRulesHandler.Handle(params, &models.Principal{}) - _, ok := response.(*bucketApi.DeleteAllReplicationRulesDefault) - suite.assert.True(ok) -} - -func (suite *RemoteBucketsTestSuite) initDeleteAllReplicationRulesRequest() (params bucketApi.DeleteAllReplicationRulesParams, api operations.ConsoleAPI) { - registerAdminBucketRemoteHandlers(&api) - params.HTTPRequest = &http.Request{} - return params, api -} - -func (suite *RemoteBucketsTestSuite) TestDeleteSelectedReplicationRulesHandlerWithError() { - params, api := suite.initDeleteSelectedReplicationRulesRequest() - response := api.BucketDeleteSelectedReplicationRulesHandler.Handle(params, &models.Principal{}) - _, ok := response.(*bucketApi.DeleteSelectedReplicationRulesDefault) - suite.assert.True(ok) -} - -func (suite *RemoteBucketsTestSuite) initDeleteSelectedReplicationRulesRequest() (params bucketApi.DeleteSelectedReplicationRulesParams, api operations.ConsoleAPI) { - registerAdminBucketRemoteHandlers(&api) - params.HTTPRequest = &http.Request{} - params.BucketName = "bucketName" - params.Rules = &models.BucketReplicationRuleList{ - Rules: []string{"rule1", "rule2"}, - } - - return params, api -} - -func (suite *RemoteBucketsTestSuite) TestUpdateMultiBucketReplicationHandlerWithError() { - params, api := suite.initUpdateMultiBucketReplicationRequest() - response := api.BucketUpdateMultiBucketReplicationHandler.Handle(params, &models.Principal{}) - _, ok := response.(*bucketApi.UpdateMultiBucketReplicationDefault) - suite.assert.True(ok) -} - -func (suite *RemoteBucketsTestSuite) initUpdateMultiBucketReplicationRequest() (params bucketApi.UpdateMultiBucketReplicationParams, api operations.ConsoleAPI) { - registerAdminBucketRemoteHandlers(&api) - r := &http.Request{} - ctx := context.WithValue(context.Background(), utils.ContextClientIP, "127.0.0.1") - rc := r.WithContext(ctx) - params.HTTPRequest = rc - params.Body = &models.MultiBucketReplicationEdit{} - return params, api -} - -func TestRemoteBuckets(t *testing.T) { - suite.Run(t, new(RemoteBucketsTestSuite)) -} diff --git a/api/admin_service.go b/api/admin_service.go deleted file mode 100644 index 93a7daeb87..0000000000 --- a/api/admin_service.go +++ /dev/null @@ -1,77 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 api - -import ( - "context" - "time" - - "github.com/go-openapi/runtime/middleware" - "github.com/minio/console/api/operations" - "github.com/minio/console/models" - - svcApi "github.com/minio/console/api/operations/service" -) - -func registerServiceHandlers(api *operations.ConsoleAPI) { - // Restart Service - api.ServiceRestartServiceHandler = svcApi.RestartServiceHandlerFunc(func(params svcApi.RestartServiceParams, session *models.Principal) middleware.Responder { - if err := getRestartServiceResponse(session, params); err != nil { - return svcApi.NewRestartServiceDefault(err.Code).WithPayload(err.APIError) - } - return svcApi.NewRestartServiceNoContent() - }) -} - -// serviceRestart - restarts the MinIO cluster -func serviceRestart(ctx context.Context, client MinioAdmin) error { - if err := client.serviceRestart(ctx); err != nil { - return err - } - // copy behavior from minio/mc mainAdminServiceRestart() - // - // Max. time taken by the server to shutdown is 5 seconds. - // This can happen when there are lot of s3 requests pending when the server - // receives a restart command. - // Sleep for 6 seconds and then check if the server is online. - time.Sleep(6 * time.Second) - - // Fetch the service status of the specified MinIO server - _, err := client.serverInfo(ctx) - if err != nil { - return err - } - return nil -} - -// getRestartServiceResponse performs serviceRestart() -func getRestartServiceResponse(session *models.Principal, params svcApi.RestartServiceParams) *CodedAPIError { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return ErrorWithContext(ctx, err) - } - // create a MinIO Admin Client interface implementation - // defining the client to be used - adminClient := AdminClient{Client: mAdmin} - - if err := serviceRestart(ctx, adminClient); err != nil { - return ErrorWithContext(ctx, err) - } - return nil -} diff --git a/api/admin_service_test.go b/api/admin_service_test.go deleted file mode 100644 index 97d1200a5f..0000000000 --- a/api/admin_service_test.go +++ /dev/null @@ -1,68 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 api - -import ( - "context" - "errors" - "testing" - - "github.com/minio/madmin-go/v3" - "github.com/stretchr/testify/assert" -) - -func TestServiceRestart(t *testing.T) { - assert := assert.New(t) - adminClient := AdminClientMock{} - ctx := context.Background() - function := "serviceRestart()" - // Test-1 : serviceRestart() restart services no errors - // mock function response from listGroups() - minioServiceRestartMock = func(_ context.Context) error { - return nil - } - MinioServerInfoMock = func(_ context.Context) (madmin.InfoMessage, error) { - return madmin.InfoMessage{}, nil - } - if err := serviceRestart(ctx, adminClient); err != nil { - t.Errorf("Failed on %s:, errors occurred: %s", function, err.Error()) - } - - // Test-2 : serviceRestart() returns errors on client.serviceRestart call - // and see that the errors is handled correctly and returned - minioServiceRestartMock = func(_ context.Context) error { - return errors.New("error") - } - MinioServerInfoMock = func(_ context.Context) (madmin.InfoMessage, error) { - return madmin.InfoMessage{}, nil - } - if err := serviceRestart(ctx, adminClient); assert.Error(err) { - assert.Equal("error", err.Error()) - } - - // Test-3 : serviceRestart() returns errors on client.serverInfo() call - // and see that the errors is handled correctly and returned - minioServiceRestartMock = func(_ context.Context) error { - return nil - } - MinioServerInfoMock = func(_ context.Context) (madmin.InfoMessage, error) { - return madmin.InfoMessage{}, errors.New("error on server info") - } - if err := serviceRestart(ctx, adminClient); assert.Error(err) { - assert.Equal("error on server info", err.Error()) - } -} diff --git a/api/admin_users.go b/api/admin_users.go deleted file mode 100644 index b37296a111..0000000000 --- a/api/admin_users.go +++ /dev/null @@ -1,722 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 api - -import ( - "context" - "fmt" - "sort" - "strings" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime/middleware" - "github.com/minio/console/api/operations" - accountApi "github.com/minio/console/api/operations/account" - bucketApi "github.com/minio/console/api/operations/bucket" - userApi "github.com/minio/console/api/operations/user" - "github.com/minio/console/models" - "github.com/minio/madmin-go/v3" - iampolicy "github.com/minio/pkg/v3/policy" -) - -// Policy evaluated constants -const ( - Unknown = 0 - Allow = 1 - Deny = -1 -) - -func registerUsersHandlers(api *operations.ConsoleAPI) { - // List Users - api.UserListUsersHandler = userApi.ListUsersHandlerFunc(func(params userApi.ListUsersParams, session *models.Principal) middleware.Responder { - listUsersResponse, err := getListUsersResponse(session, params) - if err != nil { - return userApi.NewListUsersDefault(err.Code).WithPayload(err.APIError) - } - return userApi.NewListUsersOK().WithPayload(listUsersResponse) - }) - // Add User - api.UserAddUserHandler = userApi.AddUserHandlerFunc(func(params userApi.AddUserParams, session *models.Principal) middleware.Responder { - userResponse, err := getUserAddResponse(session, params) - if err != nil { - return userApi.NewAddUserDefault(err.Code).WithPayload(err.APIError) - } - return userApi.NewAddUserCreated().WithPayload(userResponse) - }) - // Remove User - api.UserRemoveUserHandler = userApi.RemoveUserHandlerFunc(func(params userApi.RemoveUserParams, session *models.Principal) middleware.Responder { - err := getRemoveUserResponse(session, params) - if err != nil { - return userApi.NewRemoveUserDefault(err.Code).WithPayload(err.APIError) - } - return userApi.NewRemoveUserNoContent() - }) - // Update User-Groups - api.UserUpdateUserGroupsHandler = userApi.UpdateUserGroupsHandlerFunc(func(params userApi.UpdateUserGroupsParams, session *models.Principal) middleware.Responder { - userUpdateResponse, err := getUpdateUserGroupsResponse(session, params) - if err != nil { - return userApi.NewUpdateUserGroupsDefault(err.Code).WithPayload(err.APIError) - } - - return userApi.NewUpdateUserGroupsOK().WithPayload(userUpdateResponse) - }) - // Get User - api.UserGetUserInfoHandler = userApi.GetUserInfoHandlerFunc(func(params userApi.GetUserInfoParams, session *models.Principal) middleware.Responder { - userInfoResponse, err := getUserInfoResponse(session, params) - if err != nil { - return userApi.NewGetUserInfoDefault(err.Code).WithPayload(err.APIError) - } - - return userApi.NewGetUserInfoOK().WithPayload(userInfoResponse) - }) - // Update User - api.UserUpdateUserInfoHandler = userApi.UpdateUserInfoHandlerFunc(func(params userApi.UpdateUserInfoParams, session *models.Principal) middleware.Responder { - userUpdateResponse, err := getUpdateUserResponse(session, params) - if err != nil { - return userApi.NewUpdateUserInfoDefault(err.Code).WithPayload(err.APIError) - } - - return userApi.NewUpdateUserInfoOK().WithPayload(userUpdateResponse) - }) - // Update User-Groups Bulk - api.UserBulkUpdateUsersGroupsHandler = userApi.BulkUpdateUsersGroupsHandlerFunc(func(params userApi.BulkUpdateUsersGroupsParams, session *models.Principal) middleware.Responder { - err := getAddUsersListToGroupsResponse(session, params) - if err != nil { - return userApi.NewBulkUpdateUsersGroupsDefault(err.Code).WithPayload(err.APIError) - } - - return userApi.NewBulkUpdateUsersGroupsOK() - }) - api.BucketListUsersWithAccessToBucketHandler = bucketApi.ListUsersWithAccessToBucketHandlerFunc(func(params bucketApi.ListUsersWithAccessToBucketParams, session *models.Principal) middleware.Responder { - response, err := getListUsersWithAccessToBucketResponse(session, params) - if err != nil { - return bucketApi.NewListUsersWithAccessToBucketDefault(err.Code).WithPayload(err.APIError) - } - return bucketApi.NewListUsersWithAccessToBucketOK().WithPayload(response) - }) - // Change User Password - api.AccountChangeUserPasswordHandler = accountApi.ChangeUserPasswordHandlerFunc(func(params accountApi.ChangeUserPasswordParams, session *models.Principal) middleware.Responder { - err := getChangeUserPasswordResponse(session, params) - if err != nil { - return accountApi.NewChangeUserPasswordDefault(err.Code).WithPayload(err.APIError) - } - return accountApi.NewChangeUserPasswordCreated() - }) - // Check number of Service Accounts for listed users - api.UserCheckUserServiceAccountsHandler = userApi.CheckUserServiceAccountsHandlerFunc(func(params userApi.CheckUserServiceAccountsParams, session *models.Principal) middleware.Responder { - userSAList, err := getCheckUserSAResponse(session, params) - if err != nil { - return userApi.NewCheckUserServiceAccountsDefault(err.Code).WithPayload(err.APIError) - } - return userApi.NewCheckUserServiceAccountsOK().WithPayload(userSAList) - }) -} - -func listUsers(ctx context.Context, client MinioAdmin) ([]*models.User, error) { - // Get list of all users in the MinIO - // This call requires explicit authentication, no anonymous requests are - // allowed for listing users. - userMap, err := client.listUsers(ctx) - if err != nil { - return []*models.User{}, err - } - - var users []*models.User - for accessKey, user := range userMap { - userElem := &models.User{ - AccessKey: accessKey, - Status: string(user.Status), - Policy: strings.Split(user.PolicyName, ","), - MemberOf: user.MemberOf, - } - users = append(users, userElem) - } - - return users, nil -} - -// getListUsersResponse performs listUsers() and serializes it to the handler's output -func getListUsersResponse(session *models.Principal, params userApi.ListUsersParams) (*models.ListUsersResponse, *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) - } - // create a minioClient interface implementation - // defining the client to be used - adminClient := AdminClient{Client: mAdmin} - users, err := listUsers(ctx, adminClient) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - // serialize output - listUsersResponse := &models.ListUsersResponse{ - Users: users, - } - return listUsersResponse, nil -} - -// addUser invokes adding a users on `MinioAdmin` and builds the response `models.User` -func addUser(ctx context.Context, client MinioAdmin, accessKey, secretKey *string, groups []string, policies []string) (*models.User, error) { - // Calls into MinIO to add a new user if there's an errors return it - if err := client.addUser(ctx, *accessKey, *secretKey); err != nil { - return nil, err - } - // set groups for the newly created user - var userWithGroups *models.User - if len(groups) > 0 { - var errUG error - userWithGroups, errUG = updateUserGroups(ctx, client, *accessKey, groups) - - if errUG != nil { - return nil, errUG - } - } - // set policies for the newly created user - if len(policies) > 0 { - policyString := strings.Join(policies, ",") - if err := SetPolicy(ctx, client, policyString, *accessKey, "user"); err != nil { - return nil, err - } - } - - memberOf := []string{} - status := "enabled" - if userWithGroups != nil { - memberOf = userWithGroups.MemberOf - status = userWithGroups.Status - } - - userRet := &models.User{ - AccessKey: *accessKey, - MemberOf: memberOf, - Policy: policies, - Status: status, - } - return userRet, nil -} - -func getUserAddResponse(session *models.Principal, params userApi.AddUserParams) (*models.User, *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) - } - // create a minioClient interface implementation - // defining the client to be used - adminClient := AdminClient{Client: mAdmin} - var userExists bool - - _, err = adminClient.getUserInfo(ctx, *params.Body.AccessKey) - userExists = err == nil - - if userExists { - return nil, ErrorWithContext(ctx, ErrNonUniqueAccessKey) - } - user, err := addUser( - ctx, - adminClient, - params.Body.AccessKey, - params.Body.SecretKey, - params.Body.Groups, - params.Body.Policies, - ) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return user, nil -} - -// removeUser invokes removing an user on `MinioAdmin`, then we return the response from API -func removeUser(ctx context.Context, client MinioAdmin, accessKey string) error { - return client.removeUser(ctx, accessKey) -} - -func getRemoveUserResponse(session *models.Principal, params userApi.RemoveUserParams) *CodedAPIError { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return ErrorWithContext(ctx, err) - } - if session.AccountAccessKey == params.Name { - return ErrorWithContext(ctx, ErrAvoidSelfAccountDelete) - } - // create a minioClient interface implementation - // defining the client to be used - adminClient := AdminClient{Client: mAdmin} - if err := removeUser(ctx, adminClient, params.Name); err != nil { - return ErrorWithContext(ctx, err) - } - return nil -} - -// getUserInfo calls MinIO server get the User Information -func getUserInfo(ctx context.Context, client MinioAdmin, accessKey string) (*madmin.UserInfo, error) { - userInfo, err := client.getUserInfo(ctx, accessKey) - if err != nil { - return nil, err - } - return &userInfo, nil -} - -func getUserInfoResponse(session *models.Principal, params userApi.GetUserInfoParams) (*models.User, *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) - } - - // create a minioClient interface implementation - // defining the client to be used - adminClient := AdminClient{Client: mAdmin} - - user, err := getUserInfo(ctx, adminClient, params.Name) - if err != nil { - // User doesn't exist, return 404 - if madmin.ToErrorResponse(err).Code == "XMinioAdminNoSuchUser" { - errorCode := 404 - errorMessage := "User doesn't exist" - return nil, &CodedAPIError{Code: errorCode, APIError: &models.APIError{Message: errorMessage, DetailedMessage: err.Error()}} - } - return nil, ErrorWithContext(ctx, err) - } - - var policies []string - if user.PolicyName == "" { - policies = []string{} - } else { - policies = strings.Split(user.PolicyName, ",") - } - - hasPolicy := true - - if len(policies) == 0 { - hasPolicy = false - for i := 0; i < len(user.MemberOf); i++ { - group, err := adminClient.getGroupDescription(ctx, user.MemberOf[i]) - if err != nil { - continue - } - if group.Policy != "" { - hasPolicy = true - break - } - } - } - - userInformation := &models.User{ - AccessKey: params.Name, - MemberOf: user.MemberOf, - Policy: policies, - Status: string(user.Status), - HasPolicy: hasPolicy, - } - - return userInformation, nil -} - -// updateUserGroups invokes getUserInfo() to get the old groups from the user, -// then we merge the list with the new groups list to have a shorter iteration between groups and we do a comparison between the current and old groups. -// We delete or update the groups according the location in each list and send the user with the new groups from `MinioAdmin` to the client -func updateUserGroups(ctx context.Context, client MinioAdmin, user string, groupsToAssign []string) (*models.User, error) { - parallelUserUpdate := func(groupName string, originGroups []string) chan error { - chProcess := make(chan error) - - go func() error { - defer close(chProcess) - - // Compare if groupName is in the arrays - isGroupPersistent := IsElementInArray(groupsToAssign, groupName) - isInOriginGroups := IsElementInArray(originGroups, groupName) - - if isGroupPersistent && isInOriginGroups { // Group is already assigned and doesn't need to be updated - chProcess <- nil - - return nil - } - - isRemove := false // User is added by default - - // User is deleted from the group - if !isGroupPersistent { - isRemove = true - } - - userToAddRemove := []string{user} - - updateReturn := updateGroupMembers(ctx, client, groupName, userToAddRemove, isRemove) - - chProcess <- updateReturn - - return updateReturn - }() - - return chProcess - } - - userInfoOr, err := getUserInfo(ctx, client, user) - if err != nil { - return nil, err - } - - memberOf := userInfoOr.MemberOf - mergedGroupArray := UniqueKeys(append(memberOf, groupsToAssign...)) - - var listOfUpdates []chan error - - // Each group must be updated individually because there is no way to update all the groups at once for a user, - // we are using the same logic as 'mc admin group add' command - for _, groupN := range mergedGroupArray { - proc := parallelUserUpdate(groupN, memberOf) - listOfUpdates = append(listOfUpdates, proc) - } - - channelHasError := false - - for _, chanRet := range listOfUpdates { - locError := <-chanRet - - if locError != nil { - channelHasError = true - } - } - - if channelHasError { - errRt := errors.New(500, "there was an error updating the groups") - return nil, errRt - } - - userInfo, err := getUserInfo(ctx, client, user) - if err != nil { - return nil, err - } - - policies := strings.Split(userInfo.PolicyName, ",") - - userReturn := &models.User{ - AccessKey: user, - MemberOf: userInfo.MemberOf, - Policy: policies, - Status: string(userInfo.Status), - } - - return userReturn, nil -} - -func getUpdateUserGroupsResponse(session *models.Principal, params userApi.UpdateUserGroupsParams) (*models.User, *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) - } - - // create a minioClient interface implementation - // defining the client to be used - adminClient := AdminClient{Client: mAdmin} - - user, err := updateUserGroups(ctx, adminClient, params.Name, params.Body.Groups) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - - return user, nil -} - -// setUserStatus invokes setUserStatus from madmin to update user status -func setUserStatus(ctx context.Context, client MinioAdmin, user string, status string) error { - var setStatus madmin.AccountStatus - switch status { - case "enabled": - setStatus = madmin.AccountEnabled - case "disabled": - setStatus = madmin.AccountDisabled - default: - return errors.New(500, "status not valid") - } - - return client.setUserStatus(ctx, user, setStatus) -} - -func getUpdateUserResponse(session *models.Principal, params userApi.UpdateUserInfoParams) (*models.User, *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) - } - - // create a minioClient interface implementation - // defining the client to be used - adminClient := AdminClient{Client: mAdmin} - status := *params.Body.Status - groups := params.Body.Groups - - if err := setUserStatus(ctx, adminClient, params.Name, status); err != nil { - return nil, ErrorWithContext(ctx, err) - } - - userElem, errUG := updateUserGroups(ctx, adminClient, params.Name, groups) - - if errUG != nil { - return nil, ErrorWithContext(ctx, errUG) - } - return userElem, nil -} - -// addUsersListToGroups iterates over the user list & assigns the requested groups to each user. -func addUsersListToGroups(ctx context.Context, client MinioAdmin, usersToUpdate []string, groupsToAssign []string) error { - // We update each group with the complete usersList - parallelGroupsUpdate := func(groupToAssign string) chan error { - groupProcess := make(chan error) - - go func() { - defer close(groupProcess) - // We add the users array to the group. - err := updateGroupMembers(ctx, client, groupToAssign, usersToUpdate, false) - - groupProcess <- err - }() - return groupProcess - } - - var groupsUpdateList []chan error - - // We get each group name & add users accordingly - for _, groupName := range groupsToAssign { - // We update the group - proc := parallelGroupsUpdate(groupName) - groupsUpdateList = append(groupsUpdateList, proc) - } - - errorsList := []string{} // We get the errors list because we want to have all errors at once. - for _, err := range groupsUpdateList { - errorFromUpdate := <-err // We store the errors to avoid Data Race - if errorFromUpdate != nil { - // If there is an errors, we store the errors strings so we can join them after we receive all errors - errorsList = append(errorsList, errorFromUpdate.Error()) // We wait until all the channels have been closed. - } - } - - // If there are errors, we throw the final errors with the errors inside - if len(errorsList) > 0 { - errGen := fmt.Errorf("error in users-groups assignation: %q", strings.Join(errorsList, ",")) - return errGen - } - - return nil -} - -func getAddUsersListToGroupsResponse(session *models.Principal, params userApi.BulkUpdateUsersGroupsParams) *CodedAPIError { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - - mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return ErrorWithContext(ctx, err) - } - - // create a minioClient interface implementation - // defining the client to be used - adminClient := AdminClient{Client: mAdmin} - - usersList := params.Body.Users - groupsList := params.Body.Groups - - if err := addUsersListToGroups(ctx, adminClient, usersList, groupsList); err != nil { - return ErrorWithContext(ctx, err) - } - - return nil -} - -func getListUsersWithAccessToBucketResponse(session *models.Principal, params bucketApi.ListUsersWithAccessToBucketParams) ([]string, *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) - } - // create a minioClient interface implementation - // defining the client to be used - adminClient := AdminClient{Client: mAdmin} - list, err := listUsersWithAccessToBucket(ctx, adminClient, params.Bucket) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return list, nil -} - -func policyAllowsAndMatchesBucket(policy *iampolicy.Policy, bucket string) int { - policyStatements := policy.Statements - for i := 0; i < len(policyStatements); i++ { - resources := policyStatements[i].Resources - effect := policyStatements[i].Effect - if resources.Match(bucket, map[string][]string{}) { - if effect.IsValid() { - if effect.IsAllowed(true) { - return Allow - } - return Deny - } - } - } - return Unknown -} - -func listUsersWithAccessToBucket(ctx context.Context, adminClient MinioAdmin, bucket string) ([]string, error) { - users, err := adminClient.listUsers(ctx) - if err != nil { - return nil, err - } - var retval []string - akHasAccess := make(map[string]struct{}) - akIsDenied := make(map[string]struct{}) - for k, v := range users { - for _, policyName := range strings.Split(v.PolicyName, ",") { - policyName = strings.TrimSpace(policyName) - if policyName == "" { - continue - } - policy, err := adminClient.getPolicy(ctx, policyName) - if err != nil { - ErrorWithContext(ctx, fmt.Errorf("unable to fetch policy %s: %v", policyName, err)) - continue - } - if _, ok := akIsDenied[k]; !ok { - switch policyAllowsAndMatchesBucket(policy, bucket) { - case Allow: - if _, ok := akHasAccess[k]; !ok { - akHasAccess[k] = struct{}{} - } - case Deny: - akIsDenied[k] = struct{}{} - delete(akHasAccess, k) - } - } - } - } - - groups, err := adminClient.listGroups(ctx) - if err != nil { - ErrorWithContext(ctx, fmt.Errorf("unable to list groups: %v", err)) - return retval, nil - } - - for _, groupName := range groups { - info, err := groupInfo(ctx, adminClient, groupName) - if err != nil { - ErrorWithContext(ctx, fmt.Errorf("unable to fetch group info %s: %v", groupName, err)) - continue - } - policy, err := adminClient.getPolicy(ctx, info.Policy) - if err != nil { - ErrorWithContext(ctx, fmt.Errorf("unable to fetch group policy %s: %v", info.Policy, err)) - continue - } - for _, member := range info.Members { - if _, ok := akIsDenied[member]; !ok { - switch policyAllowsAndMatchesBucket(policy, bucket) { - case Allow: - if _, ok := akHasAccess[member]; !ok { - akHasAccess[member] = struct{}{} - } - case Deny: - akIsDenied[member] = struct{}{} - delete(akHasAccess, member) - } - } - } - } - for k := range akHasAccess { - retval = append(retval, k) - } - sort.Strings(retval) - return retval, nil -} - -// changeUserPassword changes password of selectedUser to newSecretKey -func changeUserPassword(ctx context.Context, client MinioAdmin, selectedUser string, newSecretKey string) error { - return client.changePassword(ctx, selectedUser, newSecretKey) -} - -// getChangeUserPasswordResponse will change the password of selctedUser to newSecretKey -func getChangeUserPasswordResponse(session *models.Principal, params accountApi.ChangeUserPasswordParams) *CodedAPIError { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return ErrorWithContext(ctx, err) - } - // create a minioClient interface implementation - // defining the client to be used - adminClient := AdminClient{Client: mAdmin} - - // params will contain selectedUser and newSecretKey credentials for the user - user := *params.Body.SelectedUser - newSecretKey := *params.Body.NewSecretKey - - // changes password of user to newSecretKey - if err := changeUserPassword(ctx, adminClient, user, newSecretKey); err != nil { - return ErrorWithContext(ctx, err) - } - return nil -} - -func getCheckUserSAResponse(session *models.Principal, params userApi.CheckUserServiceAccountsParams) (*models.UserServiceAccountSummary, *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) - } - // create a minioClient interface implementation - // defining the client to be used - adminClient := AdminClient{Client: mAdmin} - - var userServiceAccountList []*models.UserServiceAccountItem - hasSA := false - for _, user := range params.SelectedUsers { - listServAccs, err := adminClient.listServiceAccounts(ctx, user) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - numSAs := int64(len(listServAccs.Accounts)) - if numSAs > 0 { - hasSA = true - } - userAccountItem := &models.UserServiceAccountItem{ - UserName: user, - NumSAs: numSAs, - } - userServiceAccountList = append(userServiceAccountList, userAccountItem) - } - - userAccountList := &models.UserServiceAccountSummary{ - UserServiceAccountList: userServiceAccountList, - HasSA: hasSA, - } - - return userAccountList, nil -} diff --git a/api/admin_users_test.go b/api/admin_users_test.go deleted file mode 100644 index 1dc5e33032..0000000000 --- a/api/admin_users_test.go +++ /dev/null @@ -1,535 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 api - -import ( - "bytes" - "context" - "errors" - "fmt" - "strings" - "testing" - - "github.com/minio/madmin-go/v3" - iampolicy "github.com/minio/pkg/v3/policy" - asrt "github.com/stretchr/testify/assert" -) - -func TestListUsers(t *testing.T) { - assert := asrt.New(t) - adminClient := AdminClientMock{} - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - // Test-1 : listUsers() Get response from minio client with two users and return the same number on listUsers() - // mock minIO client - mockUserMap := map[string]madmin.UserInfo{ - "ABCDEFGHI": { - SecretKey: "", - PolicyName: "ABCDEFGHI-policy", - Status: "enabled", - MemberOf: []string{"group1", "group2"}, - }, - "ZBCDEFGHI": { - SecretKey: "", - PolicyName: "ZBCDEFGHI-policy", - Status: "enabled", - MemberOf: []string{"group1", "group2"}, - }, - } - - // mock function response from listUsersWithContext(ctx) - minioListUsersMock = func() (map[string]madmin.UserInfo, error) { - return mockUserMap, nil - } - - // get list users response this response should have Name, CreationDate, Size and Access - // as part of of each user - function := "listUsers()" - userMap, err := listUsers(ctx, adminClient) - if err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - // verify length of users is correct - assert.Equal(len(mockUserMap), len(userMap), fmt.Sprintf("Failed on %s: length of user's lists is not the same", function)) - - for _, b := range userMap { - assert.Contains(mockUserMap, b.AccessKey) - assert.Equal(string(mockUserMap[b.AccessKey].Status), b.Status) - assert.Equal(mockUserMap[b.AccessKey].PolicyName, strings.Join(b.Policy, ",")) - assert.ElementsMatch(mockUserMap[b.AccessKey].MemberOf, []string{"group1", "group2"}) - } - - // Test-2 : listUsers() Return and see that the error is handled correctly and returned - minioListUsersMock = func() (map[string]madmin.UserInfo, error) { - return nil, errors.New("error") - } - _, err = listUsers(ctx, adminClient) - if assert.Error(err) { - assert.Equal("error", err.Error()) - } -} - -func TestAddUser(t *testing.T) { - assert := asrt.New(t) - adminClient := AdminClientMock{} - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - // Test-1: valid case of adding a user with a proper access key - accessKey := "ABCDEFGHI" - secretKey := "ABCDEFGHIABCDEFGHI" - groups := []string{"group1", "group2", "group3"} - policies := []string{} - emptyGroupTest := []string{} - mockResponse := &madmin.UserInfo{ - MemberOf: []string{"group1", "group2", "gropup3"}, - PolicyName: "", - Status: "enabled", - SecretKey: "", - } - - // mock function response from addUser() return no error - minioAddUserMock = func(_, _ string) error { - return nil - } - - minioGetUserInfoMock = func(_ string) (madmin.UserInfo, error) { - return *mockResponse, nil - } - - minioUpdateGroupMembersMock = func(_ madmin.GroupAddRemove) error { - return nil - } - // Test-1: Add a user - function := "addUser()" - user, err := addUser(ctx, adminClient, &accessKey, &secretKey, groups, policies) - if err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - // no error should have been returned - assert.Nil(err, "Error is not null") - // the same access key should be in the model users - assert.Equal(user.AccessKey, accessKey) - - // Test-2 Add a user with empty groups list - user, err = addUser(ctx, adminClient, &accessKey, &secretKey, emptyGroupTest, policies) - // no error should have been returned - assert.Nil(err, "Error is not null") - // the same access key should be in the model users - assert.Equal(user.AccessKey, accessKey) - - // Test-3: valid case - accessKey = "AB" - secretKey = "ABCDEFGHIABCDEFGHI" - // mock function response from addUser() return no error - minioAddUserMock = func(_, _ string) error { - return errors.New("error") - } - - user, err = addUser(ctx, adminClient, &accessKey, &secretKey, groups, policies) - - // no error should have been returned - assert.Nil(user, "User is not null") - assert.NotNil(err, "An error should have been returned") - - if assert.Error(err) { - assert.Equal("error", err.Error()) - } - - // Test-4: add groups function returns an error - minioUpdateGroupMembersMock = func(_ madmin.GroupAddRemove) error { - return errors.New("error") - } - - user, err = addUser(ctx, adminClient, &accessKey, &secretKey, groups, policies) - - // no error should have been returned - assert.Nil(user, "User is not null") - assert.NotNil(err, "An error should have been returned") - - if assert.Error(err) { - assert.Equal("error", err.Error()) - } -} - -func TestRemoveUser(t *testing.T) { - assert := asrt.New(t) - // mock minIO client - adminClient := AdminClientMock{} - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - function := "removeUser()" - - // Test-1: removeUser() delete a user - // mock function response from removeUser(accessKey) - minioRemoveUserMock = func(_ string) error { - return nil - } - - if err := removeUser(ctx, adminClient, "ABCDEFGHI"); err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - - // Test-2: removeUser() make sure errors are handled correctly when error on DeleteUser() - // mock function response from removeUser(accessKey) - minioRemoveUserMock = func(_ string) error { - return errors.New("error") - } - - if err := removeUser(ctx, adminClient, "notexistentuser"); assert.Error(err) { - assert.Equal("error", err.Error()) - } -} - -func TestUserGroups(t *testing.T) { - assert := asrt.New(t) - // mock minIO client - adminClient := AdminClientMock{} - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - function := "updateUserGroups()" - mockUserGroups := []string{"group1", "group2", "group3"} - mockUserName := "testUser" - mockResponse := &madmin.UserInfo{ - MemberOf: []string{"group1", "group2", "gropup3"}, - PolicyName: "", - Status: "enabled", - SecretKey: mockUserName, - } - mockEmptyResponse := &madmin.UserInfo{ - MemberOf: nil, - PolicyName: "", - Status: "", - SecretKey: "", - } - - // Test-1: updateUserGroups() updates the groups for a user - // mock function response from updateUserGroups(accessKey, groupsToAssign) - - minioGetUserInfoMock = func(_ string) (madmin.UserInfo, error) { - return *mockResponse, nil - } - - minioUpdateGroupMembersMock = func(_ madmin.GroupAddRemove) error { - return nil - } - - if _, err := updateUserGroups(ctx, adminClient, mockUserName, mockUserGroups); err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - - // Test-2: updateUserGroups() make sure errors are handled correctly when error on UpdateGroupMembersMock() - // mock function response from removeUser(accessKey) - - minioUpdateGroupMembersMock = func(_ madmin.GroupAddRemove) error { - return errors.New("error") - } - - if _, err := updateUserGroups(ctx, adminClient, mockUserName, mockUserGroups); assert.Error(err) { - assert.Equal("there was an error updating the groups", err.Error()) - } - - // Test-3: updateUserGroups() make sure we return the correct error when getUserInfo returns error - minioGetUserInfoMock = func(_ string) (madmin.UserInfo, error) { - return *mockEmptyResponse, errors.New("error getting user ") - } - - minioUpdateGroupMembersMock = func(_ madmin.GroupAddRemove) error { - return nil - } - - if _, err := updateUserGroups(ctx, adminClient, mockUserName, mockUserGroups); assert.Error(err) { - assert.Equal("error getting user ", err.Error()) - } -} - -func TestGetUserInfo(t *testing.T) { - assert := asrt.New(t) - adminClient := AdminClientMock{} - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - // Test-1 : getUserInfo() get user info - userName := "userNameTest" - mockResponse := &madmin.UserInfo{ - SecretKey: userName, - PolicyName: "", - MemberOf: []string{"group1", "group2", "group3"}, - Status: "enabled", - } - emptyMockResponse := &madmin.UserInfo{ - SecretKey: "", - PolicyName: "", - Status: "", - MemberOf: nil, - } - - // mock function response from getUserInfo() - minioGetUserInfoMock = func(_ string) (madmin.UserInfo, error) { - return *mockResponse, nil - } - function := "getUserInfo()" - info, err := getUserInfo(ctx, adminClient, userName) - if err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - - assert.Equal(userName, info.SecretKey) - assert.Equal("", info.PolicyName) - assert.ElementsMatch([]string{"group1", "group2", "group3"}, info.MemberOf) - assert.Equal(mockResponse.Status, info.Status) - - // Test-2 : getUserInfo() Return error and see that the error is handled correctly and returned - minioGetUserInfoMock = func(_ string) (madmin.UserInfo, error) { - return *emptyMockResponse, errors.New("error") - } - _, err = getUserInfo(ctx, adminClient, userName) - if assert.Error(err) { - assert.Equal("error", err.Error()) - } -} - -func TestSetUserStatus(t *testing.T) { - assert := asrt.New(t) - adminClient := AdminClientMock{} - function := "setUserStatus()" - userName := "userName123" - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - // Test-1: setUserStatus() update valid disabled status - expectedStatus := "disabled" - minioSetUserStatusMock = func(_ string, _ madmin.AccountStatus) error { - return nil - } - if err := setUserStatus(ctx, adminClient, userName, expectedStatus); err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - // Test-2: setUserStatus() update valid enabled status - expectedStatus = "enabled" - minioSetUserStatusMock = func(_ string, _ madmin.AccountStatus) error { - return nil - } - if err := setUserStatus(ctx, adminClient, userName, expectedStatus); err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - // Test-3: setUserStatus() update invalid status, should send error - expectedStatus = "invalid" - minioSetUserStatusMock = func(_ string, _ madmin.AccountStatus) error { - return nil - } - if err := setUserStatus(ctx, adminClient, userName, expectedStatus); assert.Error(err) { - assert.Equal("status not valid", err.Error()) - } - // Test-4: setUserStatus() handler error correctly - expectedStatus = "enabled" - minioSetUserStatusMock = func(_ string, _ madmin.AccountStatus) error { - return errors.New("error") - } - if err := setUserStatus(ctx, adminClient, userName, expectedStatus); assert.Error(err) { - assert.Equal("error", err.Error()) - } -} - -func TestUserGroupsBulk(t *testing.T) { - assert := asrt.New(t) - // mock minIO client - adminClient := AdminClientMock{} - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - function := "updateUserGroups()" - mockUserGroups := []string{"group1", "group2", "group3"} - mockUsers := []string{"testUser", "testUser2"} - - // Test-1: addUsersListToGroups() updates the groups for a users list - // mock function response from updateUserGroups(accessKey, groupsToAssign) - minioUpdateGroupMembersMock = func(_ madmin.GroupAddRemove) error { - return nil - } - - if err := addUsersListToGroups(ctx, adminClient, mockUsers, mockUserGroups); err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - - // Test-2: addUsersListToGroups() make sure errors are handled correctly when error on updateGroupMembers() - // mock function response from removeUser(accessKey) - minioUpdateGroupMembersMock = func(_ madmin.GroupAddRemove) error { - return errors.New("error") - } - - if err := addUsersListToGroups(ctx, adminClient, mockUsers, mockUserGroups); assert.Error(err) { - assert.Equal("error in users-groups assignation: \"error,error,error\"", err.Error()) - } -} - -func TestListUsersWithAccessToBucket(t *testing.T) { - assert := asrt.New(t) - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - adminClient := AdminClientMock{} - user1 := madmin.UserInfo{ - SecretKey: "testtest", - PolicyName: "consoleAdmin,testPolicy,redundantPolicy", - Status: "enabled", - MemberOf: []string{"group1"}, - } - user2 := madmin.UserInfo{ - SecretKey: "testtest", - PolicyName: "testPolicy, otherPolicy", - Status: "enabled", - MemberOf: []string{"group1"}, - } - mockUsers := map[string]madmin.UserInfo{"testuser1": user1, "testuser2": user2} - minioListUsersMock = func() (map[string]madmin.UserInfo, error) { - return mockUsers, nil - } - policyMap := map[string]string{ - "consoleAdmin": `{ - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "admin:*" - ] - }, - { - "Effect": "Allow", - "Action": [ - "s3:*" - ], - "Resource": [ - "arn:aws:s3:::*" - ] - } - ] -}`, - "testPolicy": `{ - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Deny", - "Action": [ - "s3:*" - ], - "Resource": [ - "arn:aws:s3:::bucket1" - ] - } - ] - }`, - "otherPolicy": `{ - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "s3:*" - ], - "Resource": [ - "arn:aws:s3:::bucket2" - ] - } - ] - }`, - "thirdPolicy": `{ - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "s3:*" - ], - "Resource": [ - "arn:aws:s3:::bucket3" - ] - } - ] - }`, "RedundantPolicy": `{ - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "s3:*" - ], - "Resource": [ - "arn:aws:s3:::bucket1" - ] - } - ] - }`, - } - minioGetPolicyMock = func(name string) (*iampolicy.Policy, error) { - iamp, err := iampolicy.ParseConfig(bytes.NewReader([]byte(policyMap[name]))) - if err != nil { - return nil, err - } - return iamp, nil - } - minioListGroupsMock = func() ([]string, error) { - return []string{"group1"}, nil - } - minioGetGroupDescriptionMock = func(name string) (*madmin.GroupDesc, error) { - if name == "group1" { - mockResponse := &madmin.GroupDesc{ - Name: "group1", - Policy: "thirdPolicy", - Members: []string{"testuser1", "testuser2"}, - Status: "enabled", - } - return mockResponse, nil - } - return nil, ErrDefault - } - type args struct { - bucket string - } - tests := []struct { - name string - args args - want []string - }{ - { - name: "Test1", - args: args{bucket: "bucket0"}, - want: []string{"testuser1"}, - }, - { - name: "Test2", - args: args{bucket: "bucket1"}, - want: []string(nil), - }, - { - name: "Test3", - args: args{bucket: "bucket2"}, - want: []string{"testuser1", "testuser2"}, - }, - { - name: "Test4", - args: args{bucket: "bucket3"}, - want: []string{"testuser1", "testuser2"}, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - got, _ := listUsersWithAccessToBucket(ctx, adminClient, tt.args.bucket) - assert.Equal(got, tt.want) - }) - } -} diff --git a/api/client-admin.go b/api/client-admin.go index b757884598..def2acc976 100644 --- a/api/client-admin.go +++ b/api/client-admin.go @@ -364,10 +364,6 @@ func (ac AdminClient) addRemoteBucket(ctx context.Context, bucket string, target return ac.Client.SetRemoteTarget(ctx, bucket, target) } -func (ac AdminClient) setBucketQuota(ctx context.Context, bucket string, quota *madmin.BucketQuota) error { - return ac.Client.SetBucketQuota(ctx, bucket, quota) -} - func (ac AdminClient) getBucketQuota(ctx context.Context, bucket string) (madmin.BucketQuota, error) { return ac.Client.GetBucketQuota(ctx, bucket) } @@ -412,11 +408,6 @@ func (ac AdminClient) addTier(ctx context.Context, cfg *madmin.TierConfig) error return ac.Client.AddTier(ctx, cfg) } -// implements madmin.Inspect() -func (ac AdminClient) inspect(ctx context.Context, insOpts madmin.InspectOptions) ([]byte, io.ReadCloser, error) { - return ac.Client.Inspect(ctx, insOpts) -} - // implements madmin.EditTier() func (ac AdminClient) editTierCreds(ctx context.Context, tierName string, creds madmin.TierCreds) error { return ac.Client.EditTier(ctx, tierName, creds) @@ -459,19 +450,6 @@ func newAdminFromClaims(claims *models.Principal, clientIP string) (*madmin.Admi return adminClient, nil } -// newAdminFromCreds Creates a minio client using custom credentials for connecting to a remote host -func newAdminFromCreds(accessKey, secretKey, endpoint string, tlsEnabled bool) (*madmin.AdminClient, error) { - minioClient, err := madmin.NewWithOptions(endpoint, &madmin.Options{ - Creds: credentials.NewStaticV4(accessKey, secretKey, ""), - Secure: tlsEnabled, - }) - if err != nil { - return nil, err - } - minioClient.SetAppInfo(globalAppName, pkg.Version) - return minioClient, nil -} - // isLocalAddress returns true if the url contains an IPv4/IPv6 hostname // that points to the local machine - FQDN are not supported func isLocalIPEndpoint(endpoint string) bool { diff --git a/api/client.go b/api/client.go index 2ef4667bd9..d4de74baff 100644 --- a/api/client.go +++ b/api/client.go @@ -26,7 +26,6 @@ import ( "strings" "time" - "github.com/minio/minio-go/v7/pkg/replication" "github.com/minio/minio-go/v7/pkg/sse" xnet "github.com/minio/pkg/v3/net" @@ -138,11 +137,6 @@ func (c minioClient) getBucketVersioning(ctx context.Context, bucketName string) return c.client.GetBucketVersioning(ctx, bucketName) } -// implements minio.getBucketVersioning(ctx, bucketName) -func (c minioClient) getBucketReplication(ctx context.Context, bucketName string) (replication.Config, error) { - return c.client.GetBucketReplication(ctx, bucketName) -} - // implements minio.listObjects(ctx) func (c minioClient) listObjects(ctx context.Context, bucket string, opts minio.ListObjectsOptions) <-chan minio.ObjectInfo { return c.client.ListObjects(ctx, bucket, opts) @@ -247,14 +241,6 @@ func (c mcClient) watch(ctx context.Context, options mc.WatchOptions) (*mc.Watch return c.client.Watch(ctx, options) } -func (c mcClient) setReplication(ctx context.Context, cfg *replication.Config, opts replication.Options) *probe.Error { - return c.client.SetReplication(ctx, cfg, opts) -} - -func (c mcClient) deleteAllReplicationRules(ctx context.Context) *probe.Error { - return c.client.RemoveReplication(ctx) -} - func (c mcClient) setVersioning(ctx context.Context, status string, excludePrefix []string, excludeFolders bool) *probe.Error { return c.client.SetVersion(ctx, status, excludePrefix, excludeFolders) } diff --git a/api/config.go b/api/config.go index 0596647bc8..e424416c1e 100644 --- a/api/config.go +++ b/api/config.go @@ -262,18 +262,10 @@ func getPrometheusURL() string { return env.Get(PrometheusURL, "") } -func getPrometheusAuthToken() string { - return env.Get(PrometheusAuthToken, "") -} - func getPrometheusJobID() string { return env.Get(PrometheusJobID, "minio-job") } -func getPrometheusExtraLabels() string { - return env.Get(PrometheusExtraLabels, "") -} - func getMaxConcurrentUploadsLimit() int64 { cu, err := strconv.ParseInt(env.Get(ConsoleMaxConcurrentUploads, "10"), 10, 64) if err != nil { diff --git a/api/configure_console.go b/api/configure_console.go index 4e5eb9aa66..5fe19a2383 100644 --- a/api/configure_console.go +++ b/api/configure_console.go @@ -115,52 +115,13 @@ func configureAPI(api *operations.ConsoleAPI) http.Handler { registerLogoutHandlers(api) // Register bucket handlers registerBucketsHandlers(api) - // Register all users handlers - registerUsersHandlers(api) - // Register groups handlers - registerGroupsHandlers(api) - // Register policies handlers - registersPoliciesHandler(api) - // Register configurations handlers - registerConfigHandlers(api) - // Register bucket events handlers - registerBucketEventsHandlers(api) - // Register service handlers - registerServiceHandlers(api) // Register session handlers registerSessionHandlers(api) - // Register admin info handlers - registerAdminInfoHandlers(api) - // Register admin arns handlers - registerAdminArnsHandlers(api) - // Register admin notification endpoints handlers - registerAdminNotificationEndpointsHandlers(api) - // Register admin Service Account Handlers - registerServiceAccountsHandlers(api) - // Register admin remote buckets - registerAdminBucketRemoteHandlers(api) - // Register admin log search - registerLogSearchHandlers(api) - // Register admin KMS handlers - registerKMSHandlers(api) - // Register admin IDP handlers - registerIDPHandlers(api) - // Register Inspect Handler - registerInspectHandler(api) - // Register nodes handlers - registerNodesHandler(api) - - // Operator Console - // Register Object's Handlers registerObjectsHandlers(api) // Register Bucket Quota's Handlers registerBucketQuotaHandlers(api) - // Register Account handlers - registerAccountHandlers(api) - - registerReleasesHandlers(api) - + // Register Bucket Policy's Handlers registerPublicObjectsHandlers(api) api.PreServerShutdown = func() {} diff --git a/api/embedded_spec.go b/api/embedded_spec.go index cfb4ec9cbb..b0641e6268 100644 --- a/api/embedded_spec.go +++ b/api/embedded_spec.go @@ -52,26 +52,27 @@ func init() { }, "basePath": "/api/v1", "paths": { - "/account/change-password": { - "post": { + "/admin/info": { + "get": { "tags": [ - "Account" + "System" ], - "summary": "Change password of currently logged in user.", - "operationId": "AccountChangePassword", + "summary": "Returns information about the deployment", + "operationId": "AdminInfo", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/accountChangePasswordRequest" - } + "type": "boolean", + "default": false, + "name": "defaultOnly", + "in": "query" } ], "responses": { - "204": { - "description": "A successful login." + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/adminInfoResponse" + } }, "default": { "description": "Generic error response.", @@ -82,26 +83,50 @@ func init() { } } }, - "/account/change-user-password": { + "/buckets": { + "get": { + "tags": [ + "Bucket" + ], + "summary": "List Buckets", + "operationId": "ListBuckets", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/listBucketsResponse" + } + }, + "default": { + "description": "Generic error response.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + } + }, "post": { "tags": [ - "Account" + "Bucket" ], - "summary": "Change password of currently logged in user.", - "operationId": "ChangeUserPassword", + "summary": "Make bucket", + "operationId": "MakeBucket", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/changeUserPasswordRequest" + "$ref": "#/definitions/makeBucketRequest" } } ], "responses": { - "201": { - "description": "Password successfully changed." + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/makeBucketsResponse" + } }, "default": { "description": "Generic error response.", @@ -112,18 +137,18 @@ func init() { } } }, - "/admin/arns": { + "/buckets/max-share-exp": { "get": { "tags": [ - "System" + "Bucket" ], - "summary": "Returns a list of active ARNs in the instance", - "operationId": "ArnList", + "summary": "Get max expiration time for share link in seconds", + "operationId": "GetMaxShareLinkExp", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/arnsResponse" + "$ref": "#/definitions/maxShareLinkExpResponse" } }, "default": { @@ -135,27 +160,45 @@ func init() { } } }, - "/admin/info": { - "get": { + "/buckets/{bucket_name}/delete-objects": { + "post": { "tags": [ - "System" + "Object" ], - "summary": "Returns information about the deployment", - "operationId": "AdminInfo", + "summary": "Delete Multiple Objects", + "operationId": "DeleteMultipleObjects", "parameters": [ + { + "type": "string", + "name": "bucket_name", + "in": "path", + "required": true + }, { "type": "boolean", - "default": false, - "name": "defaultOnly", + "name": "all_versions", + "in": "query" + }, + { + "type": "boolean", + "name": "bypass", "in": "query" + }, + { + "name": "files", + "in": "body", + "required": true, + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/deleteFile" + } + } } ], "responses": { "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/adminInfoResponse" - } + "description": "A successful response." }, "default": { "description": "Generic error response.", @@ -166,43 +209,57 @@ func init() { } } }, - "/admin/info/widgets/{widgetId}": { + "/buckets/{bucket_name}/objects": { "get": { + "security": [ + { + "key": [] + }, + { + "anonymous": [] + } + ], "tags": [ - "System" + "Object" ], - "summary": "Returns information about the deployment", - "operationId": "DashboardWidgetDetails", + "summary": "List Objects", + "operationId": "ListObjects", "parameters": [ { - "type": "integer", - "format": "int32", - "name": "widgetId", + "type": "string", + "name": "bucket_name", "in": "path", "required": true }, { - "type": "integer", - "name": "start", + "type": "string", + "name": "prefix", + "in": "query" + }, + { + "type": "boolean", + "name": "recursive", "in": "query" }, { - "type": "integer", - "name": "end", + "type": "boolean", + "name": "with_versions", "in": "query" }, { - "type": "integer", - "format": "int32", - "name": "step", + "type": "boolean", + "name": "with_metadata", "in": "query" + }, + { + "$ref": "#/parameters/limit" } ], "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/widgetDetails" + "$ref": "#/definitions/listObjectsResponse" } }, "default": { @@ -212,43 +269,55 @@ func init() { } } } - } - }, - "/admin/inspect": { - "get": { - "produces": [ - "application/octet-stream" - ], + }, + "delete": { "tags": [ - "Inspect" + "Object" ], - "summary": "Inspect Files on Drive", - "operationId": "Inspect", + "summary": "Delete Object", + "operationId": "DeleteObject", "parameters": [ { "type": "string", - "name": "file", - "in": "query", + "name": "bucket_name", + "in": "path", "required": true }, { "type": "string", - "name": "volume", + "name": "prefix", "in": "query", "required": true }, + { + "type": "string", + "name": "version_id", + "in": "query" + }, + { + "type": "boolean", + "name": "recursive", + "in": "query" + }, + { + "type": "boolean", + "name": "all_versions", + "in": "query" + }, + { + "type": "boolean", + "name": "non_current_versions", + "in": "query" + }, { "type": "boolean", - "name": "encrypt", + "name": "bypass", "in": "query" } ], "responses": { "200": { - "description": "A successful response.", - "schema": { - "type": "file" - } + "description": "A successful response." }, "default": { "description": "Generic error response.", @@ -259,18 +328,60 @@ func init() { } } }, - "/admin/notification_endpoints": { + "/buckets/{bucket_name}/objects/download": { "get": { + "security": [ + { + "key": [] + }, + { + "anonymous": [] + } + ], + "produces": [ + "application/octet-stream" + ], "tags": [ - "Configuration" + "Object" + ], + "summary": "Download Object", + "operationId": "Download Object", + "parameters": [ + { + "type": "string", + "name": "bucket_name", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "prefix", + "in": "query", + "required": true + }, + { + "type": "string", + "name": "version_id", + "in": "query" + }, + { + "type": "boolean", + "default": false, + "name": "preview", + "in": "query" + }, + { + "type": "string", + "default": "", + "name": "override_file_name", + "in": "query" + } ], - "summary": "Returns a list of active notification endpoints", - "operationId": "NotificationEndpointList", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/notifEndpointResponse" + "type": "file" } }, "default": { @@ -280,28 +391,50 @@ func init() { } } } - }, + } + }, + "/buckets/{bucket_name}/objects/download-multiple": { "post": { + "security": [ + { + "key": [] + }, + { + "anonymous": [] + } + ], + "produces": [ + "application/octet-stream" + ], "tags": [ - "Configuration" + "Object" ], - "summary": "Allows to configure a new notification endpoint", - "operationId": "AddNotificationEndpoint", + "summary": "Download Multiple Objects", + "operationId": "DownloadMultipleObjects", "parameters": [ { - "name": "body", + "type": "string", + "name": "bucket_name", + "in": "path", + "required": true + }, + { + "name": "objectList", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/notificationEndpoint" + "type": "array", + "items": { + "type": "string" + } } } ], "responses": { - "201": { + "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/setNotificationEndpointResponse" + "type": "file" } }, "default": { @@ -313,32 +446,37 @@ func init() { } } }, - "/bucket-policy/{bucket}": { + "/buckets/{bucket_name}/objects/metadata": { "get": { "tags": [ - "Bucket" + "Object" ], - "summary": "List Policies With Given Bucket", - "operationId": "ListPoliciesWithBucket", + "summary": "Gets the metadata of an object", + "operationId": "GetObjectMetadata", "parameters": [ { "type": "string", - "name": "bucket", + "name": "bucket_name", "in": "path", "required": true }, { - "$ref": "#/parameters/offset" + "type": "string", + "name": "prefix", + "in": "query", + "required": true }, { - "$ref": "#/parameters/limit" + "type": "string", + "name": "versionID", + "in": "query" } ], "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/listPoliciesResponse" + "$ref": "#/definitions/metadata" } }, "default": { @@ -350,36 +488,36 @@ func init() { } } }, - "/bucket-users/{bucket}": { - "get": { + "/buckets/{bucket_name}/objects/restore": { + "put": { "tags": [ - "Bucket" + "Object" ], - "summary": "List Users With Access to a Given Bucket", - "operationId": "ListUsersWithAccessToBucket", + "summary": "Restore Object to a selected version", + "operationId": "PutObjectRestore", "parameters": [ { "type": "string", - "name": "bucket", + "name": "bucket_name", "in": "path", "required": true }, { - "$ref": "#/parameters/offset" + "type": "string", + "name": "prefix", + "in": "query", + "required": true }, { - "$ref": "#/parameters/limit" + "type": "string", + "name": "version_id", + "in": "query", + "required": true } ], "responses": { "200": { - "description": "A successful response.", - "schema": { - "type": "array", - "items": { - "type": "string" - } - } + "description": "A successful response." }, "default": { "description": "Generic error response.", @@ -390,32 +528,43 @@ func init() { } } }, - "/bucket/{bucket}/access-rules": { + "/buckets/{bucket_name}/objects/share": { "get": { "tags": [ - "Bucket" + "Object" ], - "summary": "List Access Rules With Given Bucket", - "operationId": "ListAccessRulesWithBucket", + "summary": "Shares an Object on a url", + "operationId": "ShareObject", "parameters": [ { "type": "string", - "name": "bucket", + "name": "bucket_name", "in": "path", "required": true }, { - "$ref": "#/parameters/offset" + "type": "string", + "name": "prefix", + "in": "query", + "required": true }, { - "$ref": "#/parameters/limit" + "type": "string", + "name": "version_id", + "in": "query", + "required": true + }, + { + "type": "string", + "name": "expires", + "in": "query" } ], "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/listAccessRulesResponse" + "type": "string" } }, "default": { @@ -425,35 +574,46 @@ func init() { } } } - }, + } + }, + "/buckets/{bucket_name}/objects/tags": { "put": { "tags": [ - "Bucket" + "Object" ], - "summary": "Add Access Rule To Given Bucket", - "operationId": "SetAccessRuleWithBucket", + "summary": "Put Object's tags", + "operationId": "PutObjectTags", "parameters": [ { "type": "string", - "name": "bucket", + "name": "bucket_name", "in": "path", "required": true }, { - "name": "prefixaccess", + "type": "string", + "name": "prefix", + "in": "query", + "required": true + }, + { + "type": "string", + "name": "version_id", + "in": "query", + "required": true + }, + { + "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/prefixAccessPair" + "$ref": "#/definitions/putObjectTagsRequest" } } ], "responses": { "200": { - "description": "A successful response.", - "schema": { - "type": "boolean" - } + "description": "A successful response." }, "default": { "description": "Generic error response.", @@ -462,35 +622,41 @@ func init() { } } } - }, - "delete": { + } + }, + "/buckets/{bucket_name}/objects/upload": { + "post": { + "security": [ + { + "key": [] + }, + { + "anonymous": [] + } + ], + "consumes": [ + "multipart/form-data" + ], "tags": [ - "Bucket" + "Object" ], - "summary": "Delete Access Rule From Given Bucket", - "operationId": "DeleteAccessRuleWithBucket", + "summary": "Uploads an Object.", "parameters": [ { "type": "string", - "name": "bucket", + "name": "bucket_name", "in": "path", "required": true }, { + "type": "string", "name": "prefix", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/prefixWrapper" - } + "in": "query" } ], "responses": { "200": { - "description": "A successful response.", - "schema": { - "type": "boolean" - } + "description": "A successful response." }, "default": { "description": "Generic error response.", @@ -501,18 +667,37 @@ func init() { } } }, - "/buckets": { + "/buckets/{bucket_name}/rewind/{date}": { "get": { "tags": [ "Bucket" ], - "summary": "List Buckets", - "operationId": "ListBuckets", + "summary": "Get objects in a bucket for a rewind date", + "operationId": "GetBucketRewind", + "parameters": [ + { + "type": "string", + "name": "bucket_name", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "date", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "prefix", + "in": "query" + } + ], "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/listBucketsResponse" + "$ref": "#/definitions/rewindResponse" } }, "default": { @@ -522,28 +707,64 @@ func init() { } } } - }, - "post": { + } + }, + "/buckets/{bucket_name}/tags": { + "put": { "tags": [ "Bucket" ], - "summary": "Make bucket", - "operationId": "MakeBucket", + "summary": "Put Bucket's tags", + "operationId": "PutBucketTags", "parameters": [ + { + "type": "string", + "name": "bucket_name", + "in": "path", + "required": true + }, { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/makeBucketRequest" + "$ref": "#/definitions/putBucketTagsRequest" + } + } + ], + "responses": { + "200": { + "description": "A successful response." + }, + "default": { + "description": "Generic error response.", + "schema": { + "$ref": "#/definitions/ApiError" } } + } + } + }, + "/buckets/{bucket_name}/versioning": { + "get": { + "tags": [ + "Bucket" + ], + "summary": "Bucket Versioning", + "operationId": "GetBucketVersioning", + "parameters": [ + { + "type": "string", + "name": "bucket_name", + "in": "path", + "required": true + } ], "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/makeBucketsResponse" + "$ref": "#/definitions/bucketVersioningResponse" } }, "default": { @@ -553,31 +774,32 @@ func init() { } } } - } - }, - "/buckets-replication": { - "post": { + }, + "put": { "tags": [ "Bucket" ], - "summary": "Sets Multi Bucket Replication in multiple Buckets", - "operationId": "SetMultiBucketReplication", + "summary": "Set Bucket Versioning", + "operationId": "SetBucketVersioning", "parameters": [ + { + "type": "string", + "name": "bucket_name", + "in": "path", + "required": true + }, { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/multiBucketReplication" + "$ref": "#/definitions/setBucketVersioning" } } ], "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/multiBucketResponseState" - } + "201": { + "description": "A successful response." }, "default": { "description": "Generic error response.", @@ -588,18 +810,26 @@ func init() { } } }, - "/buckets/max-share-exp": { + "/buckets/{name}": { "get": { "tags": [ "Bucket" ], - "summary": "Get max expiration time for share link in seconds", - "operationId": "GetMaxShareLinkExp", + "summary": "Bucket Info", + "operationId": "BucketInfo", + "parameters": [ + { + "type": "string", + "name": "name", + "in": "path", + "required": true + } + ], "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/maxShareLinkExpResponse" + "$ref": "#/definitions/bucket" } }, "default": { @@ -611,24 +841,27 @@ func init() { } } }, - "/buckets/{bucket_name}/delete-all-replication-rules": { - "delete": { + "/buckets/{name}/quota": { + "get": { "tags": [ "Bucket" ], - "summary": "Deletes all replication rules from a bucket", - "operationId": "DeleteAllReplicationRules", + "summary": "Get Bucket Quota", + "operationId": "GetBucketQuota", "parameters": [ { "type": "string", - "name": "bucket_name", + "name": "name", "in": "path", "required": true } ], "responses": { - "204": { - "description": "A successful response." + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/bucketQuota" + } }, "default": { "description": "Generic error response.", @@ -639,109 +872,31 @@ func init() { } } }, - "/buckets/{bucket_name}/delete-objects": { - "post": { - "tags": [ - "Object" + "/download-shared-object/{url}": { + "get": { + "security": [], + "produces": [ + "application/octet-stream" ], - "summary": "Delete Multiple Objects", - "operationId": "DeleteMultipleObjects", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "type": "boolean", - "name": "all_versions", - "in": "query" - }, - { - "type": "boolean", - "name": "bypass", - "in": "query" - }, - { - "name": "files", - "in": "body", - "required": true, - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/deleteFile" - } - } - } - ], - "responses": { - "200": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/buckets/{bucket_name}/delete-selected-replication-rules": { - "delete": { "tags": [ - "Bucket" + "Public" ], - "summary": "Deletes selected replication rules from a bucket", - "operationId": "DeleteSelectedReplicationRules", + "summary": "Downloads an object from a presigned url", + "operationId": "DownloadSharedObject", "parameters": [ { "type": "string", - "name": "bucket_name", + "name": "url", "in": "path", "required": true - }, - { - "name": "rules", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/bucketReplicationRuleList" - } } ], "responses": { - "204": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", + "200": { + "description": "A successful response.", "schema": { - "$ref": "#/definitions/ApiError" + "type": "file" } - } - } - } - }, - "/buckets/{bucket_name}/encryption/disable": { - "post": { - "tags": [ - "Bucket" - ], - "summary": "Disable bucket encryption.", - "operationId": "DisableBucketEncryption", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response." }, "default": { "description": "Generic error response.", @@ -752,29 +907,13 @@ func init() { } } }, - "/buckets/{bucket_name}/encryption/enable": { - "post": { + "/license/acknowledge": { + "get": { "tags": [ - "Bucket" - ], - "summary": "Enable bucket encryption.", - "operationId": "EnableBucketEncryption", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/bucketEncryptionRequest" - } - } + "License" ], + "summary": "Acknowledge the license", + "operationId": "LicenseAcknowledge", "responses": { "200": { "description": "A successful response." @@ -788,26 +927,19 @@ func init() { } } }, - "/buckets/{bucket_name}/encryption/info": { + "/login": { "get": { + "security": [], "tags": [ - "Bucket" - ], - "summary": "Get bucket encryption information.", - "operationId": "GetBucketEncryptionInfo", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - } + "Auth" ], + "summary": "Returns login strategy, form or sso.", + "operationId": "LoginDetail", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/bucketEncryptionInfo" + "$ref": "#/definitions/loginDetails" } }, "default": { @@ -817,35 +949,27 @@ func init() { } } } - } - }, - "/buckets/{bucket_name}/events": { - "get": { + }, + "post": { + "security": [], "tags": [ - "Bucket" + "Auth" ], - "summary": "List Bucket Events", - "operationId": "ListBucketEvents", + "summary": "Login to Console", + "operationId": "Login", "parameters": [ { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "$ref": "#/parameters/offset" - }, - { - "$ref": "#/parameters/limit" + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/loginRequest" + } } ], "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/listBucketEventsResponse" - } + "204": { + "description": "A successful login." }, "default": { "description": "Generic error response.", @@ -854,32 +978,29 @@ func init() { } } } - }, + } + }, + "/login/oauth2/auth": { "post": { + "security": [], "tags": [ - "Bucket" + "Auth" ], - "summary": "Create Bucket Event", - "operationId": "CreateBucketEvent", + "summary": "Identity Provider oauth2 callback endpoint.", + "operationId": "LoginOauth2Auth", "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/bucketEventRequest" + "$ref": "#/definitions/loginOauth2AuthRequest" } } ], "responses": { - "201": { - "description": "A successful response." + "204": { + "description": "A successful login." }, "default": { "description": "Generic error response.", @@ -890,37 +1011,25 @@ func init() { } } }, - "/buckets/{bucket_name}/events/{arn}": { - "delete": { + "/logout": { + "post": { "tags": [ - "Bucket" + "Auth" ], - "summary": "Delete Bucket Event", - "operationId": "DeleteBucketEvent", + "summary": "Logout from Console.", + "operationId": "Logout", "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "arn", - "in": "path", - "required": true - }, { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/notificationDeleteRequest" + "$ref": "#/definitions/logoutRequest" } } ], "responses": { - "204": { + "200": { "description": "A successful response." }, "default": { @@ -932,26 +1041,18 @@ func init() { } } }, - "/buckets/{bucket_name}/object-locking": { + "/session": { "get": { "tags": [ - "Bucket" - ], - "summary": "Returns the status of object locking support on the bucket", - "operationId": "GetBucketObjectLockingStatus", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - } + "Auth" ], + "summary": "Endpoint to check if your session is still valid", + "operationId": "SessionCheck", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/bucketObLockingResponse" + "$ref": "#/definitions/sessionResponse" } }, "default": { @@ -963,47 +1064,16 @@ func init() { } } }, - "/buckets/{bucket_name}/objects": { + "/users": { "get": { - "security": [ - { - "key": [] - }, - { - "anonymous": [] - } - ], "tags": [ - "Object" + "User" ], - "summary": "List Objects", - "operationId": "ListObjects", + "summary": "List Users", + "operationId": "ListUsers", "parameters": [ { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "prefix", - "in": "query" - }, - { - "type": "boolean", - "name": "recursive", - "in": "query" - }, - { - "type": "boolean", - "name": "with_versions", - "in": "query" - }, - { - "type": "boolean", - "name": "with_metadata", - "in": "query" + "$ref": "#/parameters/offset" }, { "$ref": "#/parameters/limit" @@ -1013,7 +1083,7 @@ func init() { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/listObjectsResponse" + "$ref": "#/definitions/listUsersResponse" } }, "default": { @@ -1023,9493 +1093,3116 @@ func init() { } } } - }, - "delete": { - "tags": [ - "Object" - ], - "summary": "Delete Object", - "operationId": "DeleteObject", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "prefix", - "in": "query", - "required": true - }, - { - "type": "string", - "name": "version_id", - "in": "query" - }, - { - "type": "boolean", - "name": "recursive", - "in": "query" - }, - { - "type": "boolean", - "name": "all_versions", - "in": "query" - }, - { - "type": "boolean", - "name": "non_current_versions", - "in": "query" - }, - { - "type": "boolean", - "name": "bypass", - "in": "query" - } - ], - "responses": { - "200": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + } + } + }, + "definitions": { + "ApiError": { + "type": "object", + "properties": { + "detailedMessage": { + "type": "string" + }, + "message": { + "type": "string" } } }, - "/buckets/{bucket_name}/objects/download": { - "get": { - "security": [ - { - "key": [] - }, - { - "anonymous": [] - } - ], - "produces": [ - "application/octet-stream" - ], - "tags": [ - "Object" - ], - "summary": "Download Object", - "operationId": "Download Object", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "prefix", - "in": "query", - "required": true - }, - { - "type": "string", - "name": "version_id", - "in": "query" - }, - { - "type": "boolean", - "default": false, - "name": "preview", - "in": "query" - }, - { - "type": "string", - "default": "", - "name": "override_file_name", - "in": "query" - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "file" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "BackendProperties": { + "type": "object", + "properties": { + "backendType": { + "type": "string" + }, + "offlineDrives": { + "type": "integer" + }, + "onlineDrives": { + "type": "integer" + }, + "rrSCParity": { + "type": "integer" + }, + "standardSCParity": { + "type": "integer" } } }, - "/buckets/{bucket_name}/objects/download-multiple": { - "post": { - "security": [ - { - "key": [] - }, - { - "anonymous": [] - } - ], - "produces": [ - "application/octet-stream" - ], - "tags": [ - "Object" - ], - "summary": "Download Multiple Objects", - "operationId": "DownloadMultipleObjects", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "name": "objectList", - "in": "body", - "required": true, - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "file" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "aUserPolicyResponse": { + "type": "object", + "properties": { + "policy": { + "type": "string" } } }, - "/buckets/{bucket_name}/objects/legalhold": { - "put": { - "tags": [ - "Object" - ], - "summary": "Put Object's legalhold status", - "operationId": "PutObjectLegalHold", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "prefix", - "in": "query", - "required": true - }, - { - "type": "string", - "name": "version_id", - "in": "query", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/putObjectLegalHoldRequest" - } - } - ], - "responses": { - "200": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "accessRule": { + "type": "object", + "properties": { + "access": { + "type": "string" + }, + "prefix": { + "type": "string" } } }, - "/buckets/{bucket_name}/objects/metadata": { - "get": { - "tags": [ - "Object" - ], - "summary": "Gets the metadata of an object", - "operationId": "GetObjectMetadata", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "prefix", - "in": "query", - "required": true - }, - { - "type": "string", - "name": "versionID", - "in": "query" - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/metadata" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "accountChangePasswordRequest": { + "type": "object", + "required": [ + "current_secret_key", + "new_secret_key" + ], + "properties": { + "current_secret_key": { + "type": "string" + }, + "new_secret_key": { + "type": "string" } } }, - "/buckets/{bucket_name}/objects/restore": { - "put": { - "tags": [ - "Object" - ], - "summary": "Restore Object to a selected version", - "operationId": "PutObjectRestore", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "prefix", - "in": "query", - "required": true - }, - { - "type": "string", - "name": "version_id", - "in": "query", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "addBucketReplication": { + "type": "object", + "properties": { + "arn": { + "type": "string" + }, + "destination_bucket": { + "type": "string" } } }, - "/buckets/{bucket_name}/objects/retention": { - "put": { - "tags": [ - "Object" - ], - "summary": "Put Object's retention status", - "operationId": "PutObjectRetention", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "prefix", - "in": "query", - "required": true - }, - { - "type": "string", - "name": "version_id", - "in": "query", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/putObjectRetentionRequest" - } - } - ], - "responses": { - "200": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "addGroupRequest": { + "type": "object", + "required": [ + "group", + "members" + ], + "properties": { + "group": { + "type": "string" + }, + "members": { + "type": "array", + "items": { + "type": "string" } } - }, - "delete": { - "tags": [ - "Object" - ], - "summary": "Delete Object retention from an object", - "operationId": "DeleteObjectRetention", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "prefix", - "in": "query", - "required": true - }, - { - "type": "string", - "name": "version_id", - "in": "query", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + } + }, + "addPolicyRequest": { + "type": "object", + "required": [ + "name", + "policy" + ], + "properties": { + "name": { + "type": "string" + }, + "policy": { + "type": "string" } } }, - "/buckets/{bucket_name}/objects/share": { - "get": { - "tags": [ - "Object" - ], - "summary": "Shares an Object on a url", - "operationId": "ShareObject", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "prefix", - "in": "query", - "required": true - }, - { - "type": "string", - "name": "version_id", - "in": "query", - "required": true - }, - { - "type": "string", - "name": "expires", - "in": "query" + "addUserRequest": { + "type": "object", + "required": [ + "accessKey", + "secretKey", + "groups", + "policies" + ], + "properties": { + "accessKey": { + "type": "string" + }, + "groups": { + "type": "array", + "items": { + "type": "string" } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "string" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + }, + "policies": { + "type": "array", + "items": { + "type": "string" } + }, + "secretKey": { + "type": "string" } } }, - "/buckets/{bucket_name}/objects/tags": { - "put": { - "tags": [ - "Object" - ], - "summary": "Put Object's tags", - "operationId": "PutObjectTags", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "prefix", - "in": "query", - "required": true - }, - { - "type": "string", - "name": "version_id", - "in": "query", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/putObjectTagsRequest" - } + "adminInfoResponse": { + "type": "object", + "properties": { + "advancedMetricsStatus": { + "type": "string", + "enum": [ + "not configured", + "available", + "unavailable" + ] + }, + "backend": { + "$ref": "#/definitions/BackendProperties" + }, + "buckets": { + "type": "integer" + }, + "objects": { + "type": "integer" + }, + "servers": { + "type": "array", + "items": { + "$ref": "#/definitions/serverProperties" } - ], - "responses": { - "200": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + }, + "usage": { + "type": "integer" + }, + "widgets": { + "type": "array", + "items": { + "$ref": "#/definitions/widget" } } } }, - "/buckets/{bucket_name}/objects/upload": { - "post": { - "security": [ - { - "key": [] - }, - { - "anonymous": [] - } - ], - "consumes": [ - "multipart/form-data" - ], - "tags": [ - "Object" - ], - "summary": "Uploads an Object.", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "prefix", - "in": "query" - } - ], - "responses": { - "200": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "apiKey": { + "type": "object", + "properties": { + "apiKey": { + "type": "string" } } }, - "/buckets/{bucket_name}/replication": { - "get": { - "tags": [ - "Bucket" - ], - "summary": "Bucket Replication", - "operationId": "GetBucketReplication", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/bucketReplicationResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "arnsResponse": { + "type": "object", + "properties": { + "arns": { + "type": "array", + "items": { + "type": "string" } } } }, - "/buckets/{bucket_name}/replication/{rule_id}": { - "get": { - "tags": [ - "Bucket" - ], - "summary": "Bucket Replication", - "operationId": "GetBucketReplicationRule", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "rule_id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/bucketReplicationRule" + "bucket": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "access": { + "$ref": "#/definitions/bucketAccess" + }, + "creation_date": { + "type": "string" + }, + "definition": { + "type": "string" + }, + "details": { + "type": "object", + "properties": { + "locking": { + "type": "boolean" + }, + "quota": { + "type": "object", + "properties": { + "quota": { + "type": "integer", + "format": "int64" + }, + "type": { + "type": "string", + "enum": [ + "hard" + ] + } + } + }, + "replication": { + "type": "boolean" + }, + "tags": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "versioning": { + "type": "boolean" + }, + "versioningSuspended": { + "type": "boolean" } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - }, - "put": { - "tags": [ - "Bucket" - ], - "summary": "Update Replication rule", - "operationId": "UpdateMultiBucketReplication", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "rule_id", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/multiBucketReplicationEdit" - } - } - ], - "responses": { - "201": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - }, - "delete": { - "tags": [ - "Bucket" - ], - "summary": "Bucket Replication Rule Delete", - "operationId": "DeleteBucketReplicationRule", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "rule_id", - "in": "path", - "required": true - } - ], - "responses": { - "204": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" + } + }, + "name": { + "type": "string", + "minLength": 3 + }, + "objects": { + "type": "integer", + "format": "int64" + }, + "rw_access": { + "type": "object", + "properties": { + "read": { + "type": "boolean" + }, + "write": { + "type": "boolean" } } + }, + "size": { + "type": "integer", + "format": "int64" } } }, - "/buckets/{bucket_name}/retention": { - "get": { - "tags": [ - "Bucket" - ], - "summary": "Get Bucket's retention config", - "operationId": "GetBucketRetentionConfig", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/getBucketRetentionConfig" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "bucketAccess": { + "type": "string", + "default": "PRIVATE", + "enum": [ + "PRIVATE", + "PUBLIC", + "CUSTOM" + ] + }, + "bucketEncryptionInfo": { + "type": "object", + "properties": { + "algorithm": { + "type": "string" + }, + "kmsMasterKeyID": { + "type": "string" } - }, - "put": { - "tags": [ - "Bucket" - ], - "summary": "Set Bucket's retention config", - "operationId": "SetBucketRetentionConfig", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/putBucketRetentionRequest" - } - } - ], - "responses": { - "200": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + } + }, + "bucketEncryptionRequest": { + "type": "object", + "properties": { + "encType": { + "$ref": "#/definitions/bucketEncryptionType" + }, + "kmsKeyID": { + "type": "string" } } }, - "/buckets/{bucket_name}/rewind/{date}": { - "get": { - "tags": [ - "Bucket" - ], - "summary": "Get objects in a bucket for a rewind date", - "operationId": "GetBucketRewind", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "date", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "prefix", - "in": "query" - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/rewindResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "bucketEncryptionType": { + "type": "string", + "default": "sse-s3", + "enum": [ + "sse-s3", + "sse-kms" + ] + }, + "bucketEventRequest": { + "type": "object", + "required": [ + "configuration" + ], + "properties": { + "configuration": { + "$ref": "#/definitions/notificationConfig" + }, + "ignoreExisting": { + "type": "boolean" } } }, - "/buckets/{bucket_name}/tags": { - "put": { - "tags": [ - "Bucket" - ], - "summary": "Put Bucket's tags", - "operationId": "PutBucketTags", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/putBucketTagsRequest" - } - } - ], - "responses": { - "200": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "bucketObLockingResponse": { + "type": "object", + "properties": { + "object_locking_enabled": { + "type": "boolean" } } }, - "/buckets/{bucket_name}/versioning": { - "get": { - "tags": [ - "Bucket" - ], - "summary": "Bucket Versioning", - "operationId": "GetBucketVersioning", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/bucketVersioningResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "bucketObject": { + "type": "object", + "properties": { + "content_type": { + "type": "string" + }, + "etag": { + "type": "string" + }, + "expiration": { + "type": "string" + }, + "expiration_rule_id": { + "type": "string" + }, + "is_delete_marker": { + "type": "boolean" + }, + "is_latest": { + "type": "boolean" + }, + "last_modified": { + "type": "string" + }, + "legal_hold_status": { + "type": "string" + }, + "metadata": { + "type": "object", + "additionalProperties": { + "type": "string" } - } - }, - "put": { - "tags": [ - "Bucket" - ], - "summary": "Set Bucket Versioning", - "operationId": "SetBucketVersioning", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/setBucketVersioning" - } + }, + "name": { + "type": "string" + }, + "retention_mode": { + "type": "string" + }, + "retention_until_date": { + "type": "string" + }, + "size": { + "type": "integer", + "format": "int64" + }, + "tags": { + "type": "object", + "additionalProperties": { + "type": "string" } - ], - "responses": { - "201": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + }, + "user_metadata": { + "type": "object", + "additionalProperties": { + "type": "string" } + }, + "user_tags": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "version_id": { + "type": "string" } } }, - "/buckets/{name}": { - "get": { - "tags": [ - "Bucket" - ], - "summary": "Bucket Info", - "operationId": "BucketInfo", - "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/bucket" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - }, - "delete": { - "tags": [ - "Bucket" - ], - "summary": "Delete Bucket", - "operationId": "DeleteBucket", - "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "204": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "bucketQuota": { + "type": "object", + "properties": { + "quota": { + "type": "integer" + }, + "type": { + "type": "string", + "enum": [ + "hard" + ] } } }, - "/buckets/{name}/quota": { - "get": { - "tags": [ - "Bucket" - ], - "summary": "Get Bucket Quota", - "operationId": "GetBucketQuota", - "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/bucketQuota" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "bucketReplicationDestination": { + "type": "object", + "properties": { + "bucket": { + "type": "string" } - }, - "put": { - "tags": [ - "Bucket" - ], - "summary": "Bucket Quota", - "operationId": "SetBucketQuota", - "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/setBucketQuota" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/bucket" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + } + }, + "bucketReplicationResponse": { + "type": "object", + "properties": { + "rules": { + "type": "array", + "items": { + "$ref": "#/definitions/bucketReplicationRule" } } } }, - "/buckets/{name}/set-policy": { - "put": { - "tags": [ - "Bucket" - ], - "summary": "Bucket Set Policy", - "operationId": "BucketSetPolicy", - "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/setBucketPolicyRequest" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/bucket" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "bucketReplicationRule": { + "type": "object", + "properties": { + "bandwidth": { + "type": "string" + }, + "delete_marker_replication": { + "type": "boolean" + }, + "deletes_replication": { + "type": "boolean" + }, + "destination": { + "$ref": "#/definitions/bucketReplicationDestination" + }, + "existingObjects": { + "type": "boolean" + }, + "healthCheckPeriod": { + "type": "integer" + }, + "id": { + "type": "string" + }, + "metadata_replication": { + "type": "boolean" + }, + "prefix": { + "type": "string" + }, + "priority": { + "type": "integer", + "format": "int32" + }, + "status": { + "type": "string", + "enum": [ + "Enabled", + "Disabled" + ] + }, + "storageClass": { + "type": "string" + }, + "syncMode": { + "type": "string", + "default": "async", + "enum": [ + "async", + "sync" + ] + }, + "tags": { + "type": "string" } } }, - "/configs": { - "get": { - "tags": [ - "Configuration" - ], - "summary": "List Configurations", - "operationId": "ListConfig", - "parameters": [ - { - "$ref": "#/parameters/offset" - }, - { - "$ref": "#/parameters/limit" - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/listConfigResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "bucketReplicationRuleList": { + "type": "object", + "properties": { + "rules": { + "type": "array", + "items": { + "type": "string" } } } }, - "/configs/export": { - "get": { - "tags": [ - "Configuration" - ], - "summary": "Export the current config from MinIO server", - "operationId": "ExportConfig", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/configExportResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" + "bucketVersioningResponse": { + "type": "object", + "properties": { + "MFADelete": { + "type": "string" + }, + "excludeFolders": { + "type": "boolean" + }, + "excludedPrefixes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "prefix": { + "type": "string" + } } } + }, + "status": { + "type": "string" } } }, - "/configs/import": { - "post": { - "consumes": [ - "multipart/form-data" - ], - "tags": [ - "Configuration" - ], - "summary": "Uploads a file to import MinIO server config.", - "parameters": [ - { - "type": "file", - "name": "file", - "in": "formData", - "required": true + "bulkUserGroups": { + "type": "object", + "required": [ + "users", + "groups" + ], + "properties": { + "groups": { + "type": "array", + "items": { + "type": "string" } - ], - "responses": { - "200": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + }, + "users": { + "type": "array", + "items": { + "type": "string" } } } }, - "/configs/{name}": { - "get": { - "tags": [ - "Configuration" - ], - "summary": "Configuration info", - "operationId": "ConfigInfo", - "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/configuration" - } - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "callHomeGetResponse": { + "type": "object", + "properties": { + "diagnosticsStatus": { + "type": "boolean" + }, + "logsStatus": { + "type": "boolean" } - }, - "put": { - "tags": [ - "Configuration" - ], - "summary": "Set Configuration", - "operationId": "SetConfig", - "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/setConfigRequest" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/setConfigResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + } + }, + "callHomeSetStatus": { + "type": "object", + "required": [ + "diagState", + "logsState" + ], + "properties": { + "diagState": { + "type": "boolean" + }, + "logsState": { + "type": "boolean" } } }, - "/configs/{name}/reset": { - "post": { - "tags": [ - "Configuration" - ], - "summary": "Configuration reset", - "operationId": "ResetConfig", - "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/setConfigResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "changeUserPasswordRequest": { + "type": "object", + "required": [ + "selectedUser", + "newSecretKey" + ], + "properties": { + "newSecretKey": { + "type": "string" + }, + "selectedUser": { + "type": "string" } } }, - "/download-shared-object/{url}": { - "get": { - "security": [], - "produces": [ - "application/octet-stream" - ], - "tags": [ - "Public" - ], - "summary": "Downloads an object from a presigned url", - "operationId": "DownloadSharedObject", - "parameters": [ - { - "type": "string", - "name": "url", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "file" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "configDescription": { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "key": { + "type": "string" } } }, - "/group/{name}": { - "get": { - "tags": [ - "Group" - ], - "summary": "Group info", - "operationId": "GroupInfo", - "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/group" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - }, - "put": { - "tags": [ - "Group" - ], - "summary": "Update Group Members or Status", - "operationId": "UpdateGroup", - "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/updateGroupRequest" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/group" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - }, - "delete": { - "tags": [ - "Group" - ], - "summary": "Remove group", - "operationId": "RemoveGroup", - "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "204": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "configExportResponse": { + "type": "object", + "properties": { + "status": { + "type": "string" + }, + "value": { + "description": "Returns base64 encoded value", + "type": "string" } } }, - "/groups": { - "get": { - "tags": [ - "Group" - ], - "summary": "List Groups", - "operationId": "ListGroups", - "parameters": [ - { - "$ref": "#/parameters/offset" - }, - { - "$ref": "#/parameters/limit" - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/listGroupsResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - }, - "post": { - "tags": [ - "Group" - ], - "summary": "Add Group", - "operationId": "AddGroup", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/addGroupRequest" - } - } - ], - "responses": { - "201": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "configuration": { + "type": "object", + "properties": { + "key_values": { + "type": "array", + "items": { + "$ref": "#/definitions/configurationKV" } + }, + "name": { + "type": "string" } } }, - "/idp/{type}": { - "get": { - "tags": [ - "idp" - ], - "summary": "List IDP Configurations", - "operationId": "ListConfigurations", - "parameters": [ - { - "type": "string", - "description": "IDP Configuration Type", - "name": "type", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/idpListConfigurationsResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - }, - "post": { - "consumes": [ - "application/json" - ], - "tags": [ - "idp" - ], - "summary": "Create IDP Configuration", - "operationId": "CreateConfiguration", - "parameters": [ - { - "type": "string", - "description": "IDP Configuration Type", - "name": "type", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/idpServerConfiguration" - } - } - ], - "responses": { - "201": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/setIDPResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "configurationKV": { + "type": "object", + "properties": { + "env_override": { + "$ref": "#/definitions/envOverride" + }, + "key": { + "type": "string" + }, + "value": { + "type": "string" } } }, - "/idp/{type}/{name}": { - "get": { - "tags": [ - "idp" - ], - "summary": "Get IDP Configuration", - "operationId": "GetConfiguration", - "parameters": [ - { - "type": "string", - "description": "IDP Configuration Name", - "name": "name", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "IDP Configuration Type", - "name": "type", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/idpServerConfiguration" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - }, - "put": { - "consumes": [ - "application/json" - ], - "tags": [ - "idp" - ], - "summary": "Update IDP Configuration", - "operationId": "UpdateConfiguration", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/idpServerConfiguration" - } - }, - { - "type": "string", - "description": "IDP Configuration Name", - "name": "name", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "IDP Configuration Type", - "name": "type", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/setIDPResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "createRemoteBucket": { + "required": [ + "accessKey", + "secretKey", + "targetURL", + "sourceBucket", + "targetBucket" + ], + "properties": { + "accessKey": { + "type": "string", + "minLength": 3 + }, + "bandwidth": { + "type": "integer", + "format": "int64" + }, + "healthCheckPeriod": { + "type": "integer", + "format": "int32" + }, + "region": { + "type": "string" + }, + "secretKey": { + "type": "string", + "minLength": 8 + }, + "sourceBucket": { + "type": "string" + }, + "syncMode": { + "type": "string", + "default": "async", + "enum": [ + "async", + "sync" + ] + }, + "targetBucket": { + "type": "string" + }, + "targetURL": { + "type": "string" } - }, - "delete": { - "tags": [ - "idp" - ], - "summary": "Delete IDP Configuration", - "operationId": "DeleteConfiguration", - "parameters": [ - { - "type": "string", - "description": "IDP Configuration Name", - "name": "name", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "IDP Configuration Type", - "name": "type", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/setIDPResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + } + }, + "deleteFile": { + "type": "object", + "properties": { + "path": { + "type": "string" + }, + "recursive": { + "type": "boolean" + }, + "versionID": { + "type": "string" } } }, - "/kms/apis": { - "get": { - "tags": [ - "KMS" - ], - "summary": "KMS apis", - "operationId": "KMSAPIs", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/kmsAPIsResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "envOverride": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" } } }, - "/kms/keys": { - "get": { - "tags": [ - "KMS" - ], - "summary": "KMS list keys", - "operationId": "KMSListKeys", - "parameters": [ - { - "type": "string", - "description": "pattern to retrieve keys", - "name": "pattern", - "in": "query" - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/kmsListKeysResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "environmentConstants": { + "type": "object", + "properties": { + "maxConcurrentDownloads": { + "type": "integer" + }, + "maxConcurrentUploads": { + "type": "integer" } - }, - "post": { - "tags": [ - "KMS" - ], - "summary": "KMS create key", - "operationId": "KMSCreateKey", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/kmsCreateKeyRequest" - } - } - ], - "responses": { - "201": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + } + }, + "getBucketRetentionConfig": { + "type": "object", + "properties": { + "mode": { + "$ref": "#/definitions/objectRetentionMode" + }, + "unit": { + "$ref": "#/definitions/objectRetentionUnit" + }, + "validity": { + "type": "integer", + "format": "int32" } } }, - "/kms/keys/{name}": { - "get": { - "tags": [ - "KMS" - ], - "summary": "KMS key status", - "operationId": "KMSKeyStatus", - "parameters": [ - { - "type": "string", - "description": "KMS key name", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/kmsKeyStatusResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "group": { + "type": "object", + "properties": { + "members": { + "type": "array", + "items": { + "type": "string" } + }, + "name": { + "type": "string" + }, + "policy": { + "type": "string" + }, + "status": { + "type": "string" } } }, - "/kms/metrics": { - "get": { - "tags": [ - "KMS" - ], - "summary": "KMS metrics", - "operationId": "KMSMetrics", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/kmsMetricsResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "iamEntity": { + "type": "string" + }, + "iamPolicy": { + "type": "object", + "properties": { + "statement": { + "type": "array", + "items": { + "$ref": "#/definitions/iamPolicyStatement" } + }, + "version": { + "type": "string" } } }, - "/kms/status": { - "get": { - "tags": [ - "KMS" - ], - "summary": "KMS status", - "operationId": "KMSStatus", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/kmsStatusResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "iamPolicyStatement": { + "type": "object", + "properties": { + "action": { + "type": "array", + "items": { + "type": "string" + } + }, + "condition": { + "type": "object", + "additionalProperties": { + "type": "object" + } + }, + "effect": { + "type": "string" + }, + "resource": { + "type": "array", + "items": { + "type": "string" } } } }, - "/kms/version": { - "get": { - "tags": [ - "KMS" - ], - "summary": "KMS version", - "operationId": "KMSVersion", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/kmsVersionResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "idpListConfigurationsResponse": { + "type": "object", + "properties": { + "results": { + "type": "array", + "items": { + "$ref": "#/definitions/idpServerConfiguration" } } } }, - "/ldap-entities": { - "post": { - "tags": [ - "idp" - ], - "summary": "Get LDAP Entities", - "operationId": "GetLDAPEntities", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/ldapEntitiesRequest" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/ldapEntities" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "idpServerConfiguration": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "info": { + "type": "array", + "items": { + "$ref": "#/definitions/idpServerConfigurationInfo" } + }, + "input": { + "type": "string" + }, + "name": { + "type": "string" + }, + "type": { + "type": "string" } } }, - "/list-external-buckets": { - "post": { - "tags": [ - "Bucket" - ], - "summary": "Lists an External list of buckets using custom credentials", - "operationId": "ListExternalBuckets", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/listExternalBucketsParams" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/listBucketsResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "idpServerConfigurationInfo": { + "type": "object", + "properties": { + "isCfg": { + "type": "boolean" + }, + "isEnv": { + "type": "boolean" + }, + "key": { + "type": "string" + }, + "value": { + "type": "string" } } }, - "/login": { - "get": { - "security": [], - "tags": [ - "Auth" - ], - "summary": "Returns login strategy, form or sso.", - "operationId": "LoginDetail", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/loginDetails" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - }, - "post": { - "security": [], - "tags": [ - "Auth" - ], - "summary": "Login to Console", - "operationId": "Login", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/loginRequest" - } - } - ], - "responses": { - "204": { - "description": "A successful login." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "kmsAPI": { + "type": "object", + "properties": { + "maxBody": { + "type": "integer" + }, + "method": { + "type": "string" + }, + "path": { + "type": "string" + }, + "timeout": { + "type": "integer" + } + } + }, + "kmsAPIsResponse": { + "type": "object", + "properties": { + "results": { + "type": "array", + "items": { + "$ref": "#/definitions/kmsAPI" } } } }, - "/login/oauth2/auth": { - "post": { - "security": [], - "tags": [ - "Auth" - ], - "summary": "Identity Provider oauth2 callback endpoint.", - "operationId": "LoginOauth2Auth", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/loginOauth2AuthRequest" - } - } - ], - "responses": { - "204": { - "description": "A successful login." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "kmsCreateKeyRequest": { + "type": "object", + "required": [ + "key" + ], + "properties": { + "key": { + "type": "string" } } }, - "/logout": { - "post": { - "tags": [ - "Auth" - ], - "summary": "Logout from Console.", - "operationId": "Logout", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/logoutRequest" - } - } - ], - "responses": { - "200": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "kmsEndpoint": { + "type": "object", + "properties": { + "status": { + "type": "string" + }, + "url": { + "type": "string" } } }, - "/logs/search": { - "get": { - "tags": [ - "Logging" - ], - "summary": "Search the logs", - "operationId": "LogSearch", - "parameters": [ - { - "type": "array", - "items": { - "type": "string" - }, - "collectionFormat": "multi", - "description": "Filter Parameters", - "name": "fp", - "in": "query" - }, - { - "type": "number", - "format": "int32", - "default": 10, - "name": "pageSize", - "in": "query" - }, - { - "type": "number", - "format": "int32", - "default": 0, - "name": "pageNo", - "in": "query" - }, - { - "enum": [ - "timeDesc", - "timeAsc" - ], - "type": "string", - "default": "timeDesc", - "name": "order", - "in": "query" - }, - { - "type": "string", - "name": "timeStart", - "in": "query" - }, - { - "type": "string", - "name": "timeEnd", - "in": "query" - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/logSearchResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "kmsKeyInfo": { + "type": "object", + "properties": { + "createdAt": { + "type": "string" + }, + "createdBy": { + "type": "string" + }, + "name": { + "type": "string" } } }, - "/nodes": { - "get": { - "tags": [ - "System" - ], - "summary": "Lists Nodes", - "operationId": "ListNodes", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "kmsKeyStatusResponse": { + "type": "object", + "properties": { + "decryptionErr": { + "type": "string" + }, + "encryptionErr": { + "type": "string" + }, + "keyID": { + "type": "string" } } }, - "/policies": { - "get": { - "tags": [ - "Policy" - ], - "summary": "List Policies", - "operationId": "ListPolicies", - "parameters": [ - { - "$ref": "#/parameters/offset" - }, - { - "$ref": "#/parameters/limit" - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/listPoliciesResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "kmsLatencyHistogram": { + "type": "object", + "properties": { + "duration": { + "type": "integer" + }, + "total": { + "type": "integer" } - }, - "post": { - "tags": [ - "Policy" - ], - "summary": "Add Policy", - "operationId": "AddPolicy", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/addPolicyRequest" - } - } - ], - "responses": { - "201": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/policy" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + } + }, + "kmsListKeysResponse": { + "type": "object", + "properties": { + "results": { + "type": "array", + "items": { + "$ref": "#/definitions/kmsKeyInfo" } } } }, - "/policies/{policy}/groups": { - "get": { - "tags": [ - "Policy" - ], - "summary": "List Groups for a Policy", - "operationId": "ListGroupsForPolicy", - "parameters": [ - { - "type": "string", - "name": "policy", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "kmsMetricsResponse": { + "type": "object", + "required": [ + "requestOK", + "requestErr", + "requestFail", + "requestActive", + "auditEvents", + "errorEvents", + "latencyHistogram", + "uptime", + "cpus", + "usableCPUs", + "threads", + "heapAlloc", + "stackAlloc" + ], + "properties": { + "auditEvents": { + "type": "integer" + }, + "cpus": { + "type": "integer" + }, + "errorEvents": { + "type": "integer" + }, + "heapAlloc": { + "type": "integer" + }, + "heapObjects": { + "type": "integer" + }, + "latencyHistogram": { + "type": "array", + "items": { + "$ref": "#/definitions/kmsLatencyHistogram" } + }, + "requestActive": { + "type": "integer" + }, + "requestErr": { + "type": "integer" + }, + "requestFail": { + "type": "integer" + }, + "requestOK": { + "type": "integer" + }, + "stackAlloc": { + "type": "integer" + }, + "threads": { + "type": "integer" + }, + "uptime": { + "type": "integer" + }, + "usableCPUs": { + "type": "integer" } } }, - "/policies/{policy}/users": { - "get": { - "tags": [ - "Policy" - ], - "summary": "List Users for a Policy", - "operationId": "ListUsersForPolicy", - "parameters": [ - { - "type": "string", - "name": "policy", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "kmsStatusResponse": { + "type": "object", + "properties": { + "defaultKeyID": { + "type": "string" + }, + "endpoints": { + "type": "array", + "items": { + "$ref": "#/definitions/kmsEndpoint" } + }, + "name": { + "type": "string" } } }, - "/policy/{name}": { - "get": { - "tags": [ - "Policy" - ], - "summary": "Policy info", - "operationId": "PolicyInfo", - "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true + "kmsVersionResponse": { + "type": "object", + "properties": { + "version": { + "type": "string" + } + } + }, + "ldapEntities": { + "type": "object", + "properties": { + "groups": { + "type": "array", + "items": { + "$ref": "#/definitions/ldapGroupPolicyEntity" } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/policy" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + }, + "policies": { + "type": "array", + "items": { + "$ref": "#/definitions/ldapPolicyEntity" + } + }, + "timestamp": { + "type": "string" + }, + "users": { + "type": "array", + "items": { + "$ref": "#/definitions/ldapUserPolicyEntity" } } - }, - "delete": { - "tags": [ - "Policy" - ], - "summary": "Remove policy", - "operationId": "RemovePolicy", - "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true + } + }, + "ldapEntitiesRequest": { + "type": "object", + "properties": { + "groups": { + "type": "array", + "items": { + "type": "string" } - ], - "responses": { - "204": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + }, + "policies": { + "type": "array", + "items": { + "type": "string" + } + }, + "users": { + "type": "array", + "items": { + "type": "string" } } } }, - "/releases": { - "get": { - "tags": [ - "release" - ], - "summary": "Get repo releases for a given version", - "operationId": "ListReleases", - "parameters": [ - { - "type": "string", - "description": "repo name", - "name": "repo", - "in": "query", - "required": true - }, - { - "type": "string", - "description": "Current Release", - "name": "current", - "in": "query" - }, - { - "type": "string", - "description": "search content", - "name": "search", - "in": "query" - }, - { - "type": "string", - "description": "filter releases", - "name": "filter", - "in": "query" - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/releaseListResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "ldapGroupPolicyEntity": { + "type": "object", + "properties": { + "group": { + "type": "string" + }, + "policies": { + "type": "array", + "items": { + "type": "string" } } } }, - "/remote-buckets": { - "get": { - "tags": [ - "Bucket" - ], - "summary": "List Remote Buckets", - "operationId": "ListRemoteBuckets", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/listRemoteBucketsResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - }, - "post": { - "tags": [ - "Bucket" - ], - "summary": "Add Remote Bucket", - "operationId": "AddRemoteBucket", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/createRemoteBucket" - } + "ldapPolicyEntity": { + "type": "object", + "properties": { + "groups": { + "type": "array", + "items": { + "type": "string" } - ], - "responses": { - "201": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + }, + "policy": { + "type": "string" + }, + "users": { + "type": "array", + "items": { + "type": "string" } } } }, - "/remote-buckets/{name}": { - "get": { - "tags": [ - "Bucket" - ], - "summary": "Remote Bucket Details", - "operationId": "RemoteBucketDetails", - "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/remoteBucket" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "ldapUserPolicyEntity": { + "type": "object", + "properties": { + "policies": { + "type": "array", + "items": { + "type": "string" } + }, + "user": { + "type": "string" } } }, - "/remote-buckets/{source-bucket-name}/{arn}": { - "delete": { - "tags": [ - "Bucket" - ], - "summary": "Delete Remote Bucket", - "operationId": "DeleteRemoteBucket", - "parameters": [ - { - "type": "string", - "name": "source-bucket-name", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "arn", - "in": "path", - "required": true - } - ], - "responses": { - "204": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "license": { + "type": "object", + "properties": { + "account_id": { + "type": "integer" + }, + "email": { + "type": "string" + }, + "expires_at": { + "type": "string" + }, + "organization": { + "type": "string" + }, + "plan": { + "type": "string" + }, + "storage_capacity": { + "type": "integer" } } }, - "/service-account-credentials": { - "post": { - "tags": [ - "ServiceAccount" - ], - "summary": "Create Service Account With Credentials", - "operationId": "CreateServiceAccountCreds", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/serviceAccountRequestCreds" - } - } - ], - "responses": { - "201": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/serviceAccountCreds" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "listAccessRulesResponse": { + "type": "object", + "properties": { + "accessRules": { + "type": "array", + "title": "list of policies", + "items": { + "$ref": "#/definitions/accessRule" } + }, + "total": { + "type": "integer", + "format": "int64", + "title": "total number of policies" } } }, - "/service-accounts": { - "get": { - "tags": [ - "ServiceAccount" - ], - "summary": "List User's Service Accounts", - "operationId": "ListUserServiceAccounts", - "parameters": [ - { - "$ref": "#/parameters/offset" - }, - { - "$ref": "#/parameters/limit" - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/serviceAccounts" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - }, - "post": { - "tags": [ - "ServiceAccount" - ], - "summary": "Create Service Account", - "operationId": "CreateServiceAccount", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/serviceAccountRequest" - } - } - ], - "responses": { - "201": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/serviceAccountCreds" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "listBucketEventsResponse": { + "type": "object", + "properties": { + "events": { + "type": "array", + "items": { + "$ref": "#/definitions/notificationConfig" } + }, + "total": { + "type": "integer", + "format": "int64", + "title": "total number of bucket events" } } }, - "/service-accounts/delete-multi": { - "delete": { - "tags": [ - "ServiceAccount" - ], - "summary": "Delete Multiple Service Accounts", - "operationId": "DeleteMultipleServiceAccounts", - "parameters": [ - { - "name": "selectedSA", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/selectedSAs" - } - } - ], - "responses": { - "204": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "listBucketsResponse": { + "type": "object", + "properties": { + "buckets": { + "type": "array", + "title": "list of resulting buckets", + "items": { + "$ref": "#/definitions/bucket" } + }, + "total": { + "type": "integer", + "format": "int64", + "title": "number of buckets accessible to the user" } } }, - "/service-accounts/{access_key}": { - "get": { - "tags": [ - "ServiceAccount" - ], - "summary": "Get Service Account", - "operationId": "GetServiceAccount", - "parameters": [ - { - "type": "string", - "name": "access_key", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/serviceAccount" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - }, - "put": { - "tags": [ - "ServiceAccount" - ], - "summary": "Set Service Account Policy", - "operationId": "UpdateServiceAccount", - "parameters": [ - { - "type": "string", - "name": "access_key", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/updateServiceAccountRequest" - } - } - ], - "responses": { - "200": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "listConfigResponse": { + "type": "object", + "properties": { + "configurations": { + "type": "array", + "items": { + "$ref": "#/definitions/configDescription" } + }, + "total": { + "type": "integer", + "format": "int64", + "title": "total number of configurations" } - }, - "delete": { - "tags": [ - "ServiceAccount" - ], - "summary": "Delete Service Account", - "operationId": "DeleteServiceAccount", - "parameters": [ - { - "type": "string", - "name": "access_key", - "in": "path", - "required": true - } - ], - "responses": { - "204": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + } + }, + "listExternalBucketsParams": { + "required": [ + "accessKey", + "secretKey", + "targetURL", + "useTLS" + ], + "properties": { + "accessKey": { + "type": "string", + "minLength": 3 + }, + "region": { + "type": "string" + }, + "secretKey": { + "type": "string", + "minLength": 8 + }, + "targetURL": { + "type": "string" + }, + "useTLS": { + "type": "boolean" } } }, - "/service/restart": { - "post": { - "tags": [ - "Service" - ], - "summary": "Restart Service", - "operationId": "RestartService", - "responses": { - "204": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "listGroupsResponse": { + "type": "object", + "properties": { + "groups": { + "type": "array", + "title": "list of groups", + "items": { + "type": "string" } + }, + "total": { + "type": "integer", + "format": "int64", + "title": "total number of groups" } } }, - "/session": { - "get": { - "tags": [ - "Auth" - ], - "summary": "Endpoint to check if your session is still valid", - "operationId": "SessionCheck", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/sessionResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "listObjectsResponse": { + "type": "object", + "properties": { + "objects": { + "type": "array", + "title": "list of resulting objects", + "items": { + "$ref": "#/definitions/bucketObject" } + }, + "total": { + "type": "integer", + "format": "int64", + "title": "number of objects" } } }, - "/set-policy": { - "put": { - "tags": [ - "Policy" - ], - "summary": "Set policy", - "operationId": "SetPolicy", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/setPolicyNameRequest" - } - } - ], - "responses": { - "204": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "listPoliciesResponse": { + "type": "object", + "properties": { + "policies": { + "type": "array", + "title": "list of policies", + "items": { + "$ref": "#/definitions/policy" } + }, + "total": { + "type": "integer", + "format": "int64", + "title": "total number of policies" } } }, - "/set-policy-multi": { - "put": { - "tags": [ - "Policy" - ], - "summary": "Set policy to multiple users/groups", - "operationId": "SetPolicyMultiple", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/setPolicyMultipleNameRequest" - } - } - ], - "responses": { - "204": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "listRemoteBucketsResponse": { + "type": "object", + "properties": { + "buckets": { + "type": "array", + "title": "list of remote buckets", + "items": { + "$ref": "#/definitions/remoteBucket" } + }, + "total": { + "type": "integer", + "format": "int64", + "title": "number of remote buckets accessible to user" } } }, - "/user/policy": { - "get": { - "tags": [ - "Policy" - ], - "summary": "returns policies for logged in user", - "operationId": "GetUserPolicy", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "string" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "listUsersResponse": { + "type": "object", + "properties": { + "users": { + "type": "array", + "title": "list of resulting users", + "items": { + "$ref": "#/definitions/user" } } } }, - "/user/{name}": { - "get": { - "tags": [ - "User" - ], - "summary": "Get User Info", - "operationId": "GetUserInfo", - "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/user" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - }, - "put": { - "tags": [ - "User" - ], - "summary": "Update User Info", - "operationId": "UpdateUserInfo", - "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/updateUser" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/user" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "logSearchResponse": { + "type": "object", + "properties": { + "results": { + "type": "object", + "title": "list of log search responses" } - }, - "delete": { - "tags": [ - "User" - ], - "summary": "Remove user", - "operationId": "RemoveUser", - "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "204": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + } + }, + "loginDetails": { + "type": "object", + "properties": { + "animatedLogin": { + "type": "boolean" + }, + "isK8S": { + "type": "boolean" + }, + "loginStrategy": { + "type": "string", + "enum": [ + "form", + "redirect", + "service-account", + "redirect-service-account" + ] + }, + "redirectRules": { + "type": "array", + "items": { + "$ref": "#/definitions/redirectRule" } } } }, - "/user/{name}/groups": { - "put": { - "tags": [ - "User" - ], - "summary": "Update Groups for a user", - "operationId": "UpdateUserGroups", - "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/updateUserGroups" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/user" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "loginOauth2AuthRequest": { + "type": "object", + "required": [ + "state", + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "state": { + "type": "string" } } }, - "/user/{name}/policies": { - "get": { - "tags": [ - "Policy" - ], - "summary": "returns policies assigned for a specified user", - "operationId": "GetSAUserPolicy", - "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/aUserPolicyResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" + "loginRequest": { + "type": "object", + "properties": { + "accessKey": { + "type": "string" + }, + "features": { + "type": "object", + "properties": { + "hide_menu": { + "type": "boolean" } } + }, + "secretKey": { + "type": "string" + }, + "sts": { + "type": "string" } } }, - "/user/{name}/service-account-credentials": { - "post": { - "tags": [ - "User" - ], - "summary": "Create Service Account for User With Credentials", - "operationId": "CreateServiceAccountCredentials", - "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/serviceAccountRequestCreds" - } - } - ], - "responses": { - "201": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/serviceAccountCreds" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "loginResponse": { + "type": "object", + "properties": { + "IDPRefreshToken": { + "type": "string" + }, + "sessionId": { + "type": "string" } } }, - "/user/{name}/service-accounts": { - "get": { - "tags": [ - "User" - ], - "summary": "returns a list of service accounts for a user", - "operationId": "ListAUserServiceAccounts", - "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/serviceAccounts" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - }, - "post": { - "tags": [ - "User" - ], - "summary": "Create Service Account for User", - "operationId": "CreateAUserServiceAccount", - "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/serviceAccountRequest" - } - } - ], - "responses": { - "201": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/serviceAccountCreds" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/users": { - "get": { - "tags": [ - "User" - ], - "summary": "List Users", - "operationId": "ListUsers", - "parameters": [ - { - "$ref": "#/parameters/offset" - }, - { - "$ref": "#/parameters/limit" - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/listUsersResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - }, - "post": { - "tags": [ - "User" - ], - "summary": "Add User", - "operationId": "AddUser", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/addUserRequest" - } - } - ], - "responses": { - "201": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/user" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/users-groups-bulk": { - "put": { - "tags": [ - "User" - ], - "summary": "Bulk functionality to Add Users to Groups", - "operationId": "BulkUpdateUsersGroups", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/bulkUserGroups" - } - } - ], - "responses": { - "200": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/users/service-accounts": { - "post": { - "tags": [ - "User" - ], - "summary": "Check number of service accounts for each user specified", - "operationId": "CheckUserServiceAccounts", - "parameters": [ - { - "name": "selectedUsers", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/selectedUsers" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/userServiceAccountSummary" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - } - }, - "definitions": { - "ApiError": { - "type": "object", - "properties": { - "detailedMessage": { - "type": "string" - }, - "message": { - "type": "string" - } - } - }, - "BackendProperties": { - "type": "object", - "properties": { - "backendType": { - "type": "string" - }, - "offlineDrives": { - "type": "integer" - }, - "onlineDrives": { - "type": "integer" - }, - "rrSCParity": { - "type": "integer" - }, - "standardSCParity": { - "type": "integer" - } - } - }, - "aUserPolicyResponse": { - "type": "object", - "properties": { - "policy": { - "type": "string" - } - } - }, - "accessRule": { - "type": "object", - "properties": { - "access": { - "type": "string" - }, - "prefix": { - "type": "string" + "logoutRequest": { + "type": "object", + "properties": { + "state": { + "type": "string" } } }, - "accountChangePasswordRequest": { + "makeBucketRequest": { "type": "object", "required": [ - "current_secret_key", - "new_secret_key" + "name" ], "properties": { - "current_secret_key": { - "type": "string" - }, - "new_secret_key": { + "name": { "type": "string" } } }, - "addBucketReplication": { + "makeBucketsResponse": { "type": "object", "properties": { - "arn": { - "type": "string" - }, - "destination_bucket": { + "bucketName": { "type": "string" } } }, - "addGroupRequest": { + "maxShareLinkExpResponse": { "type": "object", "required": [ - "group", - "members" + "exp" ], "properties": { - "group": { - "type": "string" - }, - "members": { - "type": "array", - "items": { - "type": "string" - } + "exp": { + "type": "number", + "format": "int64" } } }, - "addPolicyRequest": { + "metadata": { "type": "object", - "required": [ - "name", - "policy" - ], "properties": { - "name": { - "type": "string" - }, - "policy": { - "type": "string" + "objectMetadata": { + "type": "object", + "additionalProperties": true } } }, - "addUserRequest": { - "type": "object", + "multiBucketReplication": { "required": [ "accessKey", "secretKey", - "groups", - "policies" + "targetURL", + "bucketsRelation" ], "properties": { "accessKey": { - "type": "string" + "type": "string", + "minLength": 3 }, - "groups": { + "bandwidth": { + "type": "integer", + "format": "int64" + }, + "bucketsRelation": { "type": "array", + "minLength": 1, "items": { - "type": "string" + "$ref": "#/definitions/multiBucketsRelation" } }, - "policies": { - "type": "array", - "items": { - "type": "string" - } + "healthCheckPeriod": { + "type": "integer", + "format": "int32" + }, + "prefix": { + "type": "string" + }, + "priority": { + "type": "integer", + "format": "int32", + "default": 0 + }, + "region": { + "type": "string" + }, + "replicateDeleteMarkers": { + "type": "boolean" + }, + "replicateDeletes": { + "type": "boolean" + }, + "replicateExistingObjects": { + "type": "boolean" + }, + "replicateMetadata": { + "type": "boolean" }, "secretKey": { + "type": "string", + "minLength": 8 + }, + "storageClass": { + "type": "string", + "default": "" + }, + "syncMode": { + "type": "string", + "default": "async", + "enum": [ + "async", + "sync" + ] + }, + "tags": { + "type": "string" + }, + "targetURL": { "type": "string" } } }, - "adminInfoResponse": { - "type": "object", + "multiBucketReplicationEdit": { "properties": { - "advancedMetricsStatus": { - "type": "string", - "enum": [ - "not configured", - "available", - "unavailable" - ] + "arn": { + "type": "string" }, - "backend": { - "$ref": "#/definitions/BackendProperties" + "prefix": { + "type": "string" }, - "buckets": { - "type": "integer" + "priority": { + "type": "integer", + "format": "int32", + "default": 0 }, - "objects": { - "type": "integer" + "replicateDeleteMarkers": { + "type": "boolean" }, - "servers": { - "type": "array", - "items": { - "$ref": "#/definitions/serverProperties" - } + "replicateDeletes": { + "type": "boolean" }, - "usage": { - "type": "integer" + "replicateExistingObjects": { + "type": "boolean" }, - "widgets": { - "type": "array", - "items": { - "$ref": "#/definitions/widget" - } + "replicateMetadata": { + "type": "boolean" + }, + "ruleState": { + "type": "boolean" + }, + "storageClass": { + "type": "string", + "default": "" + }, + "tags": { + "type": "string", + "default": "" } } }, - "apiKey": { + "multiBucketResponseItem": { "type": "object", "properties": { - "apiKey": { + "errorString": { + "type": "string" + }, + "originBucket": { + "type": "string" + }, + "targetBucket": { "type": "string" } } }, - "arnsResponse": { + "multiBucketResponseState": { "type": "object", "properties": { - "arns": { + "replicationState": { "type": "array", "items": { - "type": "string" + "$ref": "#/definitions/multiBucketResponseItem" } } } }, - "bucket": { + "multiBucketsRelation": { "type": "object", - "required": [ - "name" - ], "properties": { - "access": { - "$ref": "#/definitions/bucketAccess" - }, - "creation_date": { + "destinationBucket": { "type": "string" }, - "definition": { + "originBucket": { "type": "string" - }, - "details": { - "type": "object", - "properties": { - "locking": { - "type": "boolean" - }, - "quota": { - "type": "object", - "properties": { - "quota": { - "type": "integer", - "format": "int64" - }, - "type": { - "type": "string", - "enum": [ - "hard" - ] - } - } - }, - "replication": { - "type": "boolean" - }, - "tags": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "versioning": { - "type": "boolean" - }, - "versioningSuspended": { - "type": "boolean" - } - } - }, - "name": { - "type": "string", - "minLength": 3 - }, - "objects": { - "type": "integer", - "format": "int64" - }, - "rw_access": { - "type": "object", - "properties": { - "read": { - "type": "boolean" - }, - "write": { - "type": "boolean" - } - } - }, - "size": { - "type": "integer", - "format": "int64" } } }, - "bucketAccess": { + "nofiticationService": { "type": "string", - "default": "PRIVATE", "enum": [ - "PRIVATE", - "PUBLIC", - "CUSTOM" + "webhook", + "amqp", + "kafka", + "mqtt", + "nats", + "nsq", + "mysql", + "postgres", + "elasticsearch", + "redis" ] }, - "bucketEncryptionInfo": { + "notifEndpointResponse": { "type": "object", "properties": { - "algorithm": { - "type": "string" - }, - "kmsMasterKeyID": { - "type": "string" + "notification_endpoints": { + "type": "array", + "items": { + "$ref": "#/definitions/notificationEndpointItem" + } } } }, - "bucketEncryptionRequest": { + "notificationConfig": { "type": "object", + "required": [ + "arn" + ], "properties": { - "encType": { - "$ref": "#/definitions/bucketEncryptionType" + "arn": { + "type": "string" }, - "kmsKeyID": { + "events": { + "type": "array", + "title": "filter specific type of event. Defaults to all event (default: '[put,delete,get]')", + "items": { + "$ref": "#/definitions/notificationEventType" + } + }, + "id": { "type": "string" + }, + "prefix": { + "type": "string", + "title": "filter event associated to the specified prefix" + }, + "suffix": { + "type": "string", + "title": "filter event associated to the specified suffix" } } }, - "bucketEncryptionType": { - "type": "string", - "default": "sse-s3", - "enum": [ - "sse-s3", - "sse-kms" - ] - }, - "bucketEventRequest": { + "notificationDeleteRequest": { "type": "object", "required": [ - "configuration" + "events", + "prefix", + "suffix" ], "properties": { - "configuration": { - "$ref": "#/definitions/notificationConfig" + "events": { + "type": "array", + "title": "filter specific type of event. Defaults to all event (default: '[put,delete,get]')", + "minLength": 1, + "items": { + "$ref": "#/definitions/notificationEventType" + } }, - "ignoreExisting": { - "type": "boolean" - } - } - }, - "bucketObLockingResponse": { - "type": "object", - "properties": { - "object_locking_enabled": { - "type": "boolean" + "prefix": { + "type": "string", + "title": "filter event associated to the specified prefix" + }, + "suffix": { + "type": "string", + "title": "filter event associated to the specified suffix" } } }, - "bucketObject": { + "notificationEndpoint": { "type": "object", + "required": [ + "service", + "account_id", + "properties" + ], "properties": { - "content_type": { - "type": "string" - }, - "etag": { - "type": "string" - }, - "expiration": { - "type": "string" - }, - "expiration_rule_id": { - "type": "string" - }, - "is_delete_marker": { - "type": "boolean" - }, - "is_latest": { - "type": "boolean" - }, - "last_modified": { - "type": "string" - }, - "legal_hold_status": { - "type": "string" - }, - "metadata": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "name": { - "type": "string" - }, - "retention_mode": { - "type": "string" - }, - "retention_until_date": { + "account_id": { "type": "string" }, - "size": { - "type": "integer", - "format": "int64" - }, - "tags": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "user_metadata": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "user_tags": { + "properties": { "type": "object", "additionalProperties": { "type": "string" } }, - "version_id": { - "type": "string" + "service": { + "$ref": "#/definitions/nofiticationService" } } }, - "bucketQuota": { + "notificationEndpointItem": { "type": "object", "properties": { - "quota": { - "type": "integer" + "account_id": { + "type": "string" }, - "type": { - "type": "string", - "enum": [ - "hard" - ] + "service": { + "$ref": "#/definitions/nofiticationService" + }, + "status": { + "type": "string" } } }, - "bucketReplicationDestination": { + "notificationEventType": { + "type": "string", + "enum": [ + "put", + "delete", + "get", + "replica", + "ilm", + "scanner" + ] + }, + "objectLegalHoldStatus": { + "type": "string", + "enum": [ + "enabled", + "disabled" + ] + }, + "objectRetentionMode": { + "type": "string", + "enum": [ + "governance", + "compliance" + ] + }, + "objectRetentionUnit": { + "type": "string", + "enum": [ + "days", + "years" + ] + }, + "peerInfo": { "type": "object", "properties": { - "bucket": { + "deploymentID": { + "type": "string" + }, + "endpoint": { + "type": "string" + }, + "name": { "type": "string" } } }, - "bucketReplicationResponse": { + "peerInfoRemove": { "type": "object", + "required": [ + "sites" + ], "properties": { - "rules": { + "all": { + "type": "boolean" + }, + "sites": { "type": "array", "items": { - "$ref": "#/definitions/bucketReplicationRule" + "type": "string" } } } }, - "bucketReplicationRule": { + "peerSite": { "type": "object", "properties": { - "bandwidth": { + "accessKey": { "type": "string" }, - "delete_marker_replication": { - "type": "boolean" - }, - "deletes_replication": { - "type": "boolean" - }, - "destination": { - "$ref": "#/definitions/bucketReplicationDestination" - }, - "existingObjects": { - "type": "boolean" - }, - "healthCheckPeriod": { - "type": "integer" - }, - "id": { + "endpoint": { "type": "string" }, - "metadata_replication": { - "type": "boolean" - }, - "prefix": { + "name": { "type": "string" }, - "priority": { - "type": "integer", - "format": "int32" + "secretKey": { + "type": "string" + } + } + }, + "peerSiteEditResponse": { + "type": "object", + "properties": { + "errorDetail": { + "type": "string" }, "status": { - "type": "string", - "enum": [ - "Enabled", - "Disabled" - ] - }, - "storageClass": { "type": "string" }, - "syncMode": { - "type": "string", - "default": "async", - "enum": [ - "async", - "sync" - ] + "success": { + "type": "boolean" + } + } + }, + "peerSiteRemoveResponse": { + "type": "object", + "properties": { + "errorDetail": { + "type": "string" }, - "tags": { + "status": { "type": "string" } } }, - "bucketReplicationRuleList": { + "permissionResource": { "type": "object", "properties": { - "rules": { + "conditionOperator": { + "type": "string" + }, + "prefixes": { "type": "array", "items": { "type": "string" } + }, + "resource": { + "type": "string" } } }, - "bucketVersioningResponse": { + "policy": { "type": "object", "properties": { - "MFADelete": { + "name": { "type": "string" }, - "excludeFolders": { - "type": "boolean" - }, - "excludedPrefixes": { - "type": "array", - "items": { - "type": "object", - "properties": { - "prefix": { - "type": "string" - } - } - } - }, - "status": { - "type": "string" - } - } - }, - "bulkUserGroups": { - "type": "object", - "required": [ - "users", - "groups" - ], - "properties": { - "groups": { - "type": "array", - "items": { - "type": "string" - } - }, - "users": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "callHomeGetResponse": { - "type": "object", - "properties": { - "diagnosticsStatus": { - "type": "boolean" - }, - "logsStatus": { - "type": "boolean" - } - } - }, - "callHomeSetStatus": { - "type": "object", - "required": [ - "diagState", - "logsState" - ], - "properties": { - "diagState": { - "type": "boolean" - }, - "logsState": { - "type": "boolean" - } - } - }, - "changeUserPasswordRequest": { - "type": "object", - "required": [ - "selectedUser", - "newSecretKey" - ], - "properties": { - "newSecretKey": { - "type": "string" - }, - "selectedUser": { + "policy": { "type": "string" } } }, - "configDescription": { + "policyArgs": { "type": "object", "properties": { - "description": { + "action": { "type": "string" }, - "key": { - "type": "string" - } - } - }, - "configExportResponse": { - "type": "object", - "properties": { - "status": { + "bucket_name": { "type": "string" }, - "value": { - "description": "Returns base64 encoded value", + "id": { "type": "string" } } }, - "configuration": { - "type": "object", - "properties": { - "key_values": { - "type": "array", - "items": { - "$ref": "#/definitions/configurationKV" - } - }, - "name": { - "type": "string" - } - } + "policyEntity": { + "type": "string", + "default": "user", + "enum": [ + "user", + "group" + ] }, - "configurationKV": { + "prefixAccessPair": { "type": "object", "properties": { - "env_override": { - "$ref": "#/definitions/envOverride" - }, - "key": { - "type": "string" - }, - "value": { - "type": "string" - } - } - }, - "createRemoteBucket": { - "required": [ - "accessKey", - "secretKey", - "targetURL", - "sourceBucket", - "targetBucket" - ], - "properties": { - "accessKey": { - "type": "string", - "minLength": 3 - }, - "bandwidth": { - "type": "integer", - "format": "int64" - }, - "healthCheckPeriod": { - "type": "integer", - "format": "int32" - }, - "region": { - "type": "string" - }, - "secretKey": { - "type": "string", - "minLength": 8 - }, - "sourceBucket": { - "type": "string" - }, - "syncMode": { - "type": "string", - "default": "async", - "enum": [ - "async", - "sync" - ] - }, - "targetBucket": { + "access": { "type": "string" }, - "targetURL": { + "prefix": { "type": "string" } } }, - "deleteFile": { + "prefixWrapper": { "type": "object", "properties": { - "path": { - "type": "string" - }, - "recursive": { - "type": "boolean" - }, - "versionID": { + "prefix": { "type": "string" } } }, - "envOverride": { + "principal": { "type": "object", "properties": { - "name": { - "type": "string" - }, - "value": { + "STSAccessKeyID": { "type": "string" - } - } - }, - "environmentConstants": { - "type": "object", - "properties": { - "maxConcurrentDownloads": { - "type": "integer" - }, - "maxConcurrentUploads": { - "type": "integer" - } - } - }, - "getBucketRetentionConfig": { - "type": "object", - "properties": { - "mode": { - "$ref": "#/definitions/objectRetentionMode" - }, - "unit": { - "$ref": "#/definitions/objectRetentionUnit" - }, - "validity": { - "type": "integer", - "format": "int32" - } - } - }, - "group": { - "type": "object", - "properties": { - "members": { - "type": "array", - "items": { - "type": "string" - } }, - "name": { + "STSSecretAccessKey": { "type": "string" }, - "policy": { + "STSSessionToken": { "type": "string" }, - "status": { + "accountAccessKey": { "type": "string" - } - } - }, - "iamEntity": { - "type": "string" - }, - "iamPolicy": { - "type": "object", - "properties": { - "statement": { - "type": "array", - "items": { - "$ref": "#/definitions/iamPolicyStatement" - } }, - "version": { + "customStyleOb": { "type": "string" - } - } - }, - "iamPolicyStatement": { - "type": "object", - "properties": { - "action": { - "type": "array", - "items": { - "type": "string" - } }, - "condition": { - "type": "object", - "additionalProperties": { - "type": "object" - } - }, - "effect": { - "type": "string" - }, - "resource": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "idpListConfigurationsResponse": { - "type": "object", - "properties": { - "results": { - "type": "array", - "items": { - "$ref": "#/definitions/idpServerConfiguration" - } - } - } - }, - "idpServerConfiguration": { - "type": "object", - "properties": { - "enabled": { - "type": "boolean" - }, - "info": { - "type": "array", - "items": { - "$ref": "#/definitions/idpServerConfigurationInfo" - } - }, - "input": { - "type": "string" - }, - "name": { - "type": "string" - }, - "type": { - "type": "string" - } - } - }, - "idpServerConfigurationInfo": { - "type": "object", - "properties": { - "isCfg": { - "type": "boolean" - }, - "isEnv": { - "type": "boolean" - }, - "key": { - "type": "string" - }, - "value": { - "type": "string" - } - } - }, - "kmsAPI": { - "type": "object", - "properties": { - "maxBody": { - "type": "integer" - }, - "method": { - "type": "string" - }, - "path": { - "type": "string" - }, - "timeout": { - "type": "integer" - } - } - }, - "kmsAPIsResponse": { - "type": "object", - "properties": { - "results": { - "type": "array", - "items": { - "$ref": "#/definitions/kmsAPI" - } - } - } - }, - "kmsCreateKeyRequest": { - "type": "object", - "required": [ - "key" - ], - "properties": { - "key": { - "type": "string" - } - } - }, - "kmsEndpoint": { - "type": "object", - "properties": { - "status": { - "type": "string" - }, - "url": { - "type": "string" - } - } - }, - "kmsKeyInfo": { - "type": "object", - "properties": { - "createdAt": { - "type": "string" - }, - "createdBy": { - "type": "string" - }, - "name": { - "type": "string" - } - } - }, - "kmsKeyStatusResponse": { - "type": "object", - "properties": { - "decryptionErr": { - "type": "string" - }, - "encryptionErr": { - "type": "string" - }, - "keyID": { - "type": "string" - } - } - }, - "kmsLatencyHistogram": { - "type": "object", - "properties": { - "duration": { - "type": "integer" - }, - "total": { - "type": "integer" - } - } - }, - "kmsListKeysResponse": { - "type": "object", - "properties": { - "results": { - "type": "array", - "items": { - "$ref": "#/definitions/kmsKeyInfo" - } - } - } - }, - "kmsMetricsResponse": { - "type": "object", - "required": [ - "requestOK", - "requestErr", - "requestFail", - "requestActive", - "auditEvents", - "errorEvents", - "latencyHistogram", - "uptime", - "cpus", - "usableCPUs", - "threads", - "heapAlloc", - "stackAlloc" - ], - "properties": { - "auditEvents": { - "type": "integer" - }, - "cpus": { - "type": "integer" - }, - "errorEvents": { - "type": "integer" - }, - "heapAlloc": { - "type": "integer" - }, - "heapObjects": { - "type": "integer" - }, - "latencyHistogram": { - "type": "array", - "items": { - "$ref": "#/definitions/kmsLatencyHistogram" - } - }, - "requestActive": { - "type": "integer" - }, - "requestErr": { - "type": "integer" - }, - "requestFail": { - "type": "integer" - }, - "requestOK": { - "type": "integer" - }, - "stackAlloc": { - "type": "integer" - }, - "threads": { - "type": "integer" - }, - "uptime": { - "type": "integer" - }, - "usableCPUs": { - "type": "integer" - } - } - }, - "kmsStatusResponse": { - "type": "object", - "properties": { - "defaultKeyID": { - "type": "string" - }, - "endpoints": { - "type": "array", - "items": { - "$ref": "#/definitions/kmsEndpoint" - } - }, - "name": { - "type": "string" - } - } - }, - "kmsVersionResponse": { - "type": "object", - "properties": { - "version": { - "type": "string" - } - } - }, - "ldapEntities": { - "type": "object", - "properties": { - "groups": { - "type": "array", - "items": { - "$ref": "#/definitions/ldapGroupPolicyEntity" - } - }, - "policies": { - "type": "array", - "items": { - "$ref": "#/definitions/ldapPolicyEntity" - } - }, - "timestamp": { - "type": "string" - }, - "users": { - "type": "array", - "items": { - "$ref": "#/definitions/ldapUserPolicyEntity" - } - } - } - }, - "ldapEntitiesRequest": { - "type": "object", - "properties": { - "groups": { - "type": "array", - "items": { - "type": "string" - } - }, - "policies": { - "type": "array", - "items": { - "type": "string" - } - }, - "users": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "ldapGroupPolicyEntity": { - "type": "object", - "properties": { - "group": { - "type": "string" - }, - "policies": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "ldapPolicyEntity": { - "type": "object", - "properties": { - "groups": { - "type": "array", - "items": { - "type": "string" - } - }, - "policy": { - "type": "string" - }, - "users": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "ldapUserPolicyEntity": { - "type": "object", - "properties": { - "policies": { - "type": "array", - "items": { - "type": "string" - } - }, - "user": { - "type": "string" - } - } - }, - "license": { - "type": "object", - "properties": { - "account_id": { - "type": "integer" - }, - "email": { - "type": "string" - }, - "expires_at": { - "type": "string" - }, - "organization": { - "type": "string" - }, - "plan": { - "type": "string" - }, - "storage_capacity": { - "type": "integer" - } - } - }, - "listAccessRulesResponse": { - "type": "object", - "properties": { - "accessRules": { - "type": "array", - "title": "list of policies", - "items": { - "$ref": "#/definitions/accessRule" - } - }, - "total": { - "type": "integer", - "format": "int64", - "title": "total number of policies" - } - } - }, - "listBucketEventsResponse": { - "type": "object", - "properties": { - "events": { - "type": "array", - "items": { - "$ref": "#/definitions/notificationConfig" - } - }, - "total": { - "type": "integer", - "format": "int64", - "title": "total number of bucket events" - } - } - }, - "listBucketsResponse": { - "type": "object", - "properties": { - "buckets": { - "type": "array", - "title": "list of resulting buckets", - "items": { - "$ref": "#/definitions/bucket" - } - }, - "total": { - "type": "integer", - "format": "int64", - "title": "number of buckets accessible to the user" - } - } - }, - "listConfigResponse": { - "type": "object", - "properties": { - "configurations": { - "type": "array", - "items": { - "$ref": "#/definitions/configDescription" - } - }, - "total": { - "type": "integer", - "format": "int64", - "title": "total number of configurations" - } - } - }, - "listExternalBucketsParams": { - "required": [ - "accessKey", - "secretKey", - "targetURL", - "useTLS" - ], - "properties": { - "accessKey": { - "type": "string", - "minLength": 3 - }, - "region": { - "type": "string" - }, - "secretKey": { - "type": "string", - "minLength": 8 - }, - "targetURL": { - "type": "string" - }, - "useTLS": { - "type": "boolean" - } - } - }, - "listGroupsResponse": { - "type": "object", - "properties": { - "groups": { - "type": "array", - "title": "list of groups", - "items": { - "type": "string" - } - }, - "total": { - "type": "integer", - "format": "int64", - "title": "total number of groups" - } - } - }, - "listObjectsResponse": { - "type": "object", - "properties": { - "objects": { - "type": "array", - "title": "list of resulting objects", - "items": { - "$ref": "#/definitions/bucketObject" - } - }, - "total": { - "type": "integer", - "format": "int64", - "title": "number of objects" - } - } - }, - "listPoliciesResponse": { - "type": "object", - "properties": { - "policies": { - "type": "array", - "title": "list of policies", - "items": { - "$ref": "#/definitions/policy" - } - }, - "total": { - "type": "integer", - "format": "int64", - "title": "total number of policies" - } - } - }, - "listRemoteBucketsResponse": { - "type": "object", - "properties": { - "buckets": { - "type": "array", - "title": "list of remote buckets", - "items": { - "$ref": "#/definitions/remoteBucket" - } - }, - "total": { - "type": "integer", - "format": "int64", - "title": "number of remote buckets accessible to user" - } - } - }, - "listUsersResponse": { - "type": "object", - "properties": { - "users": { - "type": "array", - "title": "list of resulting users", - "items": { - "$ref": "#/definitions/user" - } - } - } - }, - "logSearchResponse": { - "type": "object", - "properties": { - "results": { - "type": "object", - "title": "list of log search responses" - } - } - }, - "loginDetails": { - "type": "object", - "properties": { - "animatedLogin": { - "type": "boolean" - }, - "isK8S": { - "type": "boolean" - }, - "loginStrategy": { - "type": "string", - "enum": [ - "form", - "redirect", - "service-account", - "redirect-service-account" - ] - }, - "redirectRules": { - "type": "array", - "items": { - "$ref": "#/definitions/redirectRule" - } - } - } - }, - "loginOauth2AuthRequest": { - "type": "object", - "required": [ - "state", - "code" - ], - "properties": { - "code": { - "type": "string" - }, - "state": { - "type": "string" - } - } - }, - "loginRequest": { - "type": "object", - "properties": { - "accessKey": { - "type": "string" - }, - "features": { - "type": "object", - "properties": { - "hide_menu": { - "type": "boolean" - } - } - }, - "secretKey": { - "type": "string" - }, - "sts": { - "type": "string" - } - } - }, - "loginResponse": { - "type": "object", - "properties": { - "IDPRefreshToken": { - "type": "string" - }, - "sessionId": { - "type": "string" - } - } - }, - "logoutRequest": { - "type": "object", - "properties": { - "state": { - "type": "string" - } - } - }, - "makeBucketRequest": { - "type": "object", - "required": [ - "name" - ], - "properties": { - "locking": { - "type": "boolean" - }, - "name": { - "type": "string" - }, - "quota": { - "$ref": "#/definitions/setBucketQuota" - }, - "retention": { - "$ref": "#/definitions/putBucketRetentionRequest" - }, - "versioning": { - "$ref": "#/definitions/setBucketVersioning" - } - } - }, - "makeBucketsResponse": { - "type": "object", - "properties": { - "bucketName": { - "type": "string" - } - } - }, - "maxShareLinkExpResponse": { - "type": "object", - "required": [ - "exp" - ], - "properties": { - "exp": { - "type": "number", - "format": "int64" - } - } - }, - "metadata": { - "type": "object", - "properties": { - "objectMetadata": { - "type": "object", - "additionalProperties": true - } - } - }, - "multiBucketReplication": { - "required": [ - "accessKey", - "secretKey", - "targetURL", - "bucketsRelation" - ], - "properties": { - "accessKey": { - "type": "string", - "minLength": 3 - }, - "bandwidth": { - "type": "integer", - "format": "int64" - }, - "bucketsRelation": { - "type": "array", - "minLength": 1, - "items": { - "$ref": "#/definitions/multiBucketsRelation" - } - }, - "healthCheckPeriod": { - "type": "integer", - "format": "int32" - }, - "prefix": { - "type": "string" - }, - "priority": { - "type": "integer", - "format": "int32", - "default": 0 - }, - "region": { - "type": "string" - }, - "replicateDeleteMarkers": { - "type": "boolean" - }, - "replicateDeletes": { - "type": "boolean" - }, - "replicateExistingObjects": { - "type": "boolean" - }, - "replicateMetadata": { - "type": "boolean" - }, - "secretKey": { - "type": "string", - "minLength": 8 - }, - "storageClass": { - "type": "string", - "default": "" - }, - "syncMode": { - "type": "string", - "default": "async", - "enum": [ - "async", - "sync" - ] - }, - "tags": { - "type": "string" - }, - "targetURL": { - "type": "string" - } - } - }, - "multiBucketReplicationEdit": { - "properties": { - "arn": { - "type": "string" - }, - "prefix": { - "type": "string" - }, - "priority": { - "type": "integer", - "format": "int32", - "default": 0 - }, - "replicateDeleteMarkers": { - "type": "boolean" - }, - "replicateDeletes": { - "type": "boolean" - }, - "replicateExistingObjects": { - "type": "boolean" - }, - "replicateMetadata": { - "type": "boolean" - }, - "ruleState": { - "type": "boolean" - }, - "storageClass": { - "type": "string", - "default": "" - }, - "tags": { - "type": "string", - "default": "" - } - } - }, - "multiBucketResponseItem": { - "type": "object", - "properties": { - "errorString": { - "type": "string" - }, - "originBucket": { - "type": "string" - }, - "targetBucket": { - "type": "string" - } - } - }, - "multiBucketResponseState": { - "type": "object", - "properties": { - "replicationState": { - "type": "array", - "items": { - "$ref": "#/definitions/multiBucketResponseItem" - } - } - } - }, - "multiBucketsRelation": { - "type": "object", - "properties": { - "destinationBucket": { - "type": "string" - }, - "originBucket": { - "type": "string" - } - } - }, - "nofiticationService": { - "type": "string", - "enum": [ - "webhook", - "amqp", - "kafka", - "mqtt", - "nats", - "nsq", - "mysql", - "postgres", - "elasticsearch", - "redis" - ] - }, - "notifEndpointResponse": { - "type": "object", - "properties": { - "notification_endpoints": { - "type": "array", - "items": { - "$ref": "#/definitions/notificationEndpointItem" - } - } - } - }, - "notificationConfig": { - "type": "object", - "required": [ - "arn" - ], - "properties": { - "arn": { - "type": "string" - }, - "events": { - "type": "array", - "title": "filter specific type of event. Defaults to all event (default: '[put,delete,get]')", - "items": { - "$ref": "#/definitions/notificationEventType" - } - }, - "id": { - "type": "string" - }, - "prefix": { - "type": "string", - "title": "filter event associated to the specified prefix" - }, - "suffix": { - "type": "string", - "title": "filter event associated to the specified suffix" - } - } - }, - "notificationDeleteRequest": { - "type": "object", - "required": [ - "events", - "prefix", - "suffix" - ], - "properties": { - "events": { - "type": "array", - "title": "filter specific type of event. Defaults to all event (default: '[put,delete,get]')", - "minLength": 1, - "items": { - "$ref": "#/definitions/notificationEventType" - } - }, - "prefix": { - "type": "string", - "title": "filter event associated to the specified prefix" - }, - "suffix": { - "type": "string", - "title": "filter event associated to the specified suffix" - } - } - }, - "notificationEndpoint": { - "type": "object", - "required": [ - "service", - "account_id", - "properties" - ], - "properties": { - "account_id": { - "type": "string" - }, - "properties": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "service": { - "$ref": "#/definitions/nofiticationService" - } - } - }, - "notificationEndpointItem": { - "type": "object", - "properties": { - "account_id": { - "type": "string" - }, - "service": { - "$ref": "#/definitions/nofiticationService" - }, - "status": { - "type": "string" - } - } - }, - "notificationEventType": { - "type": "string", - "enum": [ - "put", - "delete", - "get", - "replica", - "ilm", - "scanner" - ] - }, - "objectLegalHoldStatus": { - "type": "string", - "enum": [ - "enabled", - "disabled" - ] - }, - "objectRetentionMode": { - "type": "string", - "enum": [ - "governance", - "compliance" - ] - }, - "objectRetentionUnit": { - "type": "string", - "enum": [ - "days", - "years" - ] - }, - "peerInfo": { - "type": "object", - "properties": { - "deploymentID": { - "type": "string" - }, - "endpoint": { - "type": "string" - }, - "name": { - "type": "string" - } - } - }, - "peerInfoRemove": { - "type": "object", - "required": [ - "sites" - ], - "properties": { - "all": { - "type": "boolean" - }, - "sites": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "peerSite": { - "type": "object", - "properties": { - "accessKey": { - "type": "string" - }, - "endpoint": { - "type": "string" - }, - "name": { - "type": "string" - }, - "secretKey": { - "type": "string" - } - } - }, - "peerSiteEditResponse": { - "type": "object", - "properties": { - "errorDetail": { - "type": "string" - }, - "status": { - "type": "string" - }, - "success": { - "type": "boolean" - } - } - }, - "peerSiteRemoveResponse": { - "type": "object", - "properties": { - "errorDetail": { - "type": "string" - }, - "status": { - "type": "string" - } - } - }, - "permissionResource": { - "type": "object", - "properties": { - "conditionOperator": { - "type": "string" - }, - "prefixes": { - "type": "array", - "items": { - "type": "string" - } - }, - "resource": { - "type": "string" - } - } - }, - "policy": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "policy": { - "type": "string" - } - } - }, - "policyArgs": { - "type": "object", - "properties": { - "action": { - "type": "string" - }, - "bucket_name": { - "type": "string" - }, - "id": { - "type": "string" - } - } - }, - "policyEntity": { - "type": "string", - "default": "user", - "enum": [ - "user", - "group" - ] - }, - "prefixAccessPair": { - "type": "object", - "properties": { - "access": { - "type": "string" - }, - "prefix": { - "type": "string" - } - } - }, - "prefixWrapper": { - "type": "object", - "properties": { - "prefix": { - "type": "string" - } - } - }, - "principal": { - "type": "object", - "properties": { - "STSAccessKeyID": { - "type": "string" - }, - "STSSecretAccessKey": { - "type": "string" - }, - "STSSessionToken": { - "type": "string" - }, - "accountAccessKey": { - "type": "string" - }, - "customStyleOb": { - "type": "string" - }, - "hm": { - "type": "boolean" - }, - "ob": { - "type": "boolean" - } - } - }, - "profilingStartRequest": { - "type": "object", - "required": [ - "type" - ], - "properties": { - "type": { - "type": "string" - } - } - }, - "putBucketRetentionRequest": { - "type": "object", - "required": [ - "mode", - "unit", - "validity" - ], - "properties": { - "mode": { - "$ref": "#/definitions/objectRetentionMode" - }, - "unit": { - "$ref": "#/definitions/objectRetentionUnit" - }, - "validity": { - "type": "integer", - "format": "int32" - } - } - }, - "putBucketTagsRequest": { - "type": "object", - "properties": { - "tags": { - "additionalProperties": { - "type": "string" - } - } - } - }, - "putObjectLegalHoldRequest": { - "type": "object", - "required": [ - "status" - ], - "properties": { - "status": { - "$ref": "#/definitions/objectLegalHoldStatus" - } - } - }, - "putObjectRetentionRequest": { - "type": "object", - "required": [ - "mode", - "expires" - ], - "properties": { - "expires": { - "type": "string" - }, - "governance_bypass": { - "type": "boolean" - }, - "mode": { - "$ref": "#/definitions/objectRetentionMode" - } - } - }, - "putObjectTagsRequest": { - "type": "object", - "properties": { - "tags": { - "additionalProperties": { - "type": "string" - } - } - } - }, - "redirectRule": { - "type": "object", - "properties": { - "displayName": { - "type": "string" - }, - "redirect": { - "type": "string" - }, - "serviceType": { - "type": "string" - } - } - }, - "releaseAuthor": { - "type": "object", - "properties": { - "avatar_url": { - "type": "string" - }, - "events_url": { - "type": "string" - }, - "followers_url": { - "type": "string" - }, - "following_url": { - "type": "string" - }, - "gists_url": { - "type": "string" - }, - "gravatar_id": { - "type": "string" - }, - "html_url": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "login": { - "type": "string" - }, - "node_id": { - "type": "string" - }, - "organizations_url": { - "type": "string" - }, - "receivedEvents_url": { - "type": "string" - }, - "repos_url": { - "type": "string" - }, - "site_admin": { - "type": "boolean" - }, - "starred_url": { - "type": "string" - }, - "subscriptions_url": { - "type": "string" - }, - "type": { - "type": "string" - }, - "url": { - "type": "string" - } - } - }, - "releaseInfo": { - "type": "object", - "properties": { - "breakingChangesContent": { - "type": "string" - }, - "contextContent": { - "type": "string" - }, - "metadata": { - "$ref": "#/definitions/releaseMetadata" - }, - "newFeaturesContent": { - "type": "string" - }, - "notesContent": { - "type": "string" - }, - "securityContent": { - "type": "string" - } - } - }, - "releaseListResponse": { - "type": "object", - "properties": { - "results": { - "type": "array", - "items": { - "$ref": "#/definitions/releaseInfo" - } - } - } - }, - "releaseMetadata": { - "type": "object", - "properties": { - "assets_url": { - "type": "string" - }, - "author": { - "$ref": "#/definitions/releaseAuthor" - }, - "created_at": { - "type": "string" - }, - "draft": { - "type": "boolean" - }, - "html_url": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "name": { - "type": "string" - }, - "node_id": { - "type": "string" - }, - "prerelease": { - "type": "boolean" - }, - "published_at": { - "type": "string" - }, - "tag_name": { - "type": "string" - }, - "tarball_url": { - "type": "string" - }, - "target_commitish": { - "type": "string" - }, - "upload_url": { - "type": "string" - }, - "url": { - "type": "string" - }, - "zipball_url": { - "type": "string" - } - } - }, - "remoteBucket": { - "type": "object", - "required": [ - "accessKey", - "sourceBucket", - "remoteARN" - ], - "properties": { - "accessKey": { - "type": "string", - "minLength": 3 - }, - "bandwidth": { - "type": "integer", - "format": "int64" - }, - "healthCheckPeriod": { - "type": "integer" - }, - "remoteARN": { - "type": "string" - }, - "secretKey": { - "type": "string", - "minLength": 8 - }, - "service": { - "type": "string", - "enum": [ - "replication" - ] - }, - "sourceBucket": { - "type": "string" - }, - "status": { - "type": "string" - }, - "syncMode": { - "type": "string" - }, - "targetBucket": { - "type": "string" - }, - "targetURL": { - "type": "string" - } - } - }, - "resultTarget": { - "type": "object", - "properties": { - "legendFormat": { - "type": "string" - }, - "result": { - "type": "array", - "items": { - "$ref": "#/definitions/widgetResult" - } - }, - "resultType": { - "type": "string" - } - } - }, - "rewindItem": { - "type": "object", - "properties": { - "action": { - "type": "string" - }, - "delete_flag": { - "type": "boolean" - }, - "is_latest": { - "type": "boolean" - }, - "last_modified": { - "type": "string" - }, - "name": { - "type": "string" - }, - "size": { - "type": "integer", - "format": "int64" - }, - "version_id": { - "type": "string" - } - } - }, - "rewindResponse": { - "type": "object", - "properties": { - "objects": { - "type": "array", - "items": { - "$ref": "#/definitions/rewindItem" - } - } - } - }, - "selectedSAs": { - "type": "array", - "items": { - "type": "string" - } - }, - "selectedUsers": { - "type": "array", - "items": { - "type": "string" - } - }, - "serverDrives": { - "type": "object", - "properties": { - "availableSpace": { - "type": "integer" - }, - "drivePath": { - "type": "string" - }, - "endpoint": { - "type": "string" - }, - "healing": { - "type": "boolean" - }, - "model": { - "type": "string" - }, - "rootDisk": { - "type": "boolean" - }, - "state": { - "type": "string" - }, - "totalSpace": { - "type": "integer" - }, - "usedSpace": { - "type": "integer" - }, - "uuid": { - "type": "string" - } - } - }, - "serverProperties": { - "type": "object", - "properties": { - "commitID": { - "type": "string" - }, - "drives": { - "type": "array", - "items": { - "$ref": "#/definitions/serverDrives" - } - }, - "endpoint": { - "type": "string" - }, - "network": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "poolNumber": { - "type": "integer" - }, - "state": { - "type": "string" - }, - "uptime": { - "type": "integer" - }, - "version": { - "type": "string" - } - } - }, - "serviceAccount": { - "type": "object", - "properties": { - "accountStatus": { - "type": "string" - }, - "description": { - "type": "string" - }, - "expiration": { - "type": "string" - }, - "impliedPolicy": { - "type": "boolean" - }, - "name": { - "type": "string" - }, - "parentUser": { - "type": "string" - }, - "policy": { - "type": "string" - } - } - }, - "serviceAccountCreds": { - "type": "object", - "properties": { - "accessKey": { - "type": "string" - }, - "secretKey": { - "type": "string" - }, - "url": { - "type": "string" - } - } - }, - "serviceAccountRequest": { - "type": "object", - "properties": { - "comment": { - "type": "string" - }, - "description": { - "type": "string" - }, - "expiry": { - "type": "string" - }, - "name": { - "type": "string" - }, - "policy": { - "type": "string", - "title": "policy to be applied to the Service Account if any" - } - } - }, - "serviceAccountRequestCreds": { - "type": "object", - "properties": { - "accessKey": { - "type": "string" - }, - "comment": { - "type": "string" - }, - "description": { - "type": "string" - }, - "expiry": { - "type": "string" - }, - "name": { - "type": "string" - }, - "policy": { - "type": "string", - "title": "policy to be applied to the Service Account if any" - }, - "secretKey": { - "type": "string" - } - } - }, - "serviceAccounts": { - "type": "array", - "items": { - "type": "object", - "properties": { - "accessKey": { - "type": "string" - }, - "accountStatus": { - "type": "string" - }, - "description": { - "type": "string" - }, - "expiration": { - "type": "string" - }, - "name": { - "type": "string" - } - } - } - }, - "sessionResponse": { - "type": "object", - "properties": { - "allowResources": { - "type": "array", - "items": { - "$ref": "#/definitions/permissionResource" - } - }, - "customStyles": { - "type": "string" - }, - "distributedMode": { - "type": "boolean" - }, - "envConstants": { - "$ref": "#/definitions/environmentConstants" - }, - "features": { - "type": "array", - "items": { - "type": "string" - } - }, - "operator": { - "type": "boolean" - }, - "permissions": { - "type": "object", - "additionalProperties": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "serverEndPoint": { - "type": "string" - }, - "status": { - "type": "string", - "enum": [ - "ok" - ] - } - } - }, - "setBucketPolicyRequest": { - "type": "object", - "required": [ - "access" - ], - "properties": { - "access": { - "$ref": "#/definitions/bucketAccess" - }, - "definition": { - "type": "string" - } - } - }, - "setBucketQuota": { - "type": "object", - "required": [ - "enabled" - ], - "properties": { - "amount": { - "type": "integer" - }, - "enabled": { - "type": "boolean" - }, - "quota_type": { - "type": "string", - "enum": [ - "hard" - ] - } - } - }, - "setBucketVersioning": { - "type": "object", - "properties": { - "enabled": { - "type": "boolean" - }, - "excludeFolders": { - "type": "boolean" - }, - "excludePrefixes": { - "type": "array", - "maxLength": 10, - "items": { - "type": "string" - } - } - } - }, - "setConfigRequest": { - "type": "object", - "required": [ - "key_values" - ], - "properties": { - "arn_resource_id": { - "type": "string", - "title": "Used if configuration is an event notification's target" - }, - "key_values": { - "type": "array", - "minItems": 1, - "items": { - "$ref": "#/definitions/configurationKV" - } - } - } - }, - "setConfigResponse": { - "type": "object", - "properties": { - "restart": { - "description": "Returns wheter server needs to restart to apply changes or not", - "type": "boolean" - } - } - }, - "setIDPResponse": { - "type": "object", - "properties": { - "restart": { - "type": "boolean" - } - } - }, - "setNotificationEndpointResponse": { - "type": "object", - "required": [ - "service", - "account_id", - "properties" - ], - "properties": { - "account_id": { - "type": "string" - }, - "properties": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "restart": { - "type": "boolean" - }, - "service": { - "$ref": "#/definitions/nofiticationService" - } - } - }, - "setPolicyMultipleNameRequest": { - "type": "object", - "properties": { - "groups": { - "type": "array", - "items": { - "$ref": "#/definitions/iamEntity" - } - }, - "name": { - "type": "array", - "items": { - "type": "string" - } - }, - "users": { - "type": "array", - "items": { - "$ref": "#/definitions/iamEntity" - } - } - } - }, - "setPolicyNameRequest": { - "type": "object", - "required": [ - "name", - "entityType", - "entityName" - ], - "properties": { - "entityName": { - "type": "string" - }, - "entityType": { - "$ref": "#/definitions/policyEntity" - }, - "name": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "setPolicyRequest": { - "type": "object", - "required": [ - "entityType", - "entityName" - ], - "properties": { - "entityName": { - "type": "string" - }, - "entityType": { - "$ref": "#/definitions/policyEntity" - } - } - }, - "siteReplicationAddRequest": { - "type": "array", - "items": { - "$ref": "#/definitions/peerSite" - } - }, - "siteReplicationAddResponse": { - "type": "object", - "properties": { - "errorDetail": { - "type": "string" - }, - "initialSyncErrorMessage": { - "type": "string" - }, - "status": { - "type": "string" - }, - "success": { - "type": "boolean" - } - } - }, - "siteReplicationInfoResponse": { - "type": "object", - "properties": { - "enabled": { - "type": "boolean" - }, - "name": { - "type": "string" - }, - "serviceAccountAccessKey": { - "type": "string" - }, - "sites": { - "type": "array", - "items": { - "$ref": "#/definitions/peerInfo" - } - } - } - }, - "siteReplicationStatusResponse": { - "type": "object", - "properties": { - "bucketStats": { - "type": "object" - }, - "enabled": { - "type": "boolean" - }, - "groupStats": { - "type": "object" - }, - "maxBuckets": { - "type": "integer" - }, - "maxGroups": { - "type": "integer" - }, - "maxPolicies": { - "type": "integer" - }, - "maxUsers": { - "type": "integer" - }, - "policyStats": { - "type": "object" - }, - "sites": { - "type": "object" - }, - "statsSummary": { - "type": "object" - }, - "userStats": { - "type": "object" - } - } - }, - "startProfilingItem": { - "type": "object", - "properties": { - "error": { - "type": "string" - }, - "nodeName": { - "type": "string" - }, - "success": { - "type": "boolean" - } - } - }, - "startProfilingList": { - "type": "object", - "properties": { - "startResults": { - "type": "array", - "items": { - "$ref": "#/definitions/startProfilingItem" - } - }, - "total": { - "type": "integer", - "format": "int64", - "title": "number of start results" - } - } - }, - "updateGroupRequest": { - "type": "object", - "required": [ - "members", - "status" - ], - "properties": { - "members": { - "type": "array", - "items": { - "type": "string" - } - }, - "status": { - "type": "string" - } - } - }, - "updateServiceAccountRequest": { - "type": "object", - "required": [ - "policy" - ], - "properties": { - "description": { - "type": "string" - }, - "expiry": { - "type": "string" - }, - "name": { - "type": "string" - }, - "policy": { - "type": "string" - }, - "secretKey": { - "type": "string" - }, - "status": { - "type": "string" - } - } - }, - "updateUser": { - "type": "object", - "required": [ - "status", - "groups" - ], - "properties": { - "groups": { - "type": "array", - "items": { - "type": "string" - } - }, - "status": { - "type": "string" - } - } - }, - "updateUserGroups": { - "type": "object", - "required": [ - "groups" - ], - "properties": { - "groups": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "user": { - "type": "object", - "properties": { - "accessKey": { - "type": "string" - }, - "hasPolicy": { - "type": "boolean" - }, - "memberOf": { - "type": "array", - "items": { - "type": "string" - } - }, - "policy": { - "type": "array", - "items": { - "type": "string" - } - }, - "status": { - "type": "string" - } - } - }, - "userSAs": { - "type": "object", - "properties": { - "path": { - "type": "string" - }, - "recursive": { - "type": "boolean" - }, - "versionID": { - "type": "string" - } - } - }, - "userServiceAccountItem": { - "type": "object", - "properties": { - "numSAs": { - "type": "integer", - "format": "int64" - }, - "userName": { - "type": "string" - } - } - }, - "userServiceAccountSummary": { - "type": "object", - "properties": { - "hasSA": { - "type": "boolean" - }, - "userServiceAccountList": { - "type": "array", - "title": "list of users with number of service accounts", - "items": { - "$ref": "#/definitions/userServiceAccountItem" - } - } - } - }, - "widget": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "options": { - "type": "object", - "properties": { - "reduceOptions": { - "type": "object", - "properties": { - "calcs": { - "type": "array", - "items": { - "type": "string" - } - } - } - } - } - }, - "targets": { - "type": "array", - "items": { - "$ref": "#/definitions/resultTarget" - } - }, - "title": { - "type": "string" - }, - "type": { - "type": "string" - } - } - }, - "widgetDetails": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "options": { - "type": "object", - "properties": { - "reduceOptions": { - "type": "object", - "properties": { - "calcs": { - "type": "array", - "items": { - "type": "string" - } - } - } - } - } - }, - "targets": { - "type": "array", - "items": { - "$ref": "#/definitions/resultTarget" - } - }, - "title": { - "type": "string" - }, - "type": { - "type": "string" - } - } - }, - "widgetResult": { - "type": "object", - "properties": { - "metric": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "values": { - "type": "array", - "items": {} - } - } - } - }, - "parameters": { - "limit": { - "type": "number", - "format": "int32", - "default": 20, - "name": "limit", - "in": "query" - }, - "offset": { - "type": "number", - "format": "int32", - "default": 0, - "name": "offset", - "in": "query" - } - }, - "securityDefinitions": { - "anonymous": { - "type": "apiKey", - "name": "X-Anonymous", - "in": "header" - }, - "key": { - "type": "oauth2", - "flow": "accessCode", - "authorizationUrl": "http://min.io", - "tokenUrl": "http://min.io" - } - }, - "security": [ - { - "key": [] - } - ] -}`)) - FlatSwaggerJSON = json.RawMessage([]byte(`{ - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "schemes": [ - "http", - "ws" - ], - "swagger": "2.0", - "info": { - "title": "MinIO Console Server", - "version": "0.1.0" - }, - "basePath": "/api/v1", - "paths": { - "/account/change-password": { - "post": { - "tags": [ - "Account" - ], - "summary": "Change password of currently logged in user.", - "operationId": "AccountChangePassword", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/accountChangePasswordRequest" - } - } - ], - "responses": { - "204": { - "description": "A successful login." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/account/change-user-password": { - "post": { - "tags": [ - "Account" - ], - "summary": "Change password of currently logged in user.", - "operationId": "ChangeUserPassword", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/changeUserPasswordRequest" - } - } - ], - "responses": { - "201": { - "description": "Password successfully changed." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/admin/arns": { - "get": { - "tags": [ - "System" - ], - "summary": "Returns a list of active ARNs in the instance", - "operationId": "ArnList", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/arnsResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/admin/info": { - "get": { - "tags": [ - "System" - ], - "summary": "Returns information about the deployment", - "operationId": "AdminInfo", - "parameters": [ - { - "type": "boolean", - "default": false, - "name": "defaultOnly", - "in": "query" - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/adminInfoResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/admin/info/widgets/{widgetId}": { - "get": { - "tags": [ - "System" - ], - "summary": "Returns information about the deployment", - "operationId": "DashboardWidgetDetails", - "parameters": [ - { - "type": "integer", - "format": "int32", - "name": "widgetId", - "in": "path", - "required": true - }, - { - "type": "integer", - "name": "start", - "in": "query" - }, - { - "type": "integer", - "name": "end", - "in": "query" - }, - { - "type": "integer", - "format": "int32", - "name": "step", - "in": "query" - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/widgetDetails" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/admin/inspect": { - "get": { - "produces": [ - "application/octet-stream" - ], - "tags": [ - "Inspect" - ], - "summary": "Inspect Files on Drive", - "operationId": "Inspect", - "parameters": [ - { - "type": "string", - "name": "file", - "in": "query", - "required": true - }, - { - "type": "string", - "name": "volume", - "in": "query", - "required": true - }, - { - "type": "boolean", - "name": "encrypt", - "in": "query" - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "file" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/admin/notification_endpoints": { - "get": { - "tags": [ - "Configuration" - ], - "summary": "Returns a list of active notification endpoints", - "operationId": "NotificationEndpointList", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/notifEndpointResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - }, - "post": { - "tags": [ - "Configuration" - ], - "summary": "Allows to configure a new notification endpoint", - "operationId": "AddNotificationEndpoint", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/notificationEndpoint" - } - } - ], - "responses": { - "201": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/setNotificationEndpointResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/bucket-policy/{bucket}": { - "get": { - "tags": [ - "Bucket" - ], - "summary": "List Policies With Given Bucket", - "operationId": "ListPoliciesWithBucket", - "parameters": [ - { - "type": "string", - "name": "bucket", - "in": "path", - "required": true - }, - { - "type": "number", - "format": "int32", - "default": 0, - "name": "offset", - "in": "query" - }, - { - "type": "number", - "format": "int32", - "default": 20, - "name": "limit", - "in": "query" - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/listPoliciesResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/bucket-users/{bucket}": { - "get": { - "tags": [ - "Bucket" - ], - "summary": "List Users With Access to a Given Bucket", - "operationId": "ListUsersWithAccessToBucket", - "parameters": [ - { - "type": "string", - "name": "bucket", - "in": "path", - "required": true - }, - { - "type": "number", - "format": "int32", - "default": 0, - "name": "offset", - "in": "query" - }, - { - "type": "number", - "format": "int32", - "default": 20, - "name": "limit", - "in": "query" - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/bucket/{bucket}/access-rules": { - "get": { - "tags": [ - "Bucket" - ], - "summary": "List Access Rules With Given Bucket", - "operationId": "ListAccessRulesWithBucket", - "parameters": [ - { - "type": "string", - "name": "bucket", - "in": "path", - "required": true - }, - { - "type": "number", - "format": "int32", - "default": 0, - "name": "offset", - "in": "query" - }, - { - "type": "number", - "format": "int32", - "default": 20, - "name": "limit", - "in": "query" - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/listAccessRulesResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - }, - "put": { - "tags": [ - "Bucket" - ], - "summary": "Add Access Rule To Given Bucket", - "operationId": "SetAccessRuleWithBucket", - "parameters": [ - { - "type": "string", - "name": "bucket", - "in": "path", - "required": true - }, - { - "name": "prefixaccess", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/prefixAccessPair" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "boolean" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - }, - "delete": { - "tags": [ - "Bucket" - ], - "summary": "Delete Access Rule From Given Bucket", - "operationId": "DeleteAccessRuleWithBucket", - "parameters": [ - { - "type": "string", - "name": "bucket", - "in": "path", - "required": true - }, - { - "name": "prefix", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/prefixWrapper" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "boolean" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/buckets": { - "get": { - "tags": [ - "Bucket" - ], - "summary": "List Buckets", - "operationId": "ListBuckets", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/listBucketsResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - }, - "post": { - "tags": [ - "Bucket" - ], - "summary": "Make bucket", - "operationId": "MakeBucket", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/makeBucketRequest" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/makeBucketsResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/buckets-replication": { - "post": { - "tags": [ - "Bucket" - ], - "summary": "Sets Multi Bucket Replication in multiple Buckets", - "operationId": "SetMultiBucketReplication", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/multiBucketReplication" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/multiBucketResponseState" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/buckets/max-share-exp": { - "get": { - "tags": [ - "Bucket" - ], - "summary": "Get max expiration time for share link in seconds", - "operationId": "GetMaxShareLinkExp", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/maxShareLinkExpResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/buckets/{bucket_name}/delete-all-replication-rules": { - "delete": { - "tags": [ - "Bucket" - ], - "summary": "Deletes all replication rules from a bucket", - "operationId": "DeleteAllReplicationRules", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - } - ], - "responses": { - "204": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/buckets/{bucket_name}/delete-objects": { - "post": { - "tags": [ - "Object" - ], - "summary": "Delete Multiple Objects", - "operationId": "DeleteMultipleObjects", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "type": "boolean", - "name": "all_versions", - "in": "query" - }, - { - "type": "boolean", - "name": "bypass", - "in": "query" - }, - { - "name": "files", - "in": "body", - "required": true, - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/deleteFile" - } - } - } - ], - "responses": { - "200": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/buckets/{bucket_name}/delete-selected-replication-rules": { - "delete": { - "tags": [ - "Bucket" - ], - "summary": "Deletes selected replication rules from a bucket", - "operationId": "DeleteSelectedReplicationRules", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "name": "rules", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/bucketReplicationRuleList" - } - } - ], - "responses": { - "204": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/buckets/{bucket_name}/encryption/disable": { - "post": { - "tags": [ - "Bucket" - ], - "summary": "Disable bucket encryption.", - "operationId": "DisableBucketEncryption", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/buckets/{bucket_name}/encryption/enable": { - "post": { - "tags": [ - "Bucket" - ], - "summary": "Enable bucket encryption.", - "operationId": "EnableBucketEncryption", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/bucketEncryptionRequest" - } - } - ], - "responses": { - "200": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/buckets/{bucket_name}/encryption/info": { - "get": { - "tags": [ - "Bucket" - ], - "summary": "Get bucket encryption information.", - "operationId": "GetBucketEncryptionInfo", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/bucketEncryptionInfo" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/buckets/{bucket_name}/events": { - "get": { - "tags": [ - "Bucket" - ], - "summary": "List Bucket Events", - "operationId": "ListBucketEvents", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "type": "number", - "format": "int32", - "default": 0, - "name": "offset", - "in": "query" - }, - { - "type": "number", - "format": "int32", - "default": 20, - "name": "limit", - "in": "query" - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/listBucketEventsResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - }, - "post": { - "tags": [ - "Bucket" - ], - "summary": "Create Bucket Event", - "operationId": "CreateBucketEvent", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/bucketEventRequest" - } - } - ], - "responses": { - "201": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/buckets/{bucket_name}/events/{arn}": { - "delete": { - "tags": [ - "Bucket" - ], - "summary": "Delete Bucket Event", - "operationId": "DeleteBucketEvent", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "arn", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/notificationDeleteRequest" - } - } - ], - "responses": { - "204": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/buckets/{bucket_name}/object-locking": { - "get": { - "tags": [ - "Bucket" - ], - "summary": "Returns the status of object locking support on the bucket", - "operationId": "GetBucketObjectLockingStatus", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/bucketObLockingResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/buckets/{bucket_name}/objects": { - "get": { - "security": [ - { - "key": [] - }, - { - "anonymous": [] - } - ], - "tags": [ - "Object" - ], - "summary": "List Objects", - "operationId": "ListObjects", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "prefix", - "in": "query" - }, - { - "type": "boolean", - "name": "recursive", - "in": "query" - }, - { - "type": "boolean", - "name": "with_versions", - "in": "query" - }, - { - "type": "boolean", - "name": "with_metadata", - "in": "query" - }, - { - "type": "number", - "format": "int32", - "default": 20, - "name": "limit", - "in": "query" - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/listObjectsResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - }, - "delete": { - "tags": [ - "Object" - ], - "summary": "Delete Object", - "operationId": "DeleteObject", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "prefix", - "in": "query", - "required": true - }, - { - "type": "string", - "name": "version_id", - "in": "query" - }, - { - "type": "boolean", - "name": "recursive", - "in": "query" - }, - { - "type": "boolean", - "name": "all_versions", - "in": "query" - }, - { - "type": "boolean", - "name": "non_current_versions", - "in": "query" - }, - { - "type": "boolean", - "name": "bypass", - "in": "query" - } - ], - "responses": { - "200": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/buckets/{bucket_name}/objects/download": { - "get": { - "security": [ - { - "key": [] - }, - { - "anonymous": [] - } - ], - "produces": [ - "application/octet-stream" - ], - "tags": [ - "Object" - ], - "summary": "Download Object", - "operationId": "Download Object", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "prefix", - "in": "query", - "required": true - }, - { - "type": "string", - "name": "version_id", - "in": "query" - }, - { - "type": "boolean", - "default": false, - "name": "preview", - "in": "query" - }, - { - "type": "string", - "default": "", - "name": "override_file_name", - "in": "query" - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "file" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/buckets/{bucket_name}/objects/download-multiple": { - "post": { - "security": [ - { - "key": [] - }, - { - "anonymous": [] - } - ], - "produces": [ - "application/octet-stream" - ], - "tags": [ - "Object" - ], - "summary": "Download Multiple Objects", - "operationId": "DownloadMultipleObjects", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "name": "objectList", - "in": "body", - "required": true, - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "file" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/buckets/{bucket_name}/objects/legalhold": { - "put": { - "tags": [ - "Object" - ], - "summary": "Put Object's legalhold status", - "operationId": "PutObjectLegalHold", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "prefix", - "in": "query", - "required": true - }, - { - "type": "string", - "name": "version_id", - "in": "query", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/putObjectLegalHoldRequest" - } - } - ], - "responses": { - "200": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/buckets/{bucket_name}/objects/metadata": { - "get": { - "tags": [ - "Object" - ], - "summary": "Gets the metadata of an object", - "operationId": "GetObjectMetadata", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "prefix", - "in": "query", - "required": true - }, - { - "type": "string", - "name": "versionID", - "in": "query" - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/metadata" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/buckets/{bucket_name}/objects/restore": { - "put": { - "tags": [ - "Object" - ], - "summary": "Restore Object to a selected version", - "operationId": "PutObjectRestore", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "prefix", - "in": "query", - "required": true - }, - { - "type": "string", - "name": "version_id", - "in": "query", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/buckets/{bucket_name}/objects/retention": { - "put": { - "tags": [ - "Object" - ], - "summary": "Put Object's retention status", - "operationId": "PutObjectRetention", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "prefix", - "in": "query", - "required": true - }, - { - "type": "string", - "name": "version_id", - "in": "query", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/putObjectRetentionRequest" - } - } - ], - "responses": { - "200": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - }, - "delete": { - "tags": [ - "Object" - ], - "summary": "Delete Object retention from an object", - "operationId": "DeleteObjectRetention", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "prefix", - "in": "query", - "required": true - }, - { - "type": "string", - "name": "version_id", - "in": "query", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/buckets/{bucket_name}/objects/share": { - "get": { - "tags": [ - "Object" - ], - "summary": "Shares an Object on a url", - "operationId": "ShareObject", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "prefix", - "in": "query", - "required": true - }, - { - "type": "string", - "name": "version_id", - "in": "query", - "required": true - }, - { - "type": "string", - "name": "expires", - "in": "query" - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "string" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/buckets/{bucket_name}/objects/tags": { - "put": { - "tags": [ - "Object" - ], - "summary": "Put Object's tags", - "operationId": "PutObjectTags", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "prefix", - "in": "query", - "required": true - }, - { - "type": "string", - "name": "version_id", - "in": "query", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/putObjectTagsRequest" - } - } - ], - "responses": { - "200": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/buckets/{bucket_name}/objects/upload": { - "post": { - "security": [ - { - "key": [] - }, - { - "anonymous": [] - } - ], - "consumes": [ - "multipart/form-data" - ], - "tags": [ - "Object" - ], - "summary": "Uploads an Object.", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "prefix", - "in": "query" - } - ], - "responses": { - "200": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "hm": { + "type": "boolean" + }, + "ob": { + "type": "boolean" } } }, - "/buckets/{bucket_name}/replication": { - "get": { - "tags": [ - "Bucket" - ], - "summary": "Bucket Replication", - "operationId": "GetBucketReplication", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/bucketReplicationResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "profilingStartRequest": { + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string" } } }, - "/buckets/{bucket_name}/replication/{rule_id}": { - "get": { - "tags": [ - "Bucket" - ], - "summary": "Bucket Replication", - "operationId": "GetBucketReplicationRule", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "rule_id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/bucketReplicationRule" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - }, - "put": { - "tags": [ - "Bucket" - ], - "summary": "Update Replication rule", - "operationId": "UpdateMultiBucketReplication", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "rule_id", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/multiBucketReplicationEdit" - } - } - ], - "responses": { - "201": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - }, - "delete": { - "tags": [ - "Bucket" - ], - "summary": "Bucket Replication Rule Delete", - "operationId": "DeleteBucketReplicationRule", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "rule_id", - "in": "path", - "required": true - } - ], - "responses": { - "204": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "putBucketRetentionRequest": { + "type": "object", + "required": [ + "mode", + "unit", + "validity" + ], + "properties": { + "mode": { + "$ref": "#/definitions/objectRetentionMode" + }, + "unit": { + "$ref": "#/definitions/objectRetentionUnit" + }, + "validity": { + "type": "integer", + "format": "int32" } } }, - "/buckets/{bucket_name}/retention": { - "get": { - "tags": [ - "Bucket" - ], - "summary": "Get Bucket's retention config", - "operationId": "GetBucketRetentionConfig", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/getBucketRetentionConfig" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "putBucketTagsRequest": { + "type": "object", + "properties": { + "tags": { + "additionalProperties": { + "type": "string" } } - }, - "put": { - "tags": [ - "Bucket" - ], - "summary": "Set Bucket's retention config", - "operationId": "SetBucketRetentionConfig", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/putBucketRetentionRequest" - } - } - ], - "responses": { - "200": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + } + }, + "putObjectLegalHoldRequest": { + "type": "object", + "required": [ + "status" + ], + "properties": { + "status": { + "$ref": "#/definitions/objectLegalHoldStatus" } } }, - "/buckets/{bucket_name}/rewind/{date}": { - "get": { - "tags": [ - "Bucket" - ], - "summary": "Get objects in a bucket for a rewind date", - "operationId": "GetBucketRewind", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "date", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "prefix", - "in": "query" - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/rewindResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "putObjectRetentionRequest": { + "type": "object", + "required": [ + "mode", + "expires" + ], + "properties": { + "expires": { + "type": "string" + }, + "governance_bypass": { + "type": "boolean" + }, + "mode": { + "$ref": "#/definitions/objectRetentionMode" } } }, - "/buckets/{bucket_name}/tags": { - "put": { - "tags": [ - "Bucket" - ], - "summary": "Put Bucket's tags", - "operationId": "PutBucketTags", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/putBucketTagsRequest" - } - } - ], - "responses": { - "200": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "putObjectTagsRequest": { + "type": "object", + "properties": { + "tags": { + "additionalProperties": { + "type": "string" } } } }, - "/buckets/{bucket_name}/versioning": { - "get": { - "tags": [ - "Bucket" - ], - "summary": "Bucket Versioning", - "operationId": "GetBucketVersioning", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/bucketVersioningResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "redirectRule": { + "type": "object", + "properties": { + "displayName": { + "type": "string" + }, + "redirect": { + "type": "string" + }, + "serviceType": { + "type": "string" } - }, - "put": { - "tags": [ - "Bucket" - ], - "summary": "Set Bucket Versioning", - "operationId": "SetBucketVersioning", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/setBucketVersioning" - } - } - ], - "responses": { - "201": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + } + }, + "releaseAuthor": { + "type": "object", + "properties": { + "avatar_url": { + "type": "string" + }, + "events_url": { + "type": "string" + }, + "followers_url": { + "type": "string" + }, + "following_url": { + "type": "string" + }, + "gists_url": { + "type": "string" + }, + "gravatar_id": { + "type": "string" + }, + "html_url": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "login": { + "type": "string" + }, + "node_id": { + "type": "string" + }, + "organizations_url": { + "type": "string" + }, + "receivedEvents_url": { + "type": "string" + }, + "repos_url": { + "type": "string" + }, + "site_admin": { + "type": "boolean" + }, + "starred_url": { + "type": "string" + }, + "subscriptions_url": { + "type": "string" + }, + "type": { + "type": "string" + }, + "url": { + "type": "string" } } }, - "/buckets/{name}": { - "get": { - "tags": [ - "Bucket" - ], - "summary": "Bucket Info", - "operationId": "BucketInfo", - "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/bucket" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "releaseInfo": { + "type": "object", + "properties": { + "breakingChangesContent": { + "type": "string" + }, + "contextContent": { + "type": "string" + }, + "metadata": { + "$ref": "#/definitions/releaseMetadata" + }, + "newFeaturesContent": { + "type": "string" + }, + "notesContent": { + "type": "string" + }, + "securityContent": { + "type": "string" } - }, - "delete": { - "tags": [ - "Bucket" - ], - "summary": "Delete Bucket", - "operationId": "DeleteBucket", - "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "204": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + } + }, + "releaseListResponse": { + "type": "object", + "properties": { + "results": { + "type": "array", + "items": { + "$ref": "#/definitions/releaseInfo" } } } }, - "/buckets/{name}/quota": { - "get": { - "tags": [ - "Bucket" - ], - "summary": "Get Bucket Quota", - "operationId": "GetBucketQuota", - "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/bucketQuota" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "releaseMetadata": { + "type": "object", + "properties": { + "assets_url": { + "type": "string" + }, + "author": { + "$ref": "#/definitions/releaseAuthor" + }, + "created_at": { + "type": "string" + }, + "draft": { + "type": "boolean" + }, + "html_url": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "node_id": { + "type": "string" + }, + "prerelease": { + "type": "boolean" + }, + "published_at": { + "type": "string" + }, + "tag_name": { + "type": "string" + }, + "tarball_url": { + "type": "string" + }, + "target_commitish": { + "type": "string" + }, + "upload_url": { + "type": "string" + }, + "url": { + "type": "string" + }, + "zipball_url": { + "type": "string" } - }, - "put": { - "tags": [ - "Bucket" - ], - "summary": "Bucket Quota", - "operationId": "SetBucketQuota", - "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/setBucketQuota" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/bucket" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + } + }, + "remoteBucket": { + "type": "object", + "required": [ + "accessKey", + "sourceBucket", + "remoteARN" + ], + "properties": { + "accessKey": { + "type": "string", + "minLength": 3 + }, + "bandwidth": { + "type": "integer", + "format": "int64" + }, + "healthCheckPeriod": { + "type": "integer" + }, + "remoteARN": { + "type": "string" + }, + "secretKey": { + "type": "string", + "minLength": 8 + }, + "service": { + "type": "string", + "enum": [ + "replication" + ] + }, + "sourceBucket": { + "type": "string" + }, + "status": { + "type": "string" + }, + "syncMode": { + "type": "string" + }, + "targetBucket": { + "type": "string" + }, + "targetURL": { + "type": "string" } } }, - "/buckets/{name}/set-policy": { - "put": { - "tags": [ - "Bucket" - ], - "summary": "Bucket Set Policy", - "operationId": "BucketSetPolicy", - "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/setBucketPolicyRequest" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/bucket" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "resultTarget": { + "type": "object", + "properties": { + "legendFormat": { + "type": "string" + }, + "result": { + "type": "array", + "items": { + "$ref": "#/definitions/widgetResult" } + }, + "resultType": { + "type": "string" } } }, - "/configs": { - "get": { - "tags": [ - "Configuration" - ], - "summary": "List Configurations", - "operationId": "ListConfig", - "parameters": [ - { - "type": "number", - "format": "int32", - "default": 0, - "name": "offset", - "in": "query" - }, - { - "type": "number", - "format": "int32", - "default": 20, - "name": "limit", - "in": "query" - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/listConfigResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "rewindItem": { + "type": "object", + "properties": { + "action": { + "type": "string" + }, + "delete_flag": { + "type": "boolean" + }, + "is_latest": { + "type": "boolean" + }, + "last_modified": { + "type": "string" + }, + "name": { + "type": "string" + }, + "size": { + "type": "integer", + "format": "int64" + }, + "version_id": { + "type": "string" } } }, - "/configs/export": { - "get": { - "tags": [ - "Configuration" - ], - "summary": "Export the current config from MinIO server", - "operationId": "ExportConfig", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/configExportResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "rewindResponse": { + "type": "object", + "properties": { + "objects": { + "type": "array", + "items": { + "$ref": "#/definitions/rewindItem" } } } }, - "/configs/import": { - "post": { - "consumes": [ - "multipart/form-data" - ], - "tags": [ - "Configuration" - ], - "summary": "Uploads a file to import MinIO server config.", - "parameters": [ - { - "type": "file", - "name": "file", - "in": "formData", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "selectedSAs": { + "type": "array", + "items": { + "type": "string" + } + }, + "selectedUsers": { + "type": "array", + "items": { + "type": "string" + } + }, + "serverDrives": { + "type": "object", + "properties": { + "availableSpace": { + "type": "integer" + }, + "drivePath": { + "type": "string" + }, + "endpoint": { + "type": "string" + }, + "healing": { + "type": "boolean" + }, + "model": { + "type": "string" + }, + "rootDisk": { + "type": "boolean" + }, + "state": { + "type": "string" + }, + "totalSpace": { + "type": "integer" + }, + "usedSpace": { + "type": "integer" + }, + "uuid": { + "type": "string" } } }, - "/configs/{name}": { - "get": { - "tags": [ - "Configuration" - ], - "summary": "Configuration info", - "operationId": "ConfigInfo", - "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true + "serverProperties": { + "type": "object", + "properties": { + "commitID": { + "type": "string" + }, + "drives": { + "type": "array", + "items": { + "$ref": "#/definitions/serverDrives" } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/configuration" - } - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + }, + "endpoint": { + "type": "string" + }, + "network": { + "type": "object", + "additionalProperties": { + "type": "string" } + }, + "poolNumber": { + "type": "integer" + }, + "state": { + "type": "string" + }, + "uptime": { + "type": "integer" + }, + "version": { + "type": "string" } - }, - "put": { - "tags": [ - "Configuration" - ], - "summary": "Set Configuration", - "operationId": "SetConfig", - "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/setConfigRequest" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/setConfigResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + } + }, + "serviceAccount": { + "type": "object", + "properties": { + "accountStatus": { + "type": "string" + }, + "description": { + "type": "string" + }, + "expiration": { + "type": "string" + }, + "impliedPolicy": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "parentUser": { + "type": "string" + }, + "policy": { + "type": "string" } } }, - "/configs/{name}/reset": { - "post": { - "tags": [ - "Configuration" - ], - "summary": "Configuration reset", - "operationId": "ResetConfig", - "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/setConfigResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "serviceAccountCreds": { + "type": "object", + "properties": { + "accessKey": { + "type": "string" + }, + "secretKey": { + "type": "string" + }, + "url": { + "type": "string" + } + } + }, + "serviceAccountRequest": { + "type": "object", + "properties": { + "comment": { + "type": "string" + }, + "description": { + "type": "string" + }, + "expiry": { + "type": "string" + }, + "name": { + "type": "string" + }, + "policy": { + "type": "string", + "title": "policy to be applied to the Service Account if any" } } }, - "/download-shared-object/{url}": { - "get": { - "security": [], - "produces": [ - "application/octet-stream" - ], - "tags": [ - "Public" - ], - "summary": "Downloads an object from a presigned url", - "operationId": "DownloadSharedObject", - "parameters": [ - { - "type": "string", - "name": "url", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "file" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "serviceAccountRequestCreds": { + "type": "object", + "properties": { + "accessKey": { + "type": "string" + }, + "comment": { + "type": "string" + }, + "description": { + "type": "string" + }, + "expiry": { + "type": "string" + }, + "name": { + "type": "string" + }, + "policy": { + "type": "string", + "title": "policy to be applied to the Service Account if any" + }, + "secretKey": { + "type": "string" } } }, - "/group/{name}": { - "get": { - "tags": [ - "Group" - ], - "summary": "Group info", - "operationId": "GroupInfo", - "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/group" - } + "serviceAccounts": { + "type": "array", + "items": { + "type": "object", + "properties": { + "accessKey": { + "type": "string" }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - }, - "put": { - "tags": [ - "Group" - ], - "summary": "Update Group Members or Status", - "operationId": "UpdateGroup", - "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true + "accountStatus": { + "type": "string" }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/updateGroupRequest" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/group" - } + "description": { + "type": "string" }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - }, - "delete": { - "tags": [ - "Group" - ], - "summary": "Remove group", - "operationId": "RemoveGroup", - "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "204": { - "description": "A successful response." + "expiration": { + "type": "string" }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "name": { + "type": "string" } } } }, - "/groups": { - "get": { - "tags": [ - "Group" - ], - "summary": "List Groups", - "operationId": "ListGroups", - "parameters": [ - { - "type": "number", - "format": "int32", - "default": 0, - "name": "offset", - "in": "query" - }, - { - "type": "number", - "format": "int32", - "default": 20, - "name": "limit", - "in": "query" - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/listGroupsResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "sessionResponse": { + "type": "object", + "properties": { + "allowResources": { + "type": "array", + "items": { + "$ref": "#/definitions/permissionResource" } - } - }, - "post": { - "tags": [ - "Group" - ], - "summary": "Add Group", - "operationId": "AddGroup", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/addGroupRequest" - } + }, + "customStyles": { + "type": "string" + }, + "distributedMode": { + "type": "boolean" + }, + "envConstants": { + "$ref": "#/definitions/environmentConstants" + }, + "features": { + "type": "array", + "items": { + "type": "string" } - ], - "responses": { - "201": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" + }, + "operator": { + "type": "boolean" + }, + "permissions": { + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "type": "string" } } + }, + "serverEndPoint": { + "type": "string" + }, + "status": { + "type": "string", + "enum": [ + "ok" + ] + } + } + }, + "setBucketPolicyRequest": { + "type": "object", + "required": [ + "access" + ], + "properties": { + "access": { + "$ref": "#/definitions/bucketAccess" + }, + "definition": { + "type": "string" + } + } + }, + "setBucketQuota": { + "type": "object", + "required": [ + "enabled" + ], + "properties": { + "amount": { + "type": "integer" + }, + "enabled": { + "type": "boolean" + }, + "quota_type": { + "type": "string", + "enum": [ + "hard" + ] } } }, - "/idp/{type}": { - "get": { - "tags": [ - "idp" - ], - "summary": "List IDP Configurations", - "operationId": "ListConfigurations", - "parameters": [ - { - "type": "string", - "description": "IDP Configuration Type", - "name": "type", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/idpListConfigurationsResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "setBucketVersioning": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "excludeFolders": { + "type": "boolean" + }, + "excludePrefixes": { + "type": "array", + "maxLength": 10, + "items": { + "type": "string" } } - }, - "post": { - "consumes": [ - "application/json" - ], - "tags": [ - "idp" - ], - "summary": "Create IDP Configuration", - "operationId": "CreateConfiguration", - "parameters": [ - { - "type": "string", - "description": "IDP Configuration Type", - "name": "type", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/idpServerConfiguration" - } - } - ], - "responses": { - "201": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/setIDPResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + } + }, + "setConfigRequest": { + "type": "object", + "required": [ + "key_values" + ], + "properties": { + "arn_resource_id": { + "type": "string", + "title": "Used if configuration is an event notification's target" + }, + "key_values": { + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/definitions/configurationKV" } } } }, - "/idp/{type}/{name}": { - "get": { - "tags": [ - "idp" - ], - "summary": "Get IDP Configuration", - "operationId": "GetConfiguration", - "parameters": [ - { - "type": "string", - "description": "IDP Configuration Name", - "name": "name", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "IDP Configuration Type", - "name": "type", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/idpServerConfiguration" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "setConfigResponse": { + "type": "object", + "properties": { + "restart": { + "description": "Returns wheter server needs to restart to apply changes or not", + "type": "boolean" } - }, - "put": { - "consumes": [ - "application/json" - ], - "tags": [ - "idp" - ], - "summary": "Update IDP Configuration", - "operationId": "UpdateConfiguration", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/idpServerConfiguration" - } - }, - { - "type": "string", - "description": "IDP Configuration Name", - "name": "name", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "IDP Configuration Type", - "name": "type", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/setIDPResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + } + }, + "setIDPResponse": { + "type": "object", + "properties": { + "restart": { + "type": "boolean" } - }, - "delete": { - "tags": [ - "idp" - ], - "summary": "Delete IDP Configuration", - "operationId": "DeleteConfiguration", - "parameters": [ - { - "type": "string", - "description": "IDP Configuration Name", - "name": "name", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "IDP Configuration Type", - "name": "type", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/setIDPResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + } + }, + "setNotificationEndpointResponse": { + "type": "object", + "required": [ + "service", + "account_id", + "properties" + ], + "properties": { + "account_id": { + "type": "string" + }, + "properties": { + "type": "object", + "additionalProperties": { + "type": "string" } + }, + "restart": { + "type": "boolean" + }, + "service": { + "$ref": "#/definitions/nofiticationService" } } }, - "/kms/apis": { - "get": { - "tags": [ - "KMS" - ], - "summary": "KMS apis", - "operationId": "KMSAPIs", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/kmsAPIsResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "setPolicyMultipleNameRequest": { + "type": "object", + "properties": { + "groups": { + "type": "array", + "items": { + "$ref": "#/definitions/iamEntity" + } + }, + "name": { + "type": "array", + "items": { + "type": "string" + } + }, + "users": { + "type": "array", + "items": { + "$ref": "#/definitions/iamEntity" } } } }, - "/kms/keys": { - "get": { - "tags": [ - "KMS" - ], - "summary": "KMS list keys", - "operationId": "KMSListKeys", - "parameters": [ - { - "type": "string", - "description": "pattern to retrieve keys", - "name": "pattern", - "in": "query" - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/kmsListKeysResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "setPolicyNameRequest": { + "type": "object", + "required": [ + "name", + "entityType", + "entityName" + ], + "properties": { + "entityName": { + "type": "string" + }, + "entityType": { + "$ref": "#/definitions/policyEntity" + }, + "name": { + "type": "array", + "items": { + "type": "string" } } - }, - "post": { - "tags": [ - "KMS" - ], - "summary": "KMS create key", - "operationId": "KMSCreateKey", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/kmsCreateKeyRequest" - } - } - ], - "responses": { - "201": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + } + }, + "setPolicyRequest": { + "type": "object", + "required": [ + "entityType", + "entityName" + ], + "properties": { + "entityName": { + "type": "string" + }, + "entityType": { + "$ref": "#/definitions/policyEntity" } } }, - "/kms/keys/{name}": { - "get": { - "tags": [ - "KMS" - ], - "summary": "KMS key status", - "operationId": "KMSKeyStatus", - "parameters": [ - { - "type": "string", - "description": "KMS key name", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/kmsKeyStatusResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "siteReplicationAddRequest": { + "type": "array", + "items": { + "$ref": "#/definitions/peerSite" + } + }, + "siteReplicationAddResponse": { + "type": "object", + "properties": { + "errorDetail": { + "type": "string" + }, + "initialSyncErrorMessage": { + "type": "string" + }, + "status": { + "type": "string" + }, + "success": { + "type": "boolean" } } }, - "/kms/metrics": { - "get": { - "tags": [ - "KMS" - ], - "summary": "KMS metrics", - "operationId": "KMSMetrics", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/kmsMetricsResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "siteReplicationInfoResponse": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "serviceAccountAccessKey": { + "type": "string" + }, + "sites": { + "type": "array", + "items": { + "$ref": "#/definitions/peerInfo" } } } }, - "/kms/status": { - "get": { - "tags": [ - "KMS" - ], - "summary": "KMS status", - "operationId": "KMSStatus", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/kmsStatusResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "siteReplicationStatusResponse": { + "type": "object", + "properties": { + "bucketStats": { + "type": "object" + }, + "enabled": { + "type": "boolean" + }, + "groupStats": { + "type": "object" + }, + "maxBuckets": { + "type": "integer" + }, + "maxGroups": { + "type": "integer" + }, + "maxPolicies": { + "type": "integer" + }, + "maxUsers": { + "type": "integer" + }, + "policyStats": { + "type": "object" + }, + "sites": { + "type": "object" + }, + "statsSummary": { + "type": "object" + }, + "userStats": { + "type": "object" } } }, - "/kms/version": { - "get": { - "tags": [ - "KMS" - ], - "summary": "KMS version", - "operationId": "KMSVersion", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/kmsVersionResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "startProfilingItem": { + "type": "object", + "properties": { + "error": { + "type": "string" + }, + "nodeName": { + "type": "string" + }, + "success": { + "type": "boolean" } } }, - "/ldap-entities": { - "post": { - "tags": [ - "idp" - ], - "summary": "Get LDAP Entities", - "operationId": "GetLDAPEntities", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/ldapEntitiesRequest" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/ldapEntities" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "startProfilingList": { + "type": "object", + "properties": { + "startResults": { + "type": "array", + "items": { + "$ref": "#/definitions/startProfilingItem" } + }, + "total": { + "type": "integer", + "format": "int64", + "title": "number of start results" } } }, - "/list-external-buckets": { - "post": { - "tags": [ - "Bucket" - ], - "summary": "Lists an External list of buckets using custom credentials", - "operationId": "ListExternalBuckets", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/listExternalBucketsParams" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/listBucketsResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "updateGroupRequest": { + "type": "object", + "required": [ + "members", + "status" + ], + "properties": { + "members": { + "type": "array", + "items": { + "type": "string" } + }, + "status": { + "type": "string" } } }, - "/login": { - "get": { - "security": [], - "tags": [ - "Auth" - ], - "summary": "Returns login strategy, form or sso.", - "operationId": "LoginDetail", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/loginDetails" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - }, - "post": { - "security": [], - "tags": [ - "Auth" - ], - "summary": "Login to Console", - "operationId": "Login", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/loginRequest" - } - } - ], - "responses": { - "204": { - "description": "A successful login." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "updateServiceAccountRequest": { + "type": "object", + "required": [ + "policy" + ], + "properties": { + "description": { + "type": "string" + }, + "expiry": { + "type": "string" + }, + "name": { + "type": "string" + }, + "policy": { + "type": "string" + }, + "secretKey": { + "type": "string" + }, + "status": { + "type": "string" } } }, - "/login/oauth2/auth": { - "post": { - "security": [], - "tags": [ - "Auth" - ], - "summary": "Identity Provider oauth2 callback endpoint.", - "operationId": "LoginOauth2Auth", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/loginOauth2AuthRequest" - } - } - ], - "responses": { - "204": { - "description": "A successful login." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "updateUser": { + "type": "object", + "required": [ + "status", + "groups" + ], + "properties": { + "groups": { + "type": "array", + "items": { + "type": "string" } + }, + "status": { + "type": "string" } } }, - "/logout": { - "post": { - "tags": [ - "Auth" - ], - "summary": "Logout from Console.", - "operationId": "Logout", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/logoutRequest" - } - } - ], - "responses": { - "200": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "updateUserGroups": { + "type": "object", + "required": [ + "groups" + ], + "properties": { + "groups": { + "type": "array", + "items": { + "type": "string" } } } }, - "/logs/search": { - "get": { - "tags": [ - "Logging" - ], - "summary": "Search the logs", - "operationId": "LogSearch", - "parameters": [ - { - "type": "array", - "items": { - "type": "string" - }, - "collectionFormat": "multi", - "description": "Filter Parameters", - "name": "fp", - "in": "query" - }, - { - "type": "number", - "format": "int32", - "default": 10, - "name": "pageSize", - "in": "query" - }, - { - "type": "number", - "format": "int32", - "default": 0, - "name": "pageNo", - "in": "query" - }, - { - "enum": [ - "timeDesc", - "timeAsc" - ], - "type": "string", - "default": "timeDesc", - "name": "order", - "in": "query" - }, - { - "type": "string", - "name": "timeStart", - "in": "query" - }, - { - "type": "string", - "name": "timeEnd", - "in": "query" - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/logSearchResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "user": { + "type": "object", + "properties": { + "accessKey": { + "type": "string" + }, + "hasPolicy": { + "type": "boolean" + }, + "memberOf": { + "type": "array", + "items": { + "type": "string" + } + }, + "policy": { + "type": "array", + "items": { + "type": "string" } + }, + "status": { + "type": "string" } } }, - "/nodes": { - "get": { - "tags": [ - "System" - ], - "summary": "Lists Nodes", - "operationId": "ListNodes", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } + "userSAs": { + "type": "object", + "properties": { + "path": { + "type": "string" + }, + "recursive": { + "type": "boolean" + }, + "versionID": { + "type": "string" } } }, - "/policies": { - "get": { - "tags": [ - "Policy" - ], - "summary": "List Policies", - "operationId": "ListPolicies", - "parameters": [ - { - "type": "number", - "format": "int32", - "default": 0, - "name": "offset", - "in": "query" - }, - { - "type": "number", - "format": "int32", - "default": 20, - "name": "limit", - "in": "query" - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/listPoliciesResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + "userServiceAccountItem": { + "type": "object", + "properties": { + "numSAs": { + "type": "integer", + "format": "int64" + }, + "userName": { + "type": "string" + } + } + }, + "userServiceAccountSummary": { + "type": "object", + "properties": { + "hasSA": { + "type": "boolean" + }, + "userServiceAccountList": { + "type": "array", + "title": "list of users with number of service accounts", + "items": { + "$ref": "#/definitions/userServiceAccountItem" } } - }, - "post": { - "tags": [ - "Policy" - ], - "summary": "Add Policy", - "operationId": "AddPolicy", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/addPolicyRequest" + } + }, + "widget": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int32" + }, + "options": { + "type": "object", + "properties": { + "reduceOptions": { + "type": "object", + "properties": { + "calcs": { + "type": "array", + "items": { + "type": "string" + } + } + } } } - ], - "responses": { - "201": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/policy" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + }, + "targets": { + "type": "array", + "items": { + "$ref": "#/definitions/resultTarget" } + }, + "title": { + "type": "string" + }, + "type": { + "type": "string" } } }, - "/policies/{policy}/groups": { - "get": { - "tags": [ - "Policy" - ], - "summary": "List Groups for a Policy", - "operationId": "ListGroupsForPolicy", - "parameters": [ - { - "type": "string", - "name": "policy", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "array", - "items": { - "type": "string" + "widgetDetails": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int32" + }, + "options": { + "type": "object", + "properties": { + "reduceOptions": { + "type": "object", + "properties": { + "calcs": { + "type": "array", + "items": { + "type": "string" + } + } } } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } } + }, + "targets": { + "type": "array", + "items": { + "$ref": "#/definitions/resultTarget" + } + }, + "title": { + "type": "string" + }, + "type": { + "type": "string" + } + } + }, + "widgetResult": { + "type": "object", + "properties": { + "metric": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "values": { + "type": "array", + "items": {} } } + } + }, + "parameters": { + "limit": { + "type": "number", + "format": "int32", + "default": 20, + "name": "limit", + "in": "query" + }, + "offset": { + "type": "number", + "format": "int32", + "default": 0, + "name": "offset", + "in": "query" + } + }, + "securityDefinitions": { + "anonymous": { + "type": "apiKey", + "name": "X-Anonymous", + "in": "header" }, - "/policies/{policy}/users": { + "key": { + "type": "oauth2", + "flow": "accessCode", + "authorizationUrl": "http://min.io", + "tokenUrl": "http://min.io" + } + }, + "security": [ + { + "key": [] + } + ] +}`)) + FlatSwaggerJSON = json.RawMessage([]byte(`{ + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "schemes": [ + "http", + "ws" + ], + "swagger": "2.0", + "info": { + "title": "MinIO Console Server", + "version": "0.1.0" + }, + "basePath": "/api/v1", + "paths": { + "/admin/info": { "get": { "tags": [ - "Policy" + "System" ], - "summary": "List Users for a Policy", - "operationId": "ListUsersForPolicy", + "summary": "Returns information about the deployment", + "operationId": "AdminInfo", "parameters": [ { - "type": "string", - "name": "policy", - "in": "path", - "required": true + "type": "boolean", + "default": false, + "name": "defaultOnly", + "in": "query" } ], "responses": { "200": { "description": "A successful response.", "schema": { - "type": "array", - "items": { - "type": "string" - } + "$ref": "#/definitions/adminInfoResponse" } }, "default": { @@ -10521,26 +4214,18 @@ func init() { } } }, - "/policy/{name}": { + "/buckets": { "get": { "tags": [ - "Policy" - ], - "summary": "Policy info", - "operationId": "PolicyInfo", - "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true - } + "Bucket" ], + "summary": "List Buckets", + "operationId": "ListBuckets", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/policy" + "$ref": "#/definitions/listBucketsResponse" } }, "default": { @@ -10551,72 +4236,27 @@ func init() { } } }, - "delete": { + "post": { "tags": [ - "Policy" + "Bucket" ], - "summary": "Remove policy", - "operationId": "RemovePolicy", + "summary": "Make bucket", + "operationId": "MakeBucket", "parameters": [ { - "type": "string", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "204": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", + "name": "body", + "in": "body", + "required": true, "schema": { - "$ref": "#/definitions/ApiError" + "$ref": "#/definitions/makeBucketRequest" } } - } - } - }, - "/releases": { - "get": { - "tags": [ - "release" - ], - "summary": "Get repo releases for a given version", - "operationId": "ListReleases", - "parameters": [ - { - "type": "string", - "description": "repo name", - "name": "repo", - "in": "query", - "required": true - }, - { - "type": "string", - "description": "Current Release", - "name": "current", - "in": "query" - }, - { - "type": "string", - "description": "search content", - "name": "search", - "in": "query" - }, - { - "type": "string", - "description": "filter releases", - "name": "filter", - "in": "query" - } ], "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/releaseListResponse" + "$ref": "#/definitions/makeBucketsResponse" } }, "default": { @@ -10628,18 +4268,18 @@ func init() { } } }, - "/remote-buckets": { + "/buckets/max-share-exp": { "get": { "tags": [ "Bucket" ], - "summary": "List Remote Buckets", - "operationId": "ListRemoteBuckets", + "summary": "Get max expiration time for share link in seconds", + "operationId": "GetMaxShareLinkExp", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/listRemoteBucketsResponse" + "$ref": "#/definitions/maxShareLinkExpResponse" } }, "default": { @@ -10649,25 +4289,46 @@ func init() { } } } - }, + } + }, + "/buckets/{bucket_name}/delete-objects": { "post": { "tags": [ - "Bucket" + "Object" ], - "summary": "Add Remote Bucket", - "operationId": "AddRemoteBucket", + "summary": "Delete Multiple Objects", + "operationId": "DeleteMultipleObjects", "parameters": [ { - "name": "body", + "type": "string", + "name": "bucket_name", + "in": "path", + "required": true + }, + { + "type": "boolean", + "name": "all_versions", + "in": "query" + }, + { + "type": "boolean", + "name": "bypass", + "in": "query" + }, + { + "name": "files", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/createRemoteBucket" + "type": "array", + "items": { + "$ref": "#/definitions/deleteFile" + } } } ], "responses": { - "201": { + "200": { "description": "A successful response." }, "default": { @@ -10679,26 +4340,61 @@ func init() { } } }, - "/remote-buckets/{name}": { + "/buckets/{bucket_name}/objects": { "get": { + "security": [ + { + "key": [] + }, + { + "anonymous": [] + } + ], "tags": [ - "Bucket" + "Object" ], - "summary": "Remote Bucket Details", - "operationId": "RemoteBucketDetails", + "summary": "List Objects", + "operationId": "ListObjects", "parameters": [ { "type": "string", - "name": "name", + "name": "bucket_name", "in": "path", "required": true + }, + { + "type": "string", + "name": "prefix", + "in": "query" + }, + { + "type": "boolean", + "name": "recursive", + "in": "query" + }, + { + "type": "boolean", + "name": "with_versions", + "in": "query" + }, + { + "type": "boolean", + "name": "with_metadata", + "in": "query" + }, + { + "type": "number", + "format": "int32", + "default": 20, + "name": "limit", + "in": "query" } ], "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/remoteBucket" + "$ref": "#/definitions/listObjectsResponse" } }, "default": { @@ -10708,31 +4404,54 @@ func init() { } } } - } - }, - "/remote-buckets/{source-bucket-name}/{arn}": { + }, "delete": { "tags": [ - "Bucket" + "Object" ], - "summary": "Delete Remote Bucket", - "operationId": "DeleteRemoteBucket", + "summary": "Delete Object", + "operationId": "DeleteObject", "parameters": [ { "type": "string", - "name": "source-bucket-name", + "name": "bucket_name", "in": "path", "required": true }, { "type": "string", - "name": "arn", - "in": "path", + "name": "prefix", + "in": "query", "required": true + }, + { + "type": "string", + "name": "version_id", + "in": "query" + }, + { + "type": "boolean", + "name": "recursive", + "in": "query" + }, + { + "type": "boolean", + "name": "all_versions", + "in": "query" + }, + { + "type": "boolean", + "name": "non_current_versions", + "in": "query" + }, + { + "type": "boolean", + "name": "bypass", + "in": "query" } ], "responses": { - "204": { + "200": { "description": "A successful response." }, "default": { @@ -10744,59 +4463,52 @@ func init() { } } }, - "/service-account-credentials": { - "post": { - "tags": [ - "ServiceAccount" - ], - "summary": "Create Service Account With Credentials", - "operationId": "CreateServiceAccountCreds", - "parameters": [ + "/buckets/{bucket_name}/objects/download": { + "get": { + "security": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/serviceAccountRequestCreds" - } - } - ], - "responses": { - "201": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/serviceAccountCreds" - } + "key": [] }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + { + "anonymous": [] } - } - } - }, - "/service-accounts": { - "get": { + ], + "produces": [ + "application/octet-stream" + ], "tags": [ - "ServiceAccount" + "Object" ], - "summary": "List User's Service Accounts", - "operationId": "ListUserServiceAccounts", + "summary": "Download Object", + "operationId": "Download Object", "parameters": [ { - "type": "number", - "format": "int32", - "default": 0, - "name": "offset", + "type": "string", + "name": "bucket_name", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "prefix", + "in": "query", + "required": true + }, + { + "type": "string", + "name": "version_id", "in": "query" }, { - "type": "number", - "format": "int32", - "default": 20, - "name": "limit", + "type": "boolean", + "default": false, + "name": "preview", + "in": "query" + }, + { + "type": "string", + "default": "", + "name": "override_file_name", "in": "query" } ], @@ -10804,7 +4516,7 @@ func init() { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/serviceAccounts" + "type": "file" } }, "default": { @@ -10814,59 +4526,51 @@ func init() { } } } - }, + } + }, + "/buckets/{bucket_name}/objects/download-multiple": { "post": { - "tags": [ - "ServiceAccount" - ], - "summary": "Create Service Account", - "operationId": "CreateServiceAccount", - "parameters": [ + "security": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/serviceAccountRequest" - } - } - ], - "responses": { - "201": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/serviceAccountCreds" - } + "key": [] }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + { + "anonymous": [] } - } - } - }, - "/service-accounts/delete-multi": { - "delete": { + ], + "produces": [ + "application/octet-stream" + ], "tags": [ - "ServiceAccount" + "Object" ], - "summary": "Delete Multiple Service Accounts", - "operationId": "DeleteMultipleServiceAccounts", + "summary": "Download Multiple Objects", + "operationId": "DownloadMultipleObjects", "parameters": [ { - "name": "selectedSA", + "type": "string", + "name": "bucket_name", + "in": "path", + "required": true + }, + { + "name": "objectList", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/selectedSAs" + "type": "array", + "items": { + "type": "string" + } } } ], "responses": { - "204": { - "description": "A successful response." + "200": { + "description": "A successful response.", + "schema": { + "type": "file" + } }, "default": { "description": "Generic error response.", @@ -10877,26 +4581,37 @@ func init() { } } }, - "/service-accounts/{access_key}": { + "/buckets/{bucket_name}/objects/metadata": { "get": { "tags": [ - "ServiceAccount" + "Object" ], - "summary": "Get Service Account", - "operationId": "GetServiceAccount", + "summary": "Gets the metadata of an object", + "operationId": "GetObjectMetadata", "parameters": [ { "type": "string", - "name": "access_key", + "name": "bucket_name", "in": "path", "required": true + }, + { + "type": "string", + "name": "prefix", + "in": "query", + "required": true + }, + { + "type": "string", + "name": "versionID", + "in": "query" } ], "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/serviceAccount" + "$ref": "#/definitions/metadata" } }, "default": { @@ -10906,27 +4621,33 @@ func init() { } } } - }, + } + }, + "/buckets/{bucket_name}/objects/restore": { "put": { "tags": [ - "ServiceAccount" + "Object" ], - "summary": "Set Service Account Policy", - "operationId": "UpdateServiceAccount", + "summary": "Restore Object to a selected version", + "operationId": "PutObjectRestore", "parameters": [ { "type": "string", - "name": "access_key", + "name": "bucket_name", "in": "path", "required": true }, { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/updateServiceAccountRequest" - } + "type": "string", + "name": "prefix", + "in": "query", + "required": true + }, + { + "type": "string", + "name": "version_id", + "in": "query", + "required": true } ], "responses": { @@ -10940,66 +4661,45 @@ func init() { } } } - }, - "delete": { + } + }, + "/buckets/{bucket_name}/objects/share": { + "get": { "tags": [ - "ServiceAccount" + "Object" ], - "summary": "Delete Service Account", - "operationId": "DeleteServiceAccount", + "summary": "Shares an Object on a url", + "operationId": "ShareObject", "parameters": [ { "type": "string", - "name": "access_key", + "name": "bucket_name", "in": "path", "required": true - } - ], - "responses": { - "204": { - "description": "A successful response." }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/service/restart": { - "post": { - "tags": [ - "Service" - ], - "summary": "Restart Service", - "operationId": "RestartService", - "responses": { - "204": { - "description": "A successful response." + { + "type": "string", + "name": "prefix", + "in": "query", + "required": true }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + { + "type": "string", + "name": "version_id", + "in": "query", + "required": true + }, + { + "type": "string", + "name": "expires", + "in": "query" } - } - } - }, - "/session": { - "get": { - "tags": [ - "Auth" ], - "summary": "Endpoint to check if your session is still valid", - "operationId": "SessionCheck", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/sessionResponse" + "type": "string" } }, "default": { @@ -11011,25 +4711,43 @@ func init() { } } }, - "/set-policy": { + "/buckets/{bucket_name}/objects/tags": { "put": { "tags": [ - "Policy" + "Object" ], - "summary": "Set policy", - "operationId": "SetPolicy", + "summary": "Put Object's tags", + "operationId": "PutObjectTags", "parameters": [ + { + "type": "string", + "name": "bucket_name", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "prefix", + "in": "query", + "required": true + }, + { + "type": "string", + "name": "version_id", + "in": "query", + "required": true + }, { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/setPolicyNameRequest" + "$ref": "#/definitions/putObjectTagsRequest" } } ], "responses": { - "204": { + "200": { "description": "A successful response." }, "default": { @@ -11041,49 +4759,39 @@ func init() { } } }, - "/set-policy-multi": { - "put": { + "/buckets/{bucket_name}/objects/upload": { + "post": { + "security": [ + { + "key": [] + }, + { + "anonymous": [] + } + ], + "consumes": [ + "multipart/form-data" + ], "tags": [ - "Policy" + "Object" ], - "summary": "Set policy to multiple users/groups", - "operationId": "SetPolicyMultiple", + "summary": "Uploads an Object.", "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/setPolicyMultipleNameRequest" - } - } - ], - "responses": { - "204": { - "description": "A successful response." + "type": "string", + "name": "bucket_name", + "in": "path", + "required": true }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } + { + "type": "string", + "name": "prefix", + "in": "query" } - } - } - }, - "/user/policy": { - "get": { - "tags": [ - "Policy" ], - "summary": "returns policies for logged in user", - "operationId": "GetUserPolicy", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "string" - } + "responses": { + "200": { + "description": "A successful response." }, "default": { "description": "Generic error response.", @@ -11094,26 +4802,37 @@ func init() { } } }, - "/user/{name}": { + "/buckets/{bucket_name}/rewind/{date}": { "get": { "tags": [ - "User" + "Bucket" ], - "summary": "Get User Info", - "operationId": "GetUserInfo", + "summary": "Get objects in a bucket for a rewind date", + "operationId": "GetBucketRewind", "parameters": [ { "type": "string", - "name": "name", + "name": "bucket_name", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "date", "in": "path", "required": true + }, + { + "type": "string", + "name": "prefix", + "in": "query" } ], "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/user" + "$ref": "#/definitions/rewindResponse" } }, "default": { @@ -11123,17 +4842,19 @@ func init() { } } } - }, + } + }, + "/buckets/{bucket_name}/tags": { "put": { "tags": [ - "User" + "Bucket" ], - "summary": "Update User Info", - "operationId": "UpdateUserInfo", + "summary": "Put Bucket's tags", + "operationId": "PutBucketTags", "parameters": [ { "type": "string", - "name": "name", + "name": "bucket_name", "in": "path", "required": true }, @@ -11142,16 +4863,13 @@ func init() { "in": "body", "required": true, "schema": { - "$ref": "#/definitions/updateUser" + "$ref": "#/definitions/putBucketTagsRequest" } } ], "responses": { "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/user" - } + "description": "A successful response." }, "default": { "description": "Generic error response.", @@ -11160,24 +4878,29 @@ func init() { } } } - }, - "delete": { + } + }, + "/buckets/{bucket_name}/versioning": { + "get": { "tags": [ - "User" + "Bucket" ], - "summary": "Remove user", - "operationId": "RemoveUser", + "summary": "Bucket Versioning", + "operationId": "GetBucketVersioning", "parameters": [ { "type": "string", - "name": "name", + "name": "bucket_name", "in": "path", "required": true } ], "responses": { - "204": { - "description": "A successful response." + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/bucketVersioningResponse" + } }, "default": { "description": "Generic error response.", @@ -11186,19 +4909,17 @@ func init() { } } } - } - }, - "/user/{name}/groups": { + }, "put": { "tags": [ - "User" + "Bucket" ], - "summary": "Update Groups for a user", - "operationId": "UpdateUserGroups", + "summary": "Set Bucket Versioning", + "operationId": "SetBucketVersioning", "parameters": [ { "type": "string", - "name": "name", + "name": "bucket_name", "in": "path", "required": true }, @@ -11207,16 +4928,13 @@ func init() { "in": "body", "required": true, "schema": { - "$ref": "#/definitions/updateUserGroups" + "$ref": "#/definitions/setBucketVersioning" } } ], "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/user" - } + "201": { + "description": "A successful response." }, "default": { "description": "Generic error response.", @@ -11227,13 +4945,13 @@ func init() { } } }, - "/user/{name}/policies": { + "/buckets/{name}": { "get": { "tags": [ - "Policy" + "Bucket" ], - "summary": "returns policies assigned for a specified user", - "operationId": "GetSAUserPolicy", + "summary": "Bucket Info", + "operationId": "BucketInfo", "parameters": [ { "type": "string", @@ -11246,7 +4964,7 @@ func init() { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/aUserPolicyResponse" + "$ref": "#/definitions/bucket" } }, "default": { @@ -11258,34 +4976,26 @@ func init() { } } }, - "/user/{name}/service-account-credentials": { - "post": { + "/buckets/{name}/quota": { + "get": { "tags": [ - "User" + "Bucket" ], - "summary": "Create Service Account for User With Credentials", - "operationId": "CreateServiceAccountCredentials", + "summary": "Get Bucket Quota", + "operationId": "GetBucketQuota", "parameters": [ { "type": "string", "name": "name", "in": "path", "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/serviceAccountRequestCreds" - } } ], "responses": { - "201": { + "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/serviceAccountCreds" + "$ref": "#/definitions/bucketQuota" } }, "default": { @@ -11297,17 +5007,21 @@ func init() { } } }, - "/user/{name}/service-accounts": { + "/download-shared-object/{url}": { "get": { + "security": [], + "produces": [ + "application/octet-stream" + ], "tags": [ - "User" + "Public" ], - "summary": "returns a list of service accounts for a user", - "operationId": "ListAUserServiceAccounts", + "summary": "Downloads an object from a presigned url", + "operationId": "DownloadSharedObject", "parameters": [ { "type": "string", - "name": "name", + "name": "url", "in": "path", "required": true } @@ -11316,7 +5030,7 @@ func init() { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/serviceAccounts" + "type": "file" } }, "default": { @@ -11326,34 +5040,41 @@ func init() { } } } - }, - "post": { + } + }, + "/license/acknowledge": { + "get": { "tags": [ - "User" + "License" ], - "summary": "Create Service Account for User", - "operationId": "CreateAUserServiceAccount", - "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true + "summary": "Acknowledge the license", + "operationId": "LicenseAcknowledge", + "responses": { + "200": { + "description": "A successful response." }, - { - "name": "body", - "in": "body", - "required": true, + "default": { + "description": "Generic error response.", "schema": { - "$ref": "#/definitions/serviceAccountRequest" + "$ref": "#/definitions/ApiError" } } + } + } + }, + "/login": { + "get": { + "security": [], + "tags": [ + "Auth" ], + "summary": "Returns login strategy, form or sso.", + "operationId": "LoginDetail", "responses": { - "201": { + "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/serviceAccountCreds" + "$ref": "#/definitions/loginDetails" } }, "default": { @@ -11363,37 +5084,27 @@ func init() { } } } - } - }, - "/users": { - "get": { + }, + "post": { + "security": [], "tags": [ - "User" + "Auth" ], - "summary": "List Users", - "operationId": "ListUsers", + "summary": "Login to Console", + "operationId": "Login", "parameters": [ { - "type": "number", - "format": "int32", - "default": 0, - "name": "offset", - "in": "query" - }, - { - "type": "number", - "format": "int32", - "default": 20, - "name": "limit", - "in": "query" + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/loginRequest" + } } ], "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/listUsersResponse" - } + "204": { + "description": "A successful login." }, "default": { "description": "Generic error response.", @@ -11402,29 +5113,29 @@ func init() { } } } - }, + } + }, + "/login/oauth2/auth": { "post": { + "security": [], "tags": [ - "User" + "Auth" ], - "summary": "Add User", - "operationId": "AddUser", + "summary": "Identity Provider oauth2 callback endpoint.", + "operationId": "LoginOauth2Auth", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/addUserRequest" + "$ref": "#/definitions/loginOauth2AuthRequest" } } ], "responses": { - "201": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/user" - } + "204": { + "description": "A successful login." }, "default": { "description": "Generic error response.", @@ -11435,20 +5146,20 @@ func init() { } } }, - "/users-groups-bulk": { - "put": { + "/logout": { + "post": { "tags": [ - "User" + "Auth" ], - "summary": "Bulk functionality to Add Users to Groups", - "operationId": "BulkUpdateUsersGroups", + "summary": "Logout from Console.", + "operationId": "Logout", "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/bulkUserGroups" + "$ref": "#/definitions/logoutRequest" } } ], @@ -11465,28 +5176,57 @@ func init() { } } }, - "/users/service-accounts": { - "post": { + "/session": { + "get": { + "tags": [ + "Auth" + ], + "summary": "Endpoint to check if your session is still valid", + "operationId": "SessionCheck", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/sessionResponse" + } + }, + "default": { + "description": "Generic error response.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + } + } + }, + "/users": { + "get": { "tags": [ "User" ], - "summary": "Check number of service accounts for each user specified", - "operationId": "CheckUserServiceAccounts", + "summary": "List Users", + "operationId": "ListUsers", "parameters": [ { - "name": "selectedUsers", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/selectedUsers" - } + "type": "number", + "format": "int32", + "default": 0, + "name": "offset", + "in": "query" + }, + { + "type": "number", + "format": "int32", + "default": 20, + "name": "limit", + "in": "query" } ], "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/userServiceAccountSummary" + "$ref": "#/definitions/listUsersResponse" } }, "default": { @@ -13082,20 +6822,8 @@ func init() { "name" ], "properties": { - "locking": { - "type": "boolean" - }, "name": { "type": "string" - }, - "quota": { - "$ref": "#/definitions/setBucketQuota" - }, - "retention": { - "$ref": "#/definitions/putBucketRetentionRequest" - }, - "versioning": { - "$ref": "#/definitions/setBucketVersioning" } } }, diff --git a/api/operations/account/account_change_password.go b/api/operations/account/account_change_password.go deleted file mode 100644 index 8974002780..0000000000 --- a/api/operations/account/account_change_password.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 account - -// 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" -) - -// AccountChangePasswordHandlerFunc turns a function with the right signature into a account change password handler -type AccountChangePasswordHandlerFunc func(AccountChangePasswordParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn AccountChangePasswordHandlerFunc) Handle(params AccountChangePasswordParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// AccountChangePasswordHandler interface for that can handle valid account change password params -type AccountChangePasswordHandler interface { - Handle(AccountChangePasswordParams, *models.Principal) middleware.Responder -} - -// NewAccountChangePassword creates a new http.Handler for the account change password operation -func NewAccountChangePassword(ctx *middleware.Context, handler AccountChangePasswordHandler) *AccountChangePassword { - return &AccountChangePassword{Context: ctx, Handler: handler} -} - -/* - AccountChangePassword swagger:route POST /account/change-password Account accountChangePassword - -Change password of currently logged in user. -*/ -type AccountChangePassword struct { - Context *middleware.Context - Handler AccountChangePasswordHandler -} - -func (o *AccountChangePassword) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewAccountChangePasswordParams() - 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/account/account_change_password_parameters.go b/api/operations/account/account_change_password_parameters.go deleted file mode 100644 index 311af15479..0000000000 --- a/api/operations/account/account_change_password_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 account - -// 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" -) - -// NewAccountChangePasswordParams creates a new AccountChangePasswordParams object -// -// There are no default values defined in the spec. -func NewAccountChangePasswordParams() AccountChangePasswordParams { - - return AccountChangePasswordParams{} -} - -// AccountChangePasswordParams contains all the bound params for the account change password operation -// typically these are obtained from a http.Request -// -// swagger:parameters AccountChangePassword -type AccountChangePasswordParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.AccountChangePasswordRequest -} - -// 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 NewAccountChangePasswordParams() beforehand. -func (o *AccountChangePasswordParams) 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.AccountChangePasswordRequest - 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/account/account_change_password_responses.go b/api/operations/account/account_change_password_responses.go deleted file mode 100644 index 91104da67d..0000000000 --- a/api/operations/account/account_change_password_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 account - -// 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" -) - -// AccountChangePasswordNoContentCode is the HTTP code returned for type AccountChangePasswordNoContent -const AccountChangePasswordNoContentCode int = 204 - -/* -AccountChangePasswordNoContent A successful login. - -swagger:response accountChangePasswordNoContent -*/ -type AccountChangePasswordNoContent struct { -} - -// NewAccountChangePasswordNoContent creates AccountChangePasswordNoContent with default headers values -func NewAccountChangePasswordNoContent() *AccountChangePasswordNoContent { - - return &AccountChangePasswordNoContent{} -} - -// WriteResponse to the client -func (o *AccountChangePasswordNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -/* -AccountChangePasswordDefault Generic error response. - -swagger:response accountChangePasswordDefault -*/ -type AccountChangePasswordDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewAccountChangePasswordDefault creates AccountChangePasswordDefault with default headers values -func NewAccountChangePasswordDefault(code int) *AccountChangePasswordDefault { - if code <= 0 { - code = 500 - } - - return &AccountChangePasswordDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the account change password default response -func (o *AccountChangePasswordDefault) WithStatusCode(code int) *AccountChangePasswordDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the account change password default response -func (o *AccountChangePasswordDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the account change password default response -func (o *AccountChangePasswordDefault) WithPayload(payload *models.APIError) *AccountChangePasswordDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the account change password default response -func (o *AccountChangePasswordDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *AccountChangePasswordDefault) 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/account/account_change_password_urlbuilder.go b/api/operations/account/account_change_password_urlbuilder.go deleted file mode 100644 index 8737a8a06f..0000000000 --- a/api/operations/account/account_change_password_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 account - -// 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" -) - -// AccountChangePasswordURL generates an URL for the account change password operation -type AccountChangePasswordURL 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 *AccountChangePasswordURL) WithBasePath(bp string) *AccountChangePasswordURL { - 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 *AccountChangePasswordURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *AccountChangePasswordURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/account/change-password" - - _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 *AccountChangePasswordURL) 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 *AccountChangePasswordURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *AccountChangePasswordURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on AccountChangePasswordURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on AccountChangePasswordURL") - } - - 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 *AccountChangePasswordURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/account/change_user_password.go b/api/operations/account/change_user_password.go deleted file mode 100644 index 0b9bdc1453..0000000000 --- a/api/operations/account/change_user_password.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 account - -// 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" -) - -// ChangeUserPasswordHandlerFunc turns a function with the right signature into a change user password handler -type ChangeUserPasswordHandlerFunc func(ChangeUserPasswordParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn ChangeUserPasswordHandlerFunc) Handle(params ChangeUserPasswordParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// ChangeUserPasswordHandler interface for that can handle valid change user password params -type ChangeUserPasswordHandler interface { - Handle(ChangeUserPasswordParams, *models.Principal) middleware.Responder -} - -// NewChangeUserPassword creates a new http.Handler for the change user password operation -func NewChangeUserPassword(ctx *middleware.Context, handler ChangeUserPasswordHandler) *ChangeUserPassword { - return &ChangeUserPassword{Context: ctx, Handler: handler} -} - -/* - ChangeUserPassword swagger:route POST /account/change-user-password Account changeUserPassword - -Change password of currently logged in user. -*/ -type ChangeUserPassword struct { - Context *middleware.Context - Handler ChangeUserPasswordHandler -} - -func (o *ChangeUserPassword) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewChangeUserPasswordParams() - 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/account/change_user_password_parameters.go b/api/operations/account/change_user_password_parameters.go deleted file mode 100644 index 9b3f8a1a51..0000000000 --- a/api/operations/account/change_user_password_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 account - -// 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" -) - -// NewChangeUserPasswordParams creates a new ChangeUserPasswordParams object -// -// There are no default values defined in the spec. -func NewChangeUserPasswordParams() ChangeUserPasswordParams { - - return ChangeUserPasswordParams{} -} - -// ChangeUserPasswordParams contains all the bound params for the change user password operation -// typically these are obtained from a http.Request -// -// swagger:parameters ChangeUserPassword -type ChangeUserPasswordParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.ChangeUserPasswordRequest -} - -// 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 NewChangeUserPasswordParams() beforehand. -func (o *ChangeUserPasswordParams) 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.ChangeUserPasswordRequest - 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/account/change_user_password_responses.go b/api/operations/account/change_user_password_responses.go deleted file mode 100644 index d40b33bed1..0000000000 --- a/api/operations/account/change_user_password_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 account - -// 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" -) - -// ChangeUserPasswordCreatedCode is the HTTP code returned for type ChangeUserPasswordCreated -const ChangeUserPasswordCreatedCode int = 201 - -/* -ChangeUserPasswordCreated Password successfully changed. - -swagger:response changeUserPasswordCreated -*/ -type ChangeUserPasswordCreated struct { -} - -// NewChangeUserPasswordCreated creates ChangeUserPasswordCreated with default headers values -func NewChangeUserPasswordCreated() *ChangeUserPasswordCreated { - - return &ChangeUserPasswordCreated{} -} - -// WriteResponse to the client -func (o *ChangeUserPasswordCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(201) -} - -/* -ChangeUserPasswordDefault Generic error response. - -swagger:response changeUserPasswordDefault -*/ -type ChangeUserPasswordDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewChangeUserPasswordDefault creates ChangeUserPasswordDefault with default headers values -func NewChangeUserPasswordDefault(code int) *ChangeUserPasswordDefault { - if code <= 0 { - code = 500 - } - - return &ChangeUserPasswordDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the change user password default response -func (o *ChangeUserPasswordDefault) WithStatusCode(code int) *ChangeUserPasswordDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the change user password default response -func (o *ChangeUserPasswordDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the change user password default response -func (o *ChangeUserPasswordDefault) WithPayload(payload *models.APIError) *ChangeUserPasswordDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the change user password default response -func (o *ChangeUserPasswordDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ChangeUserPasswordDefault) 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/account/change_user_password_urlbuilder.go b/api/operations/account/change_user_password_urlbuilder.go deleted file mode 100644 index c3ddceadc0..0000000000 --- a/api/operations/account/change_user_password_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 account - -// 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" -) - -// ChangeUserPasswordURL generates an URL for the change user password operation -type ChangeUserPasswordURL 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 *ChangeUserPasswordURL) WithBasePath(bp string) *ChangeUserPasswordURL { - 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 *ChangeUserPasswordURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ChangeUserPasswordURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/account/change-user-password" - - _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 *ChangeUserPasswordURL) 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 *ChangeUserPasswordURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ChangeUserPasswordURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ChangeUserPasswordURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ChangeUserPasswordURL") - } - - 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 *ChangeUserPasswordURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/bucket/add_remote_bucket.go b/api/operations/bucket/add_remote_bucket.go deleted file mode 100644 index 84f340d8d7..0000000000 --- a/api/operations/bucket/add_remote_bucket.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 bucket - -// 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" -) - -// AddRemoteBucketHandlerFunc turns a function with the right signature into a add remote bucket handler -type AddRemoteBucketHandlerFunc func(AddRemoteBucketParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn AddRemoteBucketHandlerFunc) Handle(params AddRemoteBucketParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// AddRemoteBucketHandler interface for that can handle valid add remote bucket params -type AddRemoteBucketHandler interface { - Handle(AddRemoteBucketParams, *models.Principal) middleware.Responder -} - -// NewAddRemoteBucket creates a new http.Handler for the add remote bucket operation -func NewAddRemoteBucket(ctx *middleware.Context, handler AddRemoteBucketHandler) *AddRemoteBucket { - return &AddRemoteBucket{Context: ctx, Handler: handler} -} - -/* - AddRemoteBucket swagger:route POST /remote-buckets Bucket addRemoteBucket - -Add Remote Bucket -*/ -type AddRemoteBucket struct { - Context *middleware.Context - Handler AddRemoteBucketHandler -} - -func (o *AddRemoteBucket) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewAddRemoteBucketParams() - 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/bucket/add_remote_bucket_parameters.go b/api/operations/bucket/add_remote_bucket_parameters.go deleted file mode 100644 index f7db6dbc0e..0000000000 --- a/api/operations/bucket/add_remote_bucket_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 bucket - -// 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" -) - -// NewAddRemoteBucketParams creates a new AddRemoteBucketParams object -// -// There are no default values defined in the spec. -func NewAddRemoteBucketParams() AddRemoteBucketParams { - - return AddRemoteBucketParams{} -} - -// AddRemoteBucketParams contains all the bound params for the add remote bucket operation -// typically these are obtained from a http.Request -// -// swagger:parameters AddRemoteBucket -type AddRemoteBucketParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.CreateRemoteBucket -} - -// 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 NewAddRemoteBucketParams() beforehand. -func (o *AddRemoteBucketParams) 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.CreateRemoteBucket - 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/bucket/add_remote_bucket_responses.go b/api/operations/bucket/add_remote_bucket_responses.go deleted file mode 100644 index 625eaa182b..0000000000 --- a/api/operations/bucket/add_remote_bucket_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 bucket - -// 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" -) - -// AddRemoteBucketCreatedCode is the HTTP code returned for type AddRemoteBucketCreated -const AddRemoteBucketCreatedCode int = 201 - -/* -AddRemoteBucketCreated A successful response. - -swagger:response addRemoteBucketCreated -*/ -type AddRemoteBucketCreated struct { -} - -// NewAddRemoteBucketCreated creates AddRemoteBucketCreated with default headers values -func NewAddRemoteBucketCreated() *AddRemoteBucketCreated { - - return &AddRemoteBucketCreated{} -} - -// WriteResponse to the client -func (o *AddRemoteBucketCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(201) -} - -/* -AddRemoteBucketDefault Generic error response. - -swagger:response addRemoteBucketDefault -*/ -type AddRemoteBucketDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewAddRemoteBucketDefault creates AddRemoteBucketDefault with default headers values -func NewAddRemoteBucketDefault(code int) *AddRemoteBucketDefault { - if code <= 0 { - code = 500 - } - - return &AddRemoteBucketDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the add remote bucket default response -func (o *AddRemoteBucketDefault) WithStatusCode(code int) *AddRemoteBucketDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the add remote bucket default response -func (o *AddRemoteBucketDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the add remote bucket default response -func (o *AddRemoteBucketDefault) WithPayload(payload *models.APIError) *AddRemoteBucketDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the add remote bucket default response -func (o *AddRemoteBucketDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *AddRemoteBucketDefault) 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/bucket/add_remote_bucket_urlbuilder.go b/api/operations/bucket/add_remote_bucket_urlbuilder.go deleted file mode 100644 index 20e379ace6..0000000000 --- a/api/operations/bucket/add_remote_bucket_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 bucket - -// 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" -) - -// AddRemoteBucketURL generates an URL for the add remote bucket operation -type AddRemoteBucketURL 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 *AddRemoteBucketURL) WithBasePath(bp string) *AddRemoteBucketURL { - 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 *AddRemoteBucketURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *AddRemoteBucketURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/remote-buckets" - - _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 *AddRemoteBucketURL) 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 *AddRemoteBucketURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *AddRemoteBucketURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on AddRemoteBucketURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on AddRemoteBucketURL") - } - - 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 *AddRemoteBucketURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/bucket/bucket_set_policy.go b/api/operations/bucket/bucket_set_policy.go deleted file mode 100644 index 8ed72a965f..0000000000 --- a/api/operations/bucket/bucket_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 bucket - -// 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" -) - -// BucketSetPolicyHandlerFunc turns a function with the right signature into a bucket set policy handler -type BucketSetPolicyHandlerFunc func(BucketSetPolicyParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn BucketSetPolicyHandlerFunc) Handle(params BucketSetPolicyParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// BucketSetPolicyHandler interface for that can handle valid bucket set policy params -type BucketSetPolicyHandler interface { - Handle(BucketSetPolicyParams, *models.Principal) middleware.Responder -} - -// NewBucketSetPolicy creates a new http.Handler for the bucket set policy operation -func NewBucketSetPolicy(ctx *middleware.Context, handler BucketSetPolicyHandler) *BucketSetPolicy { - return &BucketSetPolicy{Context: ctx, Handler: handler} -} - -/* - BucketSetPolicy swagger:route PUT /buckets/{name}/set-policy Bucket bucketSetPolicy - -Bucket Set Policy -*/ -type BucketSetPolicy struct { - Context *middleware.Context - Handler BucketSetPolicyHandler -} - -func (o *BucketSetPolicy) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewBucketSetPolicyParams() - 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/bucket/bucket_set_policy_parameters.go b/api/operations/bucket/bucket_set_policy_parameters.go deleted file mode 100644 index 6727a8f550..0000000000 --- a/api/operations/bucket/bucket_set_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 bucket - -// 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" -) - -// NewBucketSetPolicyParams creates a new BucketSetPolicyParams object -// -// There are no default values defined in the spec. -func NewBucketSetPolicyParams() BucketSetPolicyParams { - - return BucketSetPolicyParams{} -} - -// BucketSetPolicyParams contains all the bound params for the bucket set policy operation -// typically these are obtained from a http.Request -// -// swagger:parameters BucketSetPolicy -type BucketSetPolicyParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.SetBucketPolicyRequest - /* - 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 NewBucketSetPolicyParams() beforehand. -func (o *BucketSetPolicyParams) 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.SetBucketPolicyRequest - 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 *BucketSetPolicyParams) 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/bucket/bucket_set_policy_responses.go b/api/operations/bucket/bucket_set_policy_responses.go deleted file mode 100644 index 2ad0c673b7..0000000000 --- a/api/operations/bucket/bucket_set_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 bucket - -// 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" -) - -// BucketSetPolicyOKCode is the HTTP code returned for type BucketSetPolicyOK -const BucketSetPolicyOKCode int = 200 - -/* -BucketSetPolicyOK A successful response. - -swagger:response bucketSetPolicyOK -*/ -type BucketSetPolicyOK struct { - - /* - In: Body - */ - Payload *models.Bucket `json:"body,omitempty"` -} - -// NewBucketSetPolicyOK creates BucketSetPolicyOK with default headers values -func NewBucketSetPolicyOK() *BucketSetPolicyOK { - - return &BucketSetPolicyOK{} -} - -// WithPayload adds the payload to the bucket set policy o k response -func (o *BucketSetPolicyOK) WithPayload(payload *models.Bucket) *BucketSetPolicyOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the bucket set policy o k response -func (o *BucketSetPolicyOK) SetPayload(payload *models.Bucket) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *BucketSetPolicyOK) 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 - } - } -} - -/* -BucketSetPolicyDefault Generic error response. - -swagger:response bucketSetPolicyDefault -*/ -type BucketSetPolicyDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewBucketSetPolicyDefault creates BucketSetPolicyDefault with default headers values -func NewBucketSetPolicyDefault(code int) *BucketSetPolicyDefault { - if code <= 0 { - code = 500 - } - - return &BucketSetPolicyDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the bucket set policy default response -func (o *BucketSetPolicyDefault) WithStatusCode(code int) *BucketSetPolicyDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the bucket set policy default response -func (o *BucketSetPolicyDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the bucket set policy default response -func (o *BucketSetPolicyDefault) WithPayload(payload *models.APIError) *BucketSetPolicyDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the bucket set policy default response -func (o *BucketSetPolicyDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *BucketSetPolicyDefault) 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/bucket/bucket_set_policy_urlbuilder.go b/api/operations/bucket/bucket_set_policy_urlbuilder.go deleted file mode 100644 index 0fea30170a..0000000000 --- a/api/operations/bucket/bucket_set_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 bucket - -// 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" -) - -// BucketSetPolicyURL generates an URL for the bucket set policy operation -type BucketSetPolicyURL 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 *BucketSetPolicyURL) WithBasePath(bp string) *BucketSetPolicyURL { - 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 *BucketSetPolicyURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *BucketSetPolicyURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/buckets/{name}/set-policy" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on BucketSetPolicyURL") - } - - _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 *BucketSetPolicyURL) 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 *BucketSetPolicyURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *BucketSetPolicyURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on BucketSetPolicyURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on BucketSetPolicyURL") - } - - 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 *BucketSetPolicyURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/bucket/create_bucket_event.go b/api/operations/bucket/create_bucket_event.go deleted file mode 100644 index c4c955683d..0000000000 --- a/api/operations/bucket/create_bucket_event.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 bucket - -// 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" -) - -// CreateBucketEventHandlerFunc turns a function with the right signature into a create bucket event handler -type CreateBucketEventHandlerFunc func(CreateBucketEventParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateBucketEventHandlerFunc) Handle(params CreateBucketEventParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// CreateBucketEventHandler interface for that can handle valid create bucket event params -type CreateBucketEventHandler interface { - Handle(CreateBucketEventParams, *models.Principal) middleware.Responder -} - -// NewCreateBucketEvent creates a new http.Handler for the create bucket event operation -func NewCreateBucketEvent(ctx *middleware.Context, handler CreateBucketEventHandler) *CreateBucketEvent { - return &CreateBucketEvent{Context: ctx, Handler: handler} -} - -/* - CreateBucketEvent swagger:route POST /buckets/{bucket_name}/events Bucket createBucketEvent - -Create Bucket Event -*/ -type CreateBucketEvent struct { - Context *middleware.Context - Handler CreateBucketEventHandler -} - -func (o *CreateBucketEvent) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateBucketEventParams() - 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/bucket/create_bucket_event_parameters.go b/api/operations/bucket/create_bucket_event_parameters.go deleted file mode 100644 index 2f1478ac5b..0000000000 --- a/api/operations/bucket/create_bucket_event_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 bucket - -// 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" -) - -// NewCreateBucketEventParams creates a new CreateBucketEventParams object -// -// There are no default values defined in the spec. -func NewCreateBucketEventParams() CreateBucketEventParams { - - return CreateBucketEventParams{} -} - -// CreateBucketEventParams contains all the bound params for the create bucket event operation -// typically these are obtained from a http.Request -// -// swagger:parameters CreateBucketEvent -type CreateBucketEventParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.BucketEventRequest - /* - Required: true - In: path - */ - BucketName 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 NewCreateBucketEventParams() beforehand. -func (o *CreateBucketEventParams) 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.BucketEventRequest - 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", "")) - } - - rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") - if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindBucketName binds and validates parameter BucketName from path. -func (o *CreateBucketEventParams) bindBucketName(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.BucketName = raw - - return nil -} diff --git a/api/operations/bucket/create_bucket_event_responses.go b/api/operations/bucket/create_bucket_event_responses.go deleted file mode 100644 index c8bda7cd45..0000000000 --- a/api/operations/bucket/create_bucket_event_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 bucket - -// 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" -) - -// CreateBucketEventCreatedCode is the HTTP code returned for type CreateBucketEventCreated -const CreateBucketEventCreatedCode int = 201 - -/* -CreateBucketEventCreated A successful response. - -swagger:response createBucketEventCreated -*/ -type CreateBucketEventCreated struct { -} - -// NewCreateBucketEventCreated creates CreateBucketEventCreated with default headers values -func NewCreateBucketEventCreated() *CreateBucketEventCreated { - - return &CreateBucketEventCreated{} -} - -// WriteResponse to the client -func (o *CreateBucketEventCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(201) -} - -/* -CreateBucketEventDefault Generic error response. - -swagger:response createBucketEventDefault -*/ -type CreateBucketEventDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewCreateBucketEventDefault creates CreateBucketEventDefault with default headers values -func NewCreateBucketEventDefault(code int) *CreateBucketEventDefault { - if code <= 0 { - code = 500 - } - - return &CreateBucketEventDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create bucket event default response -func (o *CreateBucketEventDefault) WithStatusCode(code int) *CreateBucketEventDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create bucket event default response -func (o *CreateBucketEventDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the create bucket event default response -func (o *CreateBucketEventDefault) WithPayload(payload *models.APIError) *CreateBucketEventDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create bucket event default response -func (o *CreateBucketEventDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateBucketEventDefault) 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/bucket/create_bucket_event_urlbuilder.go b/api/operations/bucket/create_bucket_event_urlbuilder.go deleted file mode 100644 index 6852f723bc..0000000000 --- a/api/operations/bucket/create_bucket_event_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 bucket - -// 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" -) - -// CreateBucketEventURL generates an URL for the create bucket event operation -type CreateBucketEventURL struct { - BucketName 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 *CreateBucketEventURL) WithBasePath(bp string) *CreateBucketEventURL { - 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 *CreateBucketEventURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateBucketEventURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/buckets/{bucket_name}/events" - - bucketName := o.BucketName - if bucketName != "" { - _path = strings.Replace(_path, "{bucket_name}", bucketName, -1) - } else { - return nil, errors.New("bucketName is required on CreateBucketEventURL") - } - - _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 *CreateBucketEventURL) 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 *CreateBucketEventURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateBucketEventURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateBucketEventURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateBucketEventURL") - } - - 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 *CreateBucketEventURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/bucket/delete_access_rule_with_bucket.go b/api/operations/bucket/delete_access_rule_with_bucket.go deleted file mode 100644 index a20be257c7..0000000000 --- a/api/operations/bucket/delete_access_rule_with_bucket.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 bucket - -// 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" -) - -// DeleteAccessRuleWithBucketHandlerFunc turns a function with the right signature into a delete access rule with bucket handler -type DeleteAccessRuleWithBucketHandlerFunc func(DeleteAccessRuleWithBucketParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteAccessRuleWithBucketHandlerFunc) Handle(params DeleteAccessRuleWithBucketParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// DeleteAccessRuleWithBucketHandler interface for that can handle valid delete access rule with bucket params -type DeleteAccessRuleWithBucketHandler interface { - Handle(DeleteAccessRuleWithBucketParams, *models.Principal) middleware.Responder -} - -// NewDeleteAccessRuleWithBucket creates a new http.Handler for the delete access rule with bucket operation -func NewDeleteAccessRuleWithBucket(ctx *middleware.Context, handler DeleteAccessRuleWithBucketHandler) *DeleteAccessRuleWithBucket { - return &DeleteAccessRuleWithBucket{Context: ctx, Handler: handler} -} - -/* - DeleteAccessRuleWithBucket swagger:route DELETE /bucket/{bucket}/access-rules Bucket deleteAccessRuleWithBucket - -Delete Access Rule From Given Bucket -*/ -type DeleteAccessRuleWithBucket struct { - Context *middleware.Context - Handler DeleteAccessRuleWithBucketHandler -} - -func (o *DeleteAccessRuleWithBucket) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteAccessRuleWithBucketParams() - 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/bucket/delete_access_rule_with_bucket_parameters.go b/api/operations/bucket/delete_access_rule_with_bucket_parameters.go deleted file mode 100644 index c27cc6b78f..0000000000 --- a/api/operations/bucket/delete_access_rule_with_bucket_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 bucket - -// 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" -) - -// NewDeleteAccessRuleWithBucketParams creates a new DeleteAccessRuleWithBucketParams object -// -// There are no default values defined in the spec. -func NewDeleteAccessRuleWithBucketParams() DeleteAccessRuleWithBucketParams { - - return DeleteAccessRuleWithBucketParams{} -} - -// DeleteAccessRuleWithBucketParams contains all the bound params for the delete access rule with bucket operation -// typically these are obtained from a http.Request -// -// swagger:parameters DeleteAccessRuleWithBucket -type DeleteAccessRuleWithBucketParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - Bucket string - /* - Required: true - In: body - */ - Prefix *models.PrefixWrapper -} - -// 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 NewDeleteAccessRuleWithBucketParams() beforehand. -func (o *DeleteAccessRuleWithBucketParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rBucket, rhkBucket, _ := route.Params.GetOK("bucket") - if err := o.bindBucket(rBucket, rhkBucket, route.Formats); err != nil { - res = append(res, err) - } - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.PrefixWrapper - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("prefix", "body", "")) - } else { - res = append(res, errors.NewParseError("prefix", "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.Prefix = &body - } - } - } else { - res = append(res, errors.Required("prefix", "body", "")) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindBucket binds and validates parameter Bucket from path. -func (o *DeleteAccessRuleWithBucketParams) bindBucket(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.Bucket = raw - - return nil -} diff --git a/api/operations/bucket/delete_access_rule_with_bucket_responses.go b/api/operations/bucket/delete_access_rule_with_bucket_responses.go deleted file mode 100644 index 3172229549..0000000000 --- a/api/operations/bucket/delete_access_rule_with_bucket_responses.go +++ /dev/null @@ -1,133 +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 bucket - -// 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" -) - -// DeleteAccessRuleWithBucketOKCode is the HTTP code returned for type DeleteAccessRuleWithBucketOK -const DeleteAccessRuleWithBucketOKCode int = 200 - -/* -DeleteAccessRuleWithBucketOK A successful response. - -swagger:response deleteAccessRuleWithBucketOK -*/ -type DeleteAccessRuleWithBucketOK struct { - - /* - In: Body - */ - Payload bool `json:"body,omitempty"` -} - -// NewDeleteAccessRuleWithBucketOK creates DeleteAccessRuleWithBucketOK with default headers values -func NewDeleteAccessRuleWithBucketOK() *DeleteAccessRuleWithBucketOK { - - return &DeleteAccessRuleWithBucketOK{} -} - -// WithPayload adds the payload to the delete access rule with bucket o k response -func (o *DeleteAccessRuleWithBucketOK) WithPayload(payload bool) *DeleteAccessRuleWithBucketOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete access rule with bucket o k response -func (o *DeleteAccessRuleWithBucketOK) SetPayload(payload bool) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteAccessRuleWithBucketOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -DeleteAccessRuleWithBucketDefault Generic error response. - -swagger:response deleteAccessRuleWithBucketDefault -*/ -type DeleteAccessRuleWithBucketDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewDeleteAccessRuleWithBucketDefault creates DeleteAccessRuleWithBucketDefault with default headers values -func NewDeleteAccessRuleWithBucketDefault(code int) *DeleteAccessRuleWithBucketDefault { - if code <= 0 { - code = 500 - } - - return &DeleteAccessRuleWithBucketDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete access rule with bucket default response -func (o *DeleteAccessRuleWithBucketDefault) WithStatusCode(code int) *DeleteAccessRuleWithBucketDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete access rule with bucket default response -func (o *DeleteAccessRuleWithBucketDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the delete access rule with bucket default response -func (o *DeleteAccessRuleWithBucketDefault) WithPayload(payload *models.APIError) *DeleteAccessRuleWithBucketDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete access rule with bucket default response -func (o *DeleteAccessRuleWithBucketDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteAccessRuleWithBucketDefault) 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/bucket/delete_access_rule_with_bucket_urlbuilder.go b/api/operations/bucket/delete_access_rule_with_bucket_urlbuilder.go deleted file mode 100644 index 407fc727b0..0000000000 --- a/api/operations/bucket/delete_access_rule_with_bucket_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 bucket - -// 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" -) - -// DeleteAccessRuleWithBucketURL generates an URL for the delete access rule with bucket operation -type DeleteAccessRuleWithBucketURL struct { - Bucket 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 *DeleteAccessRuleWithBucketURL) WithBasePath(bp string) *DeleteAccessRuleWithBucketURL { - 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 *DeleteAccessRuleWithBucketURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteAccessRuleWithBucketURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/bucket/{bucket}/access-rules" - - bucket := o.Bucket - if bucket != "" { - _path = strings.Replace(_path, "{bucket}", bucket, -1) - } else { - return nil, errors.New("bucket is required on DeleteAccessRuleWithBucketURL") - } - - _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 *DeleteAccessRuleWithBucketURL) 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 *DeleteAccessRuleWithBucketURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteAccessRuleWithBucketURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteAccessRuleWithBucketURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteAccessRuleWithBucketURL") - } - - 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 *DeleteAccessRuleWithBucketURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/bucket/delete_all_replication_rules.go b/api/operations/bucket/delete_all_replication_rules.go deleted file mode 100644 index 255cf936c1..0000000000 --- a/api/operations/bucket/delete_all_replication_rules.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 bucket - -// 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" -) - -// DeleteAllReplicationRulesHandlerFunc turns a function with the right signature into a delete all replication rules handler -type DeleteAllReplicationRulesHandlerFunc func(DeleteAllReplicationRulesParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteAllReplicationRulesHandlerFunc) Handle(params DeleteAllReplicationRulesParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// DeleteAllReplicationRulesHandler interface for that can handle valid delete all replication rules params -type DeleteAllReplicationRulesHandler interface { - Handle(DeleteAllReplicationRulesParams, *models.Principal) middleware.Responder -} - -// NewDeleteAllReplicationRules creates a new http.Handler for the delete all replication rules operation -func NewDeleteAllReplicationRules(ctx *middleware.Context, handler DeleteAllReplicationRulesHandler) *DeleteAllReplicationRules { - return &DeleteAllReplicationRules{Context: ctx, Handler: handler} -} - -/* - DeleteAllReplicationRules swagger:route DELETE /buckets/{bucket_name}/delete-all-replication-rules Bucket deleteAllReplicationRules - -Deletes all replication rules from a bucket -*/ -type DeleteAllReplicationRules struct { - Context *middleware.Context - Handler DeleteAllReplicationRulesHandler -} - -func (o *DeleteAllReplicationRules) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteAllReplicationRulesParams() - 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/bucket/delete_all_replication_rules_parameters.go b/api/operations/bucket/delete_all_replication_rules_parameters.go deleted file mode 100644 index 1294523c23..0000000000 --- a/api/operations/bucket/delete_all_replication_rules_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 bucket - -// 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" -) - -// NewDeleteAllReplicationRulesParams creates a new DeleteAllReplicationRulesParams object -// -// There are no default values defined in the spec. -func NewDeleteAllReplicationRulesParams() DeleteAllReplicationRulesParams { - - return DeleteAllReplicationRulesParams{} -} - -// DeleteAllReplicationRulesParams contains all the bound params for the delete all replication rules operation -// typically these are obtained from a http.Request -// -// swagger:parameters DeleteAllReplicationRules -type DeleteAllReplicationRulesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - BucketName 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 NewDeleteAllReplicationRulesParams() beforehand. -func (o *DeleteAllReplicationRulesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") - if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindBucketName binds and validates parameter BucketName from path. -func (o *DeleteAllReplicationRulesParams) bindBucketName(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.BucketName = raw - - return nil -} diff --git a/api/operations/bucket/delete_all_replication_rules_responses.go b/api/operations/bucket/delete_all_replication_rules_responses.go deleted file mode 100644 index b890fef482..0000000000 --- a/api/operations/bucket/delete_all_replication_rules_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 bucket - -// 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" -) - -// DeleteAllReplicationRulesNoContentCode is the HTTP code returned for type DeleteAllReplicationRulesNoContent -const DeleteAllReplicationRulesNoContentCode int = 204 - -/* -DeleteAllReplicationRulesNoContent A successful response. - -swagger:response deleteAllReplicationRulesNoContent -*/ -type DeleteAllReplicationRulesNoContent struct { -} - -// NewDeleteAllReplicationRulesNoContent creates DeleteAllReplicationRulesNoContent with default headers values -func NewDeleteAllReplicationRulesNoContent() *DeleteAllReplicationRulesNoContent { - - return &DeleteAllReplicationRulesNoContent{} -} - -// WriteResponse to the client -func (o *DeleteAllReplicationRulesNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -/* -DeleteAllReplicationRulesDefault Generic error response. - -swagger:response deleteAllReplicationRulesDefault -*/ -type DeleteAllReplicationRulesDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewDeleteAllReplicationRulesDefault creates DeleteAllReplicationRulesDefault with default headers values -func NewDeleteAllReplicationRulesDefault(code int) *DeleteAllReplicationRulesDefault { - if code <= 0 { - code = 500 - } - - return &DeleteAllReplicationRulesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete all replication rules default response -func (o *DeleteAllReplicationRulesDefault) WithStatusCode(code int) *DeleteAllReplicationRulesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete all replication rules default response -func (o *DeleteAllReplicationRulesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the delete all replication rules default response -func (o *DeleteAllReplicationRulesDefault) WithPayload(payload *models.APIError) *DeleteAllReplicationRulesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete all replication rules default response -func (o *DeleteAllReplicationRulesDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteAllReplicationRulesDefault) 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/bucket/delete_all_replication_rules_urlbuilder.go b/api/operations/bucket/delete_all_replication_rules_urlbuilder.go deleted file mode 100644 index 1470eb09ca..0000000000 --- a/api/operations/bucket/delete_all_replication_rules_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 bucket - -// 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" -) - -// DeleteAllReplicationRulesURL generates an URL for the delete all replication rules operation -type DeleteAllReplicationRulesURL struct { - BucketName 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 *DeleteAllReplicationRulesURL) WithBasePath(bp string) *DeleteAllReplicationRulesURL { - 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 *DeleteAllReplicationRulesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteAllReplicationRulesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/buckets/{bucket_name}/delete-all-replication-rules" - - bucketName := o.BucketName - if bucketName != "" { - _path = strings.Replace(_path, "{bucket_name}", bucketName, -1) - } else { - return nil, errors.New("bucketName is required on DeleteAllReplicationRulesURL") - } - - _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 *DeleteAllReplicationRulesURL) 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 *DeleteAllReplicationRulesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteAllReplicationRulesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteAllReplicationRulesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteAllReplicationRulesURL") - } - - 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 *DeleteAllReplicationRulesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/bucket/delete_bucket.go b/api/operations/bucket/delete_bucket.go deleted file mode 100644 index 0acfe81bdc..0000000000 --- a/api/operations/bucket/delete_bucket.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 bucket - -// 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" -) - -// DeleteBucketHandlerFunc turns a function with the right signature into a delete bucket handler -type DeleteBucketHandlerFunc func(DeleteBucketParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteBucketHandlerFunc) Handle(params DeleteBucketParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// DeleteBucketHandler interface for that can handle valid delete bucket params -type DeleteBucketHandler interface { - Handle(DeleteBucketParams, *models.Principal) middleware.Responder -} - -// NewDeleteBucket creates a new http.Handler for the delete bucket operation -func NewDeleteBucket(ctx *middleware.Context, handler DeleteBucketHandler) *DeleteBucket { - return &DeleteBucket{Context: ctx, Handler: handler} -} - -/* - DeleteBucket swagger:route DELETE /buckets/{name} Bucket deleteBucket - -Delete Bucket -*/ -type DeleteBucket struct { - Context *middleware.Context - Handler DeleteBucketHandler -} - -func (o *DeleteBucket) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteBucketParams() - 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/bucket/delete_bucket_event.go b/api/operations/bucket/delete_bucket_event.go deleted file mode 100644 index 7f27144eec..0000000000 --- a/api/operations/bucket/delete_bucket_event.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 bucket - -// 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" -) - -// DeleteBucketEventHandlerFunc turns a function with the right signature into a delete bucket event handler -type DeleteBucketEventHandlerFunc func(DeleteBucketEventParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteBucketEventHandlerFunc) Handle(params DeleteBucketEventParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// DeleteBucketEventHandler interface for that can handle valid delete bucket event params -type DeleteBucketEventHandler interface { - Handle(DeleteBucketEventParams, *models.Principal) middleware.Responder -} - -// NewDeleteBucketEvent creates a new http.Handler for the delete bucket event operation -func NewDeleteBucketEvent(ctx *middleware.Context, handler DeleteBucketEventHandler) *DeleteBucketEvent { - return &DeleteBucketEvent{Context: ctx, Handler: handler} -} - -/* - DeleteBucketEvent swagger:route DELETE /buckets/{bucket_name}/events/{arn} Bucket deleteBucketEvent - -Delete Bucket Event -*/ -type DeleteBucketEvent struct { - Context *middleware.Context - Handler DeleteBucketEventHandler -} - -func (o *DeleteBucketEvent) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteBucketEventParams() - 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/bucket/delete_bucket_event_parameters.go b/api/operations/bucket/delete_bucket_event_parameters.go deleted file mode 100644 index 542b7fe5ee..0000000000 --- a/api/operations/bucket/delete_bucket_event_parameters.go +++ /dev/null @@ -1,150 +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 bucket - -// 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" -) - -// NewDeleteBucketEventParams creates a new DeleteBucketEventParams object -// -// There are no default values defined in the spec. -func NewDeleteBucketEventParams() DeleteBucketEventParams { - - return DeleteBucketEventParams{} -} - -// DeleteBucketEventParams contains all the bound params for the delete bucket event operation -// typically these are obtained from a http.Request -// -// swagger:parameters DeleteBucketEvent -type DeleteBucketEventParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - Arn string - /* - Required: true - In: body - */ - Body *models.NotificationDeleteRequest - /* - Required: true - In: path - */ - BucketName 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 NewDeleteBucketEventParams() beforehand. -func (o *DeleteBucketEventParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rArn, rhkArn, _ := route.Params.GetOK("arn") - if err := o.bindArn(rArn, rhkArn, route.Formats); err != nil { - res = append(res, err) - } - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.NotificationDeleteRequest - 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", "")) - } - - rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") - if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindArn binds and validates parameter Arn from path. -func (o *DeleteBucketEventParams) bindArn(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.Arn = raw - - return nil -} - -// bindBucketName binds and validates parameter BucketName from path. -func (o *DeleteBucketEventParams) bindBucketName(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.BucketName = raw - - return nil -} diff --git a/api/operations/bucket/delete_bucket_event_responses.go b/api/operations/bucket/delete_bucket_event_responses.go deleted file mode 100644 index 9809dbfd72..0000000000 --- a/api/operations/bucket/delete_bucket_event_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 bucket - -// 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" -) - -// DeleteBucketEventNoContentCode is the HTTP code returned for type DeleteBucketEventNoContent -const DeleteBucketEventNoContentCode int = 204 - -/* -DeleteBucketEventNoContent A successful response. - -swagger:response deleteBucketEventNoContent -*/ -type DeleteBucketEventNoContent struct { -} - -// NewDeleteBucketEventNoContent creates DeleteBucketEventNoContent with default headers values -func NewDeleteBucketEventNoContent() *DeleteBucketEventNoContent { - - return &DeleteBucketEventNoContent{} -} - -// WriteResponse to the client -func (o *DeleteBucketEventNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -/* -DeleteBucketEventDefault Generic error response. - -swagger:response deleteBucketEventDefault -*/ -type DeleteBucketEventDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewDeleteBucketEventDefault creates DeleteBucketEventDefault with default headers values -func NewDeleteBucketEventDefault(code int) *DeleteBucketEventDefault { - if code <= 0 { - code = 500 - } - - return &DeleteBucketEventDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete bucket event default response -func (o *DeleteBucketEventDefault) WithStatusCode(code int) *DeleteBucketEventDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete bucket event default response -func (o *DeleteBucketEventDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the delete bucket event default response -func (o *DeleteBucketEventDefault) WithPayload(payload *models.APIError) *DeleteBucketEventDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete bucket event default response -func (o *DeleteBucketEventDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteBucketEventDefault) 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/bucket/delete_bucket_event_urlbuilder.go b/api/operations/bucket/delete_bucket_event_urlbuilder.go deleted file mode 100644 index 9f11fc9cd0..0000000000 --- a/api/operations/bucket/delete_bucket_event_urlbuilder.go +++ /dev/null @@ -1,124 +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 bucket - -// 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" -) - -// DeleteBucketEventURL generates an URL for the delete bucket event operation -type DeleteBucketEventURL struct { - Arn string - BucketName 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 *DeleteBucketEventURL) WithBasePath(bp string) *DeleteBucketEventURL { - 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 *DeleteBucketEventURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteBucketEventURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/buckets/{bucket_name}/events/{arn}" - - arn := o.Arn - if arn != "" { - _path = strings.Replace(_path, "{arn}", arn, -1) - } else { - return nil, errors.New("arn is required on DeleteBucketEventURL") - } - - bucketName := o.BucketName - if bucketName != "" { - _path = strings.Replace(_path, "{bucket_name}", bucketName, -1) - } else { - return nil, errors.New("bucketName is required on DeleteBucketEventURL") - } - - _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 *DeleteBucketEventURL) 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 *DeleteBucketEventURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteBucketEventURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteBucketEventURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteBucketEventURL") - } - - 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 *DeleteBucketEventURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/bucket/delete_bucket_parameters.go b/api/operations/bucket/delete_bucket_parameters.go deleted file mode 100644 index 9db19aaea0..0000000000 --- a/api/operations/bucket/delete_bucket_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 bucket - -// 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" -) - -// NewDeleteBucketParams creates a new DeleteBucketParams object -// -// There are no default values defined in the spec. -func NewDeleteBucketParams() DeleteBucketParams { - - return DeleteBucketParams{} -} - -// DeleteBucketParams contains all the bound params for the delete bucket operation -// typically these are obtained from a http.Request -// -// swagger:parameters DeleteBucket -type DeleteBucketParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - 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 NewDeleteBucketParams() beforehand. -func (o *DeleteBucketParams) 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 *DeleteBucketParams) 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/bucket/delete_bucket_replication_rule.go b/api/operations/bucket/delete_bucket_replication_rule.go deleted file mode 100644 index 43bc71a2a8..0000000000 --- a/api/operations/bucket/delete_bucket_replication_rule.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 bucket - -// 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" -) - -// DeleteBucketReplicationRuleHandlerFunc turns a function with the right signature into a delete bucket replication rule handler -type DeleteBucketReplicationRuleHandlerFunc func(DeleteBucketReplicationRuleParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteBucketReplicationRuleHandlerFunc) Handle(params DeleteBucketReplicationRuleParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// DeleteBucketReplicationRuleHandler interface for that can handle valid delete bucket replication rule params -type DeleteBucketReplicationRuleHandler interface { - Handle(DeleteBucketReplicationRuleParams, *models.Principal) middleware.Responder -} - -// NewDeleteBucketReplicationRule creates a new http.Handler for the delete bucket replication rule operation -func NewDeleteBucketReplicationRule(ctx *middleware.Context, handler DeleteBucketReplicationRuleHandler) *DeleteBucketReplicationRule { - return &DeleteBucketReplicationRule{Context: ctx, Handler: handler} -} - -/* - DeleteBucketReplicationRule swagger:route DELETE /buckets/{bucket_name}/replication/{rule_id} Bucket deleteBucketReplicationRule - -Bucket Replication Rule Delete -*/ -type DeleteBucketReplicationRule struct { - Context *middleware.Context - Handler DeleteBucketReplicationRuleHandler -} - -func (o *DeleteBucketReplicationRule) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteBucketReplicationRuleParams() - 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/bucket/delete_bucket_replication_rule_parameters.go b/api/operations/bucket/delete_bucket_replication_rule_parameters.go deleted file mode 100644 index 6f5df821a5..0000000000 --- a/api/operations/bucket/delete_bucket_replication_rule_parameters.go +++ /dev/null @@ -1,112 +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 bucket - -// 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" -) - -// NewDeleteBucketReplicationRuleParams creates a new DeleteBucketReplicationRuleParams object -// -// There are no default values defined in the spec. -func NewDeleteBucketReplicationRuleParams() DeleteBucketReplicationRuleParams { - - return DeleteBucketReplicationRuleParams{} -} - -// DeleteBucketReplicationRuleParams contains all the bound params for the delete bucket replication rule operation -// typically these are obtained from a http.Request -// -// swagger:parameters DeleteBucketReplicationRule -type DeleteBucketReplicationRuleParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - BucketName string - /* - Required: true - In: path - */ - RuleID 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 NewDeleteBucketReplicationRuleParams() beforehand. -func (o *DeleteBucketReplicationRuleParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") - if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { - res = append(res, err) - } - - rRuleID, rhkRuleID, _ := route.Params.GetOK("rule_id") - if err := o.bindRuleID(rRuleID, rhkRuleID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindBucketName binds and validates parameter BucketName from path. -func (o *DeleteBucketReplicationRuleParams) bindBucketName(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.BucketName = raw - - return nil -} - -// bindRuleID binds and validates parameter RuleID from path. -func (o *DeleteBucketReplicationRuleParams) bindRuleID(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.RuleID = raw - - return nil -} diff --git a/api/operations/bucket/delete_bucket_replication_rule_responses.go b/api/operations/bucket/delete_bucket_replication_rule_responses.go deleted file mode 100644 index 9c56027c0e..0000000000 --- a/api/operations/bucket/delete_bucket_replication_rule_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 bucket - -// 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" -) - -// DeleteBucketReplicationRuleNoContentCode is the HTTP code returned for type DeleteBucketReplicationRuleNoContent -const DeleteBucketReplicationRuleNoContentCode int = 204 - -/* -DeleteBucketReplicationRuleNoContent A successful response. - -swagger:response deleteBucketReplicationRuleNoContent -*/ -type DeleteBucketReplicationRuleNoContent struct { -} - -// NewDeleteBucketReplicationRuleNoContent creates DeleteBucketReplicationRuleNoContent with default headers values -func NewDeleteBucketReplicationRuleNoContent() *DeleteBucketReplicationRuleNoContent { - - return &DeleteBucketReplicationRuleNoContent{} -} - -// WriteResponse to the client -func (o *DeleteBucketReplicationRuleNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -/* -DeleteBucketReplicationRuleDefault Generic error response. - -swagger:response deleteBucketReplicationRuleDefault -*/ -type DeleteBucketReplicationRuleDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewDeleteBucketReplicationRuleDefault creates DeleteBucketReplicationRuleDefault with default headers values -func NewDeleteBucketReplicationRuleDefault(code int) *DeleteBucketReplicationRuleDefault { - if code <= 0 { - code = 500 - } - - return &DeleteBucketReplicationRuleDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete bucket replication rule default response -func (o *DeleteBucketReplicationRuleDefault) WithStatusCode(code int) *DeleteBucketReplicationRuleDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete bucket replication rule default response -func (o *DeleteBucketReplicationRuleDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the delete bucket replication rule default response -func (o *DeleteBucketReplicationRuleDefault) WithPayload(payload *models.APIError) *DeleteBucketReplicationRuleDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete bucket replication rule default response -func (o *DeleteBucketReplicationRuleDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteBucketReplicationRuleDefault) 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/bucket/delete_bucket_replication_rule_urlbuilder.go b/api/operations/bucket/delete_bucket_replication_rule_urlbuilder.go deleted file mode 100644 index 38b36b78f0..0000000000 --- a/api/operations/bucket/delete_bucket_replication_rule_urlbuilder.go +++ /dev/null @@ -1,124 +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 bucket - -// 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" -) - -// DeleteBucketReplicationRuleURL generates an URL for the delete bucket replication rule operation -type DeleteBucketReplicationRuleURL struct { - BucketName string - RuleID 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 *DeleteBucketReplicationRuleURL) WithBasePath(bp string) *DeleteBucketReplicationRuleURL { - 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 *DeleteBucketReplicationRuleURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteBucketReplicationRuleURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/buckets/{bucket_name}/replication/{rule_id}" - - bucketName := o.BucketName - if bucketName != "" { - _path = strings.Replace(_path, "{bucket_name}", bucketName, -1) - } else { - return nil, errors.New("bucketName is required on DeleteBucketReplicationRuleURL") - } - - ruleID := o.RuleID - if ruleID != "" { - _path = strings.Replace(_path, "{rule_id}", ruleID, -1) - } else { - return nil, errors.New("ruleId is required on DeleteBucketReplicationRuleURL") - } - - _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 *DeleteBucketReplicationRuleURL) 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 *DeleteBucketReplicationRuleURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteBucketReplicationRuleURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteBucketReplicationRuleURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteBucketReplicationRuleURL") - } - - 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 *DeleteBucketReplicationRuleURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/bucket/delete_bucket_responses.go b/api/operations/bucket/delete_bucket_responses.go deleted file mode 100644 index 27fb28545c..0000000000 --- a/api/operations/bucket/delete_bucket_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 bucket - -// 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" -) - -// DeleteBucketNoContentCode is the HTTP code returned for type DeleteBucketNoContent -const DeleteBucketNoContentCode int = 204 - -/* -DeleteBucketNoContent A successful response. - -swagger:response deleteBucketNoContent -*/ -type DeleteBucketNoContent struct { -} - -// NewDeleteBucketNoContent creates DeleteBucketNoContent with default headers values -func NewDeleteBucketNoContent() *DeleteBucketNoContent { - - return &DeleteBucketNoContent{} -} - -// WriteResponse to the client -func (o *DeleteBucketNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -/* -DeleteBucketDefault Generic error response. - -swagger:response deleteBucketDefault -*/ -type DeleteBucketDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewDeleteBucketDefault creates DeleteBucketDefault with default headers values -func NewDeleteBucketDefault(code int) *DeleteBucketDefault { - if code <= 0 { - code = 500 - } - - return &DeleteBucketDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete bucket default response -func (o *DeleteBucketDefault) WithStatusCode(code int) *DeleteBucketDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete bucket default response -func (o *DeleteBucketDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the delete bucket default response -func (o *DeleteBucketDefault) WithPayload(payload *models.APIError) *DeleteBucketDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete bucket default response -func (o *DeleteBucketDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteBucketDefault) 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/bucket/delete_bucket_urlbuilder.go b/api/operations/bucket/delete_bucket_urlbuilder.go deleted file mode 100644 index ad957c1b30..0000000000 --- a/api/operations/bucket/delete_bucket_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 bucket - -// 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" -) - -// DeleteBucketURL generates an URL for the delete bucket operation -type DeleteBucketURL 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 *DeleteBucketURL) WithBasePath(bp string) *DeleteBucketURL { - 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 *DeleteBucketURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteBucketURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/buckets/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteBucketURL") - } - - _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 *DeleteBucketURL) 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 *DeleteBucketURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteBucketURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteBucketURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteBucketURL") - } - - 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 *DeleteBucketURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/bucket/delete_remote_bucket.go b/api/operations/bucket/delete_remote_bucket.go deleted file mode 100644 index 8e1212e8fb..0000000000 --- a/api/operations/bucket/delete_remote_bucket.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 bucket - -// 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" -) - -// DeleteRemoteBucketHandlerFunc turns a function with the right signature into a delete remote bucket handler -type DeleteRemoteBucketHandlerFunc func(DeleteRemoteBucketParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteRemoteBucketHandlerFunc) Handle(params DeleteRemoteBucketParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// DeleteRemoteBucketHandler interface for that can handle valid delete remote bucket params -type DeleteRemoteBucketHandler interface { - Handle(DeleteRemoteBucketParams, *models.Principal) middleware.Responder -} - -// NewDeleteRemoteBucket creates a new http.Handler for the delete remote bucket operation -func NewDeleteRemoteBucket(ctx *middleware.Context, handler DeleteRemoteBucketHandler) *DeleteRemoteBucket { - return &DeleteRemoteBucket{Context: ctx, Handler: handler} -} - -/* - DeleteRemoteBucket swagger:route DELETE /remote-buckets/{source-bucket-name}/{arn} Bucket deleteRemoteBucket - -Delete Remote Bucket -*/ -type DeleteRemoteBucket struct { - Context *middleware.Context - Handler DeleteRemoteBucketHandler -} - -func (o *DeleteRemoteBucket) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteRemoteBucketParams() - 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/bucket/delete_remote_bucket_parameters.go b/api/operations/bucket/delete_remote_bucket_parameters.go deleted file mode 100644 index 2719ed1541..0000000000 --- a/api/operations/bucket/delete_remote_bucket_parameters.go +++ /dev/null @@ -1,112 +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 bucket - -// 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" -) - -// NewDeleteRemoteBucketParams creates a new DeleteRemoteBucketParams object -// -// There are no default values defined in the spec. -func NewDeleteRemoteBucketParams() DeleteRemoteBucketParams { - - return DeleteRemoteBucketParams{} -} - -// DeleteRemoteBucketParams contains all the bound params for the delete remote bucket operation -// typically these are obtained from a http.Request -// -// swagger:parameters DeleteRemoteBucket -type DeleteRemoteBucketParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - Arn string - /* - Required: true - In: path - */ - SourceBucketName 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 NewDeleteRemoteBucketParams() beforehand. -func (o *DeleteRemoteBucketParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rArn, rhkArn, _ := route.Params.GetOK("arn") - if err := o.bindArn(rArn, rhkArn, route.Formats); err != nil { - res = append(res, err) - } - - rSourceBucketName, rhkSourceBucketName, _ := route.Params.GetOK("source-bucket-name") - if err := o.bindSourceBucketName(rSourceBucketName, rhkSourceBucketName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindArn binds and validates parameter Arn from path. -func (o *DeleteRemoteBucketParams) bindArn(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.Arn = raw - - return nil -} - -// bindSourceBucketName binds and validates parameter SourceBucketName from path. -func (o *DeleteRemoteBucketParams) bindSourceBucketName(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.SourceBucketName = raw - - return nil -} diff --git a/api/operations/bucket/delete_remote_bucket_responses.go b/api/operations/bucket/delete_remote_bucket_responses.go deleted file mode 100644 index 0dcd6ff265..0000000000 --- a/api/operations/bucket/delete_remote_bucket_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 bucket - -// 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" -) - -// DeleteRemoteBucketNoContentCode is the HTTP code returned for type DeleteRemoteBucketNoContent -const DeleteRemoteBucketNoContentCode int = 204 - -/* -DeleteRemoteBucketNoContent A successful response. - -swagger:response deleteRemoteBucketNoContent -*/ -type DeleteRemoteBucketNoContent struct { -} - -// NewDeleteRemoteBucketNoContent creates DeleteRemoteBucketNoContent with default headers values -func NewDeleteRemoteBucketNoContent() *DeleteRemoteBucketNoContent { - - return &DeleteRemoteBucketNoContent{} -} - -// WriteResponse to the client -func (o *DeleteRemoteBucketNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -/* -DeleteRemoteBucketDefault Generic error response. - -swagger:response deleteRemoteBucketDefault -*/ -type DeleteRemoteBucketDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewDeleteRemoteBucketDefault creates DeleteRemoteBucketDefault with default headers values -func NewDeleteRemoteBucketDefault(code int) *DeleteRemoteBucketDefault { - if code <= 0 { - code = 500 - } - - return &DeleteRemoteBucketDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete remote bucket default response -func (o *DeleteRemoteBucketDefault) WithStatusCode(code int) *DeleteRemoteBucketDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete remote bucket default response -func (o *DeleteRemoteBucketDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the delete remote bucket default response -func (o *DeleteRemoteBucketDefault) WithPayload(payload *models.APIError) *DeleteRemoteBucketDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete remote bucket default response -func (o *DeleteRemoteBucketDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteRemoteBucketDefault) 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/bucket/delete_remote_bucket_urlbuilder.go b/api/operations/bucket/delete_remote_bucket_urlbuilder.go deleted file mode 100644 index 0a7daef4cf..0000000000 --- a/api/operations/bucket/delete_remote_bucket_urlbuilder.go +++ /dev/null @@ -1,124 +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 bucket - -// 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" -) - -// DeleteRemoteBucketURL generates an URL for the delete remote bucket operation -type DeleteRemoteBucketURL struct { - Arn string - SourceBucketName 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 *DeleteRemoteBucketURL) WithBasePath(bp string) *DeleteRemoteBucketURL { - 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 *DeleteRemoteBucketURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteRemoteBucketURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/remote-buckets/{source-bucket-name}/{arn}" - - arn := o.Arn - if arn != "" { - _path = strings.Replace(_path, "{arn}", arn, -1) - } else { - return nil, errors.New("arn is required on DeleteRemoteBucketURL") - } - - sourceBucketName := o.SourceBucketName - if sourceBucketName != "" { - _path = strings.Replace(_path, "{source-bucket-name}", sourceBucketName, -1) - } else { - return nil, errors.New("sourceBucketName is required on DeleteRemoteBucketURL") - } - - _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 *DeleteRemoteBucketURL) 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 *DeleteRemoteBucketURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteRemoteBucketURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteRemoteBucketURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteRemoteBucketURL") - } - - 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 *DeleteRemoteBucketURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/bucket/delete_selected_replication_rules.go b/api/operations/bucket/delete_selected_replication_rules.go deleted file mode 100644 index b5c8f8c6f8..0000000000 --- a/api/operations/bucket/delete_selected_replication_rules.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 bucket - -// 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" -) - -// DeleteSelectedReplicationRulesHandlerFunc turns a function with the right signature into a delete selected replication rules handler -type DeleteSelectedReplicationRulesHandlerFunc func(DeleteSelectedReplicationRulesParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteSelectedReplicationRulesHandlerFunc) Handle(params DeleteSelectedReplicationRulesParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// DeleteSelectedReplicationRulesHandler interface for that can handle valid delete selected replication rules params -type DeleteSelectedReplicationRulesHandler interface { - Handle(DeleteSelectedReplicationRulesParams, *models.Principal) middleware.Responder -} - -// NewDeleteSelectedReplicationRules creates a new http.Handler for the delete selected replication rules operation -func NewDeleteSelectedReplicationRules(ctx *middleware.Context, handler DeleteSelectedReplicationRulesHandler) *DeleteSelectedReplicationRules { - return &DeleteSelectedReplicationRules{Context: ctx, Handler: handler} -} - -/* - DeleteSelectedReplicationRules swagger:route DELETE /buckets/{bucket_name}/delete-selected-replication-rules Bucket deleteSelectedReplicationRules - -Deletes selected replication rules from a bucket -*/ -type DeleteSelectedReplicationRules struct { - Context *middleware.Context - Handler DeleteSelectedReplicationRulesHandler -} - -func (o *DeleteSelectedReplicationRules) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteSelectedReplicationRulesParams() - 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/bucket/delete_selected_replication_rules_parameters.go b/api/operations/bucket/delete_selected_replication_rules_parameters.go deleted file mode 100644 index 7847312861..0000000000 --- a/api/operations/bucket/delete_selected_replication_rules_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 bucket - -// 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" -) - -// NewDeleteSelectedReplicationRulesParams creates a new DeleteSelectedReplicationRulesParams object -// -// There are no default values defined in the spec. -func NewDeleteSelectedReplicationRulesParams() DeleteSelectedReplicationRulesParams { - - return DeleteSelectedReplicationRulesParams{} -} - -// DeleteSelectedReplicationRulesParams contains all the bound params for the delete selected replication rules operation -// typically these are obtained from a http.Request -// -// swagger:parameters DeleteSelectedReplicationRules -type DeleteSelectedReplicationRulesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - BucketName string - /* - Required: true - In: body - */ - Rules *models.BucketReplicationRuleList -} - -// 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 NewDeleteSelectedReplicationRulesParams() beforehand. -func (o *DeleteSelectedReplicationRulesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") - if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { - res = append(res, err) - } - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.BucketReplicationRuleList - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("rules", "body", "")) - } else { - res = append(res, errors.NewParseError("rules", "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.Rules = &body - } - } - } else { - res = append(res, errors.Required("rules", "body", "")) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindBucketName binds and validates parameter BucketName from path. -func (o *DeleteSelectedReplicationRulesParams) bindBucketName(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.BucketName = raw - - return nil -} diff --git a/api/operations/bucket/delete_selected_replication_rules_responses.go b/api/operations/bucket/delete_selected_replication_rules_responses.go deleted file mode 100644 index 83de0aaa5e..0000000000 --- a/api/operations/bucket/delete_selected_replication_rules_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 bucket - -// 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" -) - -// DeleteSelectedReplicationRulesNoContentCode is the HTTP code returned for type DeleteSelectedReplicationRulesNoContent -const DeleteSelectedReplicationRulesNoContentCode int = 204 - -/* -DeleteSelectedReplicationRulesNoContent A successful response. - -swagger:response deleteSelectedReplicationRulesNoContent -*/ -type DeleteSelectedReplicationRulesNoContent struct { -} - -// NewDeleteSelectedReplicationRulesNoContent creates DeleteSelectedReplicationRulesNoContent with default headers values -func NewDeleteSelectedReplicationRulesNoContent() *DeleteSelectedReplicationRulesNoContent { - - return &DeleteSelectedReplicationRulesNoContent{} -} - -// WriteResponse to the client -func (o *DeleteSelectedReplicationRulesNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -/* -DeleteSelectedReplicationRulesDefault Generic error response. - -swagger:response deleteSelectedReplicationRulesDefault -*/ -type DeleteSelectedReplicationRulesDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewDeleteSelectedReplicationRulesDefault creates DeleteSelectedReplicationRulesDefault with default headers values -func NewDeleteSelectedReplicationRulesDefault(code int) *DeleteSelectedReplicationRulesDefault { - if code <= 0 { - code = 500 - } - - return &DeleteSelectedReplicationRulesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete selected replication rules default response -func (o *DeleteSelectedReplicationRulesDefault) WithStatusCode(code int) *DeleteSelectedReplicationRulesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete selected replication rules default response -func (o *DeleteSelectedReplicationRulesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the delete selected replication rules default response -func (o *DeleteSelectedReplicationRulesDefault) WithPayload(payload *models.APIError) *DeleteSelectedReplicationRulesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete selected replication rules default response -func (o *DeleteSelectedReplicationRulesDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteSelectedReplicationRulesDefault) 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/bucket/delete_selected_replication_rules_urlbuilder.go b/api/operations/bucket/delete_selected_replication_rules_urlbuilder.go deleted file mode 100644 index 0ed80e1c3a..0000000000 --- a/api/operations/bucket/delete_selected_replication_rules_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 bucket - -// 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" -) - -// DeleteSelectedReplicationRulesURL generates an URL for the delete selected replication rules operation -type DeleteSelectedReplicationRulesURL struct { - BucketName 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 *DeleteSelectedReplicationRulesURL) WithBasePath(bp string) *DeleteSelectedReplicationRulesURL { - 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 *DeleteSelectedReplicationRulesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteSelectedReplicationRulesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/buckets/{bucket_name}/delete-selected-replication-rules" - - bucketName := o.BucketName - if bucketName != "" { - _path = strings.Replace(_path, "{bucket_name}", bucketName, -1) - } else { - return nil, errors.New("bucketName is required on DeleteSelectedReplicationRulesURL") - } - - _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 *DeleteSelectedReplicationRulesURL) 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 *DeleteSelectedReplicationRulesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteSelectedReplicationRulesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteSelectedReplicationRulesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteSelectedReplicationRulesURL") - } - - 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 *DeleteSelectedReplicationRulesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/bucket/disable_bucket_encryption.go b/api/operations/bucket/disable_bucket_encryption.go deleted file mode 100644 index 4bef4deb74..0000000000 --- a/api/operations/bucket/disable_bucket_encryption.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 bucket - -// 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" -) - -// DisableBucketEncryptionHandlerFunc turns a function with the right signature into a disable bucket encryption handler -type DisableBucketEncryptionHandlerFunc func(DisableBucketEncryptionParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn DisableBucketEncryptionHandlerFunc) Handle(params DisableBucketEncryptionParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// DisableBucketEncryptionHandler interface for that can handle valid disable bucket encryption params -type DisableBucketEncryptionHandler interface { - Handle(DisableBucketEncryptionParams, *models.Principal) middleware.Responder -} - -// NewDisableBucketEncryption creates a new http.Handler for the disable bucket encryption operation -func NewDisableBucketEncryption(ctx *middleware.Context, handler DisableBucketEncryptionHandler) *DisableBucketEncryption { - return &DisableBucketEncryption{Context: ctx, Handler: handler} -} - -/* - DisableBucketEncryption swagger:route POST /buckets/{bucket_name}/encryption/disable Bucket disableBucketEncryption - -Disable bucket encryption. -*/ -type DisableBucketEncryption struct { - Context *middleware.Context - Handler DisableBucketEncryptionHandler -} - -func (o *DisableBucketEncryption) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDisableBucketEncryptionParams() - 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/bucket/disable_bucket_encryption_parameters.go b/api/operations/bucket/disable_bucket_encryption_parameters.go deleted file mode 100644 index 62b9a0f83b..0000000000 --- a/api/operations/bucket/disable_bucket_encryption_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 bucket - -// 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" -) - -// NewDisableBucketEncryptionParams creates a new DisableBucketEncryptionParams object -// -// There are no default values defined in the spec. -func NewDisableBucketEncryptionParams() DisableBucketEncryptionParams { - - return DisableBucketEncryptionParams{} -} - -// DisableBucketEncryptionParams contains all the bound params for the disable bucket encryption operation -// typically these are obtained from a http.Request -// -// swagger:parameters DisableBucketEncryption -type DisableBucketEncryptionParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - BucketName 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 NewDisableBucketEncryptionParams() beforehand. -func (o *DisableBucketEncryptionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") - if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindBucketName binds and validates parameter BucketName from path. -func (o *DisableBucketEncryptionParams) bindBucketName(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.BucketName = raw - - return nil -} diff --git a/api/operations/bucket/disable_bucket_encryption_responses.go b/api/operations/bucket/disable_bucket_encryption_responses.go deleted file mode 100644 index b03982414f..0000000000 --- a/api/operations/bucket/disable_bucket_encryption_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 bucket - -// 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" -) - -// DisableBucketEncryptionOKCode is the HTTP code returned for type DisableBucketEncryptionOK -const DisableBucketEncryptionOKCode int = 200 - -/* -DisableBucketEncryptionOK A successful response. - -swagger:response disableBucketEncryptionOK -*/ -type DisableBucketEncryptionOK struct { -} - -// NewDisableBucketEncryptionOK creates DisableBucketEncryptionOK with default headers values -func NewDisableBucketEncryptionOK() *DisableBucketEncryptionOK { - - return &DisableBucketEncryptionOK{} -} - -// WriteResponse to the client -func (o *DisableBucketEncryptionOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(200) -} - -/* -DisableBucketEncryptionDefault Generic error response. - -swagger:response disableBucketEncryptionDefault -*/ -type DisableBucketEncryptionDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewDisableBucketEncryptionDefault creates DisableBucketEncryptionDefault with default headers values -func NewDisableBucketEncryptionDefault(code int) *DisableBucketEncryptionDefault { - if code <= 0 { - code = 500 - } - - return &DisableBucketEncryptionDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the disable bucket encryption default response -func (o *DisableBucketEncryptionDefault) WithStatusCode(code int) *DisableBucketEncryptionDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the disable bucket encryption default response -func (o *DisableBucketEncryptionDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the disable bucket encryption default response -func (o *DisableBucketEncryptionDefault) WithPayload(payload *models.APIError) *DisableBucketEncryptionDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the disable bucket encryption default response -func (o *DisableBucketEncryptionDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DisableBucketEncryptionDefault) 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/bucket/disable_bucket_encryption_urlbuilder.go b/api/operations/bucket/disable_bucket_encryption_urlbuilder.go deleted file mode 100644 index d101996ea9..0000000000 --- a/api/operations/bucket/disable_bucket_encryption_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 bucket - -// 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" -) - -// DisableBucketEncryptionURL generates an URL for the disable bucket encryption operation -type DisableBucketEncryptionURL struct { - BucketName 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 *DisableBucketEncryptionURL) WithBasePath(bp string) *DisableBucketEncryptionURL { - 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 *DisableBucketEncryptionURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DisableBucketEncryptionURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/buckets/{bucket_name}/encryption/disable" - - bucketName := o.BucketName - if bucketName != "" { - _path = strings.Replace(_path, "{bucket_name}", bucketName, -1) - } else { - return nil, errors.New("bucketName is required on DisableBucketEncryptionURL") - } - - _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 *DisableBucketEncryptionURL) 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 *DisableBucketEncryptionURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DisableBucketEncryptionURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DisableBucketEncryptionURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DisableBucketEncryptionURL") - } - - 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 *DisableBucketEncryptionURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/bucket/enable_bucket_encryption.go b/api/operations/bucket/enable_bucket_encryption.go deleted file mode 100644 index 761e4f6a3f..0000000000 --- a/api/operations/bucket/enable_bucket_encryption.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 bucket - -// 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" -) - -// EnableBucketEncryptionHandlerFunc turns a function with the right signature into a enable bucket encryption handler -type EnableBucketEncryptionHandlerFunc func(EnableBucketEncryptionParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn EnableBucketEncryptionHandlerFunc) Handle(params EnableBucketEncryptionParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// EnableBucketEncryptionHandler interface for that can handle valid enable bucket encryption params -type EnableBucketEncryptionHandler interface { - Handle(EnableBucketEncryptionParams, *models.Principal) middleware.Responder -} - -// NewEnableBucketEncryption creates a new http.Handler for the enable bucket encryption operation -func NewEnableBucketEncryption(ctx *middleware.Context, handler EnableBucketEncryptionHandler) *EnableBucketEncryption { - return &EnableBucketEncryption{Context: ctx, Handler: handler} -} - -/* - EnableBucketEncryption swagger:route POST /buckets/{bucket_name}/encryption/enable Bucket enableBucketEncryption - -Enable bucket encryption. -*/ -type EnableBucketEncryption struct { - Context *middleware.Context - Handler EnableBucketEncryptionHandler -} - -func (o *EnableBucketEncryption) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewEnableBucketEncryptionParams() - 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/bucket/enable_bucket_encryption_parameters.go b/api/operations/bucket/enable_bucket_encryption_parameters.go deleted file mode 100644 index 04e11e438f..0000000000 --- a/api/operations/bucket/enable_bucket_encryption_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 bucket - -// 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" -) - -// NewEnableBucketEncryptionParams creates a new EnableBucketEncryptionParams object -// -// There are no default values defined in the spec. -func NewEnableBucketEncryptionParams() EnableBucketEncryptionParams { - - return EnableBucketEncryptionParams{} -} - -// EnableBucketEncryptionParams contains all the bound params for the enable bucket encryption operation -// typically these are obtained from a http.Request -// -// swagger:parameters EnableBucketEncryption -type EnableBucketEncryptionParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.BucketEncryptionRequest - /* - Required: true - In: path - */ - BucketName 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 NewEnableBucketEncryptionParams() beforehand. -func (o *EnableBucketEncryptionParams) 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.BucketEncryptionRequest - 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", "")) - } - - rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") - if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindBucketName binds and validates parameter BucketName from path. -func (o *EnableBucketEncryptionParams) bindBucketName(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.BucketName = raw - - return nil -} diff --git a/api/operations/bucket/enable_bucket_encryption_responses.go b/api/operations/bucket/enable_bucket_encryption_responses.go deleted file mode 100644 index 78307e52d5..0000000000 --- a/api/operations/bucket/enable_bucket_encryption_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 bucket - -// 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" -) - -// EnableBucketEncryptionOKCode is the HTTP code returned for type EnableBucketEncryptionOK -const EnableBucketEncryptionOKCode int = 200 - -/* -EnableBucketEncryptionOK A successful response. - -swagger:response enableBucketEncryptionOK -*/ -type EnableBucketEncryptionOK struct { -} - -// NewEnableBucketEncryptionOK creates EnableBucketEncryptionOK with default headers values -func NewEnableBucketEncryptionOK() *EnableBucketEncryptionOK { - - return &EnableBucketEncryptionOK{} -} - -// WriteResponse to the client -func (o *EnableBucketEncryptionOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(200) -} - -/* -EnableBucketEncryptionDefault Generic error response. - -swagger:response enableBucketEncryptionDefault -*/ -type EnableBucketEncryptionDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewEnableBucketEncryptionDefault creates EnableBucketEncryptionDefault with default headers values -func NewEnableBucketEncryptionDefault(code int) *EnableBucketEncryptionDefault { - if code <= 0 { - code = 500 - } - - return &EnableBucketEncryptionDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the enable bucket encryption default response -func (o *EnableBucketEncryptionDefault) WithStatusCode(code int) *EnableBucketEncryptionDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the enable bucket encryption default response -func (o *EnableBucketEncryptionDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the enable bucket encryption default response -func (o *EnableBucketEncryptionDefault) WithPayload(payload *models.APIError) *EnableBucketEncryptionDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the enable bucket encryption default response -func (o *EnableBucketEncryptionDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *EnableBucketEncryptionDefault) 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/bucket/enable_bucket_encryption_urlbuilder.go b/api/operations/bucket/enable_bucket_encryption_urlbuilder.go deleted file mode 100644 index 0402e7263d..0000000000 --- a/api/operations/bucket/enable_bucket_encryption_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 bucket - -// 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" -) - -// EnableBucketEncryptionURL generates an URL for the enable bucket encryption operation -type EnableBucketEncryptionURL struct { - BucketName 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 *EnableBucketEncryptionURL) WithBasePath(bp string) *EnableBucketEncryptionURL { - 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 *EnableBucketEncryptionURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *EnableBucketEncryptionURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/buckets/{bucket_name}/encryption/enable" - - bucketName := o.BucketName - if bucketName != "" { - _path = strings.Replace(_path, "{bucket_name}", bucketName, -1) - } else { - return nil, errors.New("bucketName is required on EnableBucketEncryptionURL") - } - - _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 *EnableBucketEncryptionURL) 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 *EnableBucketEncryptionURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *EnableBucketEncryptionURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on EnableBucketEncryptionURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on EnableBucketEncryptionURL") - } - - 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 *EnableBucketEncryptionURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/bucket/get_bucket_encryption_info.go b/api/operations/bucket/get_bucket_encryption_info.go deleted file mode 100644 index 4266154c33..0000000000 --- a/api/operations/bucket/get_bucket_encryption_info.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 bucket - -// 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" -) - -// GetBucketEncryptionInfoHandlerFunc turns a function with the right signature into a get bucket encryption info handler -type GetBucketEncryptionInfoHandlerFunc func(GetBucketEncryptionInfoParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetBucketEncryptionInfoHandlerFunc) Handle(params GetBucketEncryptionInfoParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// GetBucketEncryptionInfoHandler interface for that can handle valid get bucket encryption info params -type GetBucketEncryptionInfoHandler interface { - Handle(GetBucketEncryptionInfoParams, *models.Principal) middleware.Responder -} - -// NewGetBucketEncryptionInfo creates a new http.Handler for the get bucket encryption info operation -func NewGetBucketEncryptionInfo(ctx *middleware.Context, handler GetBucketEncryptionInfoHandler) *GetBucketEncryptionInfo { - return &GetBucketEncryptionInfo{Context: ctx, Handler: handler} -} - -/* - GetBucketEncryptionInfo swagger:route GET /buckets/{bucket_name}/encryption/info Bucket getBucketEncryptionInfo - -Get bucket encryption information. -*/ -type GetBucketEncryptionInfo struct { - Context *middleware.Context - Handler GetBucketEncryptionInfoHandler -} - -func (o *GetBucketEncryptionInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetBucketEncryptionInfoParams() - 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/bucket/get_bucket_encryption_info_parameters.go b/api/operations/bucket/get_bucket_encryption_info_parameters.go deleted file mode 100644 index 704c41c8f3..0000000000 --- a/api/operations/bucket/get_bucket_encryption_info_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 bucket - -// 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" -) - -// NewGetBucketEncryptionInfoParams creates a new GetBucketEncryptionInfoParams object -// -// There are no default values defined in the spec. -func NewGetBucketEncryptionInfoParams() GetBucketEncryptionInfoParams { - - return GetBucketEncryptionInfoParams{} -} - -// GetBucketEncryptionInfoParams contains all the bound params for the get bucket encryption info operation -// typically these are obtained from a http.Request -// -// swagger:parameters GetBucketEncryptionInfo -type GetBucketEncryptionInfoParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - BucketName 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 NewGetBucketEncryptionInfoParams() beforehand. -func (o *GetBucketEncryptionInfoParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") - if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindBucketName binds and validates parameter BucketName from path. -func (o *GetBucketEncryptionInfoParams) bindBucketName(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.BucketName = raw - - return nil -} diff --git a/api/operations/bucket/get_bucket_encryption_info_responses.go b/api/operations/bucket/get_bucket_encryption_info_responses.go deleted file mode 100644 index b8ebb9c92d..0000000000 --- a/api/operations/bucket/get_bucket_encryption_info_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 bucket - -// 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" -) - -// GetBucketEncryptionInfoOKCode is the HTTP code returned for type GetBucketEncryptionInfoOK -const GetBucketEncryptionInfoOKCode int = 200 - -/* -GetBucketEncryptionInfoOK A successful response. - -swagger:response getBucketEncryptionInfoOK -*/ -type GetBucketEncryptionInfoOK struct { - - /* - In: Body - */ - Payload *models.BucketEncryptionInfo `json:"body,omitempty"` -} - -// NewGetBucketEncryptionInfoOK creates GetBucketEncryptionInfoOK with default headers values -func NewGetBucketEncryptionInfoOK() *GetBucketEncryptionInfoOK { - - return &GetBucketEncryptionInfoOK{} -} - -// WithPayload adds the payload to the get bucket encryption info o k response -func (o *GetBucketEncryptionInfoOK) WithPayload(payload *models.BucketEncryptionInfo) *GetBucketEncryptionInfoOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get bucket encryption info o k response -func (o *GetBucketEncryptionInfoOK) SetPayload(payload *models.BucketEncryptionInfo) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetBucketEncryptionInfoOK) 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 - } - } -} - -/* -GetBucketEncryptionInfoDefault Generic error response. - -swagger:response getBucketEncryptionInfoDefault -*/ -type GetBucketEncryptionInfoDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewGetBucketEncryptionInfoDefault creates GetBucketEncryptionInfoDefault with default headers values -func NewGetBucketEncryptionInfoDefault(code int) *GetBucketEncryptionInfoDefault { - if code <= 0 { - code = 500 - } - - return &GetBucketEncryptionInfoDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get bucket encryption info default response -func (o *GetBucketEncryptionInfoDefault) WithStatusCode(code int) *GetBucketEncryptionInfoDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get bucket encryption info default response -func (o *GetBucketEncryptionInfoDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the get bucket encryption info default response -func (o *GetBucketEncryptionInfoDefault) WithPayload(payload *models.APIError) *GetBucketEncryptionInfoDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get bucket encryption info default response -func (o *GetBucketEncryptionInfoDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetBucketEncryptionInfoDefault) 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/bucket/get_bucket_encryption_info_urlbuilder.go b/api/operations/bucket/get_bucket_encryption_info_urlbuilder.go deleted file mode 100644 index ef2083c82a..0000000000 --- a/api/operations/bucket/get_bucket_encryption_info_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 bucket - -// 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" -) - -// GetBucketEncryptionInfoURL generates an URL for the get bucket encryption info operation -type GetBucketEncryptionInfoURL struct { - BucketName 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 *GetBucketEncryptionInfoURL) WithBasePath(bp string) *GetBucketEncryptionInfoURL { - 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 *GetBucketEncryptionInfoURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetBucketEncryptionInfoURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/buckets/{bucket_name}/encryption/info" - - bucketName := o.BucketName - if bucketName != "" { - _path = strings.Replace(_path, "{bucket_name}", bucketName, -1) - } else { - return nil, errors.New("bucketName is required on GetBucketEncryptionInfoURL") - } - - _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 *GetBucketEncryptionInfoURL) 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 *GetBucketEncryptionInfoURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetBucketEncryptionInfoURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetBucketEncryptionInfoURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetBucketEncryptionInfoURL") - } - - 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 *GetBucketEncryptionInfoURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/bucket/get_bucket_object_locking_status.go b/api/operations/bucket/get_bucket_object_locking_status.go deleted file mode 100644 index c31be5792e..0000000000 --- a/api/operations/bucket/get_bucket_object_locking_status.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 bucket - -// 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" -) - -// GetBucketObjectLockingStatusHandlerFunc turns a function with the right signature into a get bucket object locking status handler -type GetBucketObjectLockingStatusHandlerFunc func(GetBucketObjectLockingStatusParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetBucketObjectLockingStatusHandlerFunc) Handle(params GetBucketObjectLockingStatusParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// GetBucketObjectLockingStatusHandler interface for that can handle valid get bucket object locking status params -type GetBucketObjectLockingStatusHandler interface { - Handle(GetBucketObjectLockingStatusParams, *models.Principal) middleware.Responder -} - -// NewGetBucketObjectLockingStatus creates a new http.Handler for the get bucket object locking status operation -func NewGetBucketObjectLockingStatus(ctx *middleware.Context, handler GetBucketObjectLockingStatusHandler) *GetBucketObjectLockingStatus { - return &GetBucketObjectLockingStatus{Context: ctx, Handler: handler} -} - -/* - GetBucketObjectLockingStatus swagger:route GET /buckets/{bucket_name}/object-locking Bucket getBucketObjectLockingStatus - -Returns the status of object locking support on the bucket -*/ -type GetBucketObjectLockingStatus struct { - Context *middleware.Context - Handler GetBucketObjectLockingStatusHandler -} - -func (o *GetBucketObjectLockingStatus) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetBucketObjectLockingStatusParams() - 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/bucket/get_bucket_object_locking_status_parameters.go b/api/operations/bucket/get_bucket_object_locking_status_parameters.go deleted file mode 100644 index 1a4db78c73..0000000000 --- a/api/operations/bucket/get_bucket_object_locking_status_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 bucket - -// 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" -) - -// NewGetBucketObjectLockingStatusParams creates a new GetBucketObjectLockingStatusParams object -// -// There are no default values defined in the spec. -func NewGetBucketObjectLockingStatusParams() GetBucketObjectLockingStatusParams { - - return GetBucketObjectLockingStatusParams{} -} - -// GetBucketObjectLockingStatusParams contains all the bound params for the get bucket object locking status operation -// typically these are obtained from a http.Request -// -// swagger:parameters GetBucketObjectLockingStatus -type GetBucketObjectLockingStatusParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - BucketName 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 NewGetBucketObjectLockingStatusParams() beforehand. -func (o *GetBucketObjectLockingStatusParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") - if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindBucketName binds and validates parameter BucketName from path. -func (o *GetBucketObjectLockingStatusParams) bindBucketName(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.BucketName = raw - - return nil -} diff --git a/api/operations/bucket/get_bucket_object_locking_status_responses.go b/api/operations/bucket/get_bucket_object_locking_status_responses.go deleted file mode 100644 index ff2b391e8a..0000000000 --- a/api/operations/bucket/get_bucket_object_locking_status_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 bucket - -// 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" -) - -// GetBucketObjectLockingStatusOKCode is the HTTP code returned for type GetBucketObjectLockingStatusOK -const GetBucketObjectLockingStatusOKCode int = 200 - -/* -GetBucketObjectLockingStatusOK A successful response. - -swagger:response getBucketObjectLockingStatusOK -*/ -type GetBucketObjectLockingStatusOK struct { - - /* - In: Body - */ - Payload *models.BucketObLockingResponse `json:"body,omitempty"` -} - -// NewGetBucketObjectLockingStatusOK creates GetBucketObjectLockingStatusOK with default headers values -func NewGetBucketObjectLockingStatusOK() *GetBucketObjectLockingStatusOK { - - return &GetBucketObjectLockingStatusOK{} -} - -// WithPayload adds the payload to the get bucket object locking status o k response -func (o *GetBucketObjectLockingStatusOK) WithPayload(payload *models.BucketObLockingResponse) *GetBucketObjectLockingStatusOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get bucket object locking status o k response -func (o *GetBucketObjectLockingStatusOK) SetPayload(payload *models.BucketObLockingResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetBucketObjectLockingStatusOK) 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 - } - } -} - -/* -GetBucketObjectLockingStatusDefault Generic error response. - -swagger:response getBucketObjectLockingStatusDefault -*/ -type GetBucketObjectLockingStatusDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewGetBucketObjectLockingStatusDefault creates GetBucketObjectLockingStatusDefault with default headers values -func NewGetBucketObjectLockingStatusDefault(code int) *GetBucketObjectLockingStatusDefault { - if code <= 0 { - code = 500 - } - - return &GetBucketObjectLockingStatusDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get bucket object locking status default response -func (o *GetBucketObjectLockingStatusDefault) WithStatusCode(code int) *GetBucketObjectLockingStatusDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get bucket object locking status default response -func (o *GetBucketObjectLockingStatusDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the get bucket object locking status default response -func (o *GetBucketObjectLockingStatusDefault) WithPayload(payload *models.APIError) *GetBucketObjectLockingStatusDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get bucket object locking status default response -func (o *GetBucketObjectLockingStatusDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetBucketObjectLockingStatusDefault) 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/bucket/get_bucket_object_locking_status_urlbuilder.go b/api/operations/bucket/get_bucket_object_locking_status_urlbuilder.go deleted file mode 100644 index 59a05fe577..0000000000 --- a/api/operations/bucket/get_bucket_object_locking_status_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 bucket - -// 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" -) - -// GetBucketObjectLockingStatusURL generates an URL for the get bucket object locking status operation -type GetBucketObjectLockingStatusURL struct { - BucketName 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 *GetBucketObjectLockingStatusURL) WithBasePath(bp string) *GetBucketObjectLockingStatusURL { - 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 *GetBucketObjectLockingStatusURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetBucketObjectLockingStatusURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/buckets/{bucket_name}/object-locking" - - bucketName := o.BucketName - if bucketName != "" { - _path = strings.Replace(_path, "{bucket_name}", bucketName, -1) - } else { - return nil, errors.New("bucketName is required on GetBucketObjectLockingStatusURL") - } - - _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 *GetBucketObjectLockingStatusURL) 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 *GetBucketObjectLockingStatusURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetBucketObjectLockingStatusURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetBucketObjectLockingStatusURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetBucketObjectLockingStatusURL") - } - - 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 *GetBucketObjectLockingStatusURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/bucket/get_bucket_replication.go b/api/operations/bucket/get_bucket_replication.go deleted file mode 100644 index a788ea3623..0000000000 --- a/api/operations/bucket/get_bucket_replication.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 bucket - -// 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" -) - -// GetBucketReplicationHandlerFunc turns a function with the right signature into a get bucket replication handler -type GetBucketReplicationHandlerFunc func(GetBucketReplicationParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetBucketReplicationHandlerFunc) Handle(params GetBucketReplicationParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// GetBucketReplicationHandler interface for that can handle valid get bucket replication params -type GetBucketReplicationHandler interface { - Handle(GetBucketReplicationParams, *models.Principal) middleware.Responder -} - -// NewGetBucketReplication creates a new http.Handler for the get bucket replication operation -func NewGetBucketReplication(ctx *middleware.Context, handler GetBucketReplicationHandler) *GetBucketReplication { - return &GetBucketReplication{Context: ctx, Handler: handler} -} - -/* - GetBucketReplication swagger:route GET /buckets/{bucket_name}/replication Bucket getBucketReplication - -Bucket Replication -*/ -type GetBucketReplication struct { - Context *middleware.Context - Handler GetBucketReplicationHandler -} - -func (o *GetBucketReplication) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetBucketReplicationParams() - 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/bucket/get_bucket_replication_parameters.go b/api/operations/bucket/get_bucket_replication_parameters.go deleted file mode 100644 index e781d79316..0000000000 --- a/api/operations/bucket/get_bucket_replication_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 bucket - -// 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" -) - -// NewGetBucketReplicationParams creates a new GetBucketReplicationParams object -// -// There are no default values defined in the spec. -func NewGetBucketReplicationParams() GetBucketReplicationParams { - - return GetBucketReplicationParams{} -} - -// GetBucketReplicationParams contains all the bound params for the get bucket replication operation -// typically these are obtained from a http.Request -// -// swagger:parameters GetBucketReplication -type GetBucketReplicationParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - BucketName 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 NewGetBucketReplicationParams() beforehand. -func (o *GetBucketReplicationParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") - if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindBucketName binds and validates parameter BucketName from path. -func (o *GetBucketReplicationParams) bindBucketName(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.BucketName = raw - - return nil -} diff --git a/api/operations/bucket/get_bucket_replication_responses.go b/api/operations/bucket/get_bucket_replication_responses.go deleted file mode 100644 index 430cc00629..0000000000 --- a/api/operations/bucket/get_bucket_replication_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 bucket - -// 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" -) - -// GetBucketReplicationOKCode is the HTTP code returned for type GetBucketReplicationOK -const GetBucketReplicationOKCode int = 200 - -/* -GetBucketReplicationOK A successful response. - -swagger:response getBucketReplicationOK -*/ -type GetBucketReplicationOK struct { - - /* - In: Body - */ - Payload *models.BucketReplicationResponse `json:"body,omitempty"` -} - -// NewGetBucketReplicationOK creates GetBucketReplicationOK with default headers values -func NewGetBucketReplicationOK() *GetBucketReplicationOK { - - return &GetBucketReplicationOK{} -} - -// WithPayload adds the payload to the get bucket replication o k response -func (o *GetBucketReplicationOK) WithPayload(payload *models.BucketReplicationResponse) *GetBucketReplicationOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get bucket replication o k response -func (o *GetBucketReplicationOK) SetPayload(payload *models.BucketReplicationResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetBucketReplicationOK) 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 - } - } -} - -/* -GetBucketReplicationDefault Generic error response. - -swagger:response getBucketReplicationDefault -*/ -type GetBucketReplicationDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewGetBucketReplicationDefault creates GetBucketReplicationDefault with default headers values -func NewGetBucketReplicationDefault(code int) *GetBucketReplicationDefault { - if code <= 0 { - code = 500 - } - - return &GetBucketReplicationDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get bucket replication default response -func (o *GetBucketReplicationDefault) WithStatusCode(code int) *GetBucketReplicationDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get bucket replication default response -func (o *GetBucketReplicationDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the get bucket replication default response -func (o *GetBucketReplicationDefault) WithPayload(payload *models.APIError) *GetBucketReplicationDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get bucket replication default response -func (o *GetBucketReplicationDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetBucketReplicationDefault) 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/bucket/get_bucket_replication_rule.go b/api/operations/bucket/get_bucket_replication_rule.go deleted file mode 100644 index 5e5d833ea6..0000000000 --- a/api/operations/bucket/get_bucket_replication_rule.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 bucket - -// 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" -) - -// GetBucketReplicationRuleHandlerFunc turns a function with the right signature into a get bucket replication rule handler -type GetBucketReplicationRuleHandlerFunc func(GetBucketReplicationRuleParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetBucketReplicationRuleHandlerFunc) Handle(params GetBucketReplicationRuleParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// GetBucketReplicationRuleHandler interface for that can handle valid get bucket replication rule params -type GetBucketReplicationRuleHandler interface { - Handle(GetBucketReplicationRuleParams, *models.Principal) middleware.Responder -} - -// NewGetBucketReplicationRule creates a new http.Handler for the get bucket replication rule operation -func NewGetBucketReplicationRule(ctx *middleware.Context, handler GetBucketReplicationRuleHandler) *GetBucketReplicationRule { - return &GetBucketReplicationRule{Context: ctx, Handler: handler} -} - -/* - GetBucketReplicationRule swagger:route GET /buckets/{bucket_name}/replication/{rule_id} Bucket getBucketReplicationRule - -Bucket Replication -*/ -type GetBucketReplicationRule struct { - Context *middleware.Context - Handler GetBucketReplicationRuleHandler -} - -func (o *GetBucketReplicationRule) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetBucketReplicationRuleParams() - 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/bucket/get_bucket_replication_rule_parameters.go b/api/operations/bucket/get_bucket_replication_rule_parameters.go deleted file mode 100644 index 4b8fedce1b..0000000000 --- a/api/operations/bucket/get_bucket_replication_rule_parameters.go +++ /dev/null @@ -1,112 +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 bucket - -// 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" -) - -// NewGetBucketReplicationRuleParams creates a new GetBucketReplicationRuleParams object -// -// There are no default values defined in the spec. -func NewGetBucketReplicationRuleParams() GetBucketReplicationRuleParams { - - return GetBucketReplicationRuleParams{} -} - -// GetBucketReplicationRuleParams contains all the bound params for the get bucket replication rule operation -// typically these are obtained from a http.Request -// -// swagger:parameters GetBucketReplicationRule -type GetBucketReplicationRuleParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - BucketName string - /* - Required: true - In: path - */ - RuleID 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 NewGetBucketReplicationRuleParams() beforehand. -func (o *GetBucketReplicationRuleParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") - if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { - res = append(res, err) - } - - rRuleID, rhkRuleID, _ := route.Params.GetOK("rule_id") - if err := o.bindRuleID(rRuleID, rhkRuleID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindBucketName binds and validates parameter BucketName from path. -func (o *GetBucketReplicationRuleParams) bindBucketName(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.BucketName = raw - - return nil -} - -// bindRuleID binds and validates parameter RuleID from path. -func (o *GetBucketReplicationRuleParams) bindRuleID(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.RuleID = raw - - return nil -} diff --git a/api/operations/bucket/get_bucket_replication_rule_responses.go b/api/operations/bucket/get_bucket_replication_rule_responses.go deleted file mode 100644 index 0e1a9c3dba..0000000000 --- a/api/operations/bucket/get_bucket_replication_rule_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 bucket - -// 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" -) - -// GetBucketReplicationRuleOKCode is the HTTP code returned for type GetBucketReplicationRuleOK -const GetBucketReplicationRuleOKCode int = 200 - -/* -GetBucketReplicationRuleOK A successful response. - -swagger:response getBucketReplicationRuleOK -*/ -type GetBucketReplicationRuleOK struct { - - /* - In: Body - */ - Payload *models.BucketReplicationRule `json:"body,omitempty"` -} - -// NewGetBucketReplicationRuleOK creates GetBucketReplicationRuleOK with default headers values -func NewGetBucketReplicationRuleOK() *GetBucketReplicationRuleOK { - - return &GetBucketReplicationRuleOK{} -} - -// WithPayload adds the payload to the get bucket replication rule o k response -func (o *GetBucketReplicationRuleOK) WithPayload(payload *models.BucketReplicationRule) *GetBucketReplicationRuleOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get bucket replication rule o k response -func (o *GetBucketReplicationRuleOK) SetPayload(payload *models.BucketReplicationRule) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetBucketReplicationRuleOK) 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 - } - } -} - -/* -GetBucketReplicationRuleDefault Generic error response. - -swagger:response getBucketReplicationRuleDefault -*/ -type GetBucketReplicationRuleDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewGetBucketReplicationRuleDefault creates GetBucketReplicationRuleDefault with default headers values -func NewGetBucketReplicationRuleDefault(code int) *GetBucketReplicationRuleDefault { - if code <= 0 { - code = 500 - } - - return &GetBucketReplicationRuleDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get bucket replication rule default response -func (o *GetBucketReplicationRuleDefault) WithStatusCode(code int) *GetBucketReplicationRuleDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get bucket replication rule default response -func (o *GetBucketReplicationRuleDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the get bucket replication rule default response -func (o *GetBucketReplicationRuleDefault) WithPayload(payload *models.APIError) *GetBucketReplicationRuleDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get bucket replication rule default response -func (o *GetBucketReplicationRuleDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetBucketReplicationRuleDefault) 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/bucket/get_bucket_replication_rule_urlbuilder.go b/api/operations/bucket/get_bucket_replication_rule_urlbuilder.go deleted file mode 100644 index dcce0b82e0..0000000000 --- a/api/operations/bucket/get_bucket_replication_rule_urlbuilder.go +++ /dev/null @@ -1,124 +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 bucket - -// 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" -) - -// GetBucketReplicationRuleURL generates an URL for the get bucket replication rule operation -type GetBucketReplicationRuleURL struct { - BucketName string - RuleID 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 *GetBucketReplicationRuleURL) WithBasePath(bp string) *GetBucketReplicationRuleURL { - 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 *GetBucketReplicationRuleURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetBucketReplicationRuleURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/buckets/{bucket_name}/replication/{rule_id}" - - bucketName := o.BucketName - if bucketName != "" { - _path = strings.Replace(_path, "{bucket_name}", bucketName, -1) - } else { - return nil, errors.New("bucketName is required on GetBucketReplicationRuleURL") - } - - ruleID := o.RuleID - if ruleID != "" { - _path = strings.Replace(_path, "{rule_id}", ruleID, -1) - } else { - return nil, errors.New("ruleId is required on GetBucketReplicationRuleURL") - } - - _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 *GetBucketReplicationRuleURL) 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 *GetBucketReplicationRuleURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetBucketReplicationRuleURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetBucketReplicationRuleURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetBucketReplicationRuleURL") - } - - 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 *GetBucketReplicationRuleURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/bucket/get_bucket_replication_urlbuilder.go b/api/operations/bucket/get_bucket_replication_urlbuilder.go deleted file mode 100644 index 47ffd99029..0000000000 --- a/api/operations/bucket/get_bucket_replication_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 bucket - -// 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" -) - -// GetBucketReplicationURL generates an URL for the get bucket replication operation -type GetBucketReplicationURL struct { - BucketName 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 *GetBucketReplicationURL) WithBasePath(bp string) *GetBucketReplicationURL { - 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 *GetBucketReplicationURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetBucketReplicationURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/buckets/{bucket_name}/replication" - - bucketName := o.BucketName - if bucketName != "" { - _path = strings.Replace(_path, "{bucket_name}", bucketName, -1) - } else { - return nil, errors.New("bucketName is required on GetBucketReplicationURL") - } - - _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 *GetBucketReplicationURL) 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 *GetBucketReplicationURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetBucketReplicationURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetBucketReplicationURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetBucketReplicationURL") - } - - 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 *GetBucketReplicationURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/bucket/get_bucket_retention_config.go b/api/operations/bucket/get_bucket_retention_config.go deleted file mode 100644 index d57c9be863..0000000000 --- a/api/operations/bucket/get_bucket_retention_config.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 bucket - -// 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" -) - -// GetBucketRetentionConfigHandlerFunc turns a function with the right signature into a get bucket retention config handler -type GetBucketRetentionConfigHandlerFunc func(GetBucketRetentionConfigParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetBucketRetentionConfigHandlerFunc) Handle(params GetBucketRetentionConfigParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// GetBucketRetentionConfigHandler interface for that can handle valid get bucket retention config params -type GetBucketRetentionConfigHandler interface { - Handle(GetBucketRetentionConfigParams, *models.Principal) middleware.Responder -} - -// NewGetBucketRetentionConfig creates a new http.Handler for the get bucket retention config operation -func NewGetBucketRetentionConfig(ctx *middleware.Context, handler GetBucketRetentionConfigHandler) *GetBucketRetentionConfig { - return &GetBucketRetentionConfig{Context: ctx, Handler: handler} -} - -/* - GetBucketRetentionConfig swagger:route GET /buckets/{bucket_name}/retention Bucket getBucketRetentionConfig - -Get Bucket's retention config -*/ -type GetBucketRetentionConfig struct { - Context *middleware.Context - Handler GetBucketRetentionConfigHandler -} - -func (o *GetBucketRetentionConfig) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetBucketRetentionConfigParams() - 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/bucket/get_bucket_retention_config_parameters.go b/api/operations/bucket/get_bucket_retention_config_parameters.go deleted file mode 100644 index 85f67b8a2e..0000000000 --- a/api/operations/bucket/get_bucket_retention_config_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 bucket - -// 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" -) - -// NewGetBucketRetentionConfigParams creates a new GetBucketRetentionConfigParams object -// -// There are no default values defined in the spec. -func NewGetBucketRetentionConfigParams() GetBucketRetentionConfigParams { - - return GetBucketRetentionConfigParams{} -} - -// GetBucketRetentionConfigParams contains all the bound params for the get bucket retention config operation -// typically these are obtained from a http.Request -// -// swagger:parameters GetBucketRetentionConfig -type GetBucketRetentionConfigParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - BucketName 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 NewGetBucketRetentionConfigParams() beforehand. -func (o *GetBucketRetentionConfigParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") - if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindBucketName binds and validates parameter BucketName from path. -func (o *GetBucketRetentionConfigParams) bindBucketName(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.BucketName = raw - - return nil -} diff --git a/api/operations/bucket/get_bucket_retention_config_responses.go b/api/operations/bucket/get_bucket_retention_config_responses.go deleted file mode 100644 index a089656b19..0000000000 --- a/api/operations/bucket/get_bucket_retention_config_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 bucket - -// 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" -) - -// GetBucketRetentionConfigOKCode is the HTTP code returned for type GetBucketRetentionConfigOK -const GetBucketRetentionConfigOKCode int = 200 - -/* -GetBucketRetentionConfigOK A successful response. - -swagger:response getBucketRetentionConfigOK -*/ -type GetBucketRetentionConfigOK struct { - - /* - In: Body - */ - Payload *models.GetBucketRetentionConfig `json:"body,omitempty"` -} - -// NewGetBucketRetentionConfigOK creates GetBucketRetentionConfigOK with default headers values -func NewGetBucketRetentionConfigOK() *GetBucketRetentionConfigOK { - - return &GetBucketRetentionConfigOK{} -} - -// WithPayload adds the payload to the get bucket retention config o k response -func (o *GetBucketRetentionConfigOK) WithPayload(payload *models.GetBucketRetentionConfig) *GetBucketRetentionConfigOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get bucket retention config o k response -func (o *GetBucketRetentionConfigOK) SetPayload(payload *models.GetBucketRetentionConfig) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetBucketRetentionConfigOK) 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 - } - } -} - -/* -GetBucketRetentionConfigDefault Generic error response. - -swagger:response getBucketRetentionConfigDefault -*/ -type GetBucketRetentionConfigDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewGetBucketRetentionConfigDefault creates GetBucketRetentionConfigDefault with default headers values -func NewGetBucketRetentionConfigDefault(code int) *GetBucketRetentionConfigDefault { - if code <= 0 { - code = 500 - } - - return &GetBucketRetentionConfigDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get bucket retention config default response -func (o *GetBucketRetentionConfigDefault) WithStatusCode(code int) *GetBucketRetentionConfigDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get bucket retention config default response -func (o *GetBucketRetentionConfigDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the get bucket retention config default response -func (o *GetBucketRetentionConfigDefault) WithPayload(payload *models.APIError) *GetBucketRetentionConfigDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get bucket retention config default response -func (o *GetBucketRetentionConfigDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetBucketRetentionConfigDefault) 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/bucket/get_bucket_retention_config_urlbuilder.go b/api/operations/bucket/get_bucket_retention_config_urlbuilder.go deleted file mode 100644 index a47a9454c8..0000000000 --- a/api/operations/bucket/get_bucket_retention_config_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 bucket - -// 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" -) - -// GetBucketRetentionConfigURL generates an URL for the get bucket retention config operation -type GetBucketRetentionConfigURL struct { - BucketName 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 *GetBucketRetentionConfigURL) WithBasePath(bp string) *GetBucketRetentionConfigURL { - 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 *GetBucketRetentionConfigURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetBucketRetentionConfigURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/buckets/{bucket_name}/retention" - - bucketName := o.BucketName - if bucketName != "" { - _path = strings.Replace(_path, "{bucket_name}", bucketName, -1) - } else { - return nil, errors.New("bucketName is required on GetBucketRetentionConfigURL") - } - - _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 *GetBucketRetentionConfigURL) 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 *GetBucketRetentionConfigURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetBucketRetentionConfigURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetBucketRetentionConfigURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetBucketRetentionConfigURL") - } - - 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 *GetBucketRetentionConfigURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/bucket/list_access_rules_with_bucket.go b/api/operations/bucket/list_access_rules_with_bucket.go deleted file mode 100644 index 3bb0fcb6b5..0000000000 --- a/api/operations/bucket/list_access_rules_with_bucket.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 bucket - -// 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" -) - -// ListAccessRulesWithBucketHandlerFunc turns a function with the right signature into a list access rules with bucket handler -type ListAccessRulesWithBucketHandlerFunc func(ListAccessRulesWithBucketParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn ListAccessRulesWithBucketHandlerFunc) Handle(params ListAccessRulesWithBucketParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// ListAccessRulesWithBucketHandler interface for that can handle valid list access rules with bucket params -type ListAccessRulesWithBucketHandler interface { - Handle(ListAccessRulesWithBucketParams, *models.Principal) middleware.Responder -} - -// NewListAccessRulesWithBucket creates a new http.Handler for the list access rules with bucket operation -func NewListAccessRulesWithBucket(ctx *middleware.Context, handler ListAccessRulesWithBucketHandler) *ListAccessRulesWithBucket { - return &ListAccessRulesWithBucket{Context: ctx, Handler: handler} -} - -/* - ListAccessRulesWithBucket swagger:route GET /bucket/{bucket}/access-rules Bucket listAccessRulesWithBucket - -List Access Rules With Given Bucket -*/ -type ListAccessRulesWithBucket struct { - Context *middleware.Context - Handler ListAccessRulesWithBucketHandler -} - -func (o *ListAccessRulesWithBucket) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewListAccessRulesWithBucketParams() - 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/bucket/list_access_rules_with_bucket_parameters.go b/api/operations/bucket/list_access_rules_with_bucket_parameters.go deleted file mode 100644 index 2b5987dd98..0000000000 --- a/api/operations/bucket/list_access_rules_with_bucket_parameters.go +++ /dev/null @@ -1,170 +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 bucket - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewListAccessRulesWithBucketParams creates a new ListAccessRulesWithBucketParams object -// with the default values initialized. -func NewListAccessRulesWithBucketParams() ListAccessRulesWithBucketParams { - - var ( - // initialize parameters with default values - - limitDefault = int32(20) - offsetDefault = int32(0) - ) - - return ListAccessRulesWithBucketParams{ - Limit: &limitDefault, - - Offset: &offsetDefault, - } -} - -// ListAccessRulesWithBucketParams contains all the bound params for the list access rules with bucket operation -// typically these are obtained from a http.Request -// -// swagger:parameters ListAccessRulesWithBucket -type ListAccessRulesWithBucketParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - Bucket string - /* - In: query - Default: 20 - */ - Limit *int32 - /* - In: query - Default: 0 - */ - Offset *int32 -} - -// 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 NewListAccessRulesWithBucketParams() beforehand. -func (o *ListAccessRulesWithBucketParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rBucket, rhkBucket, _ := route.Params.GetOK("bucket") - if err := o.bindBucket(rBucket, rhkBucket, route.Formats); err != nil { - res = append(res, err) - } - - qLimit, qhkLimit, _ := qs.GetOK("limit") - if err := o.bindLimit(qLimit, qhkLimit, route.Formats); err != nil { - res = append(res, err) - } - - qOffset, qhkOffset, _ := qs.GetOK("offset") - if err := o.bindOffset(qOffset, qhkOffset, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindBucket binds and validates parameter Bucket from path. -func (o *ListAccessRulesWithBucketParams) bindBucket(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.Bucket = raw - - return nil -} - -// bindLimit binds and validates parameter Limit from query. -func (o *ListAccessRulesWithBucketParams) bindLimit(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 - // Default values have been previously initialized by NewListAccessRulesWithBucketParams() - return nil - } - - value, err := swag.ConvertInt32(raw) - if err != nil { - return errors.InvalidType("limit", "query", "int32", raw) - } - o.Limit = &value - - return nil -} - -// bindOffset binds and validates parameter Offset from query. -func (o *ListAccessRulesWithBucketParams) bindOffset(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 - // Default values have been previously initialized by NewListAccessRulesWithBucketParams() - return nil - } - - value, err := swag.ConvertInt32(raw) - if err != nil { - return errors.InvalidType("offset", "query", "int32", raw) - } - o.Offset = &value - - return nil -} diff --git a/api/operations/bucket/list_access_rules_with_bucket_responses.go b/api/operations/bucket/list_access_rules_with_bucket_responses.go deleted file mode 100644 index 113ca15c7b..0000000000 --- a/api/operations/bucket/list_access_rules_with_bucket_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 bucket - -// 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" -) - -// ListAccessRulesWithBucketOKCode is the HTTP code returned for type ListAccessRulesWithBucketOK -const ListAccessRulesWithBucketOKCode int = 200 - -/* -ListAccessRulesWithBucketOK A successful response. - -swagger:response listAccessRulesWithBucketOK -*/ -type ListAccessRulesWithBucketOK struct { - - /* - In: Body - */ - Payload *models.ListAccessRulesResponse `json:"body,omitempty"` -} - -// NewListAccessRulesWithBucketOK creates ListAccessRulesWithBucketOK with default headers values -func NewListAccessRulesWithBucketOK() *ListAccessRulesWithBucketOK { - - return &ListAccessRulesWithBucketOK{} -} - -// WithPayload adds the payload to the list access rules with bucket o k response -func (o *ListAccessRulesWithBucketOK) WithPayload(payload *models.ListAccessRulesResponse) *ListAccessRulesWithBucketOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list access rules with bucket o k response -func (o *ListAccessRulesWithBucketOK) SetPayload(payload *models.ListAccessRulesResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListAccessRulesWithBucketOK) 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 - } - } -} - -/* -ListAccessRulesWithBucketDefault Generic error response. - -swagger:response listAccessRulesWithBucketDefault -*/ -type ListAccessRulesWithBucketDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewListAccessRulesWithBucketDefault creates ListAccessRulesWithBucketDefault with default headers values -func NewListAccessRulesWithBucketDefault(code int) *ListAccessRulesWithBucketDefault { - if code <= 0 { - code = 500 - } - - return &ListAccessRulesWithBucketDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the list access rules with bucket default response -func (o *ListAccessRulesWithBucketDefault) WithStatusCode(code int) *ListAccessRulesWithBucketDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the list access rules with bucket default response -func (o *ListAccessRulesWithBucketDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the list access rules with bucket default response -func (o *ListAccessRulesWithBucketDefault) WithPayload(payload *models.APIError) *ListAccessRulesWithBucketDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list access rules with bucket default response -func (o *ListAccessRulesWithBucketDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListAccessRulesWithBucketDefault) 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/bucket/list_access_rules_with_bucket_urlbuilder.go b/api/operations/bucket/list_access_rules_with_bucket_urlbuilder.go deleted file mode 100644 index c7cfcf0b21..0000000000 --- a/api/operations/bucket/list_access_rules_with_bucket_urlbuilder.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 bucket - -// 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" - - "github.com/go-openapi/swag" -) - -// ListAccessRulesWithBucketURL generates an URL for the list access rules with bucket operation -type ListAccessRulesWithBucketURL struct { - Bucket string - - Limit *int32 - Offset *int32 - - _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 *ListAccessRulesWithBucketURL) WithBasePath(bp string) *ListAccessRulesWithBucketURL { - 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 *ListAccessRulesWithBucketURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ListAccessRulesWithBucketURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/bucket/{bucket}/access-rules" - - bucket := o.Bucket - if bucket != "" { - _path = strings.Replace(_path, "{bucket}", bucket, -1) - } else { - return nil, errors.New("bucket is required on ListAccessRulesWithBucketURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var limitQ string - if o.Limit != nil { - limitQ = swag.FormatInt32(*o.Limit) - } - if limitQ != "" { - qs.Set("limit", limitQ) - } - - var offsetQ string - if o.Offset != nil { - offsetQ = swag.FormatInt32(*o.Offset) - } - if offsetQ != "" { - qs.Set("offset", offsetQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ListAccessRulesWithBucketURL) 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 *ListAccessRulesWithBucketURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ListAccessRulesWithBucketURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ListAccessRulesWithBucketURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ListAccessRulesWithBucketURL") - } - - 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 *ListAccessRulesWithBucketURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/bucket/list_bucket_events.go b/api/operations/bucket/list_bucket_events.go deleted file mode 100644 index a3ddfcc156..0000000000 --- a/api/operations/bucket/list_bucket_events.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 bucket - -// 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" -) - -// ListBucketEventsHandlerFunc turns a function with the right signature into a list bucket events handler -type ListBucketEventsHandlerFunc func(ListBucketEventsParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn ListBucketEventsHandlerFunc) Handle(params ListBucketEventsParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// ListBucketEventsHandler interface for that can handle valid list bucket events params -type ListBucketEventsHandler interface { - Handle(ListBucketEventsParams, *models.Principal) middleware.Responder -} - -// NewListBucketEvents creates a new http.Handler for the list bucket events operation -func NewListBucketEvents(ctx *middleware.Context, handler ListBucketEventsHandler) *ListBucketEvents { - return &ListBucketEvents{Context: ctx, Handler: handler} -} - -/* - ListBucketEvents swagger:route GET /buckets/{bucket_name}/events Bucket listBucketEvents - -List Bucket Events -*/ -type ListBucketEvents struct { - Context *middleware.Context - Handler ListBucketEventsHandler -} - -func (o *ListBucketEvents) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewListBucketEventsParams() - 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/bucket/list_bucket_events_parameters.go b/api/operations/bucket/list_bucket_events_parameters.go deleted file mode 100644 index 26c1d07238..0000000000 --- a/api/operations/bucket/list_bucket_events_parameters.go +++ /dev/null @@ -1,170 +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 bucket - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewListBucketEventsParams creates a new ListBucketEventsParams object -// with the default values initialized. -func NewListBucketEventsParams() ListBucketEventsParams { - - var ( - // initialize parameters with default values - - limitDefault = int32(20) - offsetDefault = int32(0) - ) - - return ListBucketEventsParams{ - Limit: &limitDefault, - - Offset: &offsetDefault, - } -} - -// ListBucketEventsParams contains all the bound params for the list bucket events operation -// typically these are obtained from a http.Request -// -// swagger:parameters ListBucketEvents -type ListBucketEventsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - BucketName string - /* - In: query - Default: 20 - */ - Limit *int32 - /* - In: query - Default: 0 - */ - Offset *int32 -} - -// 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 NewListBucketEventsParams() beforehand. -func (o *ListBucketEventsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") - if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { - res = append(res, err) - } - - qLimit, qhkLimit, _ := qs.GetOK("limit") - if err := o.bindLimit(qLimit, qhkLimit, route.Formats); err != nil { - res = append(res, err) - } - - qOffset, qhkOffset, _ := qs.GetOK("offset") - if err := o.bindOffset(qOffset, qhkOffset, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindBucketName binds and validates parameter BucketName from path. -func (o *ListBucketEventsParams) bindBucketName(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.BucketName = raw - - return nil -} - -// bindLimit binds and validates parameter Limit from query. -func (o *ListBucketEventsParams) bindLimit(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 - // Default values have been previously initialized by NewListBucketEventsParams() - return nil - } - - value, err := swag.ConvertInt32(raw) - if err != nil { - return errors.InvalidType("limit", "query", "int32", raw) - } - o.Limit = &value - - return nil -} - -// bindOffset binds and validates parameter Offset from query. -func (o *ListBucketEventsParams) bindOffset(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 - // Default values have been previously initialized by NewListBucketEventsParams() - return nil - } - - value, err := swag.ConvertInt32(raw) - if err != nil { - return errors.InvalidType("offset", "query", "int32", raw) - } - o.Offset = &value - - return nil -} diff --git a/api/operations/bucket/list_bucket_events_responses.go b/api/operations/bucket/list_bucket_events_responses.go deleted file mode 100644 index b5ea291456..0000000000 --- a/api/operations/bucket/list_bucket_events_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 bucket - -// 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" -) - -// ListBucketEventsOKCode is the HTTP code returned for type ListBucketEventsOK -const ListBucketEventsOKCode int = 200 - -/* -ListBucketEventsOK A successful response. - -swagger:response listBucketEventsOK -*/ -type ListBucketEventsOK struct { - - /* - In: Body - */ - Payload *models.ListBucketEventsResponse `json:"body,omitempty"` -} - -// NewListBucketEventsOK creates ListBucketEventsOK with default headers values -func NewListBucketEventsOK() *ListBucketEventsOK { - - return &ListBucketEventsOK{} -} - -// WithPayload adds the payload to the list bucket events o k response -func (o *ListBucketEventsOK) WithPayload(payload *models.ListBucketEventsResponse) *ListBucketEventsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list bucket events o k response -func (o *ListBucketEventsOK) SetPayload(payload *models.ListBucketEventsResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListBucketEventsOK) 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 - } - } -} - -/* -ListBucketEventsDefault Generic error response. - -swagger:response listBucketEventsDefault -*/ -type ListBucketEventsDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewListBucketEventsDefault creates ListBucketEventsDefault with default headers values -func NewListBucketEventsDefault(code int) *ListBucketEventsDefault { - if code <= 0 { - code = 500 - } - - return &ListBucketEventsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the list bucket events default response -func (o *ListBucketEventsDefault) WithStatusCode(code int) *ListBucketEventsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the list bucket events default response -func (o *ListBucketEventsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the list bucket events default response -func (o *ListBucketEventsDefault) WithPayload(payload *models.APIError) *ListBucketEventsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list bucket events default response -func (o *ListBucketEventsDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListBucketEventsDefault) 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/bucket/list_bucket_events_urlbuilder.go b/api/operations/bucket/list_bucket_events_urlbuilder.go deleted file mode 100644 index 354e2285f4..0000000000 --- a/api/operations/bucket/list_bucket_events_urlbuilder.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 bucket - -// 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" - - "github.com/go-openapi/swag" -) - -// ListBucketEventsURL generates an URL for the list bucket events operation -type ListBucketEventsURL struct { - BucketName string - - Limit *int32 - Offset *int32 - - _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 *ListBucketEventsURL) WithBasePath(bp string) *ListBucketEventsURL { - 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 *ListBucketEventsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ListBucketEventsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/buckets/{bucket_name}/events" - - bucketName := o.BucketName - if bucketName != "" { - _path = strings.Replace(_path, "{bucket_name}", bucketName, -1) - } else { - return nil, errors.New("bucketName is required on ListBucketEventsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var limitQ string - if o.Limit != nil { - limitQ = swag.FormatInt32(*o.Limit) - } - if limitQ != "" { - qs.Set("limit", limitQ) - } - - var offsetQ string - if o.Offset != nil { - offsetQ = swag.FormatInt32(*o.Offset) - } - if offsetQ != "" { - qs.Set("offset", offsetQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ListBucketEventsURL) 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 *ListBucketEventsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ListBucketEventsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ListBucketEventsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ListBucketEventsURL") - } - - 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 *ListBucketEventsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/bucket/list_external_buckets.go b/api/operations/bucket/list_external_buckets.go deleted file mode 100644 index 956f920d04..0000000000 --- a/api/operations/bucket/list_external_buckets.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 bucket - -// 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" -) - -// ListExternalBucketsHandlerFunc turns a function with the right signature into a list external buckets handler -type ListExternalBucketsHandlerFunc func(ListExternalBucketsParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn ListExternalBucketsHandlerFunc) Handle(params ListExternalBucketsParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// ListExternalBucketsHandler interface for that can handle valid list external buckets params -type ListExternalBucketsHandler interface { - Handle(ListExternalBucketsParams, *models.Principal) middleware.Responder -} - -// NewListExternalBuckets creates a new http.Handler for the list external buckets operation -func NewListExternalBuckets(ctx *middleware.Context, handler ListExternalBucketsHandler) *ListExternalBuckets { - return &ListExternalBuckets{Context: ctx, Handler: handler} -} - -/* - ListExternalBuckets swagger:route POST /list-external-buckets Bucket listExternalBuckets - -Lists an External list of buckets using custom credentials -*/ -type ListExternalBuckets struct { - Context *middleware.Context - Handler ListExternalBucketsHandler -} - -func (o *ListExternalBuckets) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewListExternalBucketsParams() - 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/bucket/list_external_buckets_parameters.go b/api/operations/bucket/list_external_buckets_parameters.go deleted file mode 100644 index 526e1c0342..0000000000 --- a/api/operations/bucket/list_external_buckets_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 bucket - -// 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" -) - -// NewListExternalBucketsParams creates a new ListExternalBucketsParams object -// -// There are no default values defined in the spec. -func NewListExternalBucketsParams() ListExternalBucketsParams { - - return ListExternalBucketsParams{} -} - -// ListExternalBucketsParams contains all the bound params for the list external buckets operation -// typically these are obtained from a http.Request -// -// swagger:parameters ListExternalBuckets -type ListExternalBucketsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.ListExternalBucketsParams -} - -// 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 NewListExternalBucketsParams() beforehand. -func (o *ListExternalBucketsParams) 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.ListExternalBucketsParams - 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/bucket/list_external_buckets_responses.go b/api/operations/bucket/list_external_buckets_responses.go deleted file mode 100644 index af77d4dcae..0000000000 --- a/api/operations/bucket/list_external_buckets_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 bucket - -// 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" -) - -// ListExternalBucketsOKCode is the HTTP code returned for type ListExternalBucketsOK -const ListExternalBucketsOKCode int = 200 - -/* -ListExternalBucketsOK A successful response. - -swagger:response listExternalBucketsOK -*/ -type ListExternalBucketsOK struct { - - /* - In: Body - */ - Payload *models.ListBucketsResponse `json:"body,omitempty"` -} - -// NewListExternalBucketsOK creates ListExternalBucketsOK with default headers values -func NewListExternalBucketsOK() *ListExternalBucketsOK { - - return &ListExternalBucketsOK{} -} - -// WithPayload adds the payload to the list external buckets o k response -func (o *ListExternalBucketsOK) WithPayload(payload *models.ListBucketsResponse) *ListExternalBucketsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list external buckets o k response -func (o *ListExternalBucketsOK) SetPayload(payload *models.ListBucketsResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListExternalBucketsOK) 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 - } - } -} - -/* -ListExternalBucketsDefault Generic error response. - -swagger:response listExternalBucketsDefault -*/ -type ListExternalBucketsDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewListExternalBucketsDefault creates ListExternalBucketsDefault with default headers values -func NewListExternalBucketsDefault(code int) *ListExternalBucketsDefault { - if code <= 0 { - code = 500 - } - - return &ListExternalBucketsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the list external buckets default response -func (o *ListExternalBucketsDefault) WithStatusCode(code int) *ListExternalBucketsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the list external buckets default response -func (o *ListExternalBucketsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the list external buckets default response -func (o *ListExternalBucketsDefault) WithPayload(payload *models.APIError) *ListExternalBucketsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list external buckets default response -func (o *ListExternalBucketsDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListExternalBucketsDefault) 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/bucket/list_external_buckets_urlbuilder.go b/api/operations/bucket/list_external_buckets_urlbuilder.go deleted file mode 100644 index 30b2010041..0000000000 --- a/api/operations/bucket/list_external_buckets_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 bucket - -// 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" -) - -// ListExternalBucketsURL generates an URL for the list external buckets operation -type ListExternalBucketsURL 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 *ListExternalBucketsURL) WithBasePath(bp string) *ListExternalBucketsURL { - 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 *ListExternalBucketsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ListExternalBucketsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/list-external-buckets" - - _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 *ListExternalBucketsURL) 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 *ListExternalBucketsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ListExternalBucketsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ListExternalBucketsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ListExternalBucketsURL") - } - - 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 *ListExternalBucketsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/bucket/list_policies_with_bucket.go b/api/operations/bucket/list_policies_with_bucket.go deleted file mode 100644 index 892d921fa5..0000000000 --- a/api/operations/bucket/list_policies_with_bucket.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 bucket - -// 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" -) - -// ListPoliciesWithBucketHandlerFunc turns a function with the right signature into a list policies with bucket handler -type ListPoliciesWithBucketHandlerFunc func(ListPoliciesWithBucketParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn ListPoliciesWithBucketHandlerFunc) Handle(params ListPoliciesWithBucketParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// ListPoliciesWithBucketHandler interface for that can handle valid list policies with bucket params -type ListPoliciesWithBucketHandler interface { - Handle(ListPoliciesWithBucketParams, *models.Principal) middleware.Responder -} - -// NewListPoliciesWithBucket creates a new http.Handler for the list policies with bucket operation -func NewListPoliciesWithBucket(ctx *middleware.Context, handler ListPoliciesWithBucketHandler) *ListPoliciesWithBucket { - return &ListPoliciesWithBucket{Context: ctx, Handler: handler} -} - -/* - ListPoliciesWithBucket swagger:route GET /bucket-policy/{bucket} Bucket listPoliciesWithBucket - -List Policies With Given Bucket -*/ -type ListPoliciesWithBucket struct { - Context *middleware.Context - Handler ListPoliciesWithBucketHandler -} - -func (o *ListPoliciesWithBucket) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewListPoliciesWithBucketParams() - 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/bucket/list_policies_with_bucket_parameters.go b/api/operations/bucket/list_policies_with_bucket_parameters.go deleted file mode 100644 index b966665c22..0000000000 --- a/api/operations/bucket/list_policies_with_bucket_parameters.go +++ /dev/null @@ -1,170 +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 bucket - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewListPoliciesWithBucketParams creates a new ListPoliciesWithBucketParams object -// with the default values initialized. -func NewListPoliciesWithBucketParams() ListPoliciesWithBucketParams { - - var ( - // initialize parameters with default values - - limitDefault = int32(20) - offsetDefault = int32(0) - ) - - return ListPoliciesWithBucketParams{ - Limit: &limitDefault, - - Offset: &offsetDefault, - } -} - -// ListPoliciesWithBucketParams contains all the bound params for the list policies with bucket operation -// typically these are obtained from a http.Request -// -// swagger:parameters ListPoliciesWithBucket -type ListPoliciesWithBucketParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - Bucket string - /* - In: query - Default: 20 - */ - Limit *int32 - /* - In: query - Default: 0 - */ - Offset *int32 -} - -// 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 NewListPoliciesWithBucketParams() beforehand. -func (o *ListPoliciesWithBucketParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rBucket, rhkBucket, _ := route.Params.GetOK("bucket") - if err := o.bindBucket(rBucket, rhkBucket, route.Formats); err != nil { - res = append(res, err) - } - - qLimit, qhkLimit, _ := qs.GetOK("limit") - if err := o.bindLimit(qLimit, qhkLimit, route.Formats); err != nil { - res = append(res, err) - } - - qOffset, qhkOffset, _ := qs.GetOK("offset") - if err := o.bindOffset(qOffset, qhkOffset, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindBucket binds and validates parameter Bucket from path. -func (o *ListPoliciesWithBucketParams) bindBucket(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.Bucket = raw - - return nil -} - -// bindLimit binds and validates parameter Limit from query. -func (o *ListPoliciesWithBucketParams) bindLimit(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 - // Default values have been previously initialized by NewListPoliciesWithBucketParams() - return nil - } - - value, err := swag.ConvertInt32(raw) - if err != nil { - return errors.InvalidType("limit", "query", "int32", raw) - } - o.Limit = &value - - return nil -} - -// bindOffset binds and validates parameter Offset from query. -func (o *ListPoliciesWithBucketParams) bindOffset(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 - // Default values have been previously initialized by NewListPoliciesWithBucketParams() - return nil - } - - value, err := swag.ConvertInt32(raw) - if err != nil { - return errors.InvalidType("offset", "query", "int32", raw) - } - o.Offset = &value - - return nil -} diff --git a/api/operations/bucket/list_policies_with_bucket_responses.go b/api/operations/bucket/list_policies_with_bucket_responses.go deleted file mode 100644 index 4618104d4d..0000000000 --- a/api/operations/bucket/list_policies_with_bucket_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 bucket - -// 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" -) - -// ListPoliciesWithBucketOKCode is the HTTP code returned for type ListPoliciesWithBucketOK -const ListPoliciesWithBucketOKCode int = 200 - -/* -ListPoliciesWithBucketOK A successful response. - -swagger:response listPoliciesWithBucketOK -*/ -type ListPoliciesWithBucketOK struct { - - /* - In: Body - */ - Payload *models.ListPoliciesResponse `json:"body,omitempty"` -} - -// NewListPoliciesWithBucketOK creates ListPoliciesWithBucketOK with default headers values -func NewListPoliciesWithBucketOK() *ListPoliciesWithBucketOK { - - return &ListPoliciesWithBucketOK{} -} - -// WithPayload adds the payload to the list policies with bucket o k response -func (o *ListPoliciesWithBucketOK) WithPayload(payload *models.ListPoliciesResponse) *ListPoliciesWithBucketOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list policies with bucket o k response -func (o *ListPoliciesWithBucketOK) SetPayload(payload *models.ListPoliciesResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListPoliciesWithBucketOK) 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 - } - } -} - -/* -ListPoliciesWithBucketDefault Generic error response. - -swagger:response listPoliciesWithBucketDefault -*/ -type ListPoliciesWithBucketDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewListPoliciesWithBucketDefault creates ListPoliciesWithBucketDefault with default headers values -func NewListPoliciesWithBucketDefault(code int) *ListPoliciesWithBucketDefault { - if code <= 0 { - code = 500 - } - - return &ListPoliciesWithBucketDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the list policies with bucket default response -func (o *ListPoliciesWithBucketDefault) WithStatusCode(code int) *ListPoliciesWithBucketDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the list policies with bucket default response -func (o *ListPoliciesWithBucketDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the list policies with bucket default response -func (o *ListPoliciesWithBucketDefault) WithPayload(payload *models.APIError) *ListPoliciesWithBucketDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list policies with bucket default response -func (o *ListPoliciesWithBucketDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListPoliciesWithBucketDefault) 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/bucket/list_policies_with_bucket_urlbuilder.go b/api/operations/bucket/list_policies_with_bucket_urlbuilder.go deleted file mode 100644 index c9d7953139..0000000000 --- a/api/operations/bucket/list_policies_with_bucket_urlbuilder.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 bucket - -// 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" - - "github.com/go-openapi/swag" -) - -// ListPoliciesWithBucketURL generates an URL for the list policies with bucket operation -type ListPoliciesWithBucketURL struct { - Bucket string - - Limit *int32 - Offset *int32 - - _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 *ListPoliciesWithBucketURL) WithBasePath(bp string) *ListPoliciesWithBucketURL { - 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 *ListPoliciesWithBucketURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ListPoliciesWithBucketURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/bucket-policy/{bucket}" - - bucket := o.Bucket - if bucket != "" { - _path = strings.Replace(_path, "{bucket}", bucket, -1) - } else { - return nil, errors.New("bucket is required on ListPoliciesWithBucketURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var limitQ string - if o.Limit != nil { - limitQ = swag.FormatInt32(*o.Limit) - } - if limitQ != "" { - qs.Set("limit", limitQ) - } - - var offsetQ string - if o.Offset != nil { - offsetQ = swag.FormatInt32(*o.Offset) - } - if offsetQ != "" { - qs.Set("offset", offsetQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ListPoliciesWithBucketURL) 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 *ListPoliciesWithBucketURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ListPoliciesWithBucketURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ListPoliciesWithBucketURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ListPoliciesWithBucketURL") - } - - 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 *ListPoliciesWithBucketURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/bucket/list_remote_buckets.go b/api/operations/bucket/list_remote_buckets.go deleted file mode 100644 index 9c299f1f57..0000000000 --- a/api/operations/bucket/list_remote_buckets.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 bucket - -// 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" -) - -// ListRemoteBucketsHandlerFunc turns a function with the right signature into a list remote buckets handler -type ListRemoteBucketsHandlerFunc func(ListRemoteBucketsParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn ListRemoteBucketsHandlerFunc) Handle(params ListRemoteBucketsParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// ListRemoteBucketsHandler interface for that can handle valid list remote buckets params -type ListRemoteBucketsHandler interface { - Handle(ListRemoteBucketsParams, *models.Principal) middleware.Responder -} - -// NewListRemoteBuckets creates a new http.Handler for the list remote buckets operation -func NewListRemoteBuckets(ctx *middleware.Context, handler ListRemoteBucketsHandler) *ListRemoteBuckets { - return &ListRemoteBuckets{Context: ctx, Handler: handler} -} - -/* - ListRemoteBuckets swagger:route GET /remote-buckets Bucket listRemoteBuckets - -List Remote Buckets -*/ -type ListRemoteBuckets struct { - Context *middleware.Context - Handler ListRemoteBucketsHandler -} - -func (o *ListRemoteBuckets) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewListRemoteBucketsParams() - 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/bucket/list_remote_buckets_parameters.go b/api/operations/bucket/list_remote_buckets_parameters.go deleted file mode 100644 index 629ea9c568..0000000000 --- a/api/operations/bucket/list_remote_buckets_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 bucket - -// 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" -) - -// NewListRemoteBucketsParams creates a new ListRemoteBucketsParams object -// -// There are no default values defined in the spec. -func NewListRemoteBucketsParams() ListRemoteBucketsParams { - - return ListRemoteBucketsParams{} -} - -// ListRemoteBucketsParams contains all the bound params for the list remote buckets operation -// typically these are obtained from a http.Request -// -// swagger:parameters ListRemoteBuckets -type ListRemoteBucketsParams 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 NewListRemoteBucketsParams() beforehand. -func (o *ListRemoteBucketsParams) 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/bucket/list_remote_buckets_responses.go b/api/operations/bucket/list_remote_buckets_responses.go deleted file mode 100644 index 72b8673901..0000000000 --- a/api/operations/bucket/list_remote_buckets_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 bucket - -// 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" -) - -// ListRemoteBucketsOKCode is the HTTP code returned for type ListRemoteBucketsOK -const ListRemoteBucketsOKCode int = 200 - -/* -ListRemoteBucketsOK A successful response. - -swagger:response listRemoteBucketsOK -*/ -type ListRemoteBucketsOK struct { - - /* - In: Body - */ - Payload *models.ListRemoteBucketsResponse `json:"body,omitempty"` -} - -// NewListRemoteBucketsOK creates ListRemoteBucketsOK with default headers values -func NewListRemoteBucketsOK() *ListRemoteBucketsOK { - - return &ListRemoteBucketsOK{} -} - -// WithPayload adds the payload to the list remote buckets o k response -func (o *ListRemoteBucketsOK) WithPayload(payload *models.ListRemoteBucketsResponse) *ListRemoteBucketsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list remote buckets o k response -func (o *ListRemoteBucketsOK) SetPayload(payload *models.ListRemoteBucketsResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListRemoteBucketsOK) 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 - } - } -} - -/* -ListRemoteBucketsDefault Generic error response. - -swagger:response listRemoteBucketsDefault -*/ -type ListRemoteBucketsDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewListRemoteBucketsDefault creates ListRemoteBucketsDefault with default headers values -func NewListRemoteBucketsDefault(code int) *ListRemoteBucketsDefault { - if code <= 0 { - code = 500 - } - - return &ListRemoteBucketsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the list remote buckets default response -func (o *ListRemoteBucketsDefault) WithStatusCode(code int) *ListRemoteBucketsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the list remote buckets default response -func (o *ListRemoteBucketsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the list remote buckets default response -func (o *ListRemoteBucketsDefault) WithPayload(payload *models.APIError) *ListRemoteBucketsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list remote buckets default response -func (o *ListRemoteBucketsDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListRemoteBucketsDefault) 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/bucket/list_remote_buckets_urlbuilder.go b/api/operations/bucket/list_remote_buckets_urlbuilder.go deleted file mode 100644 index 0d499ed7de..0000000000 --- a/api/operations/bucket/list_remote_buckets_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 bucket - -// 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" -) - -// ListRemoteBucketsURL generates an URL for the list remote buckets operation -type ListRemoteBucketsURL 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 *ListRemoteBucketsURL) WithBasePath(bp string) *ListRemoteBucketsURL { - 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 *ListRemoteBucketsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ListRemoteBucketsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/remote-buckets" - - _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 *ListRemoteBucketsURL) 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 *ListRemoteBucketsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ListRemoteBucketsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ListRemoteBucketsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ListRemoteBucketsURL") - } - - 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 *ListRemoteBucketsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/bucket/list_users_with_access_to_bucket.go b/api/operations/bucket/list_users_with_access_to_bucket.go deleted file mode 100644 index 959a87737f..0000000000 --- a/api/operations/bucket/list_users_with_access_to_bucket.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 bucket - -// 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" -) - -// ListUsersWithAccessToBucketHandlerFunc turns a function with the right signature into a list users with access to bucket handler -type ListUsersWithAccessToBucketHandlerFunc func(ListUsersWithAccessToBucketParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn ListUsersWithAccessToBucketHandlerFunc) Handle(params ListUsersWithAccessToBucketParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// ListUsersWithAccessToBucketHandler interface for that can handle valid list users with access to bucket params -type ListUsersWithAccessToBucketHandler interface { - Handle(ListUsersWithAccessToBucketParams, *models.Principal) middleware.Responder -} - -// NewListUsersWithAccessToBucket creates a new http.Handler for the list users with access to bucket operation -func NewListUsersWithAccessToBucket(ctx *middleware.Context, handler ListUsersWithAccessToBucketHandler) *ListUsersWithAccessToBucket { - return &ListUsersWithAccessToBucket{Context: ctx, Handler: handler} -} - -/* - ListUsersWithAccessToBucket swagger:route GET /bucket-users/{bucket} Bucket listUsersWithAccessToBucket - -List Users With Access to a Given Bucket -*/ -type ListUsersWithAccessToBucket struct { - Context *middleware.Context - Handler ListUsersWithAccessToBucketHandler -} - -func (o *ListUsersWithAccessToBucket) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewListUsersWithAccessToBucketParams() - 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/bucket/list_users_with_access_to_bucket_parameters.go b/api/operations/bucket/list_users_with_access_to_bucket_parameters.go deleted file mode 100644 index 2a6e8f218c..0000000000 --- a/api/operations/bucket/list_users_with_access_to_bucket_parameters.go +++ /dev/null @@ -1,170 +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 bucket - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewListUsersWithAccessToBucketParams creates a new ListUsersWithAccessToBucketParams object -// with the default values initialized. -func NewListUsersWithAccessToBucketParams() ListUsersWithAccessToBucketParams { - - var ( - // initialize parameters with default values - - limitDefault = int32(20) - offsetDefault = int32(0) - ) - - return ListUsersWithAccessToBucketParams{ - Limit: &limitDefault, - - Offset: &offsetDefault, - } -} - -// ListUsersWithAccessToBucketParams contains all the bound params for the list users with access to bucket operation -// typically these are obtained from a http.Request -// -// swagger:parameters ListUsersWithAccessToBucket -type ListUsersWithAccessToBucketParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - Bucket string - /* - In: query - Default: 20 - */ - Limit *int32 - /* - In: query - Default: 0 - */ - Offset *int32 -} - -// 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 NewListUsersWithAccessToBucketParams() beforehand. -func (o *ListUsersWithAccessToBucketParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rBucket, rhkBucket, _ := route.Params.GetOK("bucket") - if err := o.bindBucket(rBucket, rhkBucket, route.Formats); err != nil { - res = append(res, err) - } - - qLimit, qhkLimit, _ := qs.GetOK("limit") - if err := o.bindLimit(qLimit, qhkLimit, route.Formats); err != nil { - res = append(res, err) - } - - qOffset, qhkOffset, _ := qs.GetOK("offset") - if err := o.bindOffset(qOffset, qhkOffset, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindBucket binds and validates parameter Bucket from path. -func (o *ListUsersWithAccessToBucketParams) bindBucket(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.Bucket = raw - - return nil -} - -// bindLimit binds and validates parameter Limit from query. -func (o *ListUsersWithAccessToBucketParams) bindLimit(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 - // Default values have been previously initialized by NewListUsersWithAccessToBucketParams() - return nil - } - - value, err := swag.ConvertInt32(raw) - if err != nil { - return errors.InvalidType("limit", "query", "int32", raw) - } - o.Limit = &value - - return nil -} - -// bindOffset binds and validates parameter Offset from query. -func (o *ListUsersWithAccessToBucketParams) bindOffset(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 - // Default values have been previously initialized by NewListUsersWithAccessToBucketParams() - return nil - } - - value, err := swag.ConvertInt32(raw) - if err != nil { - return errors.InvalidType("offset", "query", "int32", raw) - } - o.Offset = &value - - return nil -} diff --git a/api/operations/bucket/list_users_with_access_to_bucket_responses.go b/api/operations/bucket/list_users_with_access_to_bucket_responses.go deleted file mode 100644 index 96dacd0ff9..0000000000 --- a/api/operations/bucket/list_users_with_access_to_bucket_responses.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 bucket - -// 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" -) - -// ListUsersWithAccessToBucketOKCode is the HTTP code returned for type ListUsersWithAccessToBucketOK -const ListUsersWithAccessToBucketOKCode int = 200 - -/* -ListUsersWithAccessToBucketOK A successful response. - -swagger:response listUsersWithAccessToBucketOK -*/ -type ListUsersWithAccessToBucketOK struct { - - /* - In: Body - */ - Payload []string `json:"body,omitempty"` -} - -// NewListUsersWithAccessToBucketOK creates ListUsersWithAccessToBucketOK with default headers values -func NewListUsersWithAccessToBucketOK() *ListUsersWithAccessToBucketOK { - - return &ListUsersWithAccessToBucketOK{} -} - -// WithPayload adds the payload to the list users with access to bucket o k response -func (o *ListUsersWithAccessToBucketOK) WithPayload(payload []string) *ListUsersWithAccessToBucketOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list users with access to bucket o k response -func (o *ListUsersWithAccessToBucketOK) SetPayload(payload []string) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListUsersWithAccessToBucketOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = make([]string, 0, 50) - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -ListUsersWithAccessToBucketDefault Generic error response. - -swagger:response listUsersWithAccessToBucketDefault -*/ -type ListUsersWithAccessToBucketDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewListUsersWithAccessToBucketDefault creates ListUsersWithAccessToBucketDefault with default headers values -func NewListUsersWithAccessToBucketDefault(code int) *ListUsersWithAccessToBucketDefault { - if code <= 0 { - code = 500 - } - - return &ListUsersWithAccessToBucketDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the list users with access to bucket default response -func (o *ListUsersWithAccessToBucketDefault) WithStatusCode(code int) *ListUsersWithAccessToBucketDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the list users with access to bucket default response -func (o *ListUsersWithAccessToBucketDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the list users with access to bucket default response -func (o *ListUsersWithAccessToBucketDefault) WithPayload(payload *models.APIError) *ListUsersWithAccessToBucketDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list users with access to bucket default response -func (o *ListUsersWithAccessToBucketDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListUsersWithAccessToBucketDefault) 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/bucket/list_users_with_access_to_bucket_urlbuilder.go b/api/operations/bucket/list_users_with_access_to_bucket_urlbuilder.go deleted file mode 100644 index de7b430f1b..0000000000 --- a/api/operations/bucket/list_users_with_access_to_bucket_urlbuilder.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 bucket - -// 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" - - "github.com/go-openapi/swag" -) - -// ListUsersWithAccessToBucketURL generates an URL for the list users with access to bucket operation -type ListUsersWithAccessToBucketURL struct { - Bucket string - - Limit *int32 - Offset *int32 - - _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 *ListUsersWithAccessToBucketURL) WithBasePath(bp string) *ListUsersWithAccessToBucketURL { - 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 *ListUsersWithAccessToBucketURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ListUsersWithAccessToBucketURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/bucket-users/{bucket}" - - bucket := o.Bucket - if bucket != "" { - _path = strings.Replace(_path, "{bucket}", bucket, -1) - } else { - return nil, errors.New("bucket is required on ListUsersWithAccessToBucketURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var limitQ string - if o.Limit != nil { - limitQ = swag.FormatInt32(*o.Limit) - } - if limitQ != "" { - qs.Set("limit", limitQ) - } - - var offsetQ string - if o.Offset != nil { - offsetQ = swag.FormatInt32(*o.Offset) - } - if offsetQ != "" { - qs.Set("offset", offsetQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ListUsersWithAccessToBucketURL) 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 *ListUsersWithAccessToBucketURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ListUsersWithAccessToBucketURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ListUsersWithAccessToBucketURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ListUsersWithAccessToBucketURL") - } - - 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 *ListUsersWithAccessToBucketURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/bucket/remote_bucket_details.go b/api/operations/bucket/remote_bucket_details.go deleted file mode 100644 index 20742b9cc9..0000000000 --- a/api/operations/bucket/remote_bucket_details.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 bucket - -// 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" -) - -// RemoteBucketDetailsHandlerFunc turns a function with the right signature into a remote bucket details handler -type RemoteBucketDetailsHandlerFunc func(RemoteBucketDetailsParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn RemoteBucketDetailsHandlerFunc) Handle(params RemoteBucketDetailsParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// RemoteBucketDetailsHandler interface for that can handle valid remote bucket details params -type RemoteBucketDetailsHandler interface { - Handle(RemoteBucketDetailsParams, *models.Principal) middleware.Responder -} - -// NewRemoteBucketDetails creates a new http.Handler for the remote bucket details operation -func NewRemoteBucketDetails(ctx *middleware.Context, handler RemoteBucketDetailsHandler) *RemoteBucketDetails { - return &RemoteBucketDetails{Context: ctx, Handler: handler} -} - -/* - RemoteBucketDetails swagger:route GET /remote-buckets/{name} Bucket remoteBucketDetails - -Remote Bucket Details -*/ -type RemoteBucketDetails struct { - Context *middleware.Context - Handler RemoteBucketDetailsHandler -} - -func (o *RemoteBucketDetails) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewRemoteBucketDetailsParams() - 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/bucket/remote_bucket_details_parameters.go b/api/operations/bucket/remote_bucket_details_parameters.go deleted file mode 100644 index d06e3c9a4f..0000000000 --- a/api/operations/bucket/remote_bucket_details_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 bucket - -// 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" -) - -// NewRemoteBucketDetailsParams creates a new RemoteBucketDetailsParams object -// -// There are no default values defined in the spec. -func NewRemoteBucketDetailsParams() RemoteBucketDetailsParams { - - return RemoteBucketDetailsParams{} -} - -// RemoteBucketDetailsParams contains all the bound params for the remote bucket details operation -// typically these are obtained from a http.Request -// -// swagger:parameters RemoteBucketDetails -type RemoteBucketDetailsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - 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 NewRemoteBucketDetailsParams() beforehand. -func (o *RemoteBucketDetailsParams) 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 *RemoteBucketDetailsParams) 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/bucket/remote_bucket_details_responses.go b/api/operations/bucket/remote_bucket_details_responses.go deleted file mode 100644 index f77794eb1b..0000000000 --- a/api/operations/bucket/remote_bucket_details_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 bucket - -// 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" -) - -// RemoteBucketDetailsOKCode is the HTTP code returned for type RemoteBucketDetailsOK -const RemoteBucketDetailsOKCode int = 200 - -/* -RemoteBucketDetailsOK A successful response. - -swagger:response remoteBucketDetailsOK -*/ -type RemoteBucketDetailsOK struct { - - /* - In: Body - */ - Payload *models.RemoteBucket `json:"body,omitempty"` -} - -// NewRemoteBucketDetailsOK creates RemoteBucketDetailsOK with default headers values -func NewRemoteBucketDetailsOK() *RemoteBucketDetailsOK { - - return &RemoteBucketDetailsOK{} -} - -// WithPayload adds the payload to the remote bucket details o k response -func (o *RemoteBucketDetailsOK) WithPayload(payload *models.RemoteBucket) *RemoteBucketDetailsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the remote bucket details o k response -func (o *RemoteBucketDetailsOK) SetPayload(payload *models.RemoteBucket) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *RemoteBucketDetailsOK) 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 - } - } -} - -/* -RemoteBucketDetailsDefault Generic error response. - -swagger:response remoteBucketDetailsDefault -*/ -type RemoteBucketDetailsDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewRemoteBucketDetailsDefault creates RemoteBucketDetailsDefault with default headers values -func NewRemoteBucketDetailsDefault(code int) *RemoteBucketDetailsDefault { - if code <= 0 { - code = 500 - } - - return &RemoteBucketDetailsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the remote bucket details default response -func (o *RemoteBucketDetailsDefault) WithStatusCode(code int) *RemoteBucketDetailsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the remote bucket details default response -func (o *RemoteBucketDetailsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the remote bucket details default response -func (o *RemoteBucketDetailsDefault) WithPayload(payload *models.APIError) *RemoteBucketDetailsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the remote bucket details default response -func (o *RemoteBucketDetailsDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *RemoteBucketDetailsDefault) 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/bucket/remote_bucket_details_urlbuilder.go b/api/operations/bucket/remote_bucket_details_urlbuilder.go deleted file mode 100644 index d3d62484cd..0000000000 --- a/api/operations/bucket/remote_bucket_details_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 bucket - -// 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" -) - -// RemoteBucketDetailsURL generates an URL for the remote bucket details operation -type RemoteBucketDetailsURL 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 *RemoteBucketDetailsURL) WithBasePath(bp string) *RemoteBucketDetailsURL { - 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 *RemoteBucketDetailsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *RemoteBucketDetailsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/remote-buckets/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on RemoteBucketDetailsURL") - } - - _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 *RemoteBucketDetailsURL) 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 *RemoteBucketDetailsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *RemoteBucketDetailsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on RemoteBucketDetailsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on RemoteBucketDetailsURL") - } - - 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 *RemoteBucketDetailsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/bucket/set_access_rule_with_bucket.go b/api/operations/bucket/set_access_rule_with_bucket.go deleted file mode 100644 index 5f4c381d54..0000000000 --- a/api/operations/bucket/set_access_rule_with_bucket.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 bucket - -// 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" -) - -// SetAccessRuleWithBucketHandlerFunc turns a function with the right signature into a set access rule with bucket handler -type SetAccessRuleWithBucketHandlerFunc func(SetAccessRuleWithBucketParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn SetAccessRuleWithBucketHandlerFunc) Handle(params SetAccessRuleWithBucketParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// SetAccessRuleWithBucketHandler interface for that can handle valid set access rule with bucket params -type SetAccessRuleWithBucketHandler interface { - Handle(SetAccessRuleWithBucketParams, *models.Principal) middleware.Responder -} - -// NewSetAccessRuleWithBucket creates a new http.Handler for the set access rule with bucket operation -func NewSetAccessRuleWithBucket(ctx *middleware.Context, handler SetAccessRuleWithBucketHandler) *SetAccessRuleWithBucket { - return &SetAccessRuleWithBucket{Context: ctx, Handler: handler} -} - -/* - SetAccessRuleWithBucket swagger:route PUT /bucket/{bucket}/access-rules Bucket setAccessRuleWithBucket - -Add Access Rule To Given Bucket -*/ -type SetAccessRuleWithBucket struct { - Context *middleware.Context - Handler SetAccessRuleWithBucketHandler -} - -func (o *SetAccessRuleWithBucket) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewSetAccessRuleWithBucketParams() - 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/bucket/set_access_rule_with_bucket_parameters.go b/api/operations/bucket/set_access_rule_with_bucket_parameters.go deleted file mode 100644 index 4e403fe6a8..0000000000 --- a/api/operations/bucket/set_access_rule_with_bucket_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 bucket - -// 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" -) - -// NewSetAccessRuleWithBucketParams creates a new SetAccessRuleWithBucketParams object -// -// There are no default values defined in the spec. -func NewSetAccessRuleWithBucketParams() SetAccessRuleWithBucketParams { - - return SetAccessRuleWithBucketParams{} -} - -// SetAccessRuleWithBucketParams contains all the bound params for the set access rule with bucket operation -// typically these are obtained from a http.Request -// -// swagger:parameters SetAccessRuleWithBucket -type SetAccessRuleWithBucketParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - Bucket string - /* - Required: true - In: body - */ - Prefixaccess *models.PrefixAccessPair -} - -// 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 NewSetAccessRuleWithBucketParams() beforehand. -func (o *SetAccessRuleWithBucketParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rBucket, rhkBucket, _ := route.Params.GetOK("bucket") - if err := o.bindBucket(rBucket, rhkBucket, route.Formats); err != nil { - res = append(res, err) - } - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.PrefixAccessPair - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("prefixaccess", "body", "")) - } else { - res = append(res, errors.NewParseError("prefixaccess", "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.Prefixaccess = &body - } - } - } else { - res = append(res, errors.Required("prefixaccess", "body", "")) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindBucket binds and validates parameter Bucket from path. -func (o *SetAccessRuleWithBucketParams) bindBucket(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.Bucket = raw - - return nil -} diff --git a/api/operations/bucket/set_access_rule_with_bucket_responses.go b/api/operations/bucket/set_access_rule_with_bucket_responses.go deleted file mode 100644 index 817ed1e10b..0000000000 --- a/api/operations/bucket/set_access_rule_with_bucket_responses.go +++ /dev/null @@ -1,133 +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 bucket - -// 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" -) - -// SetAccessRuleWithBucketOKCode is the HTTP code returned for type SetAccessRuleWithBucketOK -const SetAccessRuleWithBucketOKCode int = 200 - -/* -SetAccessRuleWithBucketOK A successful response. - -swagger:response setAccessRuleWithBucketOK -*/ -type SetAccessRuleWithBucketOK struct { - - /* - In: Body - */ - Payload bool `json:"body,omitempty"` -} - -// NewSetAccessRuleWithBucketOK creates SetAccessRuleWithBucketOK with default headers values -func NewSetAccessRuleWithBucketOK() *SetAccessRuleWithBucketOK { - - return &SetAccessRuleWithBucketOK{} -} - -// WithPayload adds the payload to the set access rule with bucket o k response -func (o *SetAccessRuleWithBucketOK) WithPayload(payload bool) *SetAccessRuleWithBucketOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the set access rule with bucket o k response -func (o *SetAccessRuleWithBucketOK) SetPayload(payload bool) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *SetAccessRuleWithBucketOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -SetAccessRuleWithBucketDefault Generic error response. - -swagger:response setAccessRuleWithBucketDefault -*/ -type SetAccessRuleWithBucketDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewSetAccessRuleWithBucketDefault creates SetAccessRuleWithBucketDefault with default headers values -func NewSetAccessRuleWithBucketDefault(code int) *SetAccessRuleWithBucketDefault { - if code <= 0 { - code = 500 - } - - return &SetAccessRuleWithBucketDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the set access rule with bucket default response -func (o *SetAccessRuleWithBucketDefault) WithStatusCode(code int) *SetAccessRuleWithBucketDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the set access rule with bucket default response -func (o *SetAccessRuleWithBucketDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the set access rule with bucket default response -func (o *SetAccessRuleWithBucketDefault) WithPayload(payload *models.APIError) *SetAccessRuleWithBucketDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the set access rule with bucket default response -func (o *SetAccessRuleWithBucketDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *SetAccessRuleWithBucketDefault) 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/bucket/set_access_rule_with_bucket_urlbuilder.go b/api/operations/bucket/set_access_rule_with_bucket_urlbuilder.go deleted file mode 100644 index 8dd0a5773b..0000000000 --- a/api/operations/bucket/set_access_rule_with_bucket_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 bucket - -// 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" -) - -// SetAccessRuleWithBucketURL generates an URL for the set access rule with bucket operation -type SetAccessRuleWithBucketURL struct { - Bucket 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 *SetAccessRuleWithBucketURL) WithBasePath(bp string) *SetAccessRuleWithBucketURL { - 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 *SetAccessRuleWithBucketURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *SetAccessRuleWithBucketURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/bucket/{bucket}/access-rules" - - bucket := o.Bucket - if bucket != "" { - _path = strings.Replace(_path, "{bucket}", bucket, -1) - } else { - return nil, errors.New("bucket is required on SetAccessRuleWithBucketURL") - } - - _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 *SetAccessRuleWithBucketURL) 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 *SetAccessRuleWithBucketURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *SetAccessRuleWithBucketURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on SetAccessRuleWithBucketURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on SetAccessRuleWithBucketURL") - } - - 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 *SetAccessRuleWithBucketURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/bucket/set_bucket_quota.go b/api/operations/bucket/set_bucket_quota.go deleted file mode 100644 index 6cc482fcb3..0000000000 --- a/api/operations/bucket/set_bucket_quota.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 bucket - -// 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" -) - -// SetBucketQuotaHandlerFunc turns a function with the right signature into a set bucket quota handler -type SetBucketQuotaHandlerFunc func(SetBucketQuotaParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn SetBucketQuotaHandlerFunc) Handle(params SetBucketQuotaParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// SetBucketQuotaHandler interface for that can handle valid set bucket quota params -type SetBucketQuotaHandler interface { - Handle(SetBucketQuotaParams, *models.Principal) middleware.Responder -} - -// NewSetBucketQuota creates a new http.Handler for the set bucket quota operation -func NewSetBucketQuota(ctx *middleware.Context, handler SetBucketQuotaHandler) *SetBucketQuota { - return &SetBucketQuota{Context: ctx, Handler: handler} -} - -/* - SetBucketQuota swagger:route PUT /buckets/{name}/quota Bucket setBucketQuota - -Bucket Quota -*/ -type SetBucketQuota struct { - Context *middleware.Context - Handler SetBucketQuotaHandler -} - -func (o *SetBucketQuota) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewSetBucketQuotaParams() - 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/bucket/set_bucket_quota_parameters.go b/api/operations/bucket/set_bucket_quota_parameters.go deleted file mode 100644 index 7ee37eec4a..0000000000 --- a/api/operations/bucket/set_bucket_quota_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 bucket - -// 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" -) - -// NewSetBucketQuotaParams creates a new SetBucketQuotaParams object -// -// There are no default values defined in the spec. -func NewSetBucketQuotaParams() SetBucketQuotaParams { - - return SetBucketQuotaParams{} -} - -// SetBucketQuotaParams contains all the bound params for the set bucket quota operation -// typically these are obtained from a http.Request -// -// swagger:parameters SetBucketQuota -type SetBucketQuotaParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.SetBucketQuota - /* - 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 NewSetBucketQuotaParams() beforehand. -func (o *SetBucketQuotaParams) 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.SetBucketQuota - 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 *SetBucketQuotaParams) 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/bucket/set_bucket_quota_responses.go b/api/operations/bucket/set_bucket_quota_responses.go deleted file mode 100644 index cf1e03d948..0000000000 --- a/api/operations/bucket/set_bucket_quota_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 bucket - -// 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" -) - -// SetBucketQuotaOKCode is the HTTP code returned for type SetBucketQuotaOK -const SetBucketQuotaOKCode int = 200 - -/* -SetBucketQuotaOK A successful response. - -swagger:response setBucketQuotaOK -*/ -type SetBucketQuotaOK struct { - - /* - In: Body - */ - Payload *models.Bucket `json:"body,omitempty"` -} - -// NewSetBucketQuotaOK creates SetBucketQuotaOK with default headers values -func NewSetBucketQuotaOK() *SetBucketQuotaOK { - - return &SetBucketQuotaOK{} -} - -// WithPayload adds the payload to the set bucket quota o k response -func (o *SetBucketQuotaOK) WithPayload(payload *models.Bucket) *SetBucketQuotaOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the set bucket quota o k response -func (o *SetBucketQuotaOK) SetPayload(payload *models.Bucket) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *SetBucketQuotaOK) 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 - } - } -} - -/* -SetBucketQuotaDefault Generic error response. - -swagger:response setBucketQuotaDefault -*/ -type SetBucketQuotaDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewSetBucketQuotaDefault creates SetBucketQuotaDefault with default headers values -func NewSetBucketQuotaDefault(code int) *SetBucketQuotaDefault { - if code <= 0 { - code = 500 - } - - return &SetBucketQuotaDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the set bucket quota default response -func (o *SetBucketQuotaDefault) WithStatusCode(code int) *SetBucketQuotaDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the set bucket quota default response -func (o *SetBucketQuotaDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the set bucket quota default response -func (o *SetBucketQuotaDefault) WithPayload(payload *models.APIError) *SetBucketQuotaDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the set bucket quota default response -func (o *SetBucketQuotaDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *SetBucketQuotaDefault) 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/bucket/set_bucket_quota_urlbuilder.go b/api/operations/bucket/set_bucket_quota_urlbuilder.go deleted file mode 100644 index 251fb5d437..0000000000 --- a/api/operations/bucket/set_bucket_quota_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 bucket - -// 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" -) - -// SetBucketQuotaURL generates an URL for the set bucket quota operation -type SetBucketQuotaURL 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 *SetBucketQuotaURL) WithBasePath(bp string) *SetBucketQuotaURL { - 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 *SetBucketQuotaURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *SetBucketQuotaURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/buckets/{name}/quota" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on SetBucketQuotaURL") - } - - _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 *SetBucketQuotaURL) 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 *SetBucketQuotaURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *SetBucketQuotaURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on SetBucketQuotaURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on SetBucketQuotaURL") - } - - 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 *SetBucketQuotaURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/bucket/set_bucket_retention_config.go b/api/operations/bucket/set_bucket_retention_config.go deleted file mode 100644 index 636f4dd06a..0000000000 --- a/api/operations/bucket/set_bucket_retention_config.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 bucket - -// 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" -) - -// SetBucketRetentionConfigHandlerFunc turns a function with the right signature into a set bucket retention config handler -type SetBucketRetentionConfigHandlerFunc func(SetBucketRetentionConfigParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn SetBucketRetentionConfigHandlerFunc) Handle(params SetBucketRetentionConfigParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// SetBucketRetentionConfigHandler interface for that can handle valid set bucket retention config params -type SetBucketRetentionConfigHandler interface { - Handle(SetBucketRetentionConfigParams, *models.Principal) middleware.Responder -} - -// NewSetBucketRetentionConfig creates a new http.Handler for the set bucket retention config operation -func NewSetBucketRetentionConfig(ctx *middleware.Context, handler SetBucketRetentionConfigHandler) *SetBucketRetentionConfig { - return &SetBucketRetentionConfig{Context: ctx, Handler: handler} -} - -/* - SetBucketRetentionConfig swagger:route PUT /buckets/{bucket_name}/retention Bucket setBucketRetentionConfig - -Set Bucket's retention config -*/ -type SetBucketRetentionConfig struct { - Context *middleware.Context - Handler SetBucketRetentionConfigHandler -} - -func (o *SetBucketRetentionConfig) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewSetBucketRetentionConfigParams() - 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/bucket/set_bucket_retention_config_parameters.go b/api/operations/bucket/set_bucket_retention_config_parameters.go deleted file mode 100644 index d1d80066ad..0000000000 --- a/api/operations/bucket/set_bucket_retention_config_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 bucket - -// 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" -) - -// NewSetBucketRetentionConfigParams creates a new SetBucketRetentionConfigParams object -// -// There are no default values defined in the spec. -func NewSetBucketRetentionConfigParams() SetBucketRetentionConfigParams { - - return SetBucketRetentionConfigParams{} -} - -// SetBucketRetentionConfigParams contains all the bound params for the set bucket retention config operation -// typically these are obtained from a http.Request -// -// swagger:parameters SetBucketRetentionConfig -type SetBucketRetentionConfigParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.PutBucketRetentionRequest - /* - Required: true - In: path - */ - BucketName 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 NewSetBucketRetentionConfigParams() beforehand. -func (o *SetBucketRetentionConfigParams) 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.PutBucketRetentionRequest - 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", "")) - } - - rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") - if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindBucketName binds and validates parameter BucketName from path. -func (o *SetBucketRetentionConfigParams) bindBucketName(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.BucketName = raw - - return nil -} diff --git a/api/operations/bucket/set_bucket_retention_config_responses.go b/api/operations/bucket/set_bucket_retention_config_responses.go deleted file mode 100644 index 7fffdc5639..0000000000 --- a/api/operations/bucket/set_bucket_retention_config_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 bucket - -// 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" -) - -// SetBucketRetentionConfigOKCode is the HTTP code returned for type SetBucketRetentionConfigOK -const SetBucketRetentionConfigOKCode int = 200 - -/* -SetBucketRetentionConfigOK A successful response. - -swagger:response setBucketRetentionConfigOK -*/ -type SetBucketRetentionConfigOK struct { -} - -// NewSetBucketRetentionConfigOK creates SetBucketRetentionConfigOK with default headers values -func NewSetBucketRetentionConfigOK() *SetBucketRetentionConfigOK { - - return &SetBucketRetentionConfigOK{} -} - -// WriteResponse to the client -func (o *SetBucketRetentionConfigOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(200) -} - -/* -SetBucketRetentionConfigDefault Generic error response. - -swagger:response setBucketRetentionConfigDefault -*/ -type SetBucketRetentionConfigDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewSetBucketRetentionConfigDefault creates SetBucketRetentionConfigDefault with default headers values -func NewSetBucketRetentionConfigDefault(code int) *SetBucketRetentionConfigDefault { - if code <= 0 { - code = 500 - } - - return &SetBucketRetentionConfigDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the set bucket retention config default response -func (o *SetBucketRetentionConfigDefault) WithStatusCode(code int) *SetBucketRetentionConfigDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the set bucket retention config default response -func (o *SetBucketRetentionConfigDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the set bucket retention config default response -func (o *SetBucketRetentionConfigDefault) WithPayload(payload *models.APIError) *SetBucketRetentionConfigDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the set bucket retention config default response -func (o *SetBucketRetentionConfigDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *SetBucketRetentionConfigDefault) 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/bucket/set_bucket_retention_config_urlbuilder.go b/api/operations/bucket/set_bucket_retention_config_urlbuilder.go deleted file mode 100644 index d63073d528..0000000000 --- a/api/operations/bucket/set_bucket_retention_config_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 bucket - -// 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" -) - -// SetBucketRetentionConfigURL generates an URL for the set bucket retention config operation -type SetBucketRetentionConfigURL struct { - BucketName 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 *SetBucketRetentionConfigURL) WithBasePath(bp string) *SetBucketRetentionConfigURL { - 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 *SetBucketRetentionConfigURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *SetBucketRetentionConfigURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/buckets/{bucket_name}/retention" - - bucketName := o.BucketName - if bucketName != "" { - _path = strings.Replace(_path, "{bucket_name}", bucketName, -1) - } else { - return nil, errors.New("bucketName is required on SetBucketRetentionConfigURL") - } - - _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 *SetBucketRetentionConfigURL) 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 *SetBucketRetentionConfigURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *SetBucketRetentionConfigURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on SetBucketRetentionConfigURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on SetBucketRetentionConfigURL") - } - - 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 *SetBucketRetentionConfigURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/bucket/set_multi_bucket_replication.go b/api/operations/bucket/set_multi_bucket_replication.go deleted file mode 100644 index 310d53a7d1..0000000000 --- a/api/operations/bucket/set_multi_bucket_replication.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 bucket - -// 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" -) - -// SetMultiBucketReplicationHandlerFunc turns a function with the right signature into a set multi bucket replication handler -type SetMultiBucketReplicationHandlerFunc func(SetMultiBucketReplicationParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn SetMultiBucketReplicationHandlerFunc) Handle(params SetMultiBucketReplicationParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// SetMultiBucketReplicationHandler interface for that can handle valid set multi bucket replication params -type SetMultiBucketReplicationHandler interface { - Handle(SetMultiBucketReplicationParams, *models.Principal) middleware.Responder -} - -// NewSetMultiBucketReplication creates a new http.Handler for the set multi bucket replication operation -func NewSetMultiBucketReplication(ctx *middleware.Context, handler SetMultiBucketReplicationHandler) *SetMultiBucketReplication { - return &SetMultiBucketReplication{Context: ctx, Handler: handler} -} - -/* - SetMultiBucketReplication swagger:route POST /buckets-replication Bucket setMultiBucketReplication - -Sets Multi Bucket Replication in multiple Buckets -*/ -type SetMultiBucketReplication struct { - Context *middleware.Context - Handler SetMultiBucketReplicationHandler -} - -func (o *SetMultiBucketReplication) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewSetMultiBucketReplicationParams() - 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/bucket/set_multi_bucket_replication_parameters.go b/api/operations/bucket/set_multi_bucket_replication_parameters.go deleted file mode 100644 index 90c48d9d89..0000000000 --- a/api/operations/bucket/set_multi_bucket_replication_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 bucket - -// 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" -) - -// NewSetMultiBucketReplicationParams creates a new SetMultiBucketReplicationParams object -// -// There are no default values defined in the spec. -func NewSetMultiBucketReplicationParams() SetMultiBucketReplicationParams { - - return SetMultiBucketReplicationParams{} -} - -// SetMultiBucketReplicationParams contains all the bound params for the set multi bucket replication operation -// typically these are obtained from a http.Request -// -// swagger:parameters SetMultiBucketReplication -type SetMultiBucketReplicationParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.MultiBucketReplication -} - -// 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 NewSetMultiBucketReplicationParams() beforehand. -func (o *SetMultiBucketReplicationParams) 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.MultiBucketReplication - 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/bucket/set_multi_bucket_replication_responses.go b/api/operations/bucket/set_multi_bucket_replication_responses.go deleted file mode 100644 index f5b358a629..0000000000 --- a/api/operations/bucket/set_multi_bucket_replication_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 bucket - -// 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" -) - -// SetMultiBucketReplicationOKCode is the HTTP code returned for type SetMultiBucketReplicationOK -const SetMultiBucketReplicationOKCode int = 200 - -/* -SetMultiBucketReplicationOK A successful response. - -swagger:response setMultiBucketReplicationOK -*/ -type SetMultiBucketReplicationOK struct { - - /* - In: Body - */ - Payload *models.MultiBucketResponseState `json:"body,omitempty"` -} - -// NewSetMultiBucketReplicationOK creates SetMultiBucketReplicationOK with default headers values -func NewSetMultiBucketReplicationOK() *SetMultiBucketReplicationOK { - - return &SetMultiBucketReplicationOK{} -} - -// WithPayload adds the payload to the set multi bucket replication o k response -func (o *SetMultiBucketReplicationOK) WithPayload(payload *models.MultiBucketResponseState) *SetMultiBucketReplicationOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the set multi bucket replication o k response -func (o *SetMultiBucketReplicationOK) SetPayload(payload *models.MultiBucketResponseState) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *SetMultiBucketReplicationOK) 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 - } - } -} - -/* -SetMultiBucketReplicationDefault Generic error response. - -swagger:response setMultiBucketReplicationDefault -*/ -type SetMultiBucketReplicationDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewSetMultiBucketReplicationDefault creates SetMultiBucketReplicationDefault with default headers values -func NewSetMultiBucketReplicationDefault(code int) *SetMultiBucketReplicationDefault { - if code <= 0 { - code = 500 - } - - return &SetMultiBucketReplicationDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the set multi bucket replication default response -func (o *SetMultiBucketReplicationDefault) WithStatusCode(code int) *SetMultiBucketReplicationDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the set multi bucket replication default response -func (o *SetMultiBucketReplicationDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the set multi bucket replication default response -func (o *SetMultiBucketReplicationDefault) WithPayload(payload *models.APIError) *SetMultiBucketReplicationDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the set multi bucket replication default response -func (o *SetMultiBucketReplicationDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *SetMultiBucketReplicationDefault) 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/bucket/set_multi_bucket_replication_urlbuilder.go b/api/operations/bucket/set_multi_bucket_replication_urlbuilder.go deleted file mode 100644 index 461c92fa9a..0000000000 --- a/api/operations/bucket/set_multi_bucket_replication_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 bucket - -// 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" -) - -// SetMultiBucketReplicationURL generates an URL for the set multi bucket replication operation -type SetMultiBucketReplicationURL 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 *SetMultiBucketReplicationURL) WithBasePath(bp string) *SetMultiBucketReplicationURL { - 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 *SetMultiBucketReplicationURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *SetMultiBucketReplicationURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/buckets-replication" - - _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 *SetMultiBucketReplicationURL) 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 *SetMultiBucketReplicationURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *SetMultiBucketReplicationURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on SetMultiBucketReplicationURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on SetMultiBucketReplicationURL") - } - - 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 *SetMultiBucketReplicationURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/bucket/update_multi_bucket_replication.go b/api/operations/bucket/update_multi_bucket_replication.go deleted file mode 100644 index 90ed9600de..0000000000 --- a/api/operations/bucket/update_multi_bucket_replication.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 bucket - -// 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" -) - -// UpdateMultiBucketReplicationHandlerFunc turns a function with the right signature into a update multi bucket replication handler -type UpdateMultiBucketReplicationHandlerFunc func(UpdateMultiBucketReplicationParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn UpdateMultiBucketReplicationHandlerFunc) Handle(params UpdateMultiBucketReplicationParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// UpdateMultiBucketReplicationHandler interface for that can handle valid update multi bucket replication params -type UpdateMultiBucketReplicationHandler interface { - Handle(UpdateMultiBucketReplicationParams, *models.Principal) middleware.Responder -} - -// NewUpdateMultiBucketReplication creates a new http.Handler for the update multi bucket replication operation -func NewUpdateMultiBucketReplication(ctx *middleware.Context, handler UpdateMultiBucketReplicationHandler) *UpdateMultiBucketReplication { - return &UpdateMultiBucketReplication{Context: ctx, Handler: handler} -} - -/* - UpdateMultiBucketReplication swagger:route PUT /buckets/{bucket_name}/replication/{rule_id} Bucket updateMultiBucketReplication - -Update Replication rule -*/ -type UpdateMultiBucketReplication struct { - Context *middleware.Context - Handler UpdateMultiBucketReplicationHandler -} - -func (o *UpdateMultiBucketReplication) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewUpdateMultiBucketReplicationParams() - 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/bucket/update_multi_bucket_replication_parameters.go b/api/operations/bucket/update_multi_bucket_replication_parameters.go deleted file mode 100644 index 8470e2ec19..0000000000 --- a/api/operations/bucket/update_multi_bucket_replication_parameters.go +++ /dev/null @@ -1,150 +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 bucket - -// 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" -) - -// NewUpdateMultiBucketReplicationParams creates a new UpdateMultiBucketReplicationParams object -// -// There are no default values defined in the spec. -func NewUpdateMultiBucketReplicationParams() UpdateMultiBucketReplicationParams { - - return UpdateMultiBucketReplicationParams{} -} - -// UpdateMultiBucketReplicationParams contains all the bound params for the update multi bucket replication operation -// typically these are obtained from a http.Request -// -// swagger:parameters UpdateMultiBucketReplication -type UpdateMultiBucketReplicationParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.MultiBucketReplicationEdit - /* - Required: true - In: path - */ - BucketName string - /* - Required: true - In: path - */ - RuleID 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 NewUpdateMultiBucketReplicationParams() beforehand. -func (o *UpdateMultiBucketReplicationParams) 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.MultiBucketReplicationEdit - 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", "")) - } - - rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") - if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { - res = append(res, err) - } - - rRuleID, rhkRuleID, _ := route.Params.GetOK("rule_id") - if err := o.bindRuleID(rRuleID, rhkRuleID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindBucketName binds and validates parameter BucketName from path. -func (o *UpdateMultiBucketReplicationParams) bindBucketName(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.BucketName = raw - - return nil -} - -// bindRuleID binds and validates parameter RuleID from path. -func (o *UpdateMultiBucketReplicationParams) bindRuleID(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.RuleID = raw - - return nil -} diff --git a/api/operations/bucket/update_multi_bucket_replication_responses.go b/api/operations/bucket/update_multi_bucket_replication_responses.go deleted file mode 100644 index eed8e363f0..0000000000 --- a/api/operations/bucket/update_multi_bucket_replication_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 bucket - -// 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" -) - -// UpdateMultiBucketReplicationCreatedCode is the HTTP code returned for type UpdateMultiBucketReplicationCreated -const UpdateMultiBucketReplicationCreatedCode int = 201 - -/* -UpdateMultiBucketReplicationCreated A successful response. - -swagger:response updateMultiBucketReplicationCreated -*/ -type UpdateMultiBucketReplicationCreated struct { -} - -// NewUpdateMultiBucketReplicationCreated creates UpdateMultiBucketReplicationCreated with default headers values -func NewUpdateMultiBucketReplicationCreated() *UpdateMultiBucketReplicationCreated { - - return &UpdateMultiBucketReplicationCreated{} -} - -// WriteResponse to the client -func (o *UpdateMultiBucketReplicationCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(201) -} - -/* -UpdateMultiBucketReplicationDefault Generic error response. - -swagger:response updateMultiBucketReplicationDefault -*/ -type UpdateMultiBucketReplicationDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewUpdateMultiBucketReplicationDefault creates UpdateMultiBucketReplicationDefault with default headers values -func NewUpdateMultiBucketReplicationDefault(code int) *UpdateMultiBucketReplicationDefault { - if code <= 0 { - code = 500 - } - - return &UpdateMultiBucketReplicationDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the update multi bucket replication default response -func (o *UpdateMultiBucketReplicationDefault) WithStatusCode(code int) *UpdateMultiBucketReplicationDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the update multi bucket replication default response -func (o *UpdateMultiBucketReplicationDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the update multi bucket replication default response -func (o *UpdateMultiBucketReplicationDefault) WithPayload(payload *models.APIError) *UpdateMultiBucketReplicationDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the update multi bucket replication default response -func (o *UpdateMultiBucketReplicationDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *UpdateMultiBucketReplicationDefault) 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/bucket/update_multi_bucket_replication_urlbuilder.go b/api/operations/bucket/update_multi_bucket_replication_urlbuilder.go deleted file mode 100644 index 0606b244b2..0000000000 --- a/api/operations/bucket/update_multi_bucket_replication_urlbuilder.go +++ /dev/null @@ -1,124 +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 bucket - -// 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" -) - -// UpdateMultiBucketReplicationURL generates an URL for the update multi bucket replication operation -type UpdateMultiBucketReplicationURL struct { - BucketName string - RuleID 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 *UpdateMultiBucketReplicationURL) WithBasePath(bp string) *UpdateMultiBucketReplicationURL { - 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 *UpdateMultiBucketReplicationURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *UpdateMultiBucketReplicationURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/buckets/{bucket_name}/replication/{rule_id}" - - bucketName := o.BucketName - if bucketName != "" { - _path = strings.Replace(_path, "{bucket_name}", bucketName, -1) - } else { - return nil, errors.New("bucketName is required on UpdateMultiBucketReplicationURL") - } - - ruleID := o.RuleID - if ruleID != "" { - _path = strings.Replace(_path, "{rule_id}", ruleID, -1) - } else { - return nil, errors.New("ruleId is required on UpdateMultiBucketReplicationURL") - } - - _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 *UpdateMultiBucketReplicationURL) 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 *UpdateMultiBucketReplicationURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *UpdateMultiBucketReplicationURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on UpdateMultiBucketReplicationURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on UpdateMultiBucketReplicationURL") - } - - 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 *UpdateMultiBucketReplicationURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/configuration/add_notification_endpoint.go b/api/operations/configuration/add_notification_endpoint.go deleted file mode 100644 index bc8390ffe4..0000000000 --- a/api/operations/configuration/add_notification_endpoint.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 configuration - -// 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" -) - -// AddNotificationEndpointHandlerFunc turns a function with the right signature into a add notification endpoint handler -type AddNotificationEndpointHandlerFunc func(AddNotificationEndpointParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn AddNotificationEndpointHandlerFunc) Handle(params AddNotificationEndpointParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// AddNotificationEndpointHandler interface for that can handle valid add notification endpoint params -type AddNotificationEndpointHandler interface { - Handle(AddNotificationEndpointParams, *models.Principal) middleware.Responder -} - -// NewAddNotificationEndpoint creates a new http.Handler for the add notification endpoint operation -func NewAddNotificationEndpoint(ctx *middleware.Context, handler AddNotificationEndpointHandler) *AddNotificationEndpoint { - return &AddNotificationEndpoint{Context: ctx, Handler: handler} -} - -/* - AddNotificationEndpoint swagger:route POST /admin/notification_endpoints Configuration addNotificationEndpoint - -Allows to configure a new notification endpoint -*/ -type AddNotificationEndpoint struct { - Context *middleware.Context - Handler AddNotificationEndpointHandler -} - -func (o *AddNotificationEndpoint) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewAddNotificationEndpointParams() - 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/configuration/add_notification_endpoint_parameters.go b/api/operations/configuration/add_notification_endpoint_parameters.go deleted file mode 100644 index 94d51fdac1..0000000000 --- a/api/operations/configuration/add_notification_endpoint_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 configuration - -// 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" -) - -// NewAddNotificationEndpointParams creates a new AddNotificationEndpointParams object -// -// There are no default values defined in the spec. -func NewAddNotificationEndpointParams() AddNotificationEndpointParams { - - return AddNotificationEndpointParams{} -} - -// AddNotificationEndpointParams contains all the bound params for the add notification endpoint operation -// typically these are obtained from a http.Request -// -// swagger:parameters AddNotificationEndpoint -type AddNotificationEndpointParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.NotificationEndpoint -} - -// 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 NewAddNotificationEndpointParams() beforehand. -func (o *AddNotificationEndpointParams) 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.NotificationEndpoint - 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/configuration/add_notification_endpoint_responses.go b/api/operations/configuration/add_notification_endpoint_responses.go deleted file mode 100644 index 7af1500997..0000000000 --- a/api/operations/configuration/add_notification_endpoint_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 configuration - -// 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" -) - -// AddNotificationEndpointCreatedCode is the HTTP code returned for type AddNotificationEndpointCreated -const AddNotificationEndpointCreatedCode int = 201 - -/* -AddNotificationEndpointCreated A successful response. - -swagger:response addNotificationEndpointCreated -*/ -type AddNotificationEndpointCreated struct { - - /* - In: Body - */ - Payload *models.SetNotificationEndpointResponse `json:"body,omitempty"` -} - -// NewAddNotificationEndpointCreated creates AddNotificationEndpointCreated with default headers values -func NewAddNotificationEndpointCreated() *AddNotificationEndpointCreated { - - return &AddNotificationEndpointCreated{} -} - -// WithPayload adds the payload to the add notification endpoint created response -func (o *AddNotificationEndpointCreated) WithPayload(payload *models.SetNotificationEndpointResponse) *AddNotificationEndpointCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the add notification endpoint created response -func (o *AddNotificationEndpointCreated) SetPayload(payload *models.SetNotificationEndpointResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *AddNotificationEndpointCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -AddNotificationEndpointDefault Generic error response. - -swagger:response addNotificationEndpointDefault -*/ -type AddNotificationEndpointDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewAddNotificationEndpointDefault creates AddNotificationEndpointDefault with default headers values -func NewAddNotificationEndpointDefault(code int) *AddNotificationEndpointDefault { - if code <= 0 { - code = 500 - } - - return &AddNotificationEndpointDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the add notification endpoint default response -func (o *AddNotificationEndpointDefault) WithStatusCode(code int) *AddNotificationEndpointDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the add notification endpoint default response -func (o *AddNotificationEndpointDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the add notification endpoint default response -func (o *AddNotificationEndpointDefault) WithPayload(payload *models.APIError) *AddNotificationEndpointDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the add notification endpoint default response -func (o *AddNotificationEndpointDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *AddNotificationEndpointDefault) 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/configuration/add_notification_endpoint_urlbuilder.go b/api/operations/configuration/add_notification_endpoint_urlbuilder.go deleted file mode 100644 index 883110d1e6..0000000000 --- a/api/operations/configuration/add_notification_endpoint_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 configuration - -// 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" -) - -// AddNotificationEndpointURL generates an URL for the add notification endpoint operation -type AddNotificationEndpointURL 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 *AddNotificationEndpointURL) WithBasePath(bp string) *AddNotificationEndpointURL { - 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 *AddNotificationEndpointURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *AddNotificationEndpointURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/admin/notification_endpoints" - - _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 *AddNotificationEndpointURL) 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 *AddNotificationEndpointURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *AddNotificationEndpointURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on AddNotificationEndpointURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on AddNotificationEndpointURL") - } - - 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 *AddNotificationEndpointURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/configuration/config_info.go b/api/operations/configuration/config_info.go deleted file mode 100644 index 498cd26fee..0000000000 --- a/api/operations/configuration/config_info.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 configuration - -// 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" -) - -// ConfigInfoHandlerFunc turns a function with the right signature into a config info handler -type ConfigInfoHandlerFunc func(ConfigInfoParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn ConfigInfoHandlerFunc) Handle(params ConfigInfoParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// ConfigInfoHandler interface for that can handle valid config info params -type ConfigInfoHandler interface { - Handle(ConfigInfoParams, *models.Principal) middleware.Responder -} - -// NewConfigInfo creates a new http.Handler for the config info operation -func NewConfigInfo(ctx *middleware.Context, handler ConfigInfoHandler) *ConfigInfo { - return &ConfigInfo{Context: ctx, Handler: handler} -} - -/* - ConfigInfo swagger:route GET /configs/{name} Configuration configInfo - -Configuration info -*/ -type ConfigInfo struct { - Context *middleware.Context - Handler ConfigInfoHandler -} - -func (o *ConfigInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewConfigInfoParams() - 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/configuration/config_info_parameters.go b/api/operations/configuration/config_info_parameters.go deleted file mode 100644 index 6a4d0c6fd1..0000000000 --- a/api/operations/configuration/config_info_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 configuration - -// 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" -) - -// NewConfigInfoParams creates a new ConfigInfoParams object -// -// There are no default values defined in the spec. -func NewConfigInfoParams() ConfigInfoParams { - - return ConfigInfoParams{} -} - -// ConfigInfoParams contains all the bound params for the config info operation -// typically these are obtained from a http.Request -// -// swagger:parameters ConfigInfo -type ConfigInfoParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - 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 NewConfigInfoParams() beforehand. -func (o *ConfigInfoParams) 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 *ConfigInfoParams) 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/configuration/config_info_responses.go b/api/operations/configuration/config_info_responses.go deleted file mode 100644 index 7cbd93ac59..0000000000 --- a/api/operations/configuration/config_info_responses.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 configuration - -// 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" -) - -// ConfigInfoOKCode is the HTTP code returned for type ConfigInfoOK -const ConfigInfoOKCode int = 200 - -/* -ConfigInfoOK A successful response. - -swagger:response configInfoOK -*/ -type ConfigInfoOK struct { - - /* - In: Body - */ - Payload []*models.Configuration `json:"body,omitempty"` -} - -// NewConfigInfoOK creates ConfigInfoOK with default headers values -func NewConfigInfoOK() *ConfigInfoOK { - - return &ConfigInfoOK{} -} - -// WithPayload adds the payload to the config info o k response -func (o *ConfigInfoOK) WithPayload(payload []*models.Configuration) *ConfigInfoOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the config info o k response -func (o *ConfigInfoOK) SetPayload(payload []*models.Configuration) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ConfigInfoOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = make([]*models.Configuration, 0, 50) - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -ConfigInfoDefault Generic error response. - -swagger:response configInfoDefault -*/ -type ConfigInfoDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewConfigInfoDefault creates ConfigInfoDefault with default headers values -func NewConfigInfoDefault(code int) *ConfigInfoDefault { - if code <= 0 { - code = 500 - } - - return &ConfigInfoDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the config info default response -func (o *ConfigInfoDefault) WithStatusCode(code int) *ConfigInfoDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the config info default response -func (o *ConfigInfoDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the config info default response -func (o *ConfigInfoDefault) WithPayload(payload *models.APIError) *ConfigInfoDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the config info default response -func (o *ConfigInfoDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ConfigInfoDefault) 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/configuration/config_info_urlbuilder.go b/api/operations/configuration/config_info_urlbuilder.go deleted file mode 100644 index 17f2bade2b..0000000000 --- a/api/operations/configuration/config_info_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 configuration - -// 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" -) - -// ConfigInfoURL generates an URL for the config info operation -type ConfigInfoURL 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 *ConfigInfoURL) WithBasePath(bp string) *ConfigInfoURL { - 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 *ConfigInfoURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ConfigInfoURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/configs/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on ConfigInfoURL") - } - - _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 *ConfigInfoURL) 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 *ConfigInfoURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ConfigInfoURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ConfigInfoURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ConfigInfoURL") - } - - 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 *ConfigInfoURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/configuration/export_config.go b/api/operations/configuration/export_config.go deleted file mode 100644 index d9c57613a7..0000000000 --- a/api/operations/configuration/export_config.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 configuration - -// 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" -) - -// ExportConfigHandlerFunc turns a function with the right signature into a export config handler -type ExportConfigHandlerFunc func(ExportConfigParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn ExportConfigHandlerFunc) Handle(params ExportConfigParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// ExportConfigHandler interface for that can handle valid export config params -type ExportConfigHandler interface { - Handle(ExportConfigParams, *models.Principal) middleware.Responder -} - -// NewExportConfig creates a new http.Handler for the export config operation -func NewExportConfig(ctx *middleware.Context, handler ExportConfigHandler) *ExportConfig { - return &ExportConfig{Context: ctx, Handler: handler} -} - -/* - ExportConfig swagger:route GET /configs/export Configuration exportConfig - -Export the current config from MinIO server -*/ -type ExportConfig struct { - Context *middleware.Context - Handler ExportConfigHandler -} - -func (o *ExportConfig) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewExportConfigParams() - 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/configuration/export_config_responses.go b/api/operations/configuration/export_config_responses.go deleted file mode 100644 index c24448f56f..0000000000 --- a/api/operations/configuration/export_config_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 configuration - -// 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" -) - -// ExportConfigOKCode is the HTTP code returned for type ExportConfigOK -const ExportConfigOKCode int = 200 - -/* -ExportConfigOK A successful response. - -swagger:response exportConfigOK -*/ -type ExportConfigOK struct { - - /* - In: Body - */ - Payload *models.ConfigExportResponse `json:"body,omitempty"` -} - -// NewExportConfigOK creates ExportConfigOK with default headers values -func NewExportConfigOK() *ExportConfigOK { - - return &ExportConfigOK{} -} - -// WithPayload adds the payload to the export config o k response -func (o *ExportConfigOK) WithPayload(payload *models.ConfigExportResponse) *ExportConfigOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the export config o k response -func (o *ExportConfigOK) SetPayload(payload *models.ConfigExportResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ExportConfigOK) 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 - } - } -} - -/* -ExportConfigDefault Generic error response. - -swagger:response exportConfigDefault -*/ -type ExportConfigDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewExportConfigDefault creates ExportConfigDefault with default headers values -func NewExportConfigDefault(code int) *ExportConfigDefault { - if code <= 0 { - code = 500 - } - - return &ExportConfigDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the export config default response -func (o *ExportConfigDefault) WithStatusCode(code int) *ExportConfigDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the export config default response -func (o *ExportConfigDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the export config default response -func (o *ExportConfigDefault) WithPayload(payload *models.APIError) *ExportConfigDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the export config default response -func (o *ExportConfigDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ExportConfigDefault) 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/configuration/export_config_urlbuilder.go b/api/operations/configuration/export_config_urlbuilder.go deleted file mode 100644 index 63eb5c01b3..0000000000 --- a/api/operations/configuration/export_config_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 configuration - -// 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" -) - -// ExportConfigURL generates an URL for the export config operation -type ExportConfigURL 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 *ExportConfigURL) WithBasePath(bp string) *ExportConfigURL { - 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 *ExportConfigURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ExportConfigURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/configs/export" - - _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 *ExportConfigURL) 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 *ExportConfigURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ExportConfigURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ExportConfigURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ExportConfigURL") - } - - 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 *ExportConfigURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/configuration/list_config.go b/api/operations/configuration/list_config.go deleted file mode 100644 index 3f86e85c02..0000000000 --- a/api/operations/configuration/list_config.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 configuration - -// 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" -) - -// ListConfigHandlerFunc turns a function with the right signature into a list config handler -type ListConfigHandlerFunc func(ListConfigParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn ListConfigHandlerFunc) Handle(params ListConfigParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// ListConfigHandler interface for that can handle valid list config params -type ListConfigHandler interface { - Handle(ListConfigParams, *models.Principal) middleware.Responder -} - -// NewListConfig creates a new http.Handler for the list config operation -func NewListConfig(ctx *middleware.Context, handler ListConfigHandler) *ListConfig { - return &ListConfig{Context: ctx, Handler: handler} -} - -/* - ListConfig swagger:route GET /configs Configuration listConfig - -List Configurations -*/ -type ListConfig struct { - Context *middleware.Context - Handler ListConfigHandler -} - -func (o *ListConfig) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewListConfigParams() - 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/configuration/list_config_parameters.go b/api/operations/configuration/list_config_parameters.go deleted file mode 100644 index 0ab9ee9400..0000000000 --- a/api/operations/configuration/list_config_parameters.go +++ /dev/null @@ -1,146 +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 configuration - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewListConfigParams creates a new ListConfigParams object -// with the default values initialized. -func NewListConfigParams() ListConfigParams { - - var ( - // initialize parameters with default values - - limitDefault = int32(20) - offsetDefault = int32(0) - ) - - return ListConfigParams{ - Limit: &limitDefault, - - Offset: &offsetDefault, - } -} - -// ListConfigParams contains all the bound params for the list config operation -// typically these are obtained from a http.Request -// -// swagger:parameters ListConfig -type ListConfigParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - In: query - Default: 20 - */ - Limit *int32 - /* - In: query - Default: 0 - */ - Offset *int32 -} - -// 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 NewListConfigParams() beforehand. -func (o *ListConfigParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qLimit, qhkLimit, _ := qs.GetOK("limit") - if err := o.bindLimit(qLimit, qhkLimit, route.Formats); err != nil { - res = append(res, err) - } - - qOffset, qhkOffset, _ := qs.GetOK("offset") - if err := o.bindOffset(qOffset, qhkOffset, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindLimit binds and validates parameter Limit from query. -func (o *ListConfigParams) bindLimit(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 - // Default values have been previously initialized by NewListConfigParams() - return nil - } - - value, err := swag.ConvertInt32(raw) - if err != nil { - return errors.InvalidType("limit", "query", "int32", raw) - } - o.Limit = &value - - return nil -} - -// bindOffset binds and validates parameter Offset from query. -func (o *ListConfigParams) bindOffset(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 - // Default values have been previously initialized by NewListConfigParams() - return nil - } - - value, err := swag.ConvertInt32(raw) - if err != nil { - return errors.InvalidType("offset", "query", "int32", raw) - } - o.Offset = &value - - return nil -} diff --git a/api/operations/configuration/list_config_responses.go b/api/operations/configuration/list_config_responses.go deleted file mode 100644 index d0419a1497..0000000000 --- a/api/operations/configuration/list_config_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 configuration - -// 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" -) - -// ListConfigOKCode is the HTTP code returned for type ListConfigOK -const ListConfigOKCode int = 200 - -/* -ListConfigOK A successful response. - -swagger:response listConfigOK -*/ -type ListConfigOK struct { - - /* - In: Body - */ - Payload *models.ListConfigResponse `json:"body,omitempty"` -} - -// NewListConfigOK creates ListConfigOK with default headers values -func NewListConfigOK() *ListConfigOK { - - return &ListConfigOK{} -} - -// WithPayload adds the payload to the list config o k response -func (o *ListConfigOK) WithPayload(payload *models.ListConfigResponse) *ListConfigOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list config o k response -func (o *ListConfigOK) SetPayload(payload *models.ListConfigResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListConfigOK) 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 - } - } -} - -/* -ListConfigDefault Generic error response. - -swagger:response listConfigDefault -*/ -type ListConfigDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewListConfigDefault creates ListConfigDefault with default headers values -func NewListConfigDefault(code int) *ListConfigDefault { - if code <= 0 { - code = 500 - } - - return &ListConfigDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the list config default response -func (o *ListConfigDefault) WithStatusCode(code int) *ListConfigDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the list config default response -func (o *ListConfigDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the list config default response -func (o *ListConfigDefault) WithPayload(payload *models.APIError) *ListConfigDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list config default response -func (o *ListConfigDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListConfigDefault) 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/configuration/list_config_urlbuilder.go b/api/operations/configuration/list_config_urlbuilder.go deleted file mode 100644 index d7e71bcc43..0000000000 --- a/api/operations/configuration/list_config_urlbuilder.go +++ /dev/null @@ -1,131 +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 configuration - -// 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" - - "github.com/go-openapi/swag" -) - -// ListConfigURL generates an URL for the list config operation -type ListConfigURL struct { - Limit *int32 - Offset *int32 - - _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 *ListConfigURL) WithBasePath(bp string) *ListConfigURL { - 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 *ListConfigURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ListConfigURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/configs" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var limitQ string - if o.Limit != nil { - limitQ = swag.FormatInt32(*o.Limit) - } - if limitQ != "" { - qs.Set("limit", limitQ) - } - - var offsetQ string - if o.Offset != nil { - offsetQ = swag.FormatInt32(*o.Offset) - } - if offsetQ != "" { - qs.Set("offset", offsetQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ListConfigURL) 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 *ListConfigURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ListConfigURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ListConfigURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ListConfigURL") - } - - 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 *ListConfigURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/configuration/notification_endpoint_list.go b/api/operations/configuration/notification_endpoint_list.go deleted file mode 100644 index 918435dcb5..0000000000 --- a/api/operations/configuration/notification_endpoint_list.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 configuration - -// 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" -) - -// NotificationEndpointListHandlerFunc turns a function with the right signature into a notification endpoint list handler -type NotificationEndpointListHandlerFunc func(NotificationEndpointListParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn NotificationEndpointListHandlerFunc) Handle(params NotificationEndpointListParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// NotificationEndpointListHandler interface for that can handle valid notification endpoint list params -type NotificationEndpointListHandler interface { - Handle(NotificationEndpointListParams, *models.Principal) middleware.Responder -} - -// NewNotificationEndpointList creates a new http.Handler for the notification endpoint list operation -func NewNotificationEndpointList(ctx *middleware.Context, handler NotificationEndpointListHandler) *NotificationEndpointList { - return &NotificationEndpointList{Context: ctx, Handler: handler} -} - -/* - NotificationEndpointList swagger:route GET /admin/notification_endpoints Configuration notificationEndpointList - -Returns a list of active notification endpoints -*/ -type NotificationEndpointList struct { - Context *middleware.Context - Handler NotificationEndpointListHandler -} - -func (o *NotificationEndpointList) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewNotificationEndpointListParams() - 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/configuration/notification_endpoint_list_parameters.go b/api/operations/configuration/notification_endpoint_list_parameters.go deleted file mode 100644 index 46c6ae352c..0000000000 --- a/api/operations/configuration/notification_endpoint_list_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 configuration - -// 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" -) - -// NewNotificationEndpointListParams creates a new NotificationEndpointListParams object -// -// There are no default values defined in the spec. -func NewNotificationEndpointListParams() NotificationEndpointListParams { - - return NotificationEndpointListParams{} -} - -// NotificationEndpointListParams contains all the bound params for the notification endpoint list operation -// typically these are obtained from a http.Request -// -// swagger:parameters NotificationEndpointList -type NotificationEndpointListParams 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 NewNotificationEndpointListParams() beforehand. -func (o *NotificationEndpointListParams) 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/configuration/notification_endpoint_list_responses.go b/api/operations/configuration/notification_endpoint_list_responses.go deleted file mode 100644 index a2513dea5f..0000000000 --- a/api/operations/configuration/notification_endpoint_list_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 configuration - -// 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" -) - -// NotificationEndpointListOKCode is the HTTP code returned for type NotificationEndpointListOK -const NotificationEndpointListOKCode int = 200 - -/* -NotificationEndpointListOK A successful response. - -swagger:response notificationEndpointListOK -*/ -type NotificationEndpointListOK struct { - - /* - In: Body - */ - Payload *models.NotifEndpointResponse `json:"body,omitempty"` -} - -// NewNotificationEndpointListOK creates NotificationEndpointListOK with default headers values -func NewNotificationEndpointListOK() *NotificationEndpointListOK { - - return &NotificationEndpointListOK{} -} - -// WithPayload adds the payload to the notification endpoint list o k response -func (o *NotificationEndpointListOK) WithPayload(payload *models.NotifEndpointResponse) *NotificationEndpointListOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the notification endpoint list o k response -func (o *NotificationEndpointListOK) SetPayload(payload *models.NotifEndpointResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *NotificationEndpointListOK) 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 - } - } -} - -/* -NotificationEndpointListDefault Generic error response. - -swagger:response notificationEndpointListDefault -*/ -type NotificationEndpointListDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewNotificationEndpointListDefault creates NotificationEndpointListDefault with default headers values -func NewNotificationEndpointListDefault(code int) *NotificationEndpointListDefault { - if code <= 0 { - code = 500 - } - - return &NotificationEndpointListDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the notification endpoint list default response -func (o *NotificationEndpointListDefault) WithStatusCode(code int) *NotificationEndpointListDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the notification endpoint list default response -func (o *NotificationEndpointListDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the notification endpoint list default response -func (o *NotificationEndpointListDefault) WithPayload(payload *models.APIError) *NotificationEndpointListDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the notification endpoint list default response -func (o *NotificationEndpointListDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *NotificationEndpointListDefault) 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/configuration/notification_endpoint_list_urlbuilder.go b/api/operations/configuration/notification_endpoint_list_urlbuilder.go deleted file mode 100644 index 70232f257d..0000000000 --- a/api/operations/configuration/notification_endpoint_list_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 configuration - -// 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" -) - -// NotificationEndpointListURL generates an URL for the notification endpoint list operation -type NotificationEndpointListURL 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 *NotificationEndpointListURL) WithBasePath(bp string) *NotificationEndpointListURL { - 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 *NotificationEndpointListURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *NotificationEndpointListURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/admin/notification_endpoints" - - _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 *NotificationEndpointListURL) 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 *NotificationEndpointListURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *NotificationEndpointListURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on NotificationEndpointListURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on NotificationEndpointListURL") - } - - 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 *NotificationEndpointListURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/configuration/post_configs_import.go b/api/operations/configuration/post_configs_import.go deleted file mode 100644 index 2c273afc6f..0000000000 --- a/api/operations/configuration/post_configs_import.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 configuration - -// 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" -) - -// PostConfigsImportHandlerFunc turns a function with the right signature into a post configs import handler -type PostConfigsImportHandlerFunc func(PostConfigsImportParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn PostConfigsImportHandlerFunc) Handle(params PostConfigsImportParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// PostConfigsImportHandler interface for that can handle valid post configs import params -type PostConfigsImportHandler interface { - Handle(PostConfigsImportParams, *models.Principal) middleware.Responder -} - -// NewPostConfigsImport creates a new http.Handler for the post configs import operation -func NewPostConfigsImport(ctx *middleware.Context, handler PostConfigsImportHandler) *PostConfigsImport { - return &PostConfigsImport{Context: ctx, Handler: handler} -} - -/* - PostConfigsImport swagger:route POST /configs/import Configuration postConfigsImport - -Uploads a file to import MinIO server config. -*/ -type PostConfigsImport struct { - Context *middleware.Context - Handler PostConfigsImportHandler -} - -func (o *PostConfigsImport) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewPostConfigsImportParams() - 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/configuration/post_configs_import_parameters.go b/api/operations/configuration/post_configs_import_parameters.go deleted file mode 100644 index d4cda04dd6..0000000000 --- a/api/operations/configuration/post_configs_import_parameters.go +++ /dev/null @@ -1,103 +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 configuration - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "io" - "mime/multipart" - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" -) - -// PostConfigsImportMaxParseMemory sets the maximum size in bytes for -// the multipart form parser for this operation. -// -// The default value is 32 MB. -// The multipart parser stores up to this + 10MB. -var PostConfigsImportMaxParseMemory int64 = 32 << 20 - -// NewPostConfigsImportParams creates a new PostConfigsImportParams object -// -// There are no default values defined in the spec. -func NewPostConfigsImportParams() PostConfigsImportParams { - - return PostConfigsImportParams{} -} - -// PostConfigsImportParams contains all the bound params for the post configs import operation -// typically these are obtained from a http.Request -// -// swagger:parameters PostConfigsImport -type PostConfigsImportParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: formData - */ - File io.ReadCloser -} - -// 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 NewPostConfigsImportParams() beforehand. -func (o *PostConfigsImportParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if err := r.ParseMultipartForm(PostConfigsImportMaxParseMemory); err != nil { - if err != http.ErrNotMultipart { - return errors.New(400, "%v", err) - } else if err := r.ParseForm(); err != nil { - return errors.New(400, "%v", err) - } - } - - file, fileHeader, err := r.FormFile("file") - if err != nil { - res = append(res, errors.New(400, "reading file %q failed: %v", "file", err)) - } else if err := o.bindFile(file, fileHeader); err != nil { - // Required: true - res = append(res, err) - } else { - o.File = &runtime.File{Data: file, Header: fileHeader} - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindFile binds file parameter File. -// -// The only supported validations on files are MinLength and MaxLength -func (o *PostConfigsImportParams) bindFile(file multipart.File, header *multipart.FileHeader) error { - return nil -} diff --git a/api/operations/configuration/post_configs_import_responses.go b/api/operations/configuration/post_configs_import_responses.go deleted file mode 100644 index 1329a658c4..0000000000 --- a/api/operations/configuration/post_configs_import_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 configuration - -// 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" -) - -// PostConfigsImportOKCode is the HTTP code returned for type PostConfigsImportOK -const PostConfigsImportOKCode int = 200 - -/* -PostConfigsImportOK A successful response. - -swagger:response postConfigsImportOK -*/ -type PostConfigsImportOK struct { -} - -// NewPostConfigsImportOK creates PostConfigsImportOK with default headers values -func NewPostConfigsImportOK() *PostConfigsImportOK { - - return &PostConfigsImportOK{} -} - -// WriteResponse to the client -func (o *PostConfigsImportOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(200) -} - -/* -PostConfigsImportDefault Generic error response. - -swagger:response postConfigsImportDefault -*/ -type PostConfigsImportDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewPostConfigsImportDefault creates PostConfigsImportDefault with default headers values -func NewPostConfigsImportDefault(code int) *PostConfigsImportDefault { - if code <= 0 { - code = 500 - } - - return &PostConfigsImportDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the post configs import default response -func (o *PostConfigsImportDefault) WithStatusCode(code int) *PostConfigsImportDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the post configs import default response -func (o *PostConfigsImportDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the post configs import default response -func (o *PostConfigsImportDefault) WithPayload(payload *models.APIError) *PostConfigsImportDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the post configs import default response -func (o *PostConfigsImportDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *PostConfigsImportDefault) 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/configuration/post_configs_import_urlbuilder.go b/api/operations/configuration/post_configs_import_urlbuilder.go deleted file mode 100644 index f25a7de3a1..0000000000 --- a/api/operations/configuration/post_configs_import_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 configuration - -// 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" -) - -// PostConfigsImportURL generates an URL for the post configs import operation -type PostConfigsImportURL 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 *PostConfigsImportURL) WithBasePath(bp string) *PostConfigsImportURL { - 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 *PostConfigsImportURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *PostConfigsImportURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/configs/import" - - _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 *PostConfigsImportURL) 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 *PostConfigsImportURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *PostConfigsImportURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on PostConfigsImportURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on PostConfigsImportURL") - } - - 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 *PostConfigsImportURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/configuration/reset_config.go b/api/operations/configuration/reset_config.go deleted file mode 100644 index 233aa0193b..0000000000 --- a/api/operations/configuration/reset_config.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 configuration - -// 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" -) - -// ResetConfigHandlerFunc turns a function with the right signature into a reset config handler -type ResetConfigHandlerFunc func(ResetConfigParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn ResetConfigHandlerFunc) Handle(params ResetConfigParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// ResetConfigHandler interface for that can handle valid reset config params -type ResetConfigHandler interface { - Handle(ResetConfigParams, *models.Principal) middleware.Responder -} - -// NewResetConfig creates a new http.Handler for the reset config operation -func NewResetConfig(ctx *middleware.Context, handler ResetConfigHandler) *ResetConfig { - return &ResetConfig{Context: ctx, Handler: handler} -} - -/* - ResetConfig swagger:route POST /configs/{name}/reset Configuration resetConfig - -Configuration reset -*/ -type ResetConfig struct { - Context *middleware.Context - Handler ResetConfigHandler -} - -func (o *ResetConfig) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewResetConfigParams() - 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/configuration/reset_config_parameters.go b/api/operations/configuration/reset_config_parameters.go deleted file mode 100644 index a691defc28..0000000000 --- a/api/operations/configuration/reset_config_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 configuration - -// 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" -) - -// NewResetConfigParams creates a new ResetConfigParams object -// -// There are no default values defined in the spec. -func NewResetConfigParams() ResetConfigParams { - - return ResetConfigParams{} -} - -// ResetConfigParams contains all the bound params for the reset config operation -// typically these are obtained from a http.Request -// -// swagger:parameters ResetConfig -type ResetConfigParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - 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 NewResetConfigParams() beforehand. -func (o *ResetConfigParams) 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 *ResetConfigParams) 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/configuration/reset_config_responses.go b/api/operations/configuration/reset_config_responses.go deleted file mode 100644 index d4976f49a5..0000000000 --- a/api/operations/configuration/reset_config_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 configuration - -// 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" -) - -// ResetConfigOKCode is the HTTP code returned for type ResetConfigOK -const ResetConfigOKCode int = 200 - -/* -ResetConfigOK A successful response. - -swagger:response resetConfigOK -*/ -type ResetConfigOK struct { - - /* - In: Body - */ - Payload *models.SetConfigResponse `json:"body,omitempty"` -} - -// NewResetConfigOK creates ResetConfigOK with default headers values -func NewResetConfigOK() *ResetConfigOK { - - return &ResetConfigOK{} -} - -// WithPayload adds the payload to the reset config o k response -func (o *ResetConfigOK) WithPayload(payload *models.SetConfigResponse) *ResetConfigOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the reset config o k response -func (o *ResetConfigOK) SetPayload(payload *models.SetConfigResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ResetConfigOK) 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 - } - } -} - -/* -ResetConfigDefault Generic error response. - -swagger:response resetConfigDefault -*/ -type ResetConfigDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewResetConfigDefault creates ResetConfigDefault with default headers values -func NewResetConfigDefault(code int) *ResetConfigDefault { - if code <= 0 { - code = 500 - } - - return &ResetConfigDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the reset config default response -func (o *ResetConfigDefault) WithStatusCode(code int) *ResetConfigDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the reset config default response -func (o *ResetConfigDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the reset config default response -func (o *ResetConfigDefault) WithPayload(payload *models.APIError) *ResetConfigDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the reset config default response -func (o *ResetConfigDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ResetConfigDefault) 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/configuration/reset_config_urlbuilder.go b/api/operations/configuration/reset_config_urlbuilder.go deleted file mode 100644 index 32aa9c9a4d..0000000000 --- a/api/operations/configuration/reset_config_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 configuration - -// 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" -) - -// ResetConfigURL generates an URL for the reset config operation -type ResetConfigURL 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 *ResetConfigURL) WithBasePath(bp string) *ResetConfigURL { - 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 *ResetConfigURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ResetConfigURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/configs/{name}/reset" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on ResetConfigURL") - } - - _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 *ResetConfigURL) 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 *ResetConfigURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ResetConfigURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ResetConfigURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ResetConfigURL") - } - - 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 *ResetConfigURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/configuration/set_config.go b/api/operations/configuration/set_config.go deleted file mode 100644 index 9d04086742..0000000000 --- a/api/operations/configuration/set_config.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 configuration - -// 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" -) - -// SetConfigHandlerFunc turns a function with the right signature into a set config handler -type SetConfigHandlerFunc func(SetConfigParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn SetConfigHandlerFunc) Handle(params SetConfigParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// SetConfigHandler interface for that can handle valid set config params -type SetConfigHandler interface { - Handle(SetConfigParams, *models.Principal) middleware.Responder -} - -// NewSetConfig creates a new http.Handler for the set config operation -func NewSetConfig(ctx *middleware.Context, handler SetConfigHandler) *SetConfig { - return &SetConfig{Context: ctx, Handler: handler} -} - -/* - SetConfig swagger:route PUT /configs/{name} Configuration setConfig - -Set Configuration -*/ -type SetConfig struct { - Context *middleware.Context - Handler SetConfigHandler -} - -func (o *SetConfig) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewSetConfigParams() - 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/configuration/set_config_parameters.go b/api/operations/configuration/set_config_parameters.go deleted file mode 100644 index 4f10bf2238..0000000000 --- a/api/operations/configuration/set_config_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 configuration - -// 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" -) - -// NewSetConfigParams creates a new SetConfigParams object -// -// There are no default values defined in the spec. -func NewSetConfigParams() SetConfigParams { - - return SetConfigParams{} -} - -// SetConfigParams contains all the bound params for the set config operation -// typically these are obtained from a http.Request -// -// swagger:parameters SetConfig -type SetConfigParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.SetConfigRequest - /* - 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 NewSetConfigParams() beforehand. -func (o *SetConfigParams) 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.SetConfigRequest - 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 *SetConfigParams) 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/configuration/set_config_responses.go b/api/operations/configuration/set_config_responses.go deleted file mode 100644 index a823dc2fec..0000000000 --- a/api/operations/configuration/set_config_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 configuration - -// 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" -) - -// SetConfigOKCode is the HTTP code returned for type SetConfigOK -const SetConfigOKCode int = 200 - -/* -SetConfigOK A successful response. - -swagger:response setConfigOK -*/ -type SetConfigOK struct { - - /* - In: Body - */ - Payload *models.SetConfigResponse `json:"body,omitempty"` -} - -// NewSetConfigOK creates SetConfigOK with default headers values -func NewSetConfigOK() *SetConfigOK { - - return &SetConfigOK{} -} - -// WithPayload adds the payload to the set config o k response -func (o *SetConfigOK) WithPayload(payload *models.SetConfigResponse) *SetConfigOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the set config o k response -func (o *SetConfigOK) SetPayload(payload *models.SetConfigResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *SetConfigOK) 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 - } - } -} - -/* -SetConfigDefault Generic error response. - -swagger:response setConfigDefault -*/ -type SetConfigDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewSetConfigDefault creates SetConfigDefault with default headers values -func NewSetConfigDefault(code int) *SetConfigDefault { - if code <= 0 { - code = 500 - } - - return &SetConfigDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the set config default response -func (o *SetConfigDefault) WithStatusCode(code int) *SetConfigDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the set config default response -func (o *SetConfigDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the set config default response -func (o *SetConfigDefault) WithPayload(payload *models.APIError) *SetConfigDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the set config default response -func (o *SetConfigDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *SetConfigDefault) 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/configuration/set_config_urlbuilder.go b/api/operations/configuration/set_config_urlbuilder.go deleted file mode 100644 index 81143ca428..0000000000 --- a/api/operations/configuration/set_config_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 configuration - -// 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" -) - -// SetConfigURL generates an URL for the set config operation -type SetConfigURL 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 *SetConfigURL) WithBasePath(bp string) *SetConfigURL { - 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 *SetConfigURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *SetConfigURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/configs/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on SetConfigURL") - } - - _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 *SetConfigURL) 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 *SetConfigURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *SetConfigURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on SetConfigURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on SetConfigURL") - } - - 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 *SetConfigURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/console_api.go b/api/operations/console_api.go index a4c3129e21..9ec9db1585 100644 --- a/api/operations/console_api.go +++ b/api/operations/console_api.go @@ -36,21 +36,11 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - "github.com/minio/console/api/operations/account" "github.com/minio/console/api/operations/auth" "github.com/minio/console/api/operations/bucket" - "github.com/minio/console/api/operations/configuration" - "github.com/minio/console/api/operations/group" - "github.com/minio/console/api/operations/idp" - "github.com/minio/console/api/operations/inspect" - "github.com/minio/console/api/operations/k_m_s" - "github.com/minio/console/api/operations/logging" + "github.com/minio/console/api/operations/license" "github.com/minio/console/api/operations/object" - "github.com/minio/console/api/operations/policy" "github.com/minio/console/api/operations/public" - "github.com/minio/console/api/operations/release" - "github.com/minio/console/api/operations/service" - "github.com/minio/console/api/operations/service_account" "github.com/minio/console/api/operations/system" "github.com/minio/console/api/operations/user" "github.com/minio/console/models" @@ -80,111 +70,18 @@ func NewConsoleAPI(spec *loads.Document) *ConsoleAPI { BinProducer: runtime.ByteStreamProducer(), JSONProducer: runtime.JSONProducer(), - AccountAccountChangePasswordHandler: account.AccountChangePasswordHandlerFunc(func(params account.AccountChangePasswordParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation account.AccountChangePassword has not yet been implemented") - }), - GroupAddGroupHandler: group.AddGroupHandlerFunc(func(params group.AddGroupParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation group.AddGroup has not yet been implemented") - }), - ConfigurationAddNotificationEndpointHandler: configuration.AddNotificationEndpointHandlerFunc(func(params configuration.AddNotificationEndpointParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation configuration.AddNotificationEndpoint has not yet been implemented") - }), - PolicyAddPolicyHandler: policy.AddPolicyHandlerFunc(func(params policy.AddPolicyParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation policy.AddPolicy has not yet been implemented") - }), - BucketAddRemoteBucketHandler: bucket.AddRemoteBucketHandlerFunc(func(params bucket.AddRemoteBucketParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation bucket.AddRemoteBucket has not yet been implemented") - }), - UserAddUserHandler: user.AddUserHandlerFunc(func(params user.AddUserParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation user.AddUser has not yet been implemented") - }), SystemAdminInfoHandler: system.AdminInfoHandlerFunc(func(params system.AdminInfoParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation system.AdminInfo has not yet been implemented") }), - SystemArnListHandler: system.ArnListHandlerFunc(func(params system.ArnListParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation system.ArnList has not yet been implemented") - }), BucketBucketInfoHandler: bucket.BucketInfoHandlerFunc(func(params bucket.BucketInfoParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation bucket.BucketInfo has not yet been implemented") }), - BucketBucketSetPolicyHandler: bucket.BucketSetPolicyHandlerFunc(func(params bucket.BucketSetPolicyParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation bucket.BucketSetPolicy has not yet been implemented") - }), - UserBulkUpdateUsersGroupsHandler: user.BulkUpdateUsersGroupsHandlerFunc(func(params user.BulkUpdateUsersGroupsParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation user.BulkUpdateUsersGroups has not yet been implemented") - }), - AccountChangeUserPasswordHandler: account.ChangeUserPasswordHandlerFunc(func(params account.ChangeUserPasswordParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation account.ChangeUserPassword has not yet been implemented") - }), - UserCheckUserServiceAccountsHandler: user.CheckUserServiceAccountsHandlerFunc(func(params user.CheckUserServiceAccountsParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation user.CheckUserServiceAccounts has not yet been implemented") - }), - ConfigurationConfigInfoHandler: configuration.ConfigInfoHandlerFunc(func(params configuration.ConfigInfoParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation configuration.ConfigInfo has not yet been implemented") - }), - UserCreateAUserServiceAccountHandler: user.CreateAUserServiceAccountHandlerFunc(func(params user.CreateAUserServiceAccountParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation user.CreateAUserServiceAccount has not yet been implemented") - }), - BucketCreateBucketEventHandler: bucket.CreateBucketEventHandlerFunc(func(params bucket.CreateBucketEventParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation bucket.CreateBucketEvent has not yet been implemented") - }), - IdpCreateConfigurationHandler: idp.CreateConfigurationHandlerFunc(func(params idp.CreateConfigurationParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation idp.CreateConfiguration has not yet been implemented") - }), - ServiceAccountCreateServiceAccountHandler: service_account.CreateServiceAccountHandlerFunc(func(params service_account.CreateServiceAccountParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation service_account.CreateServiceAccount has not yet been implemented") - }), - UserCreateServiceAccountCredentialsHandler: user.CreateServiceAccountCredentialsHandlerFunc(func(params user.CreateServiceAccountCredentialsParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation user.CreateServiceAccountCredentials has not yet been implemented") - }), - ServiceAccountCreateServiceAccountCredsHandler: service_account.CreateServiceAccountCredsHandlerFunc(func(params service_account.CreateServiceAccountCredsParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation service_account.CreateServiceAccountCreds has not yet been implemented") - }), - SystemDashboardWidgetDetailsHandler: system.DashboardWidgetDetailsHandlerFunc(func(params system.DashboardWidgetDetailsParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation system.DashboardWidgetDetails has not yet been implemented") - }), - BucketDeleteAccessRuleWithBucketHandler: bucket.DeleteAccessRuleWithBucketHandlerFunc(func(params bucket.DeleteAccessRuleWithBucketParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation bucket.DeleteAccessRuleWithBucket has not yet been implemented") - }), - BucketDeleteAllReplicationRulesHandler: bucket.DeleteAllReplicationRulesHandlerFunc(func(params bucket.DeleteAllReplicationRulesParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation bucket.DeleteAllReplicationRules has not yet been implemented") - }), - BucketDeleteBucketHandler: bucket.DeleteBucketHandlerFunc(func(params bucket.DeleteBucketParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation bucket.DeleteBucket has not yet been implemented") - }), - BucketDeleteBucketEventHandler: bucket.DeleteBucketEventHandlerFunc(func(params bucket.DeleteBucketEventParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation bucket.DeleteBucketEvent has not yet been implemented") - }), - BucketDeleteBucketReplicationRuleHandler: bucket.DeleteBucketReplicationRuleHandlerFunc(func(params bucket.DeleteBucketReplicationRuleParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation bucket.DeleteBucketReplicationRule has not yet been implemented") - }), - IdpDeleteConfigurationHandler: idp.DeleteConfigurationHandlerFunc(func(params idp.DeleteConfigurationParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation idp.DeleteConfiguration has not yet been implemented") - }), ObjectDeleteMultipleObjectsHandler: object.DeleteMultipleObjectsHandlerFunc(func(params object.DeleteMultipleObjectsParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation object.DeleteMultipleObjects has not yet been implemented") }), - ServiceAccountDeleteMultipleServiceAccountsHandler: service_account.DeleteMultipleServiceAccountsHandlerFunc(func(params service_account.DeleteMultipleServiceAccountsParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation service_account.DeleteMultipleServiceAccounts has not yet been implemented") - }), ObjectDeleteObjectHandler: object.DeleteObjectHandlerFunc(func(params object.DeleteObjectParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation object.DeleteObject has not yet been implemented") }), - ObjectDeleteObjectRetentionHandler: object.DeleteObjectRetentionHandlerFunc(func(params object.DeleteObjectRetentionParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation object.DeleteObjectRetention has not yet been implemented") - }), - BucketDeleteRemoteBucketHandler: bucket.DeleteRemoteBucketHandlerFunc(func(params bucket.DeleteRemoteBucketParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation bucket.DeleteRemoteBucket has not yet been implemented") - }), - BucketDeleteSelectedReplicationRulesHandler: bucket.DeleteSelectedReplicationRulesHandlerFunc(func(params bucket.DeleteSelectedReplicationRulesParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation bucket.DeleteSelectedReplicationRules has not yet been implemented") - }), - ServiceAccountDeleteServiceAccountHandler: service_account.DeleteServiceAccountHandlerFunc(func(params service_account.DeleteServiceAccountParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation service_account.DeleteServiceAccount has not yet been implemented") - }), - BucketDisableBucketEncryptionHandler: bucket.DisableBucketEncryptionHandlerFunc(func(params bucket.DisableBucketEncryptionParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation bucket.DisableBucketEncryption has not yet been implemented") - }), ObjectDownloadObjectHandler: object.DownloadObjectHandlerFunc(func(params object.DownloadObjectParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation object.DownloadObject has not yet been implemented") }), @@ -194,147 +91,33 @@ func NewConsoleAPI(spec *loads.Document) *ConsoleAPI { PublicDownloadSharedObjectHandler: public.DownloadSharedObjectHandlerFunc(func(params public.DownloadSharedObjectParams) middleware.Responder { return middleware.NotImplemented("operation public.DownloadSharedObject has not yet been implemented") }), - BucketEnableBucketEncryptionHandler: bucket.EnableBucketEncryptionHandlerFunc(func(params bucket.EnableBucketEncryptionParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation bucket.EnableBucketEncryption has not yet been implemented") - }), - ConfigurationExportConfigHandler: configuration.ExportConfigHandlerFunc(func(params configuration.ExportConfigParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation configuration.ExportConfig has not yet been implemented") - }), - BucketGetBucketEncryptionInfoHandler: bucket.GetBucketEncryptionInfoHandlerFunc(func(params bucket.GetBucketEncryptionInfoParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation bucket.GetBucketEncryptionInfo has not yet been implemented") - }), - BucketGetBucketObjectLockingStatusHandler: bucket.GetBucketObjectLockingStatusHandlerFunc(func(params bucket.GetBucketObjectLockingStatusParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation bucket.GetBucketObjectLockingStatus has not yet been implemented") - }), BucketGetBucketQuotaHandler: bucket.GetBucketQuotaHandlerFunc(func(params bucket.GetBucketQuotaParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation bucket.GetBucketQuota has not yet been implemented") }), - BucketGetBucketReplicationHandler: bucket.GetBucketReplicationHandlerFunc(func(params bucket.GetBucketReplicationParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation bucket.GetBucketReplication has not yet been implemented") - }), - BucketGetBucketReplicationRuleHandler: bucket.GetBucketReplicationRuleHandlerFunc(func(params bucket.GetBucketReplicationRuleParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation bucket.GetBucketReplicationRule has not yet been implemented") - }), - BucketGetBucketRetentionConfigHandler: bucket.GetBucketRetentionConfigHandlerFunc(func(params bucket.GetBucketRetentionConfigParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation bucket.GetBucketRetentionConfig has not yet been implemented") - }), BucketGetBucketRewindHandler: bucket.GetBucketRewindHandlerFunc(func(params bucket.GetBucketRewindParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation bucket.GetBucketRewind has not yet been implemented") }), BucketGetBucketVersioningHandler: bucket.GetBucketVersioningHandlerFunc(func(params bucket.GetBucketVersioningParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation bucket.GetBucketVersioning has not yet been implemented") }), - IdpGetConfigurationHandler: idp.GetConfigurationHandlerFunc(func(params idp.GetConfigurationParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation idp.GetConfiguration has not yet been implemented") - }), - IdpGetLDAPEntitiesHandler: idp.GetLDAPEntitiesHandlerFunc(func(params idp.GetLDAPEntitiesParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation idp.GetLDAPEntities has not yet been implemented") - }), BucketGetMaxShareLinkExpHandler: bucket.GetMaxShareLinkExpHandlerFunc(func(params bucket.GetMaxShareLinkExpParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation bucket.GetMaxShareLinkExp has not yet been implemented") }), ObjectGetObjectMetadataHandler: object.GetObjectMetadataHandlerFunc(func(params object.GetObjectMetadataParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation object.GetObjectMetadata has not yet been implemented") }), - PolicyGetSAUserPolicyHandler: policy.GetSAUserPolicyHandlerFunc(func(params policy.GetSAUserPolicyParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation policy.GetSAUserPolicy has not yet been implemented") - }), - ServiceAccountGetServiceAccountHandler: service_account.GetServiceAccountHandlerFunc(func(params service_account.GetServiceAccountParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation service_account.GetServiceAccount has not yet been implemented") - }), - UserGetUserInfoHandler: user.GetUserInfoHandlerFunc(func(params user.GetUserInfoParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation user.GetUserInfo has not yet been implemented") - }), - PolicyGetUserPolicyHandler: policy.GetUserPolicyHandlerFunc(func(params policy.GetUserPolicyParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation policy.GetUserPolicy has not yet been implemented") - }), - GroupGroupInfoHandler: group.GroupInfoHandlerFunc(func(params group.GroupInfoParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation group.GroupInfo has not yet been implemented") - }), - InspectInspectHandler: inspect.InspectHandlerFunc(func(params inspect.InspectParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation inspect.Inspect has not yet been implemented") - }), - 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") - }), - 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") - }), - 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") - }), - 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") - }), - 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") - }), - 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") - }), - KmsKMSVersionHandler: k_m_s.KMSVersionHandlerFunc(func(params k_m_s.KMSVersionParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation k_m_s.KMSVersion has not yet been implemented") - }), - UserListAUserServiceAccountsHandler: user.ListAUserServiceAccountsHandlerFunc(func(params user.ListAUserServiceAccountsParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation user.ListAUserServiceAccounts has not yet been implemented") - }), - BucketListAccessRulesWithBucketHandler: bucket.ListAccessRulesWithBucketHandlerFunc(func(params bucket.ListAccessRulesWithBucketParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation bucket.ListAccessRulesWithBucket has not yet been implemented") - }), - BucketListBucketEventsHandler: bucket.ListBucketEventsHandlerFunc(func(params bucket.ListBucketEventsParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation bucket.ListBucketEvents has not yet been implemented") + LicenseLicenseAcknowledgeHandler: license.LicenseAcknowledgeHandlerFunc(func(params license.LicenseAcknowledgeParams, principal *models.Principal) middleware.Responder { + return middleware.NotImplemented("operation license.LicenseAcknowledge has not yet been implemented") }), BucketListBucketsHandler: bucket.ListBucketsHandlerFunc(func(params bucket.ListBucketsParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation bucket.ListBuckets has not yet been implemented") }), - ConfigurationListConfigHandler: configuration.ListConfigHandlerFunc(func(params configuration.ListConfigParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation configuration.ListConfig has not yet been implemented") - }), - IdpListConfigurationsHandler: idp.ListConfigurationsHandlerFunc(func(params idp.ListConfigurationsParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation idp.ListConfigurations has not yet been implemented") - }), - BucketListExternalBucketsHandler: bucket.ListExternalBucketsHandlerFunc(func(params bucket.ListExternalBucketsParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation bucket.ListExternalBuckets has not yet been implemented") - }), - GroupListGroupsHandler: group.ListGroupsHandlerFunc(func(params group.ListGroupsParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation group.ListGroups has not yet been implemented") - }), - PolicyListGroupsForPolicyHandler: policy.ListGroupsForPolicyHandlerFunc(func(params policy.ListGroupsForPolicyParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation policy.ListGroupsForPolicy has not yet been implemented") - }), - SystemListNodesHandler: system.ListNodesHandlerFunc(func(params system.ListNodesParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation system.ListNodes has not yet been implemented") - }), ObjectListObjectsHandler: object.ListObjectsHandlerFunc(func(params object.ListObjectsParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation object.ListObjects has not yet been implemented") }), - PolicyListPoliciesHandler: policy.ListPoliciesHandlerFunc(func(params policy.ListPoliciesParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation policy.ListPolicies has not yet been implemented") - }), - BucketListPoliciesWithBucketHandler: bucket.ListPoliciesWithBucketHandlerFunc(func(params bucket.ListPoliciesWithBucketParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation bucket.ListPoliciesWithBucket has not yet been implemented") - }), - ReleaseListReleasesHandler: release.ListReleasesHandlerFunc(func(params release.ListReleasesParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation release.ListReleases has not yet been implemented") - }), - BucketListRemoteBucketsHandler: bucket.ListRemoteBucketsHandlerFunc(func(params bucket.ListRemoteBucketsParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation bucket.ListRemoteBuckets has not yet been implemented") - }), - ServiceAccountListUserServiceAccountsHandler: service_account.ListUserServiceAccountsHandlerFunc(func(params service_account.ListUserServiceAccountsParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation service_account.ListUserServiceAccounts has not yet been implemented") - }), UserListUsersHandler: user.ListUsersHandlerFunc(func(params user.ListUsersParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation user.ListUsers has not yet been implemented") }), - PolicyListUsersForPolicyHandler: policy.ListUsersForPolicyHandlerFunc(func(params policy.ListUsersForPolicyParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation policy.ListUsersForPolicy has not yet been implemented") - }), - BucketListUsersWithAccessToBucketHandler: bucket.ListUsersWithAccessToBucketHandlerFunc(func(params bucket.ListUsersWithAccessToBucketParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation bucket.ListUsersWithAccessToBucket has not yet been implemented") - }), - LoggingLogSearchHandler: logging.LogSearchHandlerFunc(func(params logging.LogSearchParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation logging.LogSearch has not yet been implemented") - }), AuthLoginHandler: auth.LoginHandlerFunc(func(params auth.LoginParams) middleware.Responder { return middleware.NotImplemented("operation auth.Login has not yet been implemented") }), @@ -350,99 +133,27 @@ func NewConsoleAPI(spec *loads.Document) *ConsoleAPI { BucketMakeBucketHandler: bucket.MakeBucketHandlerFunc(func(params bucket.MakeBucketParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation bucket.MakeBucket has not yet been implemented") }), - ConfigurationNotificationEndpointListHandler: configuration.NotificationEndpointListHandlerFunc(func(params configuration.NotificationEndpointListParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation configuration.NotificationEndpointList has not yet been implemented") - }), - PolicyPolicyInfoHandler: policy.PolicyInfoHandlerFunc(func(params policy.PolicyInfoParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation policy.PolicyInfo has not yet been implemented") - }), ObjectPostBucketsBucketNameObjectsUploadHandler: object.PostBucketsBucketNameObjectsUploadHandlerFunc(func(params object.PostBucketsBucketNameObjectsUploadParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation object.PostBucketsBucketNameObjectsUpload has not yet been implemented") }), - ConfigurationPostConfigsImportHandler: configuration.PostConfigsImportHandlerFunc(func(params configuration.PostConfigsImportParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation configuration.PostConfigsImport has not yet been implemented") - }), BucketPutBucketTagsHandler: bucket.PutBucketTagsHandlerFunc(func(params bucket.PutBucketTagsParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation bucket.PutBucketTags has not yet been implemented") }), - ObjectPutObjectLegalHoldHandler: object.PutObjectLegalHoldHandlerFunc(func(params object.PutObjectLegalHoldParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation object.PutObjectLegalHold has not yet been implemented") - }), ObjectPutObjectRestoreHandler: object.PutObjectRestoreHandlerFunc(func(params object.PutObjectRestoreParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation object.PutObjectRestore has not yet been implemented") }), - ObjectPutObjectRetentionHandler: object.PutObjectRetentionHandlerFunc(func(params object.PutObjectRetentionParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation object.PutObjectRetention has not yet been implemented") - }), ObjectPutObjectTagsHandler: object.PutObjectTagsHandlerFunc(func(params object.PutObjectTagsParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation object.PutObjectTags has not yet been implemented") }), - BucketRemoteBucketDetailsHandler: bucket.RemoteBucketDetailsHandlerFunc(func(params bucket.RemoteBucketDetailsParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation bucket.RemoteBucketDetails has not yet been implemented") - }), - GroupRemoveGroupHandler: group.RemoveGroupHandlerFunc(func(params group.RemoveGroupParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation group.RemoveGroup has not yet been implemented") - }), - PolicyRemovePolicyHandler: policy.RemovePolicyHandlerFunc(func(params policy.RemovePolicyParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation policy.RemovePolicy has not yet been implemented") - }), - UserRemoveUserHandler: user.RemoveUserHandlerFunc(func(params user.RemoveUserParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation user.RemoveUser has not yet been implemented") - }), - ConfigurationResetConfigHandler: configuration.ResetConfigHandlerFunc(func(params configuration.ResetConfigParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation configuration.ResetConfig has not yet been implemented") - }), - ServiceRestartServiceHandler: service.RestartServiceHandlerFunc(func(params service.RestartServiceParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation service.RestartService has not yet been implemented") - }), AuthSessionCheckHandler: auth.SessionCheckHandlerFunc(func(params auth.SessionCheckParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation auth.SessionCheck has not yet been implemented") }), - BucketSetAccessRuleWithBucketHandler: bucket.SetAccessRuleWithBucketHandlerFunc(func(params bucket.SetAccessRuleWithBucketParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation bucket.SetAccessRuleWithBucket has not yet been implemented") - }), - BucketSetBucketQuotaHandler: bucket.SetBucketQuotaHandlerFunc(func(params bucket.SetBucketQuotaParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation bucket.SetBucketQuota has not yet been implemented") - }), - BucketSetBucketRetentionConfigHandler: bucket.SetBucketRetentionConfigHandlerFunc(func(params bucket.SetBucketRetentionConfigParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation bucket.SetBucketRetentionConfig has not yet been implemented") - }), BucketSetBucketVersioningHandler: bucket.SetBucketVersioningHandlerFunc(func(params bucket.SetBucketVersioningParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation bucket.SetBucketVersioning has not yet been implemented") }), - ConfigurationSetConfigHandler: configuration.SetConfigHandlerFunc(func(params configuration.SetConfigParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation configuration.SetConfig has not yet been implemented") - }), - BucketSetMultiBucketReplicationHandler: bucket.SetMultiBucketReplicationHandlerFunc(func(params bucket.SetMultiBucketReplicationParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation bucket.SetMultiBucketReplication has not yet been implemented") - }), - PolicySetPolicyHandler: policy.SetPolicyHandlerFunc(func(params policy.SetPolicyParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation policy.SetPolicy has not yet been implemented") - }), - PolicySetPolicyMultipleHandler: policy.SetPolicyMultipleHandlerFunc(func(params policy.SetPolicyMultipleParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation policy.SetPolicyMultiple has not yet been implemented") - }), ObjectShareObjectHandler: object.ShareObjectHandlerFunc(func(params object.ShareObjectParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation object.ShareObject has not yet been implemented") }), - IdpUpdateConfigurationHandler: idp.UpdateConfigurationHandlerFunc(func(params idp.UpdateConfigurationParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation idp.UpdateConfiguration has not yet been implemented") - }), - GroupUpdateGroupHandler: group.UpdateGroupHandlerFunc(func(params group.UpdateGroupParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation group.UpdateGroup has not yet been implemented") - }), - BucketUpdateMultiBucketReplicationHandler: bucket.UpdateMultiBucketReplicationHandlerFunc(func(params bucket.UpdateMultiBucketReplicationParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation bucket.UpdateMultiBucketReplication has not yet been implemented") - }), - ServiceAccountUpdateServiceAccountHandler: service_account.UpdateServiceAccountHandlerFunc(func(params service_account.UpdateServiceAccountParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation service_account.UpdateServiceAccount has not yet been implemented") - }), - UserUpdateUserGroupsHandler: user.UpdateUserGroupsHandlerFunc(func(params user.UpdateUserGroupsParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation user.UpdateUserGroups has not yet been implemented") - }), - UserUpdateUserInfoHandler: user.UpdateUserInfoHandlerFunc(func(params user.UpdateUserInfoParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation user.UpdateUserInfo has not yet been implemented") - }), // Applies when the "X-Anonymous" header is set AnonymousAuth: func(token string) (*models.Principal, error) { @@ -506,176 +217,38 @@ type ConsoleAPI struct { // APIAuthorizer provides access control (ACL/RBAC/ABAC) by providing access to the request and authenticated principal APIAuthorizer runtime.Authorizer - // AccountAccountChangePasswordHandler sets the operation handler for the account change password operation - AccountAccountChangePasswordHandler account.AccountChangePasswordHandler - // GroupAddGroupHandler sets the operation handler for the add group operation - GroupAddGroupHandler group.AddGroupHandler - // ConfigurationAddNotificationEndpointHandler sets the operation handler for the add notification endpoint operation - ConfigurationAddNotificationEndpointHandler configuration.AddNotificationEndpointHandler - // PolicyAddPolicyHandler sets the operation handler for the add policy operation - PolicyAddPolicyHandler policy.AddPolicyHandler - // BucketAddRemoteBucketHandler sets the operation handler for the add remote bucket operation - BucketAddRemoteBucketHandler bucket.AddRemoteBucketHandler - // UserAddUserHandler sets the operation handler for the add user operation - UserAddUserHandler user.AddUserHandler // SystemAdminInfoHandler sets the operation handler for the admin info operation SystemAdminInfoHandler system.AdminInfoHandler - // SystemArnListHandler sets the operation handler for the arn list operation - SystemArnListHandler system.ArnListHandler // BucketBucketInfoHandler sets the operation handler for the bucket info operation BucketBucketInfoHandler bucket.BucketInfoHandler - // BucketBucketSetPolicyHandler sets the operation handler for the bucket set policy operation - BucketBucketSetPolicyHandler bucket.BucketSetPolicyHandler - // UserBulkUpdateUsersGroupsHandler sets the operation handler for the bulk update users groups operation - UserBulkUpdateUsersGroupsHandler user.BulkUpdateUsersGroupsHandler - // AccountChangeUserPasswordHandler sets the operation handler for the change user password operation - AccountChangeUserPasswordHandler account.ChangeUserPasswordHandler - // UserCheckUserServiceAccountsHandler sets the operation handler for the check user service accounts operation - UserCheckUserServiceAccountsHandler user.CheckUserServiceAccountsHandler - // ConfigurationConfigInfoHandler sets the operation handler for the config info operation - ConfigurationConfigInfoHandler configuration.ConfigInfoHandler - // UserCreateAUserServiceAccountHandler sets the operation handler for the create a user service account operation - UserCreateAUserServiceAccountHandler user.CreateAUserServiceAccountHandler - // BucketCreateBucketEventHandler sets the operation handler for the create bucket event operation - BucketCreateBucketEventHandler bucket.CreateBucketEventHandler - // IdpCreateConfigurationHandler sets the operation handler for the create configuration operation - IdpCreateConfigurationHandler idp.CreateConfigurationHandler - // ServiceAccountCreateServiceAccountHandler sets the operation handler for the create service account operation - ServiceAccountCreateServiceAccountHandler service_account.CreateServiceAccountHandler - // UserCreateServiceAccountCredentialsHandler sets the operation handler for the create service account credentials operation - UserCreateServiceAccountCredentialsHandler user.CreateServiceAccountCredentialsHandler - // ServiceAccountCreateServiceAccountCredsHandler sets the operation handler for the create service account creds operation - ServiceAccountCreateServiceAccountCredsHandler service_account.CreateServiceAccountCredsHandler - // SystemDashboardWidgetDetailsHandler sets the operation handler for the dashboard widget details operation - SystemDashboardWidgetDetailsHandler system.DashboardWidgetDetailsHandler - // BucketDeleteAccessRuleWithBucketHandler sets the operation handler for the delete access rule with bucket operation - BucketDeleteAccessRuleWithBucketHandler bucket.DeleteAccessRuleWithBucketHandler - // BucketDeleteAllReplicationRulesHandler sets the operation handler for the delete all replication rules operation - BucketDeleteAllReplicationRulesHandler bucket.DeleteAllReplicationRulesHandler - // BucketDeleteBucketHandler sets the operation handler for the delete bucket operation - BucketDeleteBucketHandler bucket.DeleteBucketHandler - // BucketDeleteBucketEventHandler sets the operation handler for the delete bucket event operation - BucketDeleteBucketEventHandler bucket.DeleteBucketEventHandler - // BucketDeleteBucketReplicationRuleHandler sets the operation handler for the delete bucket replication rule operation - BucketDeleteBucketReplicationRuleHandler bucket.DeleteBucketReplicationRuleHandler - // IdpDeleteConfigurationHandler sets the operation handler for the delete configuration operation - IdpDeleteConfigurationHandler idp.DeleteConfigurationHandler // ObjectDeleteMultipleObjectsHandler sets the operation handler for the delete multiple objects operation ObjectDeleteMultipleObjectsHandler object.DeleteMultipleObjectsHandler - // ServiceAccountDeleteMultipleServiceAccountsHandler sets the operation handler for the delete multiple service accounts operation - ServiceAccountDeleteMultipleServiceAccountsHandler service_account.DeleteMultipleServiceAccountsHandler // ObjectDeleteObjectHandler sets the operation handler for the delete object operation ObjectDeleteObjectHandler object.DeleteObjectHandler - // ObjectDeleteObjectRetentionHandler sets the operation handler for the delete object retention operation - ObjectDeleteObjectRetentionHandler object.DeleteObjectRetentionHandler - // BucketDeleteRemoteBucketHandler sets the operation handler for the delete remote bucket operation - BucketDeleteRemoteBucketHandler bucket.DeleteRemoteBucketHandler - // BucketDeleteSelectedReplicationRulesHandler sets the operation handler for the delete selected replication rules operation - BucketDeleteSelectedReplicationRulesHandler bucket.DeleteSelectedReplicationRulesHandler - // ServiceAccountDeleteServiceAccountHandler sets the operation handler for the delete service account operation - ServiceAccountDeleteServiceAccountHandler service_account.DeleteServiceAccountHandler - // BucketDisableBucketEncryptionHandler sets the operation handler for the disable bucket encryption operation - BucketDisableBucketEncryptionHandler bucket.DisableBucketEncryptionHandler // ObjectDownloadObjectHandler sets the operation handler for the download object operation ObjectDownloadObjectHandler object.DownloadObjectHandler // ObjectDownloadMultipleObjectsHandler sets the operation handler for the download multiple objects operation ObjectDownloadMultipleObjectsHandler object.DownloadMultipleObjectsHandler // PublicDownloadSharedObjectHandler sets the operation handler for the download shared object operation PublicDownloadSharedObjectHandler public.DownloadSharedObjectHandler - // BucketEnableBucketEncryptionHandler sets the operation handler for the enable bucket encryption operation - BucketEnableBucketEncryptionHandler bucket.EnableBucketEncryptionHandler - // ConfigurationExportConfigHandler sets the operation handler for the export config operation - ConfigurationExportConfigHandler configuration.ExportConfigHandler - // BucketGetBucketEncryptionInfoHandler sets the operation handler for the get bucket encryption info operation - BucketGetBucketEncryptionInfoHandler bucket.GetBucketEncryptionInfoHandler - // BucketGetBucketObjectLockingStatusHandler sets the operation handler for the get bucket object locking status operation - BucketGetBucketObjectLockingStatusHandler bucket.GetBucketObjectLockingStatusHandler // BucketGetBucketQuotaHandler sets the operation handler for the get bucket quota operation BucketGetBucketQuotaHandler bucket.GetBucketQuotaHandler - // BucketGetBucketReplicationHandler sets the operation handler for the get bucket replication operation - BucketGetBucketReplicationHandler bucket.GetBucketReplicationHandler - // BucketGetBucketReplicationRuleHandler sets the operation handler for the get bucket replication rule operation - BucketGetBucketReplicationRuleHandler bucket.GetBucketReplicationRuleHandler - // BucketGetBucketRetentionConfigHandler sets the operation handler for the get bucket retention config operation - BucketGetBucketRetentionConfigHandler bucket.GetBucketRetentionConfigHandler // BucketGetBucketRewindHandler sets the operation handler for the get bucket rewind operation BucketGetBucketRewindHandler bucket.GetBucketRewindHandler // BucketGetBucketVersioningHandler sets the operation handler for the get bucket versioning operation BucketGetBucketVersioningHandler bucket.GetBucketVersioningHandler - // IdpGetConfigurationHandler sets the operation handler for the get configuration operation - IdpGetConfigurationHandler idp.GetConfigurationHandler - // IdpGetLDAPEntitiesHandler sets the operation handler for the get l d a p entities operation - IdpGetLDAPEntitiesHandler idp.GetLDAPEntitiesHandler // BucketGetMaxShareLinkExpHandler sets the operation handler for the get max share link exp operation BucketGetMaxShareLinkExpHandler bucket.GetMaxShareLinkExpHandler // ObjectGetObjectMetadataHandler sets the operation handler for the get object metadata operation ObjectGetObjectMetadataHandler object.GetObjectMetadataHandler - // PolicyGetSAUserPolicyHandler sets the operation handler for the get s a user policy operation - PolicyGetSAUserPolicyHandler policy.GetSAUserPolicyHandler - // ServiceAccountGetServiceAccountHandler sets the operation handler for the get service account operation - ServiceAccountGetServiceAccountHandler service_account.GetServiceAccountHandler - // UserGetUserInfoHandler sets the operation handler for the get user info operation - UserGetUserInfoHandler user.GetUserInfoHandler - // PolicyGetUserPolicyHandler sets the operation handler for the get user policy operation - PolicyGetUserPolicyHandler policy.GetUserPolicyHandler - // GroupGroupInfoHandler sets the operation handler for the group info operation - GroupGroupInfoHandler group.GroupInfoHandler - // InspectInspectHandler sets the operation handler for the inspect operation - InspectInspectHandler inspect.InspectHandler - // KmsKMSAPIsHandler sets the operation handler for the k m s a p is operation - KmsKMSAPIsHandler k_m_s.KMSAPIsHandler - // KmsKMSCreateKeyHandler sets the operation handler for the k m s create key operation - KmsKMSCreateKeyHandler k_m_s.KMSCreateKeyHandler - // KmsKMSKeyStatusHandler sets the operation handler for the k m s key status operation - KmsKMSKeyStatusHandler k_m_s.KMSKeyStatusHandler - // KmsKMSListKeysHandler sets the operation handler for the k m s list keys operation - KmsKMSListKeysHandler k_m_s.KMSListKeysHandler - // KmsKMSMetricsHandler sets the operation handler for the k m s metrics operation - KmsKMSMetricsHandler k_m_s.KMSMetricsHandler - // 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 - KmsKMSVersionHandler k_m_s.KMSVersionHandler - // UserListAUserServiceAccountsHandler sets the operation handler for the list a user service accounts operation - UserListAUserServiceAccountsHandler user.ListAUserServiceAccountsHandler - // BucketListAccessRulesWithBucketHandler sets the operation handler for the list access rules with bucket operation - BucketListAccessRulesWithBucketHandler bucket.ListAccessRulesWithBucketHandler - // BucketListBucketEventsHandler sets the operation handler for the list bucket events operation - BucketListBucketEventsHandler bucket.ListBucketEventsHandler + // LicenseLicenseAcknowledgeHandler sets the operation handler for the license acknowledge operation + LicenseLicenseAcknowledgeHandler license.LicenseAcknowledgeHandler // BucketListBucketsHandler sets the operation handler for the list buckets operation BucketListBucketsHandler bucket.ListBucketsHandler - // ConfigurationListConfigHandler sets the operation handler for the list config operation - ConfigurationListConfigHandler configuration.ListConfigHandler - // IdpListConfigurationsHandler sets the operation handler for the list configurations operation - IdpListConfigurationsHandler idp.ListConfigurationsHandler - // BucketListExternalBucketsHandler sets the operation handler for the list external buckets operation - BucketListExternalBucketsHandler bucket.ListExternalBucketsHandler - // GroupListGroupsHandler sets the operation handler for the list groups operation - GroupListGroupsHandler group.ListGroupsHandler - // PolicyListGroupsForPolicyHandler sets the operation handler for the list groups for policy operation - PolicyListGroupsForPolicyHandler policy.ListGroupsForPolicyHandler - // SystemListNodesHandler sets the operation handler for the list nodes operation - SystemListNodesHandler system.ListNodesHandler // ObjectListObjectsHandler sets the operation handler for the list objects operation ObjectListObjectsHandler object.ListObjectsHandler - // PolicyListPoliciesHandler sets the operation handler for the list policies operation - PolicyListPoliciesHandler policy.ListPoliciesHandler - // BucketListPoliciesWithBucketHandler sets the operation handler for the list policies with bucket operation - BucketListPoliciesWithBucketHandler bucket.ListPoliciesWithBucketHandler - // ReleaseListReleasesHandler sets the operation handler for the list releases operation - ReleaseListReleasesHandler release.ListReleasesHandler - // BucketListRemoteBucketsHandler sets the operation handler for the list remote buckets operation - BucketListRemoteBucketsHandler bucket.ListRemoteBucketsHandler - // ServiceAccountListUserServiceAccountsHandler sets the operation handler for the list user service accounts operation - ServiceAccountListUserServiceAccountsHandler service_account.ListUserServiceAccountsHandler // UserListUsersHandler sets the operation handler for the list users operation UserListUsersHandler user.ListUsersHandler - // PolicyListUsersForPolicyHandler sets the operation handler for the list users for policy operation - PolicyListUsersForPolicyHandler policy.ListUsersForPolicyHandler - // BucketListUsersWithAccessToBucketHandler sets the operation handler for the list users with access to bucket operation - BucketListUsersWithAccessToBucketHandler bucket.ListUsersWithAccessToBucketHandler - // LoggingLogSearchHandler sets the operation handler for the log search operation - LoggingLogSearchHandler logging.LogSearchHandler // AuthLoginHandler sets the operation handler for the login operation AuthLoginHandler auth.LoginHandler // AuthLoginDetailHandler sets the operation handler for the login detail operation @@ -686,68 +259,20 @@ type ConsoleAPI struct { AuthLogoutHandler auth.LogoutHandler // BucketMakeBucketHandler sets the operation handler for the make bucket operation BucketMakeBucketHandler bucket.MakeBucketHandler - // ConfigurationNotificationEndpointListHandler sets the operation handler for the notification endpoint list operation - ConfigurationNotificationEndpointListHandler configuration.NotificationEndpointListHandler - // PolicyPolicyInfoHandler sets the operation handler for the policy info operation - PolicyPolicyInfoHandler policy.PolicyInfoHandler // ObjectPostBucketsBucketNameObjectsUploadHandler sets the operation handler for the post buckets bucket name objects upload operation ObjectPostBucketsBucketNameObjectsUploadHandler object.PostBucketsBucketNameObjectsUploadHandler - // ConfigurationPostConfigsImportHandler sets the operation handler for the post configs import operation - ConfigurationPostConfigsImportHandler configuration.PostConfigsImportHandler // BucketPutBucketTagsHandler sets the operation handler for the put bucket tags operation BucketPutBucketTagsHandler bucket.PutBucketTagsHandler - // ObjectPutObjectLegalHoldHandler sets the operation handler for the put object legal hold operation - ObjectPutObjectLegalHoldHandler object.PutObjectLegalHoldHandler // ObjectPutObjectRestoreHandler sets the operation handler for the put object restore operation ObjectPutObjectRestoreHandler object.PutObjectRestoreHandler - // ObjectPutObjectRetentionHandler sets the operation handler for the put object retention operation - ObjectPutObjectRetentionHandler object.PutObjectRetentionHandler // ObjectPutObjectTagsHandler sets the operation handler for the put object tags operation ObjectPutObjectTagsHandler object.PutObjectTagsHandler - // BucketRemoteBucketDetailsHandler sets the operation handler for the remote bucket details operation - BucketRemoteBucketDetailsHandler bucket.RemoteBucketDetailsHandler - // GroupRemoveGroupHandler sets the operation handler for the remove group operation - GroupRemoveGroupHandler group.RemoveGroupHandler - // PolicyRemovePolicyHandler sets the operation handler for the remove policy operation - PolicyRemovePolicyHandler policy.RemovePolicyHandler - // UserRemoveUserHandler sets the operation handler for the remove user operation - UserRemoveUserHandler user.RemoveUserHandler - // ConfigurationResetConfigHandler sets the operation handler for the reset config operation - ConfigurationResetConfigHandler configuration.ResetConfigHandler - // ServiceRestartServiceHandler sets the operation handler for the restart service operation - ServiceRestartServiceHandler service.RestartServiceHandler // AuthSessionCheckHandler sets the operation handler for the session check operation AuthSessionCheckHandler auth.SessionCheckHandler - // BucketSetAccessRuleWithBucketHandler sets the operation handler for the set access rule with bucket operation - BucketSetAccessRuleWithBucketHandler bucket.SetAccessRuleWithBucketHandler - // BucketSetBucketQuotaHandler sets the operation handler for the set bucket quota operation - BucketSetBucketQuotaHandler bucket.SetBucketQuotaHandler - // BucketSetBucketRetentionConfigHandler sets the operation handler for the set bucket retention config operation - BucketSetBucketRetentionConfigHandler bucket.SetBucketRetentionConfigHandler // BucketSetBucketVersioningHandler sets the operation handler for the set bucket versioning operation BucketSetBucketVersioningHandler bucket.SetBucketVersioningHandler - // ConfigurationSetConfigHandler sets the operation handler for the set config operation - ConfigurationSetConfigHandler configuration.SetConfigHandler - // BucketSetMultiBucketReplicationHandler sets the operation handler for the set multi bucket replication operation - BucketSetMultiBucketReplicationHandler bucket.SetMultiBucketReplicationHandler - // PolicySetPolicyHandler sets the operation handler for the set policy operation - PolicySetPolicyHandler policy.SetPolicyHandler - // PolicySetPolicyMultipleHandler sets the operation handler for the set policy multiple operation - PolicySetPolicyMultipleHandler policy.SetPolicyMultipleHandler // ObjectShareObjectHandler sets the operation handler for the share object operation ObjectShareObjectHandler object.ShareObjectHandler - // IdpUpdateConfigurationHandler sets the operation handler for the update configuration operation - IdpUpdateConfigurationHandler idp.UpdateConfigurationHandler - // GroupUpdateGroupHandler sets the operation handler for the update group operation - GroupUpdateGroupHandler group.UpdateGroupHandler - // BucketUpdateMultiBucketReplicationHandler sets the operation handler for the update multi bucket replication operation - BucketUpdateMultiBucketReplicationHandler bucket.UpdateMultiBucketReplicationHandler - // ServiceAccountUpdateServiceAccountHandler sets the operation handler for the update service account operation - ServiceAccountUpdateServiceAccountHandler service_account.UpdateServiceAccountHandler - // UserUpdateUserGroupsHandler sets the operation handler for the update user groups operation - UserUpdateUserGroupsHandler user.UpdateUserGroupsHandler - // UserUpdateUserInfoHandler sets the operation handler for the update user info operation - UserUpdateUserInfoHandler user.UpdateUserInfoHandler // ServeError is called when an error is received, there is a default handler // but you can set your own with this @@ -838,111 +363,18 @@ func (o *ConsoleAPI) Validate() error { unregistered = append(unregistered, "KeyAuth") } - if o.AccountAccountChangePasswordHandler == nil { - unregistered = append(unregistered, "account.AccountChangePasswordHandler") - } - if o.GroupAddGroupHandler == nil { - unregistered = append(unregistered, "group.AddGroupHandler") - } - if o.ConfigurationAddNotificationEndpointHandler == nil { - unregistered = append(unregistered, "configuration.AddNotificationEndpointHandler") - } - if o.PolicyAddPolicyHandler == nil { - unregistered = append(unregistered, "policy.AddPolicyHandler") - } - if o.BucketAddRemoteBucketHandler == nil { - unregistered = append(unregistered, "bucket.AddRemoteBucketHandler") - } - if o.UserAddUserHandler == nil { - unregistered = append(unregistered, "user.AddUserHandler") - } if o.SystemAdminInfoHandler == nil { unregistered = append(unregistered, "system.AdminInfoHandler") } - if o.SystemArnListHandler == nil { - unregistered = append(unregistered, "system.ArnListHandler") - } if o.BucketBucketInfoHandler == nil { unregistered = append(unregistered, "bucket.BucketInfoHandler") } - if o.BucketBucketSetPolicyHandler == nil { - unregistered = append(unregistered, "bucket.BucketSetPolicyHandler") - } - if o.UserBulkUpdateUsersGroupsHandler == nil { - unregistered = append(unregistered, "user.BulkUpdateUsersGroupsHandler") - } - if o.AccountChangeUserPasswordHandler == nil { - unregistered = append(unregistered, "account.ChangeUserPasswordHandler") - } - if o.UserCheckUserServiceAccountsHandler == nil { - unregistered = append(unregistered, "user.CheckUserServiceAccountsHandler") - } - if o.ConfigurationConfigInfoHandler == nil { - unregistered = append(unregistered, "configuration.ConfigInfoHandler") - } - if o.UserCreateAUserServiceAccountHandler == nil { - unregistered = append(unregistered, "user.CreateAUserServiceAccountHandler") - } - if o.BucketCreateBucketEventHandler == nil { - unregistered = append(unregistered, "bucket.CreateBucketEventHandler") - } - if o.IdpCreateConfigurationHandler == nil { - unregistered = append(unregistered, "idp.CreateConfigurationHandler") - } - if o.ServiceAccountCreateServiceAccountHandler == nil { - unregistered = append(unregistered, "service_account.CreateServiceAccountHandler") - } - if o.UserCreateServiceAccountCredentialsHandler == nil { - unregistered = append(unregistered, "user.CreateServiceAccountCredentialsHandler") - } - if o.ServiceAccountCreateServiceAccountCredsHandler == nil { - unregistered = append(unregistered, "service_account.CreateServiceAccountCredsHandler") - } - if o.SystemDashboardWidgetDetailsHandler == nil { - unregistered = append(unregistered, "system.DashboardWidgetDetailsHandler") - } - if o.BucketDeleteAccessRuleWithBucketHandler == nil { - unregistered = append(unregistered, "bucket.DeleteAccessRuleWithBucketHandler") - } - if o.BucketDeleteAllReplicationRulesHandler == nil { - unregistered = append(unregistered, "bucket.DeleteAllReplicationRulesHandler") - } - if o.BucketDeleteBucketHandler == nil { - unregistered = append(unregistered, "bucket.DeleteBucketHandler") - } - if o.BucketDeleteBucketEventHandler == nil { - unregistered = append(unregistered, "bucket.DeleteBucketEventHandler") - } - if o.BucketDeleteBucketReplicationRuleHandler == nil { - unregistered = append(unregistered, "bucket.DeleteBucketReplicationRuleHandler") - } - if o.IdpDeleteConfigurationHandler == nil { - unregistered = append(unregistered, "idp.DeleteConfigurationHandler") - } if o.ObjectDeleteMultipleObjectsHandler == nil { unregistered = append(unregistered, "object.DeleteMultipleObjectsHandler") } - if o.ServiceAccountDeleteMultipleServiceAccountsHandler == nil { - unregistered = append(unregistered, "service_account.DeleteMultipleServiceAccountsHandler") - } if o.ObjectDeleteObjectHandler == nil { unregistered = append(unregistered, "object.DeleteObjectHandler") } - if o.ObjectDeleteObjectRetentionHandler == nil { - unregistered = append(unregistered, "object.DeleteObjectRetentionHandler") - } - if o.BucketDeleteRemoteBucketHandler == nil { - unregistered = append(unregistered, "bucket.DeleteRemoteBucketHandler") - } - if o.BucketDeleteSelectedReplicationRulesHandler == nil { - unregistered = append(unregistered, "bucket.DeleteSelectedReplicationRulesHandler") - } - if o.ServiceAccountDeleteServiceAccountHandler == nil { - unregistered = append(unregistered, "service_account.DeleteServiceAccountHandler") - } - if o.BucketDisableBucketEncryptionHandler == nil { - unregistered = append(unregistered, "bucket.DisableBucketEncryptionHandler") - } if o.ObjectDownloadObjectHandler == nil { unregistered = append(unregistered, "object.DownloadObjectHandler") } @@ -952,147 +384,33 @@ func (o *ConsoleAPI) Validate() error { if o.PublicDownloadSharedObjectHandler == nil { unregistered = append(unregistered, "public.DownloadSharedObjectHandler") } - if o.BucketEnableBucketEncryptionHandler == nil { - unregistered = append(unregistered, "bucket.EnableBucketEncryptionHandler") - } - if o.ConfigurationExportConfigHandler == nil { - unregistered = append(unregistered, "configuration.ExportConfigHandler") - } - if o.BucketGetBucketEncryptionInfoHandler == nil { - unregistered = append(unregistered, "bucket.GetBucketEncryptionInfoHandler") - } - if o.BucketGetBucketObjectLockingStatusHandler == nil { - unregistered = append(unregistered, "bucket.GetBucketObjectLockingStatusHandler") - } if o.BucketGetBucketQuotaHandler == nil { unregistered = append(unregistered, "bucket.GetBucketQuotaHandler") } - if o.BucketGetBucketReplicationHandler == nil { - unregistered = append(unregistered, "bucket.GetBucketReplicationHandler") - } - if o.BucketGetBucketReplicationRuleHandler == nil { - unregistered = append(unregistered, "bucket.GetBucketReplicationRuleHandler") - } - if o.BucketGetBucketRetentionConfigHandler == nil { - unregistered = append(unregistered, "bucket.GetBucketRetentionConfigHandler") - } if o.BucketGetBucketRewindHandler == nil { unregistered = append(unregistered, "bucket.GetBucketRewindHandler") } if o.BucketGetBucketVersioningHandler == nil { unregistered = append(unregistered, "bucket.GetBucketVersioningHandler") } - if o.IdpGetConfigurationHandler == nil { - unregistered = append(unregistered, "idp.GetConfigurationHandler") - } - if o.IdpGetLDAPEntitiesHandler == nil { - unregistered = append(unregistered, "idp.GetLDAPEntitiesHandler") - } if o.BucketGetMaxShareLinkExpHandler == nil { unregistered = append(unregistered, "bucket.GetMaxShareLinkExpHandler") } if o.ObjectGetObjectMetadataHandler == nil { unregistered = append(unregistered, "object.GetObjectMetadataHandler") } - if o.PolicyGetSAUserPolicyHandler == nil { - unregistered = append(unregistered, "policy.GetSAUserPolicyHandler") - } - if o.ServiceAccountGetServiceAccountHandler == nil { - unregistered = append(unregistered, "service_account.GetServiceAccountHandler") - } - if o.UserGetUserInfoHandler == nil { - unregistered = append(unregistered, "user.GetUserInfoHandler") - } - if o.PolicyGetUserPolicyHandler == nil { - unregistered = append(unregistered, "policy.GetUserPolicyHandler") - } - if o.GroupGroupInfoHandler == nil { - unregistered = append(unregistered, "group.GroupInfoHandler") - } - if o.InspectInspectHandler == nil { - unregistered = append(unregistered, "inspect.InspectHandler") - } - if o.KmsKMSAPIsHandler == nil { - unregistered = append(unregistered, "k_m_s.KMSAPIsHandler") - } - if o.KmsKMSCreateKeyHandler == nil { - unregistered = append(unregistered, "k_m_s.KMSCreateKeyHandler") - } - if o.KmsKMSKeyStatusHandler == nil { - unregistered = append(unregistered, "k_m_s.KMSKeyStatusHandler") - } - if o.KmsKMSListKeysHandler == nil { - unregistered = append(unregistered, "k_m_s.KMSListKeysHandler") - } - if o.KmsKMSMetricsHandler == nil { - unregistered = append(unregistered, "k_m_s.KMSMetricsHandler") - } - if o.KmsKMSStatusHandler == nil { - unregistered = append(unregistered, "k_m_s.KMSStatusHandler") - } - if o.KmsKMSVersionHandler == nil { - unregistered = append(unregistered, "k_m_s.KMSVersionHandler") - } - if o.UserListAUserServiceAccountsHandler == nil { - unregistered = append(unregistered, "user.ListAUserServiceAccountsHandler") - } - if o.BucketListAccessRulesWithBucketHandler == nil { - unregistered = append(unregistered, "bucket.ListAccessRulesWithBucketHandler") - } - if o.BucketListBucketEventsHandler == nil { - unregistered = append(unregistered, "bucket.ListBucketEventsHandler") + if o.LicenseLicenseAcknowledgeHandler == nil { + unregistered = append(unregistered, "license.LicenseAcknowledgeHandler") } if o.BucketListBucketsHandler == nil { unregistered = append(unregistered, "bucket.ListBucketsHandler") } - if o.ConfigurationListConfigHandler == nil { - unregistered = append(unregistered, "configuration.ListConfigHandler") - } - if o.IdpListConfigurationsHandler == nil { - unregistered = append(unregistered, "idp.ListConfigurationsHandler") - } - if o.BucketListExternalBucketsHandler == nil { - unregistered = append(unregistered, "bucket.ListExternalBucketsHandler") - } - if o.GroupListGroupsHandler == nil { - unregistered = append(unregistered, "group.ListGroupsHandler") - } - if o.PolicyListGroupsForPolicyHandler == nil { - unregistered = append(unregistered, "policy.ListGroupsForPolicyHandler") - } - if o.SystemListNodesHandler == nil { - unregistered = append(unregistered, "system.ListNodesHandler") - } if o.ObjectListObjectsHandler == nil { unregistered = append(unregistered, "object.ListObjectsHandler") } - if o.PolicyListPoliciesHandler == nil { - unregistered = append(unregistered, "policy.ListPoliciesHandler") - } - if o.BucketListPoliciesWithBucketHandler == nil { - unregistered = append(unregistered, "bucket.ListPoliciesWithBucketHandler") - } - if o.ReleaseListReleasesHandler == nil { - unregistered = append(unregistered, "release.ListReleasesHandler") - } - if o.BucketListRemoteBucketsHandler == nil { - unregistered = append(unregistered, "bucket.ListRemoteBucketsHandler") - } - if o.ServiceAccountListUserServiceAccountsHandler == nil { - unregistered = append(unregistered, "service_account.ListUserServiceAccountsHandler") - } if o.UserListUsersHandler == nil { unregistered = append(unregistered, "user.ListUsersHandler") } - if o.PolicyListUsersForPolicyHandler == nil { - unregistered = append(unregistered, "policy.ListUsersForPolicyHandler") - } - if o.BucketListUsersWithAccessToBucketHandler == nil { - unregistered = append(unregistered, "bucket.ListUsersWithAccessToBucketHandler") - } - if o.LoggingLogSearchHandler == nil { - unregistered = append(unregistered, "logging.LogSearchHandler") - } if o.AuthLoginHandler == nil { unregistered = append(unregistered, "auth.LoginHandler") } @@ -1108,99 +426,27 @@ func (o *ConsoleAPI) Validate() error { if o.BucketMakeBucketHandler == nil { unregistered = append(unregistered, "bucket.MakeBucketHandler") } - if o.ConfigurationNotificationEndpointListHandler == nil { - unregistered = append(unregistered, "configuration.NotificationEndpointListHandler") - } - if o.PolicyPolicyInfoHandler == nil { - unregistered = append(unregistered, "policy.PolicyInfoHandler") - } if o.ObjectPostBucketsBucketNameObjectsUploadHandler == nil { unregistered = append(unregistered, "object.PostBucketsBucketNameObjectsUploadHandler") } - if o.ConfigurationPostConfigsImportHandler == nil { - unregistered = append(unregistered, "configuration.PostConfigsImportHandler") - } if o.BucketPutBucketTagsHandler == nil { unregistered = append(unregistered, "bucket.PutBucketTagsHandler") } - if o.ObjectPutObjectLegalHoldHandler == nil { - unregistered = append(unregistered, "object.PutObjectLegalHoldHandler") - } if o.ObjectPutObjectRestoreHandler == nil { unregistered = append(unregistered, "object.PutObjectRestoreHandler") } - if o.ObjectPutObjectRetentionHandler == nil { - unregistered = append(unregistered, "object.PutObjectRetentionHandler") - } if o.ObjectPutObjectTagsHandler == nil { unregistered = append(unregistered, "object.PutObjectTagsHandler") } - if o.BucketRemoteBucketDetailsHandler == nil { - unregistered = append(unregistered, "bucket.RemoteBucketDetailsHandler") - } - if o.GroupRemoveGroupHandler == nil { - unregistered = append(unregistered, "group.RemoveGroupHandler") - } - if o.PolicyRemovePolicyHandler == nil { - unregistered = append(unregistered, "policy.RemovePolicyHandler") - } - if o.UserRemoveUserHandler == nil { - unregistered = append(unregistered, "user.RemoveUserHandler") - } - if o.ConfigurationResetConfigHandler == nil { - unregistered = append(unregistered, "configuration.ResetConfigHandler") - } - if o.ServiceRestartServiceHandler == nil { - unregistered = append(unregistered, "service.RestartServiceHandler") - } if o.AuthSessionCheckHandler == nil { unregistered = append(unregistered, "auth.SessionCheckHandler") } - if o.BucketSetAccessRuleWithBucketHandler == nil { - unregistered = append(unregistered, "bucket.SetAccessRuleWithBucketHandler") - } - if o.BucketSetBucketQuotaHandler == nil { - unregistered = append(unregistered, "bucket.SetBucketQuotaHandler") - } - if o.BucketSetBucketRetentionConfigHandler == nil { - unregistered = append(unregistered, "bucket.SetBucketRetentionConfigHandler") - } if o.BucketSetBucketVersioningHandler == nil { unregistered = append(unregistered, "bucket.SetBucketVersioningHandler") } - if o.ConfigurationSetConfigHandler == nil { - unregistered = append(unregistered, "configuration.SetConfigHandler") - } - if o.BucketSetMultiBucketReplicationHandler == nil { - unregistered = append(unregistered, "bucket.SetMultiBucketReplicationHandler") - } - if o.PolicySetPolicyHandler == nil { - unregistered = append(unregistered, "policy.SetPolicyHandler") - } - if o.PolicySetPolicyMultipleHandler == nil { - unregistered = append(unregistered, "policy.SetPolicyMultipleHandler") - } if o.ObjectShareObjectHandler == nil { unregistered = append(unregistered, "object.ShareObjectHandler") } - if o.IdpUpdateConfigurationHandler == nil { - unregistered = append(unregistered, "idp.UpdateConfigurationHandler") - } - if o.GroupUpdateGroupHandler == nil { - unregistered = append(unregistered, "group.UpdateGroupHandler") - } - if o.BucketUpdateMultiBucketReplicationHandler == nil { - unregistered = append(unregistered, "bucket.UpdateMultiBucketReplicationHandler") - } - if o.ServiceAccountUpdateServiceAccountHandler == nil { - unregistered = append(unregistered, "service_account.UpdateServiceAccountHandler") - } - if o.UserUpdateUserGroupsHandler == nil { - unregistered = append(unregistered, "user.UpdateUserGroupsHandler") - } - if o.UserUpdateUserInfoHandler == nil { - unregistered = append(unregistered, "user.UpdateUserInfoHandler") - } if len(unregistered) > 0 { return fmt.Errorf("missing registration: %s", strings.Join(unregistered, ", ")) @@ -1309,30 +555,6 @@ func (o *ConsoleAPI) initHandlerCache() { o.handlers = make(map[string]map[string]http.Handler) } - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/account/change-password"] = account.NewAccountChangePassword(o.context, o.AccountAccountChangePasswordHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/groups"] = group.NewAddGroup(o.context, o.GroupAddGroupHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/admin/notification_endpoints"] = configuration.NewAddNotificationEndpoint(o.context, o.ConfigurationAddNotificationEndpointHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/policies"] = policy.NewAddPolicy(o.context, o.PolicyAddPolicyHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/remote-buckets"] = bucket.NewAddRemoteBucket(o.context, o.BucketAddRemoteBucketHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/users"] = user.NewAddUser(o.context, o.UserAddUserHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } @@ -1340,83 +562,7 @@ func (o *ConsoleAPI) initHandlerCache() { if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } - o.handlers["GET"]["/admin/arns"] = system.NewArnList(o.context, o.SystemArnListHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } o.handlers["GET"]["/buckets/{name}"] = bucket.NewBucketInfo(o.context, o.BucketBucketInfoHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/buckets/{name}/set-policy"] = bucket.NewBucketSetPolicy(o.context, o.BucketBucketSetPolicyHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/users-groups-bulk"] = user.NewBulkUpdateUsersGroups(o.context, o.UserBulkUpdateUsersGroupsHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/account/change-user-password"] = account.NewChangeUserPassword(o.context, o.AccountChangeUserPasswordHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/users/service-accounts"] = user.NewCheckUserServiceAccounts(o.context, o.UserCheckUserServiceAccountsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/configs/{name}"] = configuration.NewConfigInfo(o.context, o.ConfigurationConfigInfoHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/user/{name}/service-accounts"] = user.NewCreateAUserServiceAccount(o.context, o.UserCreateAUserServiceAccountHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/buckets/{bucket_name}/events"] = bucket.NewCreateBucketEvent(o.context, o.BucketCreateBucketEventHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/idp/{type}"] = idp.NewCreateConfiguration(o.context, o.IdpCreateConfigurationHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/service-accounts"] = service_account.NewCreateServiceAccount(o.context, o.ServiceAccountCreateServiceAccountHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/user/{name}/service-account-credentials"] = user.NewCreateServiceAccountCredentials(o.context, o.UserCreateServiceAccountCredentialsHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/service-account-credentials"] = service_account.NewCreateServiceAccountCreds(o.context, o.ServiceAccountCreateServiceAccountCredsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/admin/info/widgets/{widgetId}"] = system.NewDashboardWidgetDetails(o.context, o.SystemDashboardWidgetDetailsHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/bucket/{bucket}/access-rules"] = bucket.NewDeleteAccessRuleWithBucket(o.context, o.BucketDeleteAccessRuleWithBucketHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/buckets/{bucket_name}/delete-all-replication-rules"] = bucket.NewDeleteAllReplicationRules(o.context, o.BucketDeleteAllReplicationRulesHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/buckets/{name}"] = bucket.NewDeleteBucket(o.context, o.BucketDeleteBucketHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/buckets/{bucket_name}/events/{arn}"] = bucket.NewDeleteBucketEvent(o.context, o.BucketDeleteBucketEventHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/buckets/{bucket_name}/replication/{rule_id}"] = bucket.NewDeleteBucketReplicationRule(o.context, o.BucketDeleteBucketReplicationRuleHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/idp/{type}/{name}"] = idp.NewDeleteConfiguration(o.context, o.IdpDeleteConfigurationHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } @@ -1424,31 +570,7 @@ func (o *ConsoleAPI) initHandlerCache() { if o.handlers["DELETE"] == nil { o.handlers["DELETE"] = make(map[string]http.Handler) } - o.handlers["DELETE"]["/service-accounts/delete-multi"] = service_account.NewDeleteMultipleServiceAccounts(o.context, o.ServiceAccountDeleteMultipleServiceAccountsHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } o.handlers["DELETE"]["/buckets/{bucket_name}/objects"] = object.NewDeleteObject(o.context, o.ObjectDeleteObjectHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/buckets/{bucket_name}/objects/retention"] = object.NewDeleteObjectRetention(o.context, o.ObjectDeleteObjectRetentionHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/remote-buckets/{source-bucket-name}/{arn}"] = bucket.NewDeleteRemoteBucket(o.context, o.BucketDeleteRemoteBucketHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/buckets/{bucket_name}/delete-selected-replication-rules"] = bucket.NewDeleteSelectedReplicationRules(o.context, o.BucketDeleteSelectedReplicationRulesHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/service-accounts/{access_key}"] = service_account.NewDeleteServiceAccount(o.context, o.ServiceAccountDeleteServiceAccountHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/buckets/{bucket_name}/encryption/disable"] = bucket.NewDisableBucketEncryption(o.context, o.BucketDisableBucketEncryptionHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } @@ -1461,22 +583,6 @@ func (o *ConsoleAPI) initHandlerCache() { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/download-shared-object/{url}"] = public.NewDownloadSharedObject(o.context, o.PublicDownloadSharedObjectHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/buckets/{bucket_name}/encryption/enable"] = bucket.NewEnableBucketEncryption(o.context, o.BucketEnableBucketEncryptionHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/configs/export"] = configuration.NewExportConfig(o.context, o.ConfigurationExportConfigHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/buckets/{bucket_name}/encryption/info"] = bucket.NewGetBucketEncryptionInfo(o.context, o.BucketGetBucketEncryptionInfoHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/buckets/{bucket_name}/object-locking"] = bucket.NewGetBucketObjectLockingStatus(o.context, o.BucketGetBucketObjectLockingStatusHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } @@ -1484,18 +590,6 @@ func (o *ConsoleAPI) initHandlerCache() { if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } - o.handlers["GET"]["/buckets/{bucket_name}/replication"] = bucket.NewGetBucketReplication(o.context, o.BucketGetBucketReplicationHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/buckets/{bucket_name}/replication/{rule_id}"] = bucket.NewGetBucketReplicationRule(o.context, o.BucketGetBucketReplicationRuleHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/buckets/{bucket_name}/retention"] = bucket.NewGetBucketRetentionConfig(o.context, o.BucketGetBucketRetentionConfigHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } o.handlers["GET"]["/buckets/{bucket_name}/rewind/{date}"] = bucket.NewGetBucketRewind(o.context, o.BucketGetBucketRewindHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) @@ -1504,14 +598,6 @@ func (o *ConsoleAPI) initHandlerCache() { if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } - o.handlers["GET"]["/idp/{type}/{name}"] = idp.NewGetConfiguration(o.context, o.IdpGetConfigurationHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/ldap-entities"] = idp.NewGetLDAPEntities(o.context, o.IdpGetLDAPEntitiesHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } o.handlers["GET"]["/buckets/max-share-exp"] = bucket.NewGetMaxShareLinkExp(o.context, o.BucketGetMaxShareLinkExpHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) @@ -1520,67 +606,7 @@ func (o *ConsoleAPI) initHandlerCache() { if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } - o.handlers["GET"]["/user/{name}/policies"] = policy.NewGetSAUserPolicy(o.context, o.PolicyGetSAUserPolicyHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/service-accounts/{access_key}"] = service_account.NewGetServiceAccount(o.context, o.ServiceAccountGetServiceAccountHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/user/{name}"] = user.NewGetUserInfo(o.context, o.UserGetUserInfoHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/user/policy"] = policy.NewGetUserPolicy(o.context, o.PolicyGetUserPolicyHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/group/{name}"] = group.NewGroupInfo(o.context, o.GroupGroupInfoHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/admin/inspect"] = inspect.NewInspect(o.context, o.InspectInspectHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/kms/apis"] = k_m_s.NewKMSAPIs(o.context, o.KmsKMSAPIsHandler) - 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["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/kms/keys/{name}"] = k_m_s.NewKMSKeyStatus(o.context, o.KmsKMSKeyStatusHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/kms/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/metrics"] = k_m_s.NewKMSMetrics(o.context, o.KmsKMSMetricsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/kms/status"] = k_m_s.NewKMSStatus(o.context, o.KmsKMSStatusHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/kms/version"] = k_m_s.NewKMSVersion(o.context, o.KmsKMSVersionHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/user/{name}/service-accounts"] = user.NewListAUserServiceAccounts(o.context, o.UserListAUserServiceAccountsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/bucket/{bucket}/access-rules"] = bucket.NewListAccessRulesWithBucket(o.context, o.BucketListAccessRulesWithBucketHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/buckets/{bucket_name}/events"] = bucket.NewListBucketEvents(o.context, o.BucketListBucketEventsHandler) + o.handlers["GET"]["/license/acknowledge"] = license.NewLicenseAcknowledge(o.context, o.LicenseLicenseAcknowledgeHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } @@ -1588,67 +614,11 @@ func (o *ConsoleAPI) initHandlerCache() { if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } - o.handlers["GET"]["/configs"] = configuration.NewListConfig(o.context, o.ConfigurationListConfigHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/idp/{type}"] = idp.NewListConfigurations(o.context, o.IdpListConfigurationsHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/list-external-buckets"] = bucket.NewListExternalBuckets(o.context, o.BucketListExternalBucketsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/groups"] = group.NewListGroups(o.context, o.GroupListGroupsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/policies/{policy}/groups"] = policy.NewListGroupsForPolicy(o.context, o.PolicyListGroupsForPolicyHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/nodes"] = system.NewListNodes(o.context, o.SystemListNodesHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } o.handlers["GET"]["/buckets/{bucket_name}/objects"] = object.NewListObjects(o.context, o.ObjectListObjectsHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } - o.handlers["GET"]["/policies"] = policy.NewListPolicies(o.context, o.PolicyListPoliciesHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/bucket-policy/{bucket}"] = bucket.NewListPoliciesWithBucket(o.context, o.BucketListPoliciesWithBucketHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/releases"] = release.NewListReleases(o.context, o.ReleaseListReleasesHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/remote-buckets"] = bucket.NewListRemoteBuckets(o.context, o.BucketListRemoteBucketsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/service-accounts"] = service_account.NewListUserServiceAccounts(o.context, o.ServiceAccountListUserServiceAccountsHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } o.handlers["GET"]["/users"] = user.NewListUsers(o.context, o.UserListUsersHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/policies/{policy}/users"] = policy.NewListUsersForPolicy(o.context, o.PolicyListUsersForPolicyHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/bucket-users/{bucket}"] = bucket.NewListUsersWithAccessToBucket(o.context, o.BucketListUsersWithAccessToBucketHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/logs/search"] = logging.NewLogSearch(o.context, o.LoggingLogSearchHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } @@ -1669,22 +639,10 @@ func (o *ConsoleAPI) initHandlerCache() { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/buckets"] = bucket.NewMakeBucket(o.context, o.BucketMakeBucketHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/admin/notification_endpoints"] = configuration.NewNotificationEndpointList(o.context, o.ConfigurationNotificationEndpointListHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/policy/{name}"] = policy.NewPolicyInfo(o.context, o.PolicyPolicyInfoHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/buckets/{bucket_name}/objects/upload"] = object.NewPostBucketsBucketNameObjectsUpload(o.context, o.ObjectPostBucketsBucketNameObjectsUploadHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/configs/import"] = configuration.NewPostConfigsImport(o.context, o.ConfigurationPostConfigsImportHandler) if o.handlers["PUT"] == nil { o.handlers["PUT"] = make(map[string]http.Handler) } @@ -1692,107 +650,23 @@ func (o *ConsoleAPI) initHandlerCache() { if o.handlers["PUT"] == nil { o.handlers["PUT"] = make(map[string]http.Handler) } - o.handlers["PUT"]["/buckets/{bucket_name}/objects/legalhold"] = object.NewPutObjectLegalHold(o.context, o.ObjectPutObjectLegalHoldHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } o.handlers["PUT"]["/buckets/{bucket_name}/objects/restore"] = object.NewPutObjectRestore(o.context, o.ObjectPutObjectRestoreHandler) if o.handlers["PUT"] == nil { o.handlers["PUT"] = make(map[string]http.Handler) } - o.handlers["PUT"]["/buckets/{bucket_name}/objects/retention"] = object.NewPutObjectRetention(o.context, o.ObjectPutObjectRetentionHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } o.handlers["PUT"]["/buckets/{bucket_name}/objects/tags"] = object.NewPutObjectTags(o.context, o.ObjectPutObjectTagsHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } - o.handlers["GET"]["/remote-buckets/{name}"] = bucket.NewRemoteBucketDetails(o.context, o.BucketRemoteBucketDetailsHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/group/{name}"] = group.NewRemoveGroup(o.context, o.GroupRemoveGroupHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/policy/{name}"] = policy.NewRemovePolicy(o.context, o.PolicyRemovePolicyHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/user/{name}"] = user.NewRemoveUser(o.context, o.UserRemoveUserHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/configs/{name}/reset"] = configuration.NewResetConfig(o.context, o.ConfigurationResetConfigHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/service/restart"] = service.NewRestartService(o.context, o.ServiceRestartServiceHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } o.handlers["GET"]["/session"] = auth.NewSessionCheck(o.context, o.AuthSessionCheckHandler) if o.handlers["PUT"] == nil { o.handlers["PUT"] = make(map[string]http.Handler) } - o.handlers["PUT"]["/bucket/{bucket}/access-rules"] = bucket.NewSetAccessRuleWithBucket(o.context, o.BucketSetAccessRuleWithBucketHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/buckets/{name}/quota"] = bucket.NewSetBucketQuota(o.context, o.BucketSetBucketQuotaHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/buckets/{bucket_name}/retention"] = bucket.NewSetBucketRetentionConfig(o.context, o.BucketSetBucketRetentionConfigHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } o.handlers["PUT"]["/buckets/{bucket_name}/versioning"] = bucket.NewSetBucketVersioning(o.context, o.BucketSetBucketVersioningHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/configs/{name}"] = configuration.NewSetConfig(o.context, o.ConfigurationSetConfigHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/buckets-replication"] = bucket.NewSetMultiBucketReplication(o.context, o.BucketSetMultiBucketReplicationHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/set-policy"] = policy.NewSetPolicy(o.context, o.PolicySetPolicyHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/set-policy-multi"] = policy.NewSetPolicyMultiple(o.context, o.PolicySetPolicyMultipleHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/buckets/{bucket_name}/objects/share"] = object.NewShareObject(o.context, o.ObjectShareObjectHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/idp/{type}/{name}"] = idp.NewUpdateConfiguration(o.context, o.IdpUpdateConfigurationHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/group/{name}"] = group.NewUpdateGroup(o.context, o.GroupUpdateGroupHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/buckets/{bucket_name}/replication/{rule_id}"] = bucket.NewUpdateMultiBucketReplication(o.context, o.BucketUpdateMultiBucketReplicationHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/service-accounts/{access_key}"] = service_account.NewUpdateServiceAccount(o.context, o.ServiceAccountUpdateServiceAccountHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/user/{name}/groups"] = user.NewUpdateUserGroups(o.context, o.UserUpdateUserGroupsHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/user/{name}"] = user.NewUpdateUserInfo(o.context, o.UserUpdateUserInfoHandler) } // Serve creates a http handler to serve the API over HTTP diff --git a/api/operations/group/add_group.go b/api/operations/group/add_group.go deleted file mode 100644 index 8ea343402c..0000000000 --- a/api/operations/group/add_group.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 group - -// 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" -) - -// AddGroupHandlerFunc turns a function with the right signature into a add group handler -type AddGroupHandlerFunc func(AddGroupParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn AddGroupHandlerFunc) Handle(params AddGroupParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// AddGroupHandler interface for that can handle valid add group params -type AddGroupHandler interface { - Handle(AddGroupParams, *models.Principal) middleware.Responder -} - -// NewAddGroup creates a new http.Handler for the add group operation -func NewAddGroup(ctx *middleware.Context, handler AddGroupHandler) *AddGroup { - return &AddGroup{Context: ctx, Handler: handler} -} - -/* - AddGroup swagger:route POST /groups Group addGroup - -Add Group -*/ -type AddGroup struct { - Context *middleware.Context - Handler AddGroupHandler -} - -func (o *AddGroup) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewAddGroupParams() - 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/group/add_group_parameters.go b/api/operations/group/add_group_parameters.go deleted file mode 100644 index 157633c996..0000000000 --- a/api/operations/group/add_group_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 group - -// 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" -) - -// NewAddGroupParams creates a new AddGroupParams object -// -// There are no default values defined in the spec. -func NewAddGroupParams() AddGroupParams { - - return AddGroupParams{} -} - -// AddGroupParams contains all the bound params for the add group operation -// typically these are obtained from a http.Request -// -// swagger:parameters AddGroup -type AddGroupParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.AddGroupRequest -} - -// 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 NewAddGroupParams() beforehand. -func (o *AddGroupParams) 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.AddGroupRequest - 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/group/add_group_responses.go b/api/operations/group/add_group_responses.go deleted file mode 100644 index b68b7b3cb2..0000000000 --- a/api/operations/group/add_group_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 group - -// 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" -) - -// AddGroupCreatedCode is the HTTP code returned for type AddGroupCreated -const AddGroupCreatedCode int = 201 - -/* -AddGroupCreated A successful response. - -swagger:response addGroupCreated -*/ -type AddGroupCreated struct { -} - -// NewAddGroupCreated creates AddGroupCreated with default headers values -func NewAddGroupCreated() *AddGroupCreated { - - return &AddGroupCreated{} -} - -// WriteResponse to the client -func (o *AddGroupCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(201) -} - -/* -AddGroupDefault Generic error response. - -swagger:response addGroupDefault -*/ -type AddGroupDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewAddGroupDefault creates AddGroupDefault with default headers values -func NewAddGroupDefault(code int) *AddGroupDefault { - if code <= 0 { - code = 500 - } - - return &AddGroupDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the add group default response -func (o *AddGroupDefault) WithStatusCode(code int) *AddGroupDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the add group default response -func (o *AddGroupDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the add group default response -func (o *AddGroupDefault) WithPayload(payload *models.APIError) *AddGroupDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the add group default response -func (o *AddGroupDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *AddGroupDefault) 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/group/add_group_urlbuilder.go b/api/operations/group/add_group_urlbuilder.go deleted file mode 100644 index 50d8c844f3..0000000000 --- a/api/operations/group/add_group_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 group - -// 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" -) - -// AddGroupURL generates an URL for the add group operation -type AddGroupURL 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 *AddGroupURL) WithBasePath(bp string) *AddGroupURL { - 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 *AddGroupURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *AddGroupURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/groups" - - _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 *AddGroupURL) 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 *AddGroupURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *AddGroupURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on AddGroupURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on AddGroupURL") - } - - 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 *AddGroupURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/group/group_info.go b/api/operations/group/group_info.go deleted file mode 100644 index 5a5685184b..0000000000 --- a/api/operations/group/group_info.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 group - -// 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" -) - -// GroupInfoHandlerFunc turns a function with the right signature into a group info handler -type GroupInfoHandlerFunc func(GroupInfoParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn GroupInfoHandlerFunc) Handle(params GroupInfoParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// GroupInfoHandler interface for that can handle valid group info params -type GroupInfoHandler interface { - Handle(GroupInfoParams, *models.Principal) middleware.Responder -} - -// NewGroupInfo creates a new http.Handler for the group info operation -func NewGroupInfo(ctx *middleware.Context, handler GroupInfoHandler) *GroupInfo { - return &GroupInfo{Context: ctx, Handler: handler} -} - -/* - GroupInfo swagger:route GET /group/{name} Group groupInfo - -Group info -*/ -type GroupInfo struct { - Context *middleware.Context - Handler GroupInfoHandler -} - -func (o *GroupInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGroupInfoParams() - 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/group/group_info_parameters.go b/api/operations/group/group_info_parameters.go deleted file mode 100644 index 36c2e5dab2..0000000000 --- a/api/operations/group/group_info_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 group - -// 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" -) - -// NewGroupInfoParams creates a new GroupInfoParams object -// -// There are no default values defined in the spec. -func NewGroupInfoParams() GroupInfoParams { - - return GroupInfoParams{} -} - -// GroupInfoParams contains all the bound params for the group info operation -// typically these are obtained from a http.Request -// -// swagger:parameters GroupInfo -type GroupInfoParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - 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 NewGroupInfoParams() beforehand. -func (o *GroupInfoParams) 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 *GroupInfoParams) 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/group/group_info_responses.go b/api/operations/group/group_info_responses.go deleted file mode 100644 index 4eb2ce67c9..0000000000 --- a/api/operations/group/group_info_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 group - -// 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" -) - -// GroupInfoOKCode is the HTTP code returned for type GroupInfoOK -const GroupInfoOKCode int = 200 - -/* -GroupInfoOK A successful response. - -swagger:response groupInfoOK -*/ -type GroupInfoOK struct { - - /* - In: Body - */ - Payload *models.Group `json:"body,omitempty"` -} - -// NewGroupInfoOK creates GroupInfoOK with default headers values -func NewGroupInfoOK() *GroupInfoOK { - - return &GroupInfoOK{} -} - -// WithPayload adds the payload to the group info o k response -func (o *GroupInfoOK) WithPayload(payload *models.Group) *GroupInfoOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the group info o k response -func (o *GroupInfoOK) SetPayload(payload *models.Group) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GroupInfoOK) 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 - } - } -} - -/* -GroupInfoDefault Generic error response. - -swagger:response groupInfoDefault -*/ -type GroupInfoDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewGroupInfoDefault creates GroupInfoDefault with default headers values -func NewGroupInfoDefault(code int) *GroupInfoDefault { - if code <= 0 { - code = 500 - } - - return &GroupInfoDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the group info default response -func (o *GroupInfoDefault) WithStatusCode(code int) *GroupInfoDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the group info default response -func (o *GroupInfoDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the group info default response -func (o *GroupInfoDefault) WithPayload(payload *models.APIError) *GroupInfoDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the group info default response -func (o *GroupInfoDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GroupInfoDefault) 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/group/group_info_urlbuilder.go b/api/operations/group/group_info_urlbuilder.go deleted file mode 100644 index 6922e99f30..0000000000 --- a/api/operations/group/group_info_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 group - -// 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" -) - -// GroupInfoURL generates an URL for the group info operation -type GroupInfoURL 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 *GroupInfoURL) WithBasePath(bp string) *GroupInfoURL { - 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 *GroupInfoURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GroupInfoURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/group/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GroupInfoURL") - } - - _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 *GroupInfoURL) 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 *GroupInfoURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GroupInfoURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GroupInfoURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GroupInfoURL") - } - - 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 *GroupInfoURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/group/list_groups.go b/api/operations/group/list_groups.go deleted file mode 100644 index a41f343569..0000000000 --- a/api/operations/group/list_groups.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 group - -// 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" -) - -// ListGroupsHandlerFunc turns a function with the right signature into a list groups handler -type ListGroupsHandlerFunc func(ListGroupsParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn ListGroupsHandlerFunc) Handle(params ListGroupsParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// ListGroupsHandler interface for that can handle valid list groups params -type ListGroupsHandler interface { - Handle(ListGroupsParams, *models.Principal) middleware.Responder -} - -// NewListGroups creates a new http.Handler for the list groups operation -func NewListGroups(ctx *middleware.Context, handler ListGroupsHandler) *ListGroups { - return &ListGroups{Context: ctx, Handler: handler} -} - -/* - ListGroups swagger:route GET /groups Group listGroups - -List Groups -*/ -type ListGroups struct { - Context *middleware.Context - Handler ListGroupsHandler -} - -func (o *ListGroups) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewListGroupsParams() - 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/group/list_groups_parameters.go b/api/operations/group/list_groups_parameters.go deleted file mode 100644 index 0a4cb0e52e..0000000000 --- a/api/operations/group/list_groups_parameters.go +++ /dev/null @@ -1,146 +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 group - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewListGroupsParams creates a new ListGroupsParams object -// with the default values initialized. -func NewListGroupsParams() ListGroupsParams { - - var ( - // initialize parameters with default values - - limitDefault = int32(20) - offsetDefault = int32(0) - ) - - return ListGroupsParams{ - Limit: &limitDefault, - - Offset: &offsetDefault, - } -} - -// ListGroupsParams contains all the bound params for the list groups operation -// typically these are obtained from a http.Request -// -// swagger:parameters ListGroups -type ListGroupsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - In: query - Default: 20 - */ - Limit *int32 - /* - In: query - Default: 0 - */ - Offset *int32 -} - -// 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 NewListGroupsParams() beforehand. -func (o *ListGroupsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qLimit, qhkLimit, _ := qs.GetOK("limit") - if err := o.bindLimit(qLimit, qhkLimit, route.Formats); err != nil { - res = append(res, err) - } - - qOffset, qhkOffset, _ := qs.GetOK("offset") - if err := o.bindOffset(qOffset, qhkOffset, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindLimit binds and validates parameter Limit from query. -func (o *ListGroupsParams) bindLimit(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 - // Default values have been previously initialized by NewListGroupsParams() - return nil - } - - value, err := swag.ConvertInt32(raw) - if err != nil { - return errors.InvalidType("limit", "query", "int32", raw) - } - o.Limit = &value - - return nil -} - -// bindOffset binds and validates parameter Offset from query. -func (o *ListGroupsParams) bindOffset(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 - // Default values have been previously initialized by NewListGroupsParams() - return nil - } - - value, err := swag.ConvertInt32(raw) - if err != nil { - return errors.InvalidType("offset", "query", "int32", raw) - } - o.Offset = &value - - return nil -} diff --git a/api/operations/group/list_groups_responses.go b/api/operations/group/list_groups_responses.go deleted file mode 100644 index 871bb770ae..0000000000 --- a/api/operations/group/list_groups_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 group - -// 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" -) - -// ListGroupsOKCode is the HTTP code returned for type ListGroupsOK -const ListGroupsOKCode int = 200 - -/* -ListGroupsOK A successful response. - -swagger:response listGroupsOK -*/ -type ListGroupsOK struct { - - /* - In: Body - */ - Payload *models.ListGroupsResponse `json:"body,omitempty"` -} - -// NewListGroupsOK creates ListGroupsOK with default headers values -func NewListGroupsOK() *ListGroupsOK { - - return &ListGroupsOK{} -} - -// WithPayload adds the payload to the list groups o k response -func (o *ListGroupsOK) WithPayload(payload *models.ListGroupsResponse) *ListGroupsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list groups o k response -func (o *ListGroupsOK) SetPayload(payload *models.ListGroupsResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListGroupsOK) 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 - } - } -} - -/* -ListGroupsDefault Generic error response. - -swagger:response listGroupsDefault -*/ -type ListGroupsDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewListGroupsDefault creates ListGroupsDefault with default headers values -func NewListGroupsDefault(code int) *ListGroupsDefault { - if code <= 0 { - code = 500 - } - - return &ListGroupsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the list groups default response -func (o *ListGroupsDefault) WithStatusCode(code int) *ListGroupsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the list groups default response -func (o *ListGroupsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the list groups default response -func (o *ListGroupsDefault) WithPayload(payload *models.APIError) *ListGroupsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list groups default response -func (o *ListGroupsDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListGroupsDefault) 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/group/list_groups_urlbuilder.go b/api/operations/group/list_groups_urlbuilder.go deleted file mode 100644 index cba8f738a6..0000000000 --- a/api/operations/group/list_groups_urlbuilder.go +++ /dev/null @@ -1,131 +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 group - -// 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" - - "github.com/go-openapi/swag" -) - -// ListGroupsURL generates an URL for the list groups operation -type ListGroupsURL struct { - Limit *int32 - Offset *int32 - - _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 *ListGroupsURL) WithBasePath(bp string) *ListGroupsURL { - 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 *ListGroupsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ListGroupsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/groups" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var limitQ string - if o.Limit != nil { - limitQ = swag.FormatInt32(*o.Limit) - } - if limitQ != "" { - qs.Set("limit", limitQ) - } - - var offsetQ string - if o.Offset != nil { - offsetQ = swag.FormatInt32(*o.Offset) - } - if offsetQ != "" { - qs.Set("offset", offsetQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ListGroupsURL) 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 *ListGroupsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ListGroupsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ListGroupsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ListGroupsURL") - } - - 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 *ListGroupsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/group/remove_group.go b/api/operations/group/remove_group.go deleted file mode 100644 index c1fdd1eae8..0000000000 --- a/api/operations/group/remove_group.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 group - -// 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" -) - -// RemoveGroupHandlerFunc turns a function with the right signature into a remove group handler -type RemoveGroupHandlerFunc func(RemoveGroupParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn RemoveGroupHandlerFunc) Handle(params RemoveGroupParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// RemoveGroupHandler interface for that can handle valid remove group params -type RemoveGroupHandler interface { - Handle(RemoveGroupParams, *models.Principal) middleware.Responder -} - -// NewRemoveGroup creates a new http.Handler for the remove group operation -func NewRemoveGroup(ctx *middleware.Context, handler RemoveGroupHandler) *RemoveGroup { - return &RemoveGroup{Context: ctx, Handler: handler} -} - -/* - RemoveGroup swagger:route DELETE /group/{name} Group removeGroup - -Remove group -*/ -type RemoveGroup struct { - Context *middleware.Context - Handler RemoveGroupHandler -} - -func (o *RemoveGroup) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewRemoveGroupParams() - 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/group/remove_group_parameters.go b/api/operations/group/remove_group_parameters.go deleted file mode 100644 index 399a49b7ed..0000000000 --- a/api/operations/group/remove_group_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 group - -// 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" -) - -// NewRemoveGroupParams creates a new RemoveGroupParams object -// -// There are no default values defined in the spec. -func NewRemoveGroupParams() RemoveGroupParams { - - return RemoveGroupParams{} -} - -// RemoveGroupParams contains all the bound params for the remove group operation -// typically these are obtained from a http.Request -// -// swagger:parameters RemoveGroup -type RemoveGroupParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - 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 NewRemoveGroupParams() beforehand. -func (o *RemoveGroupParams) 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 *RemoveGroupParams) 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/group/remove_group_responses.go b/api/operations/group/remove_group_responses.go deleted file mode 100644 index 7bb82d8a3c..0000000000 --- a/api/operations/group/remove_group_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 group - -// 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" -) - -// RemoveGroupNoContentCode is the HTTP code returned for type RemoveGroupNoContent -const RemoveGroupNoContentCode int = 204 - -/* -RemoveGroupNoContent A successful response. - -swagger:response removeGroupNoContent -*/ -type RemoveGroupNoContent struct { -} - -// NewRemoveGroupNoContent creates RemoveGroupNoContent with default headers values -func NewRemoveGroupNoContent() *RemoveGroupNoContent { - - return &RemoveGroupNoContent{} -} - -// WriteResponse to the client -func (o *RemoveGroupNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -/* -RemoveGroupDefault Generic error response. - -swagger:response removeGroupDefault -*/ -type RemoveGroupDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewRemoveGroupDefault creates RemoveGroupDefault with default headers values -func NewRemoveGroupDefault(code int) *RemoveGroupDefault { - if code <= 0 { - code = 500 - } - - return &RemoveGroupDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the remove group default response -func (o *RemoveGroupDefault) WithStatusCode(code int) *RemoveGroupDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the remove group default response -func (o *RemoveGroupDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the remove group default response -func (o *RemoveGroupDefault) WithPayload(payload *models.APIError) *RemoveGroupDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the remove group default response -func (o *RemoveGroupDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *RemoveGroupDefault) 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/group/remove_group_urlbuilder.go b/api/operations/group/remove_group_urlbuilder.go deleted file mode 100644 index d48724878c..0000000000 --- a/api/operations/group/remove_group_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 group - -// 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" -) - -// RemoveGroupURL generates an URL for the remove group operation -type RemoveGroupURL 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 *RemoveGroupURL) WithBasePath(bp string) *RemoveGroupURL { - 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 *RemoveGroupURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *RemoveGroupURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/group/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on RemoveGroupURL") - } - - _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 *RemoveGroupURL) 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 *RemoveGroupURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *RemoveGroupURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on RemoveGroupURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on RemoveGroupURL") - } - - 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 *RemoveGroupURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/group/update_group.go b/api/operations/group/update_group.go deleted file mode 100644 index bd7e99c442..0000000000 --- a/api/operations/group/update_group.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 group - -// 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" -) - -// UpdateGroupHandlerFunc turns a function with the right signature into a update group handler -type UpdateGroupHandlerFunc func(UpdateGroupParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn UpdateGroupHandlerFunc) Handle(params UpdateGroupParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// UpdateGroupHandler interface for that can handle valid update group params -type UpdateGroupHandler interface { - Handle(UpdateGroupParams, *models.Principal) middleware.Responder -} - -// NewUpdateGroup creates a new http.Handler for the update group operation -func NewUpdateGroup(ctx *middleware.Context, handler UpdateGroupHandler) *UpdateGroup { - return &UpdateGroup{Context: ctx, Handler: handler} -} - -/* - UpdateGroup swagger:route PUT /group/{name} Group updateGroup - -Update Group Members or Status -*/ -type UpdateGroup struct { - Context *middleware.Context - Handler UpdateGroupHandler -} - -func (o *UpdateGroup) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewUpdateGroupParams() - 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/group/update_group_parameters.go b/api/operations/group/update_group_parameters.go deleted file mode 100644 index b401fff268..0000000000 --- a/api/operations/group/update_group_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 group - -// 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" -) - -// NewUpdateGroupParams creates a new UpdateGroupParams object -// -// There are no default values defined in the spec. -func NewUpdateGroupParams() UpdateGroupParams { - - return UpdateGroupParams{} -} - -// UpdateGroupParams contains all the bound params for the update group operation -// typically these are obtained from a http.Request -// -// swagger:parameters UpdateGroup -type UpdateGroupParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.UpdateGroupRequest - /* - 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 NewUpdateGroupParams() beforehand. -func (o *UpdateGroupParams) 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.UpdateGroupRequest - 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 *UpdateGroupParams) 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/group/update_group_responses.go b/api/operations/group/update_group_responses.go deleted file mode 100644 index bfa38a101d..0000000000 --- a/api/operations/group/update_group_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 group - -// 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" -) - -// UpdateGroupOKCode is the HTTP code returned for type UpdateGroupOK -const UpdateGroupOKCode int = 200 - -/* -UpdateGroupOK A successful response. - -swagger:response updateGroupOK -*/ -type UpdateGroupOK struct { - - /* - In: Body - */ - Payload *models.Group `json:"body,omitempty"` -} - -// NewUpdateGroupOK creates UpdateGroupOK with default headers values -func NewUpdateGroupOK() *UpdateGroupOK { - - return &UpdateGroupOK{} -} - -// WithPayload adds the payload to the update group o k response -func (o *UpdateGroupOK) WithPayload(payload *models.Group) *UpdateGroupOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the update group o k response -func (o *UpdateGroupOK) SetPayload(payload *models.Group) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *UpdateGroupOK) 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 - } - } -} - -/* -UpdateGroupDefault Generic error response. - -swagger:response updateGroupDefault -*/ -type UpdateGroupDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewUpdateGroupDefault creates UpdateGroupDefault with default headers values -func NewUpdateGroupDefault(code int) *UpdateGroupDefault { - if code <= 0 { - code = 500 - } - - return &UpdateGroupDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the update group default response -func (o *UpdateGroupDefault) WithStatusCode(code int) *UpdateGroupDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the update group default response -func (o *UpdateGroupDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the update group default response -func (o *UpdateGroupDefault) WithPayload(payload *models.APIError) *UpdateGroupDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the update group default response -func (o *UpdateGroupDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *UpdateGroupDefault) 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/group/update_group_urlbuilder.go b/api/operations/group/update_group_urlbuilder.go deleted file mode 100644 index bd3ece4f69..0000000000 --- a/api/operations/group/update_group_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 group - -// 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" -) - -// UpdateGroupURL generates an URL for the update group operation -type UpdateGroupURL 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 *UpdateGroupURL) WithBasePath(bp string) *UpdateGroupURL { - 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 *UpdateGroupURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *UpdateGroupURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/group/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on UpdateGroupURL") - } - - _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 *UpdateGroupURL) 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 *UpdateGroupURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *UpdateGroupURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on UpdateGroupURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on UpdateGroupURL") - } - - 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 *UpdateGroupURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/idp/create_configuration.go b/api/operations/idp/create_configuration.go deleted file mode 100644 index 59ba731205..0000000000 --- a/api/operations/idp/create_configuration.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 idp - -// 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" -) - -// CreateConfigurationHandlerFunc turns a function with the right signature into a create configuration handler -type CreateConfigurationHandlerFunc func(CreateConfigurationParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateConfigurationHandlerFunc) Handle(params CreateConfigurationParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// CreateConfigurationHandler interface for that can handle valid create configuration params -type CreateConfigurationHandler interface { - Handle(CreateConfigurationParams, *models.Principal) middleware.Responder -} - -// NewCreateConfiguration creates a new http.Handler for the create configuration operation -func NewCreateConfiguration(ctx *middleware.Context, handler CreateConfigurationHandler) *CreateConfiguration { - return &CreateConfiguration{Context: ctx, Handler: handler} -} - -/* - CreateConfiguration swagger:route POST /idp/{type} idp createConfiguration - -Create IDP Configuration -*/ -type CreateConfiguration struct { - Context *middleware.Context - Handler CreateConfigurationHandler -} - -func (o *CreateConfiguration) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateConfigurationParams() - 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/idp/create_configuration_parameters.go b/api/operations/idp/create_configuration_parameters.go deleted file mode 100644 index be3be1f544..0000000000 --- a/api/operations/idp/create_configuration_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 idp - -// 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" -) - -// NewCreateConfigurationParams creates a new CreateConfigurationParams object -// -// There are no default values defined in the spec. -func NewCreateConfigurationParams() CreateConfigurationParams { - - return CreateConfigurationParams{} -} - -// CreateConfigurationParams contains all the bound params for the create configuration operation -// typically these are obtained from a http.Request -// -// swagger:parameters CreateConfiguration -type CreateConfigurationParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.IdpServerConfiguration - /*IDP Configuration Type - Required: true - In: path - */ - Type 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 NewCreateConfigurationParams() beforehand. -func (o *CreateConfigurationParams) 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.IdpServerConfiguration - 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", "")) - } - - rType, rhkType, _ := route.Params.GetOK("type") - if err := o.bindType(rType, rhkType, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindType binds and validates parameter Type from path. -func (o *CreateConfigurationParams) bindType(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.Type = raw - - return nil -} diff --git a/api/operations/idp/create_configuration_responses.go b/api/operations/idp/create_configuration_responses.go deleted file mode 100644 index 9a28b534a7..0000000000 --- a/api/operations/idp/create_configuration_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 idp - -// 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" -) - -// CreateConfigurationCreatedCode is the HTTP code returned for type CreateConfigurationCreated -const CreateConfigurationCreatedCode int = 201 - -/* -CreateConfigurationCreated A successful response. - -swagger:response createConfigurationCreated -*/ -type CreateConfigurationCreated struct { - - /* - In: Body - */ - Payload *models.SetIDPResponse `json:"body,omitempty"` -} - -// NewCreateConfigurationCreated creates CreateConfigurationCreated with default headers values -func NewCreateConfigurationCreated() *CreateConfigurationCreated { - - return &CreateConfigurationCreated{} -} - -// WithPayload adds the payload to the create configuration created response -func (o *CreateConfigurationCreated) WithPayload(payload *models.SetIDPResponse) *CreateConfigurationCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create configuration created response -func (o *CreateConfigurationCreated) SetPayload(payload *models.SetIDPResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateConfigurationCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateConfigurationDefault Generic error response. - -swagger:response createConfigurationDefault -*/ -type CreateConfigurationDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewCreateConfigurationDefault creates CreateConfigurationDefault with default headers values -func NewCreateConfigurationDefault(code int) *CreateConfigurationDefault { - if code <= 0 { - code = 500 - } - - return &CreateConfigurationDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create configuration default response -func (o *CreateConfigurationDefault) WithStatusCode(code int) *CreateConfigurationDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create configuration default response -func (o *CreateConfigurationDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the create configuration default response -func (o *CreateConfigurationDefault) WithPayload(payload *models.APIError) *CreateConfigurationDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create configuration default response -func (o *CreateConfigurationDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateConfigurationDefault) 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/idp/create_configuration_urlbuilder.go b/api/operations/idp/create_configuration_urlbuilder.go deleted file mode 100644 index f0bd9ebb78..0000000000 --- a/api/operations/idp/create_configuration_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 idp - -// 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" -) - -// CreateConfigurationURL generates an URL for the create configuration operation -type CreateConfigurationURL struct { - Type 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 *CreateConfigurationURL) WithBasePath(bp string) *CreateConfigurationURL { - 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 *CreateConfigurationURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateConfigurationURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/idp/{type}" - - typeVar := o.Type - if typeVar != "" { - _path = strings.Replace(_path, "{type}", typeVar, -1) - } else { - return nil, errors.New("type is required on CreateConfigurationURL") - } - - _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 *CreateConfigurationURL) 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 *CreateConfigurationURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateConfigurationURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateConfigurationURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateConfigurationURL") - } - - 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 *CreateConfigurationURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/idp/delete_configuration.go b/api/operations/idp/delete_configuration.go deleted file mode 100644 index c66a143744..0000000000 --- a/api/operations/idp/delete_configuration.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 idp - -// 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" -) - -// DeleteConfigurationHandlerFunc turns a function with the right signature into a delete configuration handler -type DeleteConfigurationHandlerFunc func(DeleteConfigurationParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteConfigurationHandlerFunc) Handle(params DeleteConfigurationParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// DeleteConfigurationHandler interface for that can handle valid delete configuration params -type DeleteConfigurationHandler interface { - Handle(DeleteConfigurationParams, *models.Principal) middleware.Responder -} - -// NewDeleteConfiguration creates a new http.Handler for the delete configuration operation -func NewDeleteConfiguration(ctx *middleware.Context, handler DeleteConfigurationHandler) *DeleteConfiguration { - return &DeleteConfiguration{Context: ctx, Handler: handler} -} - -/* - DeleteConfiguration swagger:route DELETE /idp/{type}/{name} idp deleteConfiguration - -Delete IDP Configuration -*/ -type DeleteConfiguration struct { - Context *middleware.Context - Handler DeleteConfigurationHandler -} - -func (o *DeleteConfiguration) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteConfigurationParams() - 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/idp/delete_configuration_parameters.go b/api/operations/idp/delete_configuration_parameters.go deleted file mode 100644 index f0e58e6ccc..0000000000 --- a/api/operations/idp/delete_configuration_parameters.go +++ /dev/null @@ -1,112 +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 idp - -// 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" -) - -// NewDeleteConfigurationParams creates a new DeleteConfigurationParams object -// -// There are no default values defined in the spec. -func NewDeleteConfigurationParams() DeleteConfigurationParams { - - return DeleteConfigurationParams{} -} - -// DeleteConfigurationParams contains all the bound params for the delete configuration operation -// typically these are obtained from a http.Request -// -// swagger:parameters DeleteConfiguration -type DeleteConfigurationParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*IDP Configuration Name - Required: true - In: path - */ - Name string - /*IDP Configuration Type - Required: true - In: path - */ - Type 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 NewDeleteConfigurationParams() beforehand. -func (o *DeleteConfigurationParams) 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) - } - - rType, rhkType, _ := route.Params.GetOK("type") - if err := o.bindType(rType, rhkType, 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 *DeleteConfigurationParams) 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 -} - -// bindType binds and validates parameter Type from path. -func (o *DeleteConfigurationParams) bindType(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.Type = raw - - return nil -} diff --git a/api/operations/idp/delete_configuration_responses.go b/api/operations/idp/delete_configuration_responses.go deleted file mode 100644 index 8d72e0e32a..0000000000 --- a/api/operations/idp/delete_configuration_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 idp - -// 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" -) - -// DeleteConfigurationOKCode is the HTTP code returned for type DeleteConfigurationOK -const DeleteConfigurationOKCode int = 200 - -/* -DeleteConfigurationOK A successful response. - -swagger:response deleteConfigurationOK -*/ -type DeleteConfigurationOK struct { - - /* - In: Body - */ - Payload *models.SetIDPResponse `json:"body,omitempty"` -} - -// NewDeleteConfigurationOK creates DeleteConfigurationOK with default headers values -func NewDeleteConfigurationOK() *DeleteConfigurationOK { - - return &DeleteConfigurationOK{} -} - -// WithPayload adds the payload to the delete configuration o k response -func (o *DeleteConfigurationOK) WithPayload(payload *models.SetIDPResponse) *DeleteConfigurationOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete configuration o k response -func (o *DeleteConfigurationOK) SetPayload(payload *models.SetIDPResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteConfigurationOK) 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 - } - } -} - -/* -DeleteConfigurationDefault Generic error response. - -swagger:response deleteConfigurationDefault -*/ -type DeleteConfigurationDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewDeleteConfigurationDefault creates DeleteConfigurationDefault with default headers values -func NewDeleteConfigurationDefault(code int) *DeleteConfigurationDefault { - if code <= 0 { - code = 500 - } - - return &DeleteConfigurationDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete configuration default response -func (o *DeleteConfigurationDefault) WithStatusCode(code int) *DeleteConfigurationDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete configuration default response -func (o *DeleteConfigurationDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the delete configuration default response -func (o *DeleteConfigurationDefault) WithPayload(payload *models.APIError) *DeleteConfigurationDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete configuration default response -func (o *DeleteConfigurationDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteConfigurationDefault) 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/idp/delete_configuration_urlbuilder.go b/api/operations/idp/delete_configuration_urlbuilder.go deleted file mode 100644 index 561dbaf101..0000000000 --- a/api/operations/idp/delete_configuration_urlbuilder.go +++ /dev/null @@ -1,124 +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 idp - -// 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" -) - -// DeleteConfigurationURL generates an URL for the delete configuration operation -type DeleteConfigurationURL struct { - Name string - Type 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 *DeleteConfigurationURL) WithBasePath(bp string) *DeleteConfigurationURL { - 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 *DeleteConfigurationURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteConfigurationURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/idp/{type}/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on DeleteConfigurationURL") - } - - typeVar := o.Type - if typeVar != "" { - _path = strings.Replace(_path, "{type}", typeVar, -1) - } else { - return nil, errors.New("type is required on DeleteConfigurationURL") - } - - _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 *DeleteConfigurationURL) 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 *DeleteConfigurationURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteConfigurationURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteConfigurationURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteConfigurationURL") - } - - 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 *DeleteConfigurationURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/idp/get_configuration.go b/api/operations/idp/get_configuration.go deleted file mode 100644 index cf0dc12a64..0000000000 --- a/api/operations/idp/get_configuration.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 idp - -// 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" -) - -// GetConfigurationHandlerFunc turns a function with the right signature into a get configuration handler -type GetConfigurationHandlerFunc func(GetConfigurationParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetConfigurationHandlerFunc) Handle(params GetConfigurationParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// GetConfigurationHandler interface for that can handle valid get configuration params -type GetConfigurationHandler interface { - Handle(GetConfigurationParams, *models.Principal) middleware.Responder -} - -// NewGetConfiguration creates a new http.Handler for the get configuration operation -func NewGetConfiguration(ctx *middleware.Context, handler GetConfigurationHandler) *GetConfiguration { - return &GetConfiguration{Context: ctx, Handler: handler} -} - -/* - GetConfiguration swagger:route GET /idp/{type}/{name} idp getConfiguration - -Get IDP Configuration -*/ -type GetConfiguration struct { - Context *middleware.Context - Handler GetConfigurationHandler -} - -func (o *GetConfiguration) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetConfigurationParams() - 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/idp/get_configuration_parameters.go b/api/operations/idp/get_configuration_parameters.go deleted file mode 100644 index 47bcab428e..0000000000 --- a/api/operations/idp/get_configuration_parameters.go +++ /dev/null @@ -1,112 +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 idp - -// 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" -) - -// NewGetConfigurationParams creates a new GetConfigurationParams object -// -// There are no default values defined in the spec. -func NewGetConfigurationParams() GetConfigurationParams { - - return GetConfigurationParams{} -} - -// GetConfigurationParams contains all the bound params for the get configuration operation -// typically these are obtained from a http.Request -// -// swagger:parameters GetConfiguration -type GetConfigurationParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*IDP Configuration Name - Required: true - In: path - */ - Name string - /*IDP Configuration Type - Required: true - In: path - */ - Type 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 NewGetConfigurationParams() beforehand. -func (o *GetConfigurationParams) 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) - } - - rType, rhkType, _ := route.Params.GetOK("type") - if err := o.bindType(rType, rhkType, 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 *GetConfigurationParams) 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 -} - -// bindType binds and validates parameter Type from path. -func (o *GetConfigurationParams) bindType(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.Type = raw - - return nil -} diff --git a/api/operations/idp/get_configuration_responses.go b/api/operations/idp/get_configuration_responses.go deleted file mode 100644 index 8e07dcb510..0000000000 --- a/api/operations/idp/get_configuration_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 idp - -// 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" -) - -// GetConfigurationOKCode is the HTTP code returned for type GetConfigurationOK -const GetConfigurationOKCode int = 200 - -/* -GetConfigurationOK A successful response. - -swagger:response getConfigurationOK -*/ -type GetConfigurationOK struct { - - /* - In: Body - */ - Payload *models.IdpServerConfiguration `json:"body,omitempty"` -} - -// NewGetConfigurationOK creates GetConfigurationOK with default headers values -func NewGetConfigurationOK() *GetConfigurationOK { - - return &GetConfigurationOK{} -} - -// WithPayload adds the payload to the get configuration o k response -func (o *GetConfigurationOK) WithPayload(payload *models.IdpServerConfiguration) *GetConfigurationOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get configuration o k response -func (o *GetConfigurationOK) SetPayload(payload *models.IdpServerConfiguration) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetConfigurationOK) 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 - } - } -} - -/* -GetConfigurationDefault Generic error response. - -swagger:response getConfigurationDefault -*/ -type GetConfigurationDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewGetConfigurationDefault creates GetConfigurationDefault with default headers values -func NewGetConfigurationDefault(code int) *GetConfigurationDefault { - if code <= 0 { - code = 500 - } - - return &GetConfigurationDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get configuration default response -func (o *GetConfigurationDefault) WithStatusCode(code int) *GetConfigurationDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get configuration default response -func (o *GetConfigurationDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the get configuration default response -func (o *GetConfigurationDefault) WithPayload(payload *models.APIError) *GetConfigurationDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get configuration default response -func (o *GetConfigurationDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetConfigurationDefault) 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/idp/get_configuration_urlbuilder.go b/api/operations/idp/get_configuration_urlbuilder.go deleted file mode 100644 index a5db53bd7f..0000000000 --- a/api/operations/idp/get_configuration_urlbuilder.go +++ /dev/null @@ -1,124 +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 idp - -// 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" -) - -// GetConfigurationURL generates an URL for the get configuration operation -type GetConfigurationURL struct { - Name string - Type 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 *GetConfigurationURL) WithBasePath(bp string) *GetConfigurationURL { - 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 *GetConfigurationURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetConfigurationURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/idp/{type}/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetConfigurationURL") - } - - typeVar := o.Type - if typeVar != "" { - _path = strings.Replace(_path, "{type}", typeVar, -1) - } else { - return nil, errors.New("type is required on GetConfigurationURL") - } - - _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 *GetConfigurationURL) 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 *GetConfigurationURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetConfigurationURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetConfigurationURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetConfigurationURL") - } - - 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 *GetConfigurationURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/idp/get_l_d_a_p_entities.go b/api/operations/idp/get_l_d_a_p_entities.go deleted file mode 100644 index 0c3d97ce51..0000000000 --- a/api/operations/idp/get_l_d_a_p_entities.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 idp - -// 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" -) - -// GetLDAPEntitiesHandlerFunc turns a function with the right signature into a get l d a p entities handler -type GetLDAPEntitiesHandlerFunc func(GetLDAPEntitiesParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetLDAPEntitiesHandlerFunc) Handle(params GetLDAPEntitiesParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// GetLDAPEntitiesHandler interface for that can handle valid get l d a p entities params -type GetLDAPEntitiesHandler interface { - Handle(GetLDAPEntitiesParams, *models.Principal) middleware.Responder -} - -// NewGetLDAPEntities creates a new http.Handler for the get l d a p entities operation -func NewGetLDAPEntities(ctx *middleware.Context, handler GetLDAPEntitiesHandler) *GetLDAPEntities { - return &GetLDAPEntities{Context: ctx, Handler: handler} -} - -/* - GetLDAPEntities swagger:route POST /ldap-entities idp getLDAPEntities - -Get LDAP Entities -*/ -type GetLDAPEntities struct { - Context *middleware.Context - Handler GetLDAPEntitiesHandler -} - -func (o *GetLDAPEntities) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetLDAPEntitiesParams() - 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/idp/get_l_d_a_p_entities_parameters.go b/api/operations/idp/get_l_d_a_p_entities_parameters.go deleted file mode 100644 index 83bdfed1b2..0000000000 --- a/api/operations/idp/get_l_d_a_p_entities_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 idp - -// 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" -) - -// NewGetLDAPEntitiesParams creates a new GetLDAPEntitiesParams object -// -// There are no default values defined in the spec. -func NewGetLDAPEntitiesParams() GetLDAPEntitiesParams { - - return GetLDAPEntitiesParams{} -} - -// GetLDAPEntitiesParams contains all the bound params for the get l d a p entities operation -// typically these are obtained from a http.Request -// -// swagger:parameters GetLDAPEntities -type GetLDAPEntitiesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.LdapEntitiesRequest -} - -// 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 NewGetLDAPEntitiesParams() beforehand. -func (o *GetLDAPEntitiesParams) 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.LdapEntitiesRequest - 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/idp/get_l_d_a_p_entities_responses.go b/api/operations/idp/get_l_d_a_p_entities_responses.go deleted file mode 100644 index dcfed987db..0000000000 --- a/api/operations/idp/get_l_d_a_p_entities_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 idp - -// 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" -) - -// GetLDAPEntitiesOKCode is the HTTP code returned for type GetLDAPEntitiesOK -const GetLDAPEntitiesOKCode int = 200 - -/* -GetLDAPEntitiesOK A successful response. - -swagger:response getLDAPEntitiesOK -*/ -type GetLDAPEntitiesOK struct { - - /* - In: Body - */ - Payload *models.LdapEntities `json:"body,omitempty"` -} - -// NewGetLDAPEntitiesOK creates GetLDAPEntitiesOK with default headers values -func NewGetLDAPEntitiesOK() *GetLDAPEntitiesOK { - - return &GetLDAPEntitiesOK{} -} - -// WithPayload adds the payload to the get l d a p entities o k response -func (o *GetLDAPEntitiesOK) WithPayload(payload *models.LdapEntities) *GetLDAPEntitiesOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get l d a p entities o k response -func (o *GetLDAPEntitiesOK) SetPayload(payload *models.LdapEntities) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetLDAPEntitiesOK) 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 - } - } -} - -/* -GetLDAPEntitiesDefault Generic error response. - -swagger:response getLDAPEntitiesDefault -*/ -type GetLDAPEntitiesDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewGetLDAPEntitiesDefault creates GetLDAPEntitiesDefault with default headers values -func NewGetLDAPEntitiesDefault(code int) *GetLDAPEntitiesDefault { - if code <= 0 { - code = 500 - } - - return &GetLDAPEntitiesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get l d a p entities default response -func (o *GetLDAPEntitiesDefault) WithStatusCode(code int) *GetLDAPEntitiesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get l d a p entities default response -func (o *GetLDAPEntitiesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the get l d a p entities default response -func (o *GetLDAPEntitiesDefault) WithPayload(payload *models.APIError) *GetLDAPEntitiesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get l d a p entities default response -func (o *GetLDAPEntitiesDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetLDAPEntitiesDefault) 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/idp/get_l_d_a_p_entities_urlbuilder.go b/api/operations/idp/get_l_d_a_p_entities_urlbuilder.go deleted file mode 100644 index 22e6fae570..0000000000 --- a/api/operations/idp/get_l_d_a_p_entities_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 idp - -// 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" -) - -// GetLDAPEntitiesURL generates an URL for the get l d a p entities operation -type GetLDAPEntitiesURL 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 *GetLDAPEntitiesURL) WithBasePath(bp string) *GetLDAPEntitiesURL { - 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 *GetLDAPEntitiesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetLDAPEntitiesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/ldap-entities" - - _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 *GetLDAPEntitiesURL) 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 *GetLDAPEntitiesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetLDAPEntitiesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetLDAPEntitiesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetLDAPEntitiesURL") - } - - 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 *GetLDAPEntitiesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/idp/list_configurations_parameters.go b/api/operations/idp/list_configurations_parameters.go deleted file mode 100644 index 2a4f2500bb..0000000000 --- a/api/operations/idp/list_configurations_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 idp - -// 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" -) - -// NewListConfigurationsParams creates a new ListConfigurationsParams object -// -// There are no default values defined in the spec. -func NewListConfigurationsParams() ListConfigurationsParams { - - return ListConfigurationsParams{} -} - -// ListConfigurationsParams contains all the bound params for the list configurations operation -// typically these are obtained from a http.Request -// -// swagger:parameters ListConfigurations -type ListConfigurationsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*IDP Configuration Type - Required: true - In: path - */ - Type 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 NewListConfigurationsParams() beforehand. -func (o *ListConfigurationsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rType, rhkType, _ := route.Params.GetOK("type") - if err := o.bindType(rType, rhkType, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindType binds and validates parameter Type from path. -func (o *ListConfigurationsParams) bindType(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.Type = raw - - return nil -} diff --git a/api/operations/idp/list_configurations_responses.go b/api/operations/idp/list_configurations_responses.go deleted file mode 100644 index 2ed1ab42f6..0000000000 --- a/api/operations/idp/list_configurations_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 idp - -// 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" -) - -// ListConfigurationsOKCode is the HTTP code returned for type ListConfigurationsOK -const ListConfigurationsOKCode int = 200 - -/* -ListConfigurationsOK A successful response. - -swagger:response listConfigurationsOK -*/ -type ListConfigurationsOK struct { - - /* - In: Body - */ - Payload *models.IdpListConfigurationsResponse `json:"body,omitempty"` -} - -// NewListConfigurationsOK creates ListConfigurationsOK with default headers values -func NewListConfigurationsOK() *ListConfigurationsOK { - - return &ListConfigurationsOK{} -} - -// WithPayload adds the payload to the list configurations o k response -func (o *ListConfigurationsOK) WithPayload(payload *models.IdpListConfigurationsResponse) *ListConfigurationsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list configurations o k response -func (o *ListConfigurationsOK) SetPayload(payload *models.IdpListConfigurationsResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListConfigurationsOK) 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 - } - } -} - -/* -ListConfigurationsDefault Generic error response. - -swagger:response listConfigurationsDefault -*/ -type ListConfigurationsDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewListConfigurationsDefault creates ListConfigurationsDefault with default headers values -func NewListConfigurationsDefault(code int) *ListConfigurationsDefault { - if code <= 0 { - code = 500 - } - - return &ListConfigurationsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the list configurations default response -func (o *ListConfigurationsDefault) WithStatusCode(code int) *ListConfigurationsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the list configurations default response -func (o *ListConfigurationsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the list configurations default response -func (o *ListConfigurationsDefault) WithPayload(payload *models.APIError) *ListConfigurationsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list configurations default response -func (o *ListConfigurationsDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListConfigurationsDefault) 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/idp/list_configurations_urlbuilder.go b/api/operations/idp/list_configurations_urlbuilder.go deleted file mode 100644 index a3f4bdcd1a..0000000000 --- a/api/operations/idp/list_configurations_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 idp - -// 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" -) - -// ListConfigurationsURL generates an URL for the list configurations operation -type ListConfigurationsURL struct { - Type 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 *ListConfigurationsURL) WithBasePath(bp string) *ListConfigurationsURL { - 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 *ListConfigurationsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ListConfigurationsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/idp/{type}" - - typeVar := o.Type - if typeVar != "" { - _path = strings.Replace(_path, "{type}", typeVar, -1) - } else { - return nil, errors.New("type is required on ListConfigurationsURL") - } - - _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 *ListConfigurationsURL) 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 *ListConfigurationsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ListConfigurationsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ListConfigurationsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ListConfigurationsURL") - } - - 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 *ListConfigurationsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/idp/update_configuration.go b/api/operations/idp/update_configuration.go deleted file mode 100644 index a0b3550659..0000000000 --- a/api/operations/idp/update_configuration.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 idp - -// 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" -) - -// UpdateConfigurationHandlerFunc turns a function with the right signature into a update configuration handler -type UpdateConfigurationHandlerFunc func(UpdateConfigurationParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn UpdateConfigurationHandlerFunc) Handle(params UpdateConfigurationParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// UpdateConfigurationHandler interface for that can handle valid update configuration params -type UpdateConfigurationHandler interface { - Handle(UpdateConfigurationParams, *models.Principal) middleware.Responder -} - -// NewUpdateConfiguration creates a new http.Handler for the update configuration operation -func NewUpdateConfiguration(ctx *middleware.Context, handler UpdateConfigurationHandler) *UpdateConfiguration { - return &UpdateConfiguration{Context: ctx, Handler: handler} -} - -/* - UpdateConfiguration swagger:route PUT /idp/{type}/{name} idp updateConfiguration - -Update IDP Configuration -*/ -type UpdateConfiguration struct { - Context *middleware.Context - Handler UpdateConfigurationHandler -} - -func (o *UpdateConfiguration) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewUpdateConfigurationParams() - 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/idp/update_configuration_parameters.go b/api/operations/idp/update_configuration_parameters.go deleted file mode 100644 index 52134ce09a..0000000000 --- a/api/operations/idp/update_configuration_parameters.go +++ /dev/null @@ -1,150 +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 idp - -// 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" -) - -// NewUpdateConfigurationParams creates a new UpdateConfigurationParams object -// -// There are no default values defined in the spec. -func NewUpdateConfigurationParams() UpdateConfigurationParams { - - return UpdateConfigurationParams{} -} - -// UpdateConfigurationParams contains all the bound params for the update configuration operation -// typically these are obtained from a http.Request -// -// swagger:parameters UpdateConfiguration -type UpdateConfigurationParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.IdpServerConfiguration - /*IDP Configuration Name - Required: true - In: path - */ - Name string - /*IDP Configuration Type - Required: true - In: path - */ - Type 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 NewUpdateConfigurationParams() beforehand. -func (o *UpdateConfigurationParams) 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.IdpServerConfiguration - 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) - } - - rType, rhkType, _ := route.Params.GetOK("type") - if err := o.bindType(rType, rhkType, 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 *UpdateConfigurationParams) 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 -} - -// bindType binds and validates parameter Type from path. -func (o *UpdateConfigurationParams) bindType(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.Type = raw - - return nil -} diff --git a/api/operations/idp/update_configuration_responses.go b/api/operations/idp/update_configuration_responses.go deleted file mode 100644 index 92bd1025b3..0000000000 --- a/api/operations/idp/update_configuration_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 idp - -// 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" -) - -// UpdateConfigurationOKCode is the HTTP code returned for type UpdateConfigurationOK -const UpdateConfigurationOKCode int = 200 - -/* -UpdateConfigurationOK A successful response. - -swagger:response updateConfigurationOK -*/ -type UpdateConfigurationOK struct { - - /* - In: Body - */ - Payload *models.SetIDPResponse `json:"body,omitempty"` -} - -// NewUpdateConfigurationOK creates UpdateConfigurationOK with default headers values -func NewUpdateConfigurationOK() *UpdateConfigurationOK { - - return &UpdateConfigurationOK{} -} - -// WithPayload adds the payload to the update configuration o k response -func (o *UpdateConfigurationOK) WithPayload(payload *models.SetIDPResponse) *UpdateConfigurationOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the update configuration o k response -func (o *UpdateConfigurationOK) SetPayload(payload *models.SetIDPResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *UpdateConfigurationOK) 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 - } - } -} - -/* -UpdateConfigurationDefault Generic error response. - -swagger:response updateConfigurationDefault -*/ -type UpdateConfigurationDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewUpdateConfigurationDefault creates UpdateConfigurationDefault with default headers values -func NewUpdateConfigurationDefault(code int) *UpdateConfigurationDefault { - if code <= 0 { - code = 500 - } - - return &UpdateConfigurationDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the update configuration default response -func (o *UpdateConfigurationDefault) WithStatusCode(code int) *UpdateConfigurationDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the update configuration default response -func (o *UpdateConfigurationDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the update configuration default response -func (o *UpdateConfigurationDefault) WithPayload(payload *models.APIError) *UpdateConfigurationDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the update configuration default response -func (o *UpdateConfigurationDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *UpdateConfigurationDefault) 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/idp/update_configuration_urlbuilder.go b/api/operations/idp/update_configuration_urlbuilder.go deleted file mode 100644 index 6bda80f40e..0000000000 --- a/api/operations/idp/update_configuration_urlbuilder.go +++ /dev/null @@ -1,124 +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 idp - -// 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" -) - -// UpdateConfigurationURL generates an URL for the update configuration operation -type UpdateConfigurationURL struct { - Name string - Type 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 *UpdateConfigurationURL) WithBasePath(bp string) *UpdateConfigurationURL { - 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 *UpdateConfigurationURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *UpdateConfigurationURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/idp/{type}/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on UpdateConfigurationURL") - } - - typeVar := o.Type - if typeVar != "" { - _path = strings.Replace(_path, "{type}", typeVar, -1) - } else { - return nil, errors.New("type is required on UpdateConfigurationURL") - } - - _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 *UpdateConfigurationURL) 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 *UpdateConfigurationURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *UpdateConfigurationURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on UpdateConfigurationURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on UpdateConfigurationURL") - } - - 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 *UpdateConfigurationURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/inspect/inspect.go b/api/operations/inspect/inspect.go deleted file mode 100644 index 4f54222ed1..0000000000 --- a/api/operations/inspect/inspect.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 inspect - -// 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" -) - -// InspectHandlerFunc turns a function with the right signature into a inspect handler -type InspectHandlerFunc func(InspectParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn InspectHandlerFunc) Handle(params InspectParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// InspectHandler interface for that can handle valid inspect params -type InspectHandler interface { - Handle(InspectParams, *models.Principal) middleware.Responder -} - -// NewInspect creates a new http.Handler for the inspect operation -func NewInspect(ctx *middleware.Context, handler InspectHandler) *Inspect { - return &Inspect{Context: ctx, Handler: handler} -} - -/* - Inspect swagger:route GET /admin/inspect Inspect inspect - -Inspect Files on Drive -*/ -type Inspect struct { - Context *middleware.Context - Handler InspectHandler -} - -func (o *Inspect) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewInspectParams() - 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/inspect/inspect_parameters.go b/api/operations/inspect/inspect_parameters.go deleted file mode 100644 index 20dce92e81..0000000000 --- a/api/operations/inspect/inspect_parameters.go +++ /dev/null @@ -1,163 +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 inspect - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// NewInspectParams creates a new InspectParams object -// -// There are no default values defined in the spec. -func NewInspectParams() InspectParams { - - return InspectParams{} -} - -// InspectParams contains all the bound params for the inspect operation -// typically these are obtained from a http.Request -// -// swagger:parameters Inspect -type InspectParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - In: query - */ - Encrypt *bool - /* - Required: true - In: query - */ - File string - /* - Required: true - In: query - */ - Volume 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 NewInspectParams() beforehand. -func (o *InspectParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qEncrypt, qhkEncrypt, _ := qs.GetOK("encrypt") - if err := o.bindEncrypt(qEncrypt, qhkEncrypt, route.Formats); err != nil { - res = append(res, err) - } - - qFile, qhkFile, _ := qs.GetOK("file") - if err := o.bindFile(qFile, qhkFile, route.Formats); err != nil { - res = append(res, err) - } - - qVolume, qhkVolume, _ := qs.GetOK("volume") - if err := o.bindVolume(qVolume, qhkVolume, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindEncrypt binds and validates parameter Encrypt from query. -func (o *InspectParams) bindEncrypt(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 - } - - value, err := swag.ConvertBool(raw) - if err != nil { - return errors.InvalidType("encrypt", "query", "bool", raw) - } - o.Encrypt = &value - - return nil -} - -// bindFile binds and validates parameter File from query. -func (o *InspectParams) bindFile(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("file", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("file", "query", raw); err != nil { - return err - } - o.File = raw - - return nil -} - -// bindVolume binds and validates parameter Volume from query. -func (o *InspectParams) bindVolume(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("volume", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("volume", "query", raw); err != nil { - return err - } - o.Volume = raw - - return nil -} diff --git a/api/operations/inspect/inspect_responses.go b/api/operations/inspect/inspect_responses.go deleted file mode 100644 index 6e5d23a7df..0000000000 --- a/api/operations/inspect/inspect_responses.go +++ /dev/null @@ -1,134 +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 inspect - -// 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/runtime" - - "github.com/minio/console/models" -) - -// InspectOKCode is the HTTP code returned for type InspectOK -const InspectOKCode int = 200 - -/* -InspectOK A successful response. - -swagger:response inspectOK -*/ -type InspectOK struct { - - /* - In: Body - */ - Payload io.ReadCloser `json:"body,omitempty"` -} - -// NewInspectOK creates InspectOK with default headers values -func NewInspectOK() *InspectOK { - - return &InspectOK{} -} - -// WithPayload adds the payload to the inspect o k response -func (o *InspectOK) WithPayload(payload io.ReadCloser) *InspectOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the inspect o k response -func (o *InspectOK) SetPayload(payload io.ReadCloser) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *InspectOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -InspectDefault Generic error response. - -swagger:response inspectDefault -*/ -type InspectDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewInspectDefault creates InspectDefault with default headers values -func NewInspectDefault(code int) *InspectDefault { - if code <= 0 { - code = 500 - } - - return &InspectDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the inspect default response -func (o *InspectDefault) WithStatusCode(code int) *InspectDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the inspect default response -func (o *InspectDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the inspect default response -func (o *InspectDefault) WithPayload(payload *models.APIError) *InspectDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the inspect default response -func (o *InspectDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *InspectDefault) 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/inspect/inspect_urlbuilder.go b/api/operations/inspect/inspect_urlbuilder.go deleted file mode 100644 index 64548ae948..0000000000 --- a/api/operations/inspect/inspect_urlbuilder.go +++ /dev/null @@ -1,134 +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 inspect - -// 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" - - "github.com/go-openapi/swag" -) - -// InspectURL generates an URL for the inspect operation -type InspectURL struct { - Encrypt *bool - File string - Volume 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 *InspectURL) WithBasePath(bp string) *InspectURL { - 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 *InspectURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *InspectURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/admin/inspect" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var encryptQ string - if o.Encrypt != nil { - encryptQ = swag.FormatBool(*o.Encrypt) - } - if encryptQ != "" { - qs.Set("encrypt", encryptQ) - } - - fileQ := o.File - if fileQ != "" { - qs.Set("file", fileQ) - } - - volumeQ := o.Volume - if volumeQ != "" { - qs.Set("volume", volumeQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *InspectURL) 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 *InspectURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *InspectURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on InspectURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on InspectURL") - } - - 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 *InspectURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/k_m_s/k_m_s_a_p_is.go b/api/operations/k_m_s/k_m_s_a_p_is.go deleted file mode 100644 index 4757d4759d..0000000000 --- a/api/operations/k_m_s/k_m_s_a_p_is.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" -) - -// KMSAPIsHandlerFunc turns a function with the right signature into a k m s a p is handler -type KMSAPIsHandlerFunc func(KMSAPIsParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn KMSAPIsHandlerFunc) Handle(params KMSAPIsParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// KMSAPIsHandler interface for that can handle valid k m s a p is params -type KMSAPIsHandler interface { - Handle(KMSAPIsParams, *models.Principal) middleware.Responder -} - -// NewKMSAPIs creates a new http.Handler for the k m s a p is operation -func NewKMSAPIs(ctx *middleware.Context, handler KMSAPIsHandler) *KMSAPIs { - return &KMSAPIs{Context: ctx, Handler: handler} -} - -/* - KMSAPIs swagger:route GET /kms/apis KMS kMSAPIs - -KMS apis -*/ -type KMSAPIs struct { - Context *middleware.Context - Handler KMSAPIsHandler -} - -func (o *KMSAPIs) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewKMSAPIsParams() - 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_a_p_is_parameters.go b/api/operations/k_m_s/k_m_s_a_p_is_parameters.go deleted file mode 100644 index 7c7bcaa190..0000000000 --- a/api/operations/k_m_s/k_m_s_a_p_is_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" -) - -// NewKMSAPIsParams creates a new KMSAPIsParams object -// -// There are no default values defined in the spec. -func NewKMSAPIsParams() KMSAPIsParams { - - return KMSAPIsParams{} -} - -// KMSAPIsParams contains all the bound params for the k m s a p is operation -// typically these are obtained from a http.Request -// -// swagger:parameters KMSAPIs -type KMSAPIsParams 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 NewKMSAPIsParams() beforehand. -func (o *KMSAPIsParams) 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_a_p_is_responses.go b/api/operations/k_m_s/k_m_s_a_p_is_responses.go deleted file mode 100644 index af13ba7502..0000000000 --- a/api/operations/k_m_s/k_m_s_a_p_is_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" -) - -// KMSAPIsOKCode is the HTTP code returned for type KMSAPIsOK -const KMSAPIsOKCode int = 200 - -/* -KMSAPIsOK A successful response. - -swagger:response kMSAPIsOK -*/ -type KMSAPIsOK struct { - - /* - In: Body - */ - Payload *models.KmsAPIsResponse `json:"body,omitempty"` -} - -// NewKMSAPIsOK creates KMSAPIsOK with default headers values -func NewKMSAPIsOK() *KMSAPIsOK { - - return &KMSAPIsOK{} -} - -// WithPayload adds the payload to the k m s a p is o k response -func (o *KMSAPIsOK) WithPayload(payload *models.KmsAPIsResponse) *KMSAPIsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the k m s a p is o k response -func (o *KMSAPIsOK) SetPayload(payload *models.KmsAPIsResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *KMSAPIsOK) 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 - } - } -} - -/* -KMSAPIsDefault Generic error response. - -swagger:response kMSAPIsDefault -*/ -type KMSAPIsDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewKMSAPIsDefault creates KMSAPIsDefault with default headers values -func NewKMSAPIsDefault(code int) *KMSAPIsDefault { - if code <= 0 { - code = 500 - } - - return &KMSAPIsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the k m s a p is default response -func (o *KMSAPIsDefault) WithStatusCode(code int) *KMSAPIsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the k m s a p is default response -func (o *KMSAPIsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the k m s a p is default response -func (o *KMSAPIsDefault) WithPayload(payload *models.APIError) *KMSAPIsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the k m s a p is default response -func (o *KMSAPIsDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *KMSAPIsDefault) 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_a_p_is_urlbuilder.go b/api/operations/k_m_s/k_m_s_a_p_is_urlbuilder.go deleted file mode 100644 index 124924c7c2..0000000000 --- a/api/operations/k_m_s/k_m_s_a_p_is_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" -) - -// KMSAPIsURL generates an URL for the k m s a p is operation -type KMSAPIsURL 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 *KMSAPIsURL) WithBasePath(bp string) *KMSAPIsURL { - 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 *KMSAPIsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *KMSAPIsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/kms/apis" - - _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 *KMSAPIsURL) 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 *KMSAPIsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *KMSAPIsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on KMSAPIsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on KMSAPIsURL") - } - - 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 *KMSAPIsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/k_m_s/k_m_s_create_key.go b/api/operations/k_m_s/k_m_s_create_key.go deleted file mode 100644 index df651020b0..0000000000 --- a/api/operations/k_m_s/k_m_s_create_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" -) - -// KMSCreateKeyHandlerFunc turns a function with the right signature into a k m s create key handler -type KMSCreateKeyHandlerFunc func(KMSCreateKeyParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn KMSCreateKeyHandlerFunc) Handle(params KMSCreateKeyParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// KMSCreateKeyHandler interface for that can handle valid k m s create key params -type KMSCreateKeyHandler interface { - Handle(KMSCreateKeyParams, *models.Principal) middleware.Responder -} - -// NewKMSCreateKey creates a new http.Handler for the k m s create key operation -func NewKMSCreateKey(ctx *middleware.Context, handler KMSCreateKeyHandler) *KMSCreateKey { - return &KMSCreateKey{Context: ctx, Handler: handler} -} - -/* - KMSCreateKey swagger:route POST /kms/keys KMS kMSCreateKey - -KMS create key -*/ -type KMSCreateKey struct { - Context *middleware.Context - Handler KMSCreateKeyHandler -} - -func (o *KMSCreateKey) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewKMSCreateKeyParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/api/operations/k_m_s/k_m_s_create_key_parameters.go b/api/operations/k_m_s/k_m_s_create_key_parameters.go deleted file mode 100644 index 2cc8fb38c8..0000000000 --- a/api/operations/k_m_s/k_m_s_create_key_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" -) - -// NewKMSCreateKeyParams creates a new KMSCreateKeyParams object -// -// There are no default values defined in the spec. -func NewKMSCreateKeyParams() KMSCreateKeyParams { - - return KMSCreateKeyParams{} -} - -// KMSCreateKeyParams contains all the bound params for the k m s create key operation -// typically these are obtained from a http.Request -// -// swagger:parameters KMSCreateKey -type KMSCreateKeyParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.KmsCreateKeyRequest -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewKMSCreateKeyParams() beforehand. -func (o *KMSCreateKeyParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.KmsCreateKeyRequest - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("body", "body", "")) - } else { - res = append(res, errors.NewParseError("body", "body", "", err)) - } - } else { - // 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_create_key_responses.go b/api/operations/k_m_s/k_m_s_create_key_responses.go deleted file mode 100644 index 2746b4c0bb..0000000000 --- a/api/operations/k_m_s/k_m_s_create_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" -) - -// KMSCreateKeyCreatedCode is the HTTP code returned for type KMSCreateKeyCreated -const KMSCreateKeyCreatedCode int = 201 - -/* -KMSCreateKeyCreated A successful response. - -swagger:response kMSCreateKeyCreated -*/ -type KMSCreateKeyCreated struct { -} - -// NewKMSCreateKeyCreated creates KMSCreateKeyCreated with default headers values -func NewKMSCreateKeyCreated() *KMSCreateKeyCreated { - - return &KMSCreateKeyCreated{} -} - -// WriteResponse to the client -func (o *KMSCreateKeyCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(201) -} - -/* -KMSCreateKeyDefault Generic error response. - -swagger:response kMSCreateKeyDefault -*/ -type KMSCreateKeyDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewKMSCreateKeyDefault creates KMSCreateKeyDefault with default headers values -func NewKMSCreateKeyDefault(code int) *KMSCreateKeyDefault { - if code <= 0 { - code = 500 - } - - return &KMSCreateKeyDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the k m s create key default response -func (o *KMSCreateKeyDefault) WithStatusCode(code int) *KMSCreateKeyDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the k m s create key default response -func (o *KMSCreateKeyDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the k m s create key default response -func (o *KMSCreateKeyDefault) WithPayload(payload *models.APIError) *KMSCreateKeyDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the k m s create key default response -func (o *KMSCreateKeyDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *KMSCreateKeyDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/api/operations/k_m_s/k_m_s_create_key_urlbuilder.go b/api/operations/k_m_s/k_m_s_create_key_urlbuilder.go deleted file mode 100644 index 1b72d7beb0..0000000000 --- a/api/operations/k_m_s/k_m_s_create_key_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" -) - -// KMSCreateKeyURL generates an URL for the k m s create key operation -type KMSCreateKeyURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *KMSCreateKeyURL) WithBasePath(bp string) *KMSCreateKeyURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *KMSCreateKeyURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *KMSCreateKeyURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/kms/keys" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *KMSCreateKeyURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *KMSCreateKeyURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *KMSCreateKeyURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on KMSCreateKeyURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on KMSCreateKeyURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *KMSCreateKeyURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/k_m_s/k_m_s_key_status.go b/api/operations/k_m_s/k_m_s_key_status.go deleted file mode 100644 index a6bc30a68a..0000000000 --- a/api/operations/k_m_s/k_m_s_key_status.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" -) - -// KMSKeyStatusHandlerFunc turns a function with the right signature into a k m s key status handler -type KMSKeyStatusHandlerFunc func(KMSKeyStatusParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn KMSKeyStatusHandlerFunc) Handle(params KMSKeyStatusParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// KMSKeyStatusHandler interface for that can handle valid k m s key status params -type KMSKeyStatusHandler interface { - Handle(KMSKeyStatusParams, *models.Principal) middleware.Responder -} - -// NewKMSKeyStatus creates a new http.Handler for the k m s key status operation -func NewKMSKeyStatus(ctx *middleware.Context, handler KMSKeyStatusHandler) *KMSKeyStatus { - return &KMSKeyStatus{Context: ctx, Handler: handler} -} - -/* - KMSKeyStatus swagger:route GET /kms/keys/{name} KMS kMSKeyStatus - -KMS key status -*/ -type KMSKeyStatus struct { - Context *middleware.Context - Handler KMSKeyStatusHandler -} - -func (o *KMSKeyStatus) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewKMSKeyStatusParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/api/operations/k_m_s/k_m_s_key_status_parameters.go b/api/operations/k_m_s/k_m_s_key_status_parameters.go deleted file mode 100644 index aad1750457..0000000000 --- a/api/operations/k_m_s/k_m_s_key_status_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" -) - -// NewKMSKeyStatusParams creates a new KMSKeyStatusParams object -// -// There are no default values defined in the spec. -func NewKMSKeyStatusParams() KMSKeyStatusParams { - - return KMSKeyStatusParams{} -} - -// KMSKeyStatusParams contains all the bound params for the k m s key status operation -// typically these are obtained from a http.Request -// -// swagger:parameters KMSKeyStatus -type KMSKeyStatusParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*KMS key name - Required: true - In: path - */ - Name string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewKMSKeyStatusParams() beforehand. -func (o *KMSKeyStatusParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rName, rhkName, _ := route.Params.GetOK("name") - if err := o.bindName(rName, rhkName, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindName binds and validates parameter Name from path. -func (o *KMSKeyStatusParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // Parameter is provided by construction from the route - o.Name = raw - - return nil -} diff --git a/api/operations/k_m_s/k_m_s_key_status_responses.go b/api/operations/k_m_s/k_m_s_key_status_responses.go deleted file mode 100644 index 643865f2e3..0000000000 --- a/api/operations/k_m_s/k_m_s_key_status_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" -) - -// KMSKeyStatusOKCode is the HTTP code returned for type KMSKeyStatusOK -const KMSKeyStatusOKCode int = 200 - -/* -KMSKeyStatusOK A successful response. - -swagger:response kMSKeyStatusOK -*/ -type KMSKeyStatusOK struct { - - /* - In: Body - */ - Payload *models.KmsKeyStatusResponse `json:"body,omitempty"` -} - -// NewKMSKeyStatusOK creates KMSKeyStatusOK with default headers values -func NewKMSKeyStatusOK() *KMSKeyStatusOK { - - return &KMSKeyStatusOK{} -} - -// WithPayload adds the payload to the k m s key status o k response -func (o *KMSKeyStatusOK) WithPayload(payload *models.KmsKeyStatusResponse) *KMSKeyStatusOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the k m s key status o k response -func (o *KMSKeyStatusOK) SetPayload(payload *models.KmsKeyStatusResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *KMSKeyStatusOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -KMSKeyStatusDefault Generic error response. - -swagger:response kMSKeyStatusDefault -*/ -type KMSKeyStatusDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewKMSKeyStatusDefault creates KMSKeyStatusDefault with default headers values -func NewKMSKeyStatusDefault(code int) *KMSKeyStatusDefault { - if code <= 0 { - code = 500 - } - - return &KMSKeyStatusDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the k m s key status default response -func (o *KMSKeyStatusDefault) WithStatusCode(code int) *KMSKeyStatusDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the k m s key status default response -func (o *KMSKeyStatusDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the k m s key status default response -func (o *KMSKeyStatusDefault) WithPayload(payload *models.APIError) *KMSKeyStatusDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the k m s key status default response -func (o *KMSKeyStatusDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *KMSKeyStatusDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/api/operations/k_m_s/k_m_s_key_status_urlbuilder.go b/api/operations/k_m_s/k_m_s_key_status_urlbuilder.go deleted file mode 100644 index d417c3cb38..0000000000 --- a/api/operations/k_m_s/k_m_s_key_status_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" -) - -// KMSKeyStatusURL generates an URL for the k m s key status operation -type KMSKeyStatusURL struct { - Name string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *KMSKeyStatusURL) WithBasePath(bp string) *KMSKeyStatusURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *KMSKeyStatusURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *KMSKeyStatusURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/kms/keys/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on KMSKeyStatusURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *KMSKeyStatusURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *KMSKeyStatusURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *KMSKeyStatusURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on KMSKeyStatusURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on KMSKeyStatusURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *KMSKeyStatusURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/k_m_s/k_m_s_list_keys.go b/api/operations/k_m_s/k_m_s_list_keys.go deleted file mode 100644 index dc316b0a2b..0000000000 --- a/api/operations/k_m_s/k_m_s_list_keys.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" -) - -// KMSListKeysHandlerFunc turns a function with the right signature into a k m s list keys handler -type KMSListKeysHandlerFunc func(KMSListKeysParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn KMSListKeysHandlerFunc) Handle(params KMSListKeysParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// KMSListKeysHandler interface for that can handle valid k m s list keys params -type KMSListKeysHandler interface { - Handle(KMSListKeysParams, *models.Principal) middleware.Responder -} - -// NewKMSListKeys creates a new http.Handler for the k m s list keys operation -func NewKMSListKeys(ctx *middleware.Context, handler KMSListKeysHandler) *KMSListKeys { - return &KMSListKeys{Context: ctx, Handler: handler} -} - -/* - KMSListKeys swagger:route GET /kms/keys KMS kMSListKeys - -KMS list keys -*/ -type KMSListKeys struct { - Context *middleware.Context - Handler KMSListKeysHandler -} - -func (o *KMSListKeys) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewKMSListKeysParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/api/operations/k_m_s/k_m_s_list_keys_parameters.go b/api/operations/k_m_s/k_m_s_list_keys_parameters.go deleted file mode 100644 index e4d477c037..0000000000 --- a/api/operations/k_m_s/k_m_s_list_keys_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" -) - -// NewKMSListKeysParams creates a new KMSListKeysParams object -// -// There are no default values defined in the spec. -func NewKMSListKeysParams() KMSListKeysParams { - - return KMSListKeysParams{} -} - -// KMSListKeysParams contains all the bound params for the k m s list keys operation -// typically these are obtained from a http.Request -// -// swagger:parameters KMSListKeys -type KMSListKeysParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*pattern to retrieve keys - In: query - */ - Pattern *string -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewKMSListKeysParams() beforehand. -func (o *KMSListKeysParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qPattern, qhkPattern, _ := qs.GetOK("pattern") - if err := o.bindPattern(qPattern, qhkPattern, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindPattern binds and validates parameter Pattern from query. -func (o *KMSListKeysParams) bindPattern(rawData []string, hasKey bool, formats strfmt.Registry) error { - 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_keys_responses.go b/api/operations/k_m_s/k_m_s_list_keys_responses.go deleted file mode 100644 index 1ede4f0537..0000000000 --- a/api/operations/k_m_s/k_m_s_list_keys_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" -) - -// KMSListKeysOKCode is the HTTP code returned for type KMSListKeysOK -const KMSListKeysOKCode int = 200 - -/* -KMSListKeysOK A successful response. - -swagger:response kMSListKeysOK -*/ -type KMSListKeysOK struct { - - /* - In: Body - */ - Payload *models.KmsListKeysResponse `json:"body,omitempty"` -} - -// NewKMSListKeysOK creates KMSListKeysOK with default headers values -func NewKMSListKeysOK() *KMSListKeysOK { - - return &KMSListKeysOK{} -} - -// WithPayload adds the payload to the k m s list keys o k response -func (o *KMSListKeysOK) WithPayload(payload *models.KmsListKeysResponse) *KMSListKeysOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the k m s list keys o k response -func (o *KMSListKeysOK) SetPayload(payload *models.KmsListKeysResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *KMSListKeysOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -KMSListKeysDefault Generic error response. - -swagger:response kMSListKeysDefault -*/ -type KMSListKeysDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewKMSListKeysDefault creates KMSListKeysDefault with default headers values -func NewKMSListKeysDefault(code int) *KMSListKeysDefault { - if code <= 0 { - code = 500 - } - - return &KMSListKeysDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the k m s list keys default response -func (o *KMSListKeysDefault) WithStatusCode(code int) *KMSListKeysDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the k m s list keys default response -func (o *KMSListKeysDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the k m s list keys default response -func (o *KMSListKeysDefault) WithPayload(payload *models.APIError) *KMSListKeysDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the k m s list keys default response -func (o *KMSListKeysDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *KMSListKeysDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/api/operations/k_m_s/k_m_s_list_keys_urlbuilder.go b/api/operations/k_m_s/k_m_s_list_keys_urlbuilder.go deleted file mode 100644 index 7f99343a75..0000000000 --- a/api/operations/k_m_s/k_m_s_list_keys_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" -) - -// KMSListKeysURL generates an URL for the k m s list keys operation -type KMSListKeysURL struct { - Pattern *string - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *KMSListKeysURL) WithBasePath(bp string) *KMSListKeysURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *KMSListKeysURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *KMSListKeysURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/kms/keys" - - _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 *KMSListKeysURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *KMSListKeysURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *KMSListKeysURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on KMSListKeysURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on KMSListKeysURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *KMSListKeysURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/k_m_s/k_m_s_metrics.go b/api/operations/k_m_s/k_m_s_metrics.go deleted file mode 100644 index 6403fbc944..0000000000 --- a/api/operations/k_m_s/k_m_s_metrics.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" -) - -// KMSMetricsHandlerFunc turns a function with the right signature into a k m s metrics handler -type KMSMetricsHandlerFunc func(KMSMetricsParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn KMSMetricsHandlerFunc) Handle(params KMSMetricsParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// KMSMetricsHandler interface for that can handle valid k m s metrics params -type KMSMetricsHandler interface { - Handle(KMSMetricsParams, *models.Principal) middleware.Responder -} - -// NewKMSMetrics creates a new http.Handler for the k m s metrics operation -func NewKMSMetrics(ctx *middleware.Context, handler KMSMetricsHandler) *KMSMetrics { - return &KMSMetrics{Context: ctx, Handler: handler} -} - -/* - KMSMetrics swagger:route GET /kms/metrics KMS kMSMetrics - -KMS metrics -*/ -type KMSMetrics struct { - Context *middleware.Context - Handler KMSMetricsHandler -} - -func (o *KMSMetrics) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewKMSMetricsParams() - 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_metrics_parameters.go b/api/operations/k_m_s/k_m_s_metrics_parameters.go deleted file mode 100644 index 41ebfa4c7d..0000000000 --- a/api/operations/k_m_s/k_m_s_metrics_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" -) - -// NewKMSMetricsParams creates a new KMSMetricsParams object -// -// There are no default values defined in the spec. -func NewKMSMetricsParams() KMSMetricsParams { - - return KMSMetricsParams{} -} - -// KMSMetricsParams contains all the bound params for the k m s metrics operation -// typically these are obtained from a http.Request -// -// swagger:parameters KMSMetrics -type KMSMetricsParams 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 NewKMSMetricsParams() beforehand. -func (o *KMSMetricsParams) 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_metrics_responses.go b/api/operations/k_m_s/k_m_s_metrics_responses.go deleted file mode 100644 index ae8b4d7ea7..0000000000 --- a/api/operations/k_m_s/k_m_s_metrics_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" -) - -// KMSMetricsOKCode is the HTTP code returned for type KMSMetricsOK -const KMSMetricsOKCode int = 200 - -/* -KMSMetricsOK A successful response. - -swagger:response kMSMetricsOK -*/ -type KMSMetricsOK struct { - - /* - In: Body - */ - Payload *models.KmsMetricsResponse `json:"body,omitempty"` -} - -// NewKMSMetricsOK creates KMSMetricsOK with default headers values -func NewKMSMetricsOK() *KMSMetricsOK { - - return &KMSMetricsOK{} -} - -// WithPayload adds the payload to the k m s metrics o k response -func (o *KMSMetricsOK) WithPayload(payload *models.KmsMetricsResponse) *KMSMetricsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the k m s metrics o k response -func (o *KMSMetricsOK) SetPayload(payload *models.KmsMetricsResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *KMSMetricsOK) 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 - } - } -} - -/* -KMSMetricsDefault Generic error response. - -swagger:response kMSMetricsDefault -*/ -type KMSMetricsDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewKMSMetricsDefault creates KMSMetricsDefault with default headers values -func NewKMSMetricsDefault(code int) *KMSMetricsDefault { - if code <= 0 { - code = 500 - } - - return &KMSMetricsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the k m s metrics default response -func (o *KMSMetricsDefault) WithStatusCode(code int) *KMSMetricsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the k m s metrics default response -func (o *KMSMetricsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the k m s metrics default response -func (o *KMSMetricsDefault) WithPayload(payload *models.APIError) *KMSMetricsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the k m s metrics default response -func (o *KMSMetricsDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *KMSMetricsDefault) 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_metrics_urlbuilder.go b/api/operations/k_m_s/k_m_s_metrics_urlbuilder.go deleted file mode 100644 index 150628e898..0000000000 --- a/api/operations/k_m_s/k_m_s_metrics_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" -) - -// KMSMetricsURL generates an URL for the k m s metrics operation -type KMSMetricsURL 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 *KMSMetricsURL) WithBasePath(bp string) *KMSMetricsURL { - 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 *KMSMetricsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *KMSMetricsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/kms/metrics" - - _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 *KMSMetricsURL) 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 *KMSMetricsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *KMSMetricsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on KMSMetricsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on KMSMetricsURL") - } - - 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 *KMSMetricsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/k_m_s/k_m_s_status.go b/api/operations/k_m_s/k_m_s_status.go deleted file mode 100644 index f054001fad..0000000000 --- a/api/operations/k_m_s/k_m_s_status.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" -) - -// KMSStatusHandlerFunc turns a function with the right signature into a k m s status handler -type KMSStatusHandlerFunc func(KMSStatusParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn KMSStatusHandlerFunc) Handle(params KMSStatusParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// KMSStatusHandler interface for that can handle valid k m s status params -type KMSStatusHandler interface { - Handle(KMSStatusParams, *models.Principal) middleware.Responder -} - -// NewKMSStatus creates a new http.Handler for the k m s status operation -func NewKMSStatus(ctx *middleware.Context, handler KMSStatusHandler) *KMSStatus { - return &KMSStatus{Context: ctx, Handler: handler} -} - -/* - KMSStatus swagger:route GET /kms/status KMS kMSStatus - -KMS status -*/ -type KMSStatus struct { - Context *middleware.Context - Handler KMSStatusHandler -} - -func (o *KMSStatus) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewKMSStatusParams() - uprinc, aCtx, err := o.Context.Authorize(r, route) - if err != nil { - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - if aCtx != nil { - *r = *aCtx - } - var principal *models.Principal - if uprinc != nil { - principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise - } - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params, principal) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/api/operations/k_m_s/k_m_s_status_parameters.go b/api/operations/k_m_s/k_m_s_status_parameters.go deleted file mode 100644 index d674a1a0e8..0000000000 --- a/api/operations/k_m_s/k_m_s_status_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" -) - -// NewKMSStatusParams creates a new KMSStatusParams object -// -// There are no default values defined in the spec. -func NewKMSStatusParams() KMSStatusParams { - - return KMSStatusParams{} -} - -// KMSStatusParams contains all the bound params for the k m s status operation -// typically these are obtained from a http.Request -// -// swagger:parameters KMSStatus -type KMSStatusParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewKMSStatusParams() beforehand. -func (o *KMSStatusParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/api/operations/k_m_s/k_m_s_status_responses.go b/api/operations/k_m_s/k_m_s_status_responses.go deleted file mode 100644 index 62e9da03e4..0000000000 --- a/api/operations/k_m_s/k_m_s_status_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" -) - -// KMSStatusOKCode is the HTTP code returned for type KMSStatusOK -const KMSStatusOKCode int = 200 - -/* -KMSStatusOK A successful response. - -swagger:response kMSStatusOK -*/ -type KMSStatusOK struct { - - /* - In: Body - */ - Payload *models.KmsStatusResponse `json:"body,omitempty"` -} - -// NewKMSStatusOK creates KMSStatusOK with default headers values -func NewKMSStatusOK() *KMSStatusOK { - - return &KMSStatusOK{} -} - -// WithPayload adds the payload to the k m s status o k response -func (o *KMSStatusOK) WithPayload(payload *models.KmsStatusResponse) *KMSStatusOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the k m s status o k response -func (o *KMSStatusOK) SetPayload(payload *models.KmsStatusResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *KMSStatusOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -KMSStatusDefault Generic error response. - -swagger:response kMSStatusDefault -*/ -type KMSStatusDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewKMSStatusDefault creates KMSStatusDefault with default headers values -func NewKMSStatusDefault(code int) *KMSStatusDefault { - if code <= 0 { - code = 500 - } - - return &KMSStatusDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the k m s status default response -func (o *KMSStatusDefault) WithStatusCode(code int) *KMSStatusDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the k m s status default response -func (o *KMSStatusDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the k m s status default response -func (o *KMSStatusDefault) WithPayload(payload *models.APIError) *KMSStatusDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the k m s status default response -func (o *KMSStatusDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *KMSStatusDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(o._statusCode) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/api/operations/k_m_s/k_m_s_status_urlbuilder.go b/api/operations/k_m_s/k_m_s_status_urlbuilder.go deleted file mode 100644 index 38c003bb2e..0000000000 --- a/api/operations/k_m_s/k_m_s_status_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" -) - -// KMSStatusURL generates an URL for the k m s status operation -type KMSStatusURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *KMSStatusURL) WithBasePath(bp string) *KMSStatusURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *KMSStatusURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *KMSStatusURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/kms/status" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *KMSStatusURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *KMSStatusURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *KMSStatusURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on KMSStatusURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on KMSStatusURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *KMSStatusURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/k_m_s/k_m_s_version.go b/api/operations/k_m_s/k_m_s_version.go deleted file mode 100644 index c7ca199c5e..0000000000 --- a/api/operations/k_m_s/k_m_s_version.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" -) - -// KMSVersionHandlerFunc turns a function with the right signature into a k m s version handler -type KMSVersionHandlerFunc func(KMSVersionParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn KMSVersionHandlerFunc) Handle(params KMSVersionParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// KMSVersionHandler interface for that can handle valid k m s version params -type KMSVersionHandler interface { - Handle(KMSVersionParams, *models.Principal) middleware.Responder -} - -// NewKMSVersion creates a new http.Handler for the k m s version operation -func NewKMSVersion(ctx *middleware.Context, handler KMSVersionHandler) *KMSVersion { - return &KMSVersion{Context: ctx, Handler: handler} -} - -/* - KMSVersion swagger:route GET /kms/version KMS kMSVersion - -KMS version -*/ -type KMSVersion struct { - Context *middleware.Context - Handler KMSVersionHandler -} - -func (o *KMSVersion) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewKMSVersionParams() - 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_version_parameters.go b/api/operations/k_m_s/k_m_s_version_parameters.go deleted file mode 100644 index d9095e6589..0000000000 --- a/api/operations/k_m_s/k_m_s_version_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" -) - -// NewKMSVersionParams creates a new KMSVersionParams object -// -// There are no default values defined in the spec. -func NewKMSVersionParams() KMSVersionParams { - - return KMSVersionParams{} -} - -// KMSVersionParams contains all the bound params for the k m s version operation -// typically these are obtained from a http.Request -// -// swagger:parameters KMSVersion -type KMSVersionParams 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 NewKMSVersionParams() beforehand. -func (o *KMSVersionParams) 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_version_responses.go b/api/operations/k_m_s/k_m_s_version_responses.go deleted file mode 100644 index 4c2c273ebd..0000000000 --- a/api/operations/k_m_s/k_m_s_version_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" -) - -// KMSVersionOKCode is the HTTP code returned for type KMSVersionOK -const KMSVersionOKCode int = 200 - -/* -KMSVersionOK A successful response. - -swagger:response kMSVersionOK -*/ -type KMSVersionOK struct { - - /* - In: Body - */ - Payload *models.KmsVersionResponse `json:"body,omitempty"` -} - -// NewKMSVersionOK creates KMSVersionOK with default headers values -func NewKMSVersionOK() *KMSVersionOK { - - return &KMSVersionOK{} -} - -// WithPayload adds the payload to the k m s version o k response -func (o *KMSVersionOK) WithPayload(payload *models.KmsVersionResponse) *KMSVersionOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the k m s version o k response -func (o *KMSVersionOK) SetPayload(payload *models.KmsVersionResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *KMSVersionOK) 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 - } - } -} - -/* -KMSVersionDefault Generic error response. - -swagger:response kMSVersionDefault -*/ -type KMSVersionDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewKMSVersionDefault creates KMSVersionDefault with default headers values -func NewKMSVersionDefault(code int) *KMSVersionDefault { - if code <= 0 { - code = 500 - } - - return &KMSVersionDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the k m s version default response -func (o *KMSVersionDefault) WithStatusCode(code int) *KMSVersionDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the k m s version default response -func (o *KMSVersionDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the k m s version default response -func (o *KMSVersionDefault) WithPayload(payload *models.APIError) *KMSVersionDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the k m s version default response -func (o *KMSVersionDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *KMSVersionDefault) 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_version_urlbuilder.go b/api/operations/k_m_s/k_m_s_version_urlbuilder.go deleted file mode 100644 index b46eda49d5..0000000000 --- a/api/operations/k_m_s/k_m_s_version_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" -) - -// KMSVersionURL generates an URL for the k m s version operation -type KMSVersionURL 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 *KMSVersionURL) WithBasePath(bp string) *KMSVersionURL { - 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 *KMSVersionURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *KMSVersionURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/kms/version" - - _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 *KMSVersionURL) 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 *KMSVersionURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *KMSVersionURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on KMSVersionURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on KMSVersionURL") - } - - 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 *KMSVersionURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/idp/list_configurations.go b/api/operations/license/license_acknowledge.go similarity index 64% rename from api/operations/idp/list_configurations.go rename to api/operations/license/license_acknowledge.go index 7f7b6c936e..d360e30aba 100644 --- a/api/operations/idp/list_configurations.go +++ b/api/operations/license/license_acknowledge.go @@ -17,7 +17,7 @@ // along with this program. If not, see . // -package idp +package license // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the generate command @@ -30,40 +30,40 @@ import ( "github.com/minio/console/models" ) -// ListConfigurationsHandlerFunc turns a function with the right signature into a list configurations handler -type ListConfigurationsHandlerFunc func(ListConfigurationsParams, *models.Principal) middleware.Responder +// LicenseAcknowledgeHandlerFunc turns a function with the right signature into a license acknowledge handler +type LicenseAcknowledgeHandlerFunc func(LicenseAcknowledgeParams, *models.Principal) middleware.Responder // Handle executing the request and returning a response -func (fn ListConfigurationsHandlerFunc) Handle(params ListConfigurationsParams, principal *models.Principal) middleware.Responder { +func (fn LicenseAcknowledgeHandlerFunc) Handle(params LicenseAcknowledgeParams, principal *models.Principal) middleware.Responder { return fn(params, principal) } -// ListConfigurationsHandler interface for that can handle valid list configurations params -type ListConfigurationsHandler interface { - Handle(ListConfigurationsParams, *models.Principal) middleware.Responder +// LicenseAcknowledgeHandler interface for that can handle valid license acknowledge params +type LicenseAcknowledgeHandler interface { + Handle(LicenseAcknowledgeParams, *models.Principal) middleware.Responder } -// NewListConfigurations creates a new http.Handler for the list configurations operation -func NewListConfigurations(ctx *middleware.Context, handler ListConfigurationsHandler) *ListConfigurations { - return &ListConfigurations{Context: ctx, Handler: handler} +// NewLicenseAcknowledge creates a new http.Handler for the license acknowledge operation +func NewLicenseAcknowledge(ctx *middleware.Context, handler LicenseAcknowledgeHandler) *LicenseAcknowledge { + return &LicenseAcknowledge{Context: ctx, Handler: handler} } /* - ListConfigurations swagger:route GET /idp/{type} idp listConfigurations + LicenseAcknowledge swagger:route GET /license/acknowledge License licenseAcknowledge -List IDP Configurations +Acknowledge the license */ -type ListConfigurations struct { +type LicenseAcknowledge struct { Context *middleware.Context - Handler ListConfigurationsHandler + Handler LicenseAcknowledgeHandler } -func (o *ListConfigurations) ServeHTTP(rw http.ResponseWriter, r *http.Request) { +func (o *LicenseAcknowledge) ServeHTTP(rw http.ResponseWriter, r *http.Request) { route, rCtx, _ := o.Context.RouteInfo(r) if rCtx != nil { *r = *rCtx } - var Params = NewListConfigurationsParams() + var Params = NewLicenseAcknowledgeParams() uprinc, aCtx, err := o.Context.Authorize(r, route) if err != nil { o.Context.Respond(rw, r, route.Produces, route, err) diff --git a/api/operations/configuration/export_config_parameters.go b/api/operations/license/license_acknowledge_parameters.go similarity index 75% rename from api/operations/configuration/export_config_parameters.go rename to api/operations/license/license_acknowledge_parameters.go index a8ed0781dc..31353087ea 100644 --- a/api/operations/configuration/export_config_parameters.go +++ b/api/operations/license/license_acknowledge_parameters.go @@ -17,7 +17,7 @@ // along with this program. If not, see . // -package configuration +package license // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command @@ -29,19 +29,19 @@ import ( "github.com/go-openapi/runtime/middleware" ) -// NewExportConfigParams creates a new ExportConfigParams object +// NewLicenseAcknowledgeParams creates a new LicenseAcknowledgeParams object // // There are no default values defined in the spec. -func NewExportConfigParams() ExportConfigParams { +func NewLicenseAcknowledgeParams() LicenseAcknowledgeParams { - return ExportConfigParams{} + return LicenseAcknowledgeParams{} } -// ExportConfigParams contains all the bound params for the export config operation +// LicenseAcknowledgeParams contains all the bound params for the license acknowledge operation // typically these are obtained from a http.Request // -// swagger:parameters ExportConfig -type ExportConfigParams struct { +// swagger:parameters LicenseAcknowledge +type LicenseAcknowledgeParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` @@ -50,8 +50,8 @@ type ExportConfigParams struct { // 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 NewExportConfigParams() beforehand. -func (o *ExportConfigParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { +// To ensure default values, the struct must have been initialized with NewLicenseAcknowledgeParams() beforehand. +func (o *LicenseAcknowledgeParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r diff --git a/api/operations/object/put_object_retention_responses.go b/api/operations/license/license_acknowledge_responses.go similarity index 56% rename from api/operations/object/put_object_retention_responses.go rename to api/operations/license/license_acknowledge_responses.go index 04be190f96..621c9444af 100644 --- a/api/operations/object/put_object_retention_responses.go +++ b/api/operations/license/license_acknowledge_responses.go @@ -17,7 +17,7 @@ // along with this program. If not, see . // -package object +package license // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command @@ -30,25 +30,25 @@ import ( "github.com/minio/console/models" ) -// PutObjectRetentionOKCode is the HTTP code returned for type PutObjectRetentionOK -const PutObjectRetentionOKCode int = 200 +// LicenseAcknowledgeOKCode is the HTTP code returned for type LicenseAcknowledgeOK +const LicenseAcknowledgeOKCode int = 200 /* -PutObjectRetentionOK A successful response. +LicenseAcknowledgeOK A successful response. -swagger:response putObjectRetentionOK +swagger:response licenseAcknowledgeOK */ -type PutObjectRetentionOK struct { +type LicenseAcknowledgeOK struct { } -// NewPutObjectRetentionOK creates PutObjectRetentionOK with default headers values -func NewPutObjectRetentionOK() *PutObjectRetentionOK { +// NewLicenseAcknowledgeOK creates LicenseAcknowledgeOK with default headers values +func NewLicenseAcknowledgeOK() *LicenseAcknowledgeOK { - return &PutObjectRetentionOK{} + return &LicenseAcknowledgeOK{} } // WriteResponse to the client -func (o *PutObjectRetentionOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { +func (o *LicenseAcknowledgeOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses @@ -56,11 +56,11 @@ func (o *PutObjectRetentionOK) WriteResponse(rw http.ResponseWriter, producer ru } /* -PutObjectRetentionDefault Generic error response. +LicenseAcknowledgeDefault Generic error response. -swagger:response putObjectRetentionDefault +swagger:response licenseAcknowledgeDefault */ -type PutObjectRetentionDefault struct { +type LicenseAcknowledgeDefault struct { _statusCode int /* @@ -69,41 +69,41 @@ type PutObjectRetentionDefault struct { Payload *models.APIError `json:"body,omitempty"` } -// NewPutObjectRetentionDefault creates PutObjectRetentionDefault with default headers values -func NewPutObjectRetentionDefault(code int) *PutObjectRetentionDefault { +// NewLicenseAcknowledgeDefault creates LicenseAcknowledgeDefault with default headers values +func NewLicenseAcknowledgeDefault(code int) *LicenseAcknowledgeDefault { if code <= 0 { code = 500 } - return &PutObjectRetentionDefault{ + return &LicenseAcknowledgeDefault{ _statusCode: code, } } -// WithStatusCode adds the status to the put object retention default response -func (o *PutObjectRetentionDefault) WithStatusCode(code int) *PutObjectRetentionDefault { +// WithStatusCode adds the status to the license acknowledge default response +func (o *LicenseAcknowledgeDefault) WithStatusCode(code int) *LicenseAcknowledgeDefault { o._statusCode = code return o } -// SetStatusCode sets the status to the put object retention default response -func (o *PutObjectRetentionDefault) SetStatusCode(code int) { +// SetStatusCode sets the status to the license acknowledge default response +func (o *LicenseAcknowledgeDefault) SetStatusCode(code int) { o._statusCode = code } -// WithPayload adds the payload to the put object retention default response -func (o *PutObjectRetentionDefault) WithPayload(payload *models.APIError) *PutObjectRetentionDefault { +// WithPayload adds the payload to the license acknowledge default response +func (o *LicenseAcknowledgeDefault) WithPayload(payload *models.APIError) *LicenseAcknowledgeDefault { o.Payload = payload return o } -// SetPayload sets the payload to the put object retention default response -func (o *PutObjectRetentionDefault) SetPayload(payload *models.APIError) { +// SetPayload sets the payload to the license acknowledge default response +func (o *LicenseAcknowledgeDefault) SetPayload(payload *models.APIError) { o.Payload = payload } // WriteResponse to the client -func (o *PutObjectRetentionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { +func (o *LicenseAcknowledgeDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.WriteHeader(o._statusCode) if o.Payload != nil { diff --git a/api/operations/system/list_nodes_urlbuilder.go b/api/operations/license/license_acknowledge_urlbuilder.go similarity index 75% rename from api/operations/system/list_nodes_urlbuilder.go rename to api/operations/license/license_acknowledge_urlbuilder.go index e81cf85839..e2e9957af0 100644 --- a/api/operations/system/list_nodes_urlbuilder.go +++ b/api/operations/license/license_acknowledge_urlbuilder.go @@ -17,7 +17,7 @@ // along with this program. If not, see . // -package system +package license // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the generate command @@ -28,15 +28,15 @@ import ( golangswaggerpaths "path" ) -// ListNodesURL generates an URL for the list nodes operation -type ListNodesURL struct { +// LicenseAcknowledgeURL generates an URL for the license acknowledge operation +type LicenseAcknowledgeURL 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 *ListNodesURL) WithBasePath(bp string) *ListNodesURL { +func (o *LicenseAcknowledgeURL) WithBasePath(bp string) *LicenseAcknowledgeURL { o.SetBasePath(bp) return o } @@ -44,15 +44,15 @@ func (o *ListNodesURL) WithBasePath(bp string) *ListNodesURL { // 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 *ListNodesURL) SetBasePath(bp string) { +func (o *LicenseAcknowledgeURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string -func (o *ListNodesURL) Build() (*url.URL, error) { +func (o *LicenseAcknowledgeURL) Build() (*url.URL, error) { var _result url.URL - var _path = "/nodes" + var _path = "/license/acknowledge" _basePath := o._basePath if _basePath == "" { @@ -64,7 +64,7 @@ func (o *ListNodesURL) Build() (*url.URL, error) { } // Must is a helper function to panic when the url builder returns an error -func (o *ListNodesURL) Must(u *url.URL, err error) *url.URL { +func (o *LicenseAcknowledgeURL) Must(u *url.URL, err error) *url.URL { if err != nil { panic(err) } @@ -75,17 +75,17 @@ func (o *ListNodesURL) Must(u *url.URL, err error) *url.URL { } // String returns the string representation of the path with query string -func (o *ListNodesURL) String() string { +func (o *LicenseAcknowledgeURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string -func (o *ListNodesURL) BuildFull(scheme, host string) (*url.URL, error) { +func (o *LicenseAcknowledgeURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { - return nil, errors.New("scheme is required for a full url on ListNodesURL") + return nil, errors.New("scheme is required for a full url on LicenseAcknowledgeURL") } if host == "" { - return nil, errors.New("host is required for a full url on ListNodesURL") + return nil, errors.New("host is required for a full url on LicenseAcknowledgeURL") } base, err := o.Build() @@ -99,6 +99,6 @@ func (o *ListNodesURL) BuildFull(scheme, host string) (*url.URL, error) { } // StringFull returns the string representation of a complete url -func (o *ListNodesURL) StringFull(scheme, host string) string { +func (o *LicenseAcknowledgeURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } diff --git a/api/operations/logging/log_search.go b/api/operations/logging/log_search.go deleted file mode 100644 index b716b5c983..0000000000 --- a/api/operations/logging/log_search.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 logging - -// 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" -) - -// LogSearchHandlerFunc turns a function with the right signature into a log search handler -type LogSearchHandlerFunc func(LogSearchParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn LogSearchHandlerFunc) Handle(params LogSearchParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// LogSearchHandler interface for that can handle valid log search params -type LogSearchHandler interface { - Handle(LogSearchParams, *models.Principal) middleware.Responder -} - -// NewLogSearch creates a new http.Handler for the log search operation -func NewLogSearch(ctx *middleware.Context, handler LogSearchHandler) *LogSearch { - return &LogSearch{Context: ctx, Handler: handler} -} - -/* - LogSearch swagger:route GET /logs/search Logging logSearch - -Search the logs -*/ -type LogSearch struct { - Context *middleware.Context - Handler LogSearchHandler -} - -func (o *LogSearch) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewLogSearchParams() - 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/logging/log_search_parameters.go b/api/operations/logging/log_search_parameters.go deleted file mode 100644 index 49adcd22ec..0000000000 --- a/api/operations/logging/log_search_parameters.go +++ /dev/null @@ -1,279 +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 logging - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// NewLogSearchParams creates a new LogSearchParams object -// with the default values initialized. -func NewLogSearchParams() LogSearchParams { - - var ( - // initialize parameters with default values - - orderDefault = string("timeDesc") - pageNoDefault = int32(0) - pageSizeDefault = int32(10) - ) - - return LogSearchParams{ - Order: &orderDefault, - - PageNo: &pageNoDefault, - - PageSize: &pageSizeDefault, - } -} - -// LogSearchParams contains all the bound params for the log search operation -// typically these are obtained from a http.Request -// -// swagger:parameters LogSearch -type LogSearchParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Filter Parameters - In: query - Collection Format: multi - */ - Fp []string - /* - In: query - Default: "timeDesc" - */ - Order *string - /* - In: query - Default: 0 - */ - PageNo *int32 - /* - In: query - Default: 10 - */ - PageSize *int32 - /* - In: query - */ - TimeEnd *string - /* - In: query - */ - TimeStart *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 NewLogSearchParams() beforehand. -func (o *LogSearchParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qFp, qhkFp, _ := qs.GetOK("fp") - if err := o.bindFp(qFp, qhkFp, route.Formats); err != nil { - res = append(res, err) - } - - qOrder, qhkOrder, _ := qs.GetOK("order") - if err := o.bindOrder(qOrder, qhkOrder, route.Formats); err != nil { - res = append(res, err) - } - - qPageNo, qhkPageNo, _ := qs.GetOK("pageNo") - if err := o.bindPageNo(qPageNo, qhkPageNo, route.Formats); err != nil { - res = append(res, err) - } - - qPageSize, qhkPageSize, _ := qs.GetOK("pageSize") - if err := o.bindPageSize(qPageSize, qhkPageSize, route.Formats); err != nil { - res = append(res, err) - } - - qTimeEnd, qhkTimeEnd, _ := qs.GetOK("timeEnd") - if err := o.bindTimeEnd(qTimeEnd, qhkTimeEnd, route.Formats); err != nil { - res = append(res, err) - } - - qTimeStart, qhkTimeStart, _ := qs.GetOK("timeStart") - if err := o.bindTimeStart(qTimeStart, qhkTimeStart, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindFp binds and validates array parameter Fp from query. -// -// Arrays are parsed according to CollectionFormat: "multi" (defaults to "csv" when empty). -func (o *LogSearchParams) bindFp(rawData []string, hasKey bool, formats strfmt.Registry) error { - // CollectionFormat: multi - fpIC := rawData - if len(fpIC) == 0 { - return nil - } - - var fpIR []string - for _, fpIV := range fpIC { - fpI := fpIV - - fpIR = append(fpIR, fpI) - } - - o.Fp = fpIR - - return nil -} - -// bindOrder binds and validates parameter Order from query. -func (o *LogSearchParams) bindOrder(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 - // Default values have been previously initialized by NewLogSearchParams() - return nil - } - o.Order = &raw - - if err := o.validateOrder(formats); err != nil { - return err - } - - return nil -} - -// validateOrder carries on validations for parameter Order -func (o *LogSearchParams) validateOrder(formats strfmt.Registry) error { - - if err := validate.EnumCase("order", "query", *o.Order, []interface{}{"timeDesc", "timeAsc"}, true); err != nil { - return err - } - - return nil -} - -// bindPageNo binds and validates parameter PageNo from query. -func (o *LogSearchParams) bindPageNo(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 - // Default values have been previously initialized by NewLogSearchParams() - return nil - } - - value, err := swag.ConvertInt32(raw) - if err != nil { - return errors.InvalidType("pageNo", "query", "int32", raw) - } - o.PageNo = &value - - return nil -} - -// bindPageSize binds and validates parameter PageSize from query. -func (o *LogSearchParams) bindPageSize(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 - // Default values have been previously initialized by NewLogSearchParams() - return nil - } - - value, err := swag.ConvertInt32(raw) - if err != nil { - return errors.InvalidType("pageSize", "query", "int32", raw) - } - o.PageSize = &value - - return nil -} - -// bindTimeEnd binds and validates parameter TimeEnd from query. -func (o *LogSearchParams) bindTimeEnd(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.TimeEnd = &raw - - return nil -} - -// bindTimeStart binds and validates parameter TimeStart from query. -func (o *LogSearchParams) bindTimeStart(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.TimeStart = &raw - - return nil -} diff --git a/api/operations/logging/log_search_responses.go b/api/operations/logging/log_search_responses.go deleted file mode 100644 index f2927f960a..0000000000 --- a/api/operations/logging/log_search_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 logging - -// 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" -) - -// LogSearchOKCode is the HTTP code returned for type LogSearchOK -const LogSearchOKCode int = 200 - -/* -LogSearchOK A successful response. - -swagger:response logSearchOK -*/ -type LogSearchOK struct { - - /* - In: Body - */ - Payload *models.LogSearchResponse `json:"body,omitempty"` -} - -// NewLogSearchOK creates LogSearchOK with default headers values -func NewLogSearchOK() *LogSearchOK { - - return &LogSearchOK{} -} - -// WithPayload adds the payload to the log search o k response -func (o *LogSearchOK) WithPayload(payload *models.LogSearchResponse) *LogSearchOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the log search o k response -func (o *LogSearchOK) SetPayload(payload *models.LogSearchResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *LogSearchOK) 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 - } - } -} - -/* -LogSearchDefault Generic error response. - -swagger:response logSearchDefault -*/ -type LogSearchDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewLogSearchDefault creates LogSearchDefault with default headers values -func NewLogSearchDefault(code int) *LogSearchDefault { - if code <= 0 { - code = 500 - } - - return &LogSearchDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the log search default response -func (o *LogSearchDefault) WithStatusCode(code int) *LogSearchDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the log search default response -func (o *LogSearchDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the log search default response -func (o *LogSearchDefault) WithPayload(payload *models.APIError) *LogSearchDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the log search default response -func (o *LogSearchDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *LogSearchDefault) 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/logging/log_search_urlbuilder.go b/api/operations/logging/log_search_urlbuilder.go deleted file mode 100644 index f421ee458d..0000000000 --- a/api/operations/logging/log_search_urlbuilder.go +++ /dev/null @@ -1,173 +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 logging - -// 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" - - "github.com/go-openapi/swag" -) - -// LogSearchURL generates an URL for the log search operation -type LogSearchURL struct { - Fp []string - Order *string - PageNo *int32 - PageSize *int32 - TimeEnd *string - TimeStart *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 *LogSearchURL) WithBasePath(bp string) *LogSearchURL { - 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 *LogSearchURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *LogSearchURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/logs/search" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var fpIR []string - for _, fpI := range o.Fp { - fpIS := fpI - if fpIS != "" { - fpIR = append(fpIR, fpIS) - } - } - - fp := swag.JoinByFormat(fpIR, "multi") - - for _, qsv := range fp { - qs.Add("fp", qsv) - } - - var orderQ string - if o.Order != nil { - orderQ = *o.Order - } - if orderQ != "" { - qs.Set("order", orderQ) - } - - var pageNoQ string - if o.PageNo != nil { - pageNoQ = swag.FormatInt32(*o.PageNo) - } - if pageNoQ != "" { - qs.Set("pageNo", pageNoQ) - } - - var pageSizeQ string - if o.PageSize != nil { - pageSizeQ = swag.FormatInt32(*o.PageSize) - } - if pageSizeQ != "" { - qs.Set("pageSize", pageSizeQ) - } - - var timeEndQ string - if o.TimeEnd != nil { - timeEndQ = *o.TimeEnd - } - if timeEndQ != "" { - qs.Set("timeEnd", timeEndQ) - } - - var timeStartQ string - if o.TimeStart != nil { - timeStartQ = *o.TimeStart - } - if timeStartQ != "" { - qs.Set("timeStart", timeStartQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *LogSearchURL) 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 *LogSearchURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *LogSearchURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on LogSearchURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on LogSearchURL") - } - - 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 *LogSearchURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/object/delete_object_retention.go b/api/operations/object/delete_object_retention.go deleted file mode 100644 index 129320b491..0000000000 --- a/api/operations/object/delete_object_retention.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 object - -// 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" -) - -// DeleteObjectRetentionHandlerFunc turns a function with the right signature into a delete object retention handler -type DeleteObjectRetentionHandlerFunc func(DeleteObjectRetentionParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteObjectRetentionHandlerFunc) Handle(params DeleteObjectRetentionParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// DeleteObjectRetentionHandler interface for that can handle valid delete object retention params -type DeleteObjectRetentionHandler interface { - Handle(DeleteObjectRetentionParams, *models.Principal) middleware.Responder -} - -// NewDeleteObjectRetention creates a new http.Handler for the delete object retention operation -func NewDeleteObjectRetention(ctx *middleware.Context, handler DeleteObjectRetentionHandler) *DeleteObjectRetention { - return &DeleteObjectRetention{Context: ctx, Handler: handler} -} - -/* - DeleteObjectRetention swagger:route DELETE /buckets/{bucket_name}/objects/retention Object deleteObjectRetention - -Delete Object retention from an object -*/ -type DeleteObjectRetention struct { - Context *middleware.Context - Handler DeleteObjectRetentionHandler -} - -func (o *DeleteObjectRetention) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteObjectRetentionParams() - 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/object/delete_object_retention_parameters.go b/api/operations/object/delete_object_retention_parameters.go deleted file mode 100644 index 769582f526..0000000000 --- a/api/operations/object/delete_object_retention_parameters.go +++ /dev/null @@ -1,154 +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 object - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" -) - -// NewDeleteObjectRetentionParams creates a new DeleteObjectRetentionParams object -// -// There are no default values defined in the spec. -func NewDeleteObjectRetentionParams() DeleteObjectRetentionParams { - - return DeleteObjectRetentionParams{} -} - -// DeleteObjectRetentionParams contains all the bound params for the delete object retention operation -// typically these are obtained from a http.Request -// -// swagger:parameters DeleteObjectRetention -type DeleteObjectRetentionParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - BucketName string - /* - Required: true - In: query - */ - Prefix string - /* - Required: true - In: query - */ - VersionID 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 NewDeleteObjectRetentionParams() beforehand. -func (o *DeleteObjectRetentionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") - if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { - res = append(res, err) - } - - qPrefix, qhkPrefix, _ := qs.GetOK("prefix") - if err := o.bindPrefix(qPrefix, qhkPrefix, route.Formats); err != nil { - res = append(res, err) - } - - qVersionID, qhkVersionID, _ := qs.GetOK("version_id") - if err := o.bindVersionID(qVersionID, qhkVersionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindBucketName binds and validates parameter BucketName from path. -func (o *DeleteObjectRetentionParams) bindBucketName(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.BucketName = raw - - return nil -} - -// bindPrefix binds and validates parameter Prefix from query. -func (o *DeleteObjectRetentionParams) bindPrefix(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("prefix", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("prefix", "query", raw); err != nil { - return err - } - o.Prefix = raw - - return nil -} - -// bindVersionID binds and validates parameter VersionID from query. -func (o *DeleteObjectRetentionParams) bindVersionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("version_id", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("version_id", "query", raw); err != nil { - return err - } - o.VersionID = raw - - return nil -} diff --git a/api/operations/object/delete_object_retention_responses.go b/api/operations/object/delete_object_retention_responses.go deleted file mode 100644 index 36107cf26b..0000000000 --- a/api/operations/object/delete_object_retention_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 object - -// 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" -) - -// DeleteObjectRetentionOKCode is the HTTP code returned for type DeleteObjectRetentionOK -const DeleteObjectRetentionOKCode int = 200 - -/* -DeleteObjectRetentionOK A successful response. - -swagger:response deleteObjectRetentionOK -*/ -type DeleteObjectRetentionOK struct { -} - -// NewDeleteObjectRetentionOK creates DeleteObjectRetentionOK with default headers values -func NewDeleteObjectRetentionOK() *DeleteObjectRetentionOK { - - return &DeleteObjectRetentionOK{} -} - -// WriteResponse to the client -func (o *DeleteObjectRetentionOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(200) -} - -/* -DeleteObjectRetentionDefault Generic error response. - -swagger:response deleteObjectRetentionDefault -*/ -type DeleteObjectRetentionDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewDeleteObjectRetentionDefault creates DeleteObjectRetentionDefault with default headers values -func NewDeleteObjectRetentionDefault(code int) *DeleteObjectRetentionDefault { - if code <= 0 { - code = 500 - } - - return &DeleteObjectRetentionDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete object retention default response -func (o *DeleteObjectRetentionDefault) WithStatusCode(code int) *DeleteObjectRetentionDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete object retention default response -func (o *DeleteObjectRetentionDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the delete object retention default response -func (o *DeleteObjectRetentionDefault) WithPayload(payload *models.APIError) *DeleteObjectRetentionDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete object retention default response -func (o *DeleteObjectRetentionDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteObjectRetentionDefault) 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/object/delete_object_retention_urlbuilder.go b/api/operations/object/delete_object_retention_urlbuilder.go deleted file mode 100644 index 4732e5542c..0000000000 --- a/api/operations/object/delete_object_retention_urlbuilder.go +++ /dev/null @@ -1,133 +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 object - -// 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" -) - -// DeleteObjectRetentionURL generates an URL for the delete object retention operation -type DeleteObjectRetentionURL struct { - BucketName string - - Prefix string - VersionID 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 *DeleteObjectRetentionURL) WithBasePath(bp string) *DeleteObjectRetentionURL { - 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 *DeleteObjectRetentionURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteObjectRetentionURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/buckets/{bucket_name}/objects/retention" - - bucketName := o.BucketName - if bucketName != "" { - _path = strings.Replace(_path, "{bucket_name}", bucketName, -1) - } else { - return nil, errors.New("bucketName is required on DeleteObjectRetentionURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - prefixQ := o.Prefix - if prefixQ != "" { - qs.Set("prefix", prefixQ) - } - - versionIDQ := o.VersionID - if versionIDQ != "" { - qs.Set("version_id", versionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DeleteObjectRetentionURL) 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 *DeleteObjectRetentionURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteObjectRetentionURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteObjectRetentionURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteObjectRetentionURL") - } - - 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 *DeleteObjectRetentionURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/object/put_object_legal_hold.go b/api/operations/object/put_object_legal_hold.go deleted file mode 100644 index 5b394cacd9..0000000000 --- a/api/operations/object/put_object_legal_hold.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 object - -// 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" -) - -// PutObjectLegalHoldHandlerFunc turns a function with the right signature into a put object legal hold handler -type PutObjectLegalHoldHandlerFunc func(PutObjectLegalHoldParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn PutObjectLegalHoldHandlerFunc) Handle(params PutObjectLegalHoldParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// PutObjectLegalHoldHandler interface for that can handle valid put object legal hold params -type PutObjectLegalHoldHandler interface { - Handle(PutObjectLegalHoldParams, *models.Principal) middleware.Responder -} - -// NewPutObjectLegalHold creates a new http.Handler for the put object legal hold operation -func NewPutObjectLegalHold(ctx *middleware.Context, handler PutObjectLegalHoldHandler) *PutObjectLegalHold { - return &PutObjectLegalHold{Context: ctx, Handler: handler} -} - -/* - PutObjectLegalHold swagger:route PUT /buckets/{bucket_name}/objects/legalhold Object putObjectLegalHold - -Put Object's legalhold status -*/ -type PutObjectLegalHold struct { - Context *middleware.Context - Handler PutObjectLegalHoldHandler -} - -func (o *PutObjectLegalHold) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewPutObjectLegalHoldParams() - 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/object/put_object_legal_hold_parameters.go b/api/operations/object/put_object_legal_hold_parameters.go deleted file mode 100644 index f97fe35126..0000000000 --- a/api/operations/object/put_object_legal_hold_parameters.go +++ /dev/null @@ -1,190 +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 object - -// 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" -) - -// NewPutObjectLegalHoldParams creates a new PutObjectLegalHoldParams object -// -// There are no default values defined in the spec. -func NewPutObjectLegalHoldParams() PutObjectLegalHoldParams { - - return PutObjectLegalHoldParams{} -} - -// PutObjectLegalHoldParams contains all the bound params for the put object legal hold operation -// typically these are obtained from a http.Request -// -// swagger:parameters PutObjectLegalHold -type PutObjectLegalHoldParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.PutObjectLegalHoldRequest - /* - Required: true - In: path - */ - BucketName string - /* - Required: true - In: query - */ - Prefix string - /* - Required: true - In: query - */ - VersionID 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 NewPutObjectLegalHoldParams() beforehand. -func (o *PutObjectLegalHoldParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.PutObjectLegalHoldRequest - 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", "")) - } - - rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") - if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { - res = append(res, err) - } - - qPrefix, qhkPrefix, _ := qs.GetOK("prefix") - if err := o.bindPrefix(qPrefix, qhkPrefix, route.Formats); err != nil { - res = append(res, err) - } - - qVersionID, qhkVersionID, _ := qs.GetOK("version_id") - if err := o.bindVersionID(qVersionID, qhkVersionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindBucketName binds and validates parameter BucketName from path. -func (o *PutObjectLegalHoldParams) bindBucketName(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.BucketName = raw - - return nil -} - -// bindPrefix binds and validates parameter Prefix from query. -func (o *PutObjectLegalHoldParams) bindPrefix(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("prefix", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("prefix", "query", raw); err != nil { - return err - } - o.Prefix = raw - - return nil -} - -// bindVersionID binds and validates parameter VersionID from query. -func (o *PutObjectLegalHoldParams) bindVersionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("version_id", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("version_id", "query", raw); err != nil { - return err - } - o.VersionID = raw - - return nil -} diff --git a/api/operations/object/put_object_legal_hold_responses.go b/api/operations/object/put_object_legal_hold_responses.go deleted file mode 100644 index 06cadc0ed7..0000000000 --- a/api/operations/object/put_object_legal_hold_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 object - -// 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" -) - -// PutObjectLegalHoldOKCode is the HTTP code returned for type PutObjectLegalHoldOK -const PutObjectLegalHoldOKCode int = 200 - -/* -PutObjectLegalHoldOK A successful response. - -swagger:response putObjectLegalHoldOK -*/ -type PutObjectLegalHoldOK struct { -} - -// NewPutObjectLegalHoldOK creates PutObjectLegalHoldOK with default headers values -func NewPutObjectLegalHoldOK() *PutObjectLegalHoldOK { - - return &PutObjectLegalHoldOK{} -} - -// WriteResponse to the client -func (o *PutObjectLegalHoldOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(200) -} - -/* -PutObjectLegalHoldDefault Generic error response. - -swagger:response putObjectLegalHoldDefault -*/ -type PutObjectLegalHoldDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewPutObjectLegalHoldDefault creates PutObjectLegalHoldDefault with default headers values -func NewPutObjectLegalHoldDefault(code int) *PutObjectLegalHoldDefault { - if code <= 0 { - code = 500 - } - - return &PutObjectLegalHoldDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the put object legal hold default response -func (o *PutObjectLegalHoldDefault) WithStatusCode(code int) *PutObjectLegalHoldDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the put object legal hold default response -func (o *PutObjectLegalHoldDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the put object legal hold default response -func (o *PutObjectLegalHoldDefault) WithPayload(payload *models.APIError) *PutObjectLegalHoldDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the put object legal hold default response -func (o *PutObjectLegalHoldDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *PutObjectLegalHoldDefault) 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/object/put_object_legal_hold_urlbuilder.go b/api/operations/object/put_object_legal_hold_urlbuilder.go deleted file mode 100644 index 721b503a37..0000000000 --- a/api/operations/object/put_object_legal_hold_urlbuilder.go +++ /dev/null @@ -1,133 +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 object - -// 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" -) - -// PutObjectLegalHoldURL generates an URL for the put object legal hold operation -type PutObjectLegalHoldURL struct { - BucketName string - - Prefix string - VersionID 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 *PutObjectLegalHoldURL) WithBasePath(bp string) *PutObjectLegalHoldURL { - 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 *PutObjectLegalHoldURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *PutObjectLegalHoldURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/buckets/{bucket_name}/objects/legalhold" - - bucketName := o.BucketName - if bucketName != "" { - _path = strings.Replace(_path, "{bucket_name}", bucketName, -1) - } else { - return nil, errors.New("bucketName is required on PutObjectLegalHoldURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - prefixQ := o.Prefix - if prefixQ != "" { - qs.Set("prefix", prefixQ) - } - - versionIDQ := o.VersionID - if versionIDQ != "" { - qs.Set("version_id", versionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *PutObjectLegalHoldURL) 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 *PutObjectLegalHoldURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *PutObjectLegalHoldURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on PutObjectLegalHoldURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on PutObjectLegalHoldURL") - } - - 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 *PutObjectLegalHoldURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/object/put_object_retention.go b/api/operations/object/put_object_retention.go deleted file mode 100644 index 24036295bc..0000000000 --- a/api/operations/object/put_object_retention.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 object - -// 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" -) - -// PutObjectRetentionHandlerFunc turns a function with the right signature into a put object retention handler -type PutObjectRetentionHandlerFunc func(PutObjectRetentionParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn PutObjectRetentionHandlerFunc) Handle(params PutObjectRetentionParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// PutObjectRetentionHandler interface for that can handle valid put object retention params -type PutObjectRetentionHandler interface { - Handle(PutObjectRetentionParams, *models.Principal) middleware.Responder -} - -// NewPutObjectRetention creates a new http.Handler for the put object retention operation -func NewPutObjectRetention(ctx *middleware.Context, handler PutObjectRetentionHandler) *PutObjectRetention { - return &PutObjectRetention{Context: ctx, Handler: handler} -} - -/* - PutObjectRetention swagger:route PUT /buckets/{bucket_name}/objects/retention Object putObjectRetention - -Put Object's retention status -*/ -type PutObjectRetention struct { - Context *middleware.Context - Handler PutObjectRetentionHandler -} - -func (o *PutObjectRetention) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewPutObjectRetentionParams() - 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/object/put_object_retention_parameters.go b/api/operations/object/put_object_retention_parameters.go deleted file mode 100644 index e580f1414a..0000000000 --- a/api/operations/object/put_object_retention_parameters.go +++ /dev/null @@ -1,190 +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 object - -// 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" -) - -// NewPutObjectRetentionParams creates a new PutObjectRetentionParams object -// -// There are no default values defined in the spec. -func NewPutObjectRetentionParams() PutObjectRetentionParams { - - return PutObjectRetentionParams{} -} - -// PutObjectRetentionParams contains all the bound params for the put object retention operation -// typically these are obtained from a http.Request -// -// swagger:parameters PutObjectRetention -type PutObjectRetentionParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.PutObjectRetentionRequest - /* - Required: true - In: path - */ - BucketName string - /* - Required: true - In: query - */ - Prefix string - /* - Required: true - In: query - */ - VersionID 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 NewPutObjectRetentionParams() beforehand. -func (o *PutObjectRetentionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.PutObjectRetentionRequest - 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", "")) - } - - rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") - if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { - res = append(res, err) - } - - qPrefix, qhkPrefix, _ := qs.GetOK("prefix") - if err := o.bindPrefix(qPrefix, qhkPrefix, route.Formats); err != nil { - res = append(res, err) - } - - qVersionID, qhkVersionID, _ := qs.GetOK("version_id") - if err := o.bindVersionID(qVersionID, qhkVersionID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindBucketName binds and validates parameter BucketName from path. -func (o *PutObjectRetentionParams) bindBucketName(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.BucketName = raw - - return nil -} - -// bindPrefix binds and validates parameter Prefix from query. -func (o *PutObjectRetentionParams) bindPrefix(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("prefix", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("prefix", "query", raw); err != nil { - return err - } - o.Prefix = raw - - return nil -} - -// bindVersionID binds and validates parameter VersionID from query. -func (o *PutObjectRetentionParams) bindVersionID(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("version_id", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("version_id", "query", raw); err != nil { - return err - } - o.VersionID = raw - - return nil -} diff --git a/api/operations/object/put_object_retention_urlbuilder.go b/api/operations/object/put_object_retention_urlbuilder.go deleted file mode 100644 index ad54c6c2be..0000000000 --- a/api/operations/object/put_object_retention_urlbuilder.go +++ /dev/null @@ -1,133 +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 object - -// 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" -) - -// PutObjectRetentionURL generates an URL for the put object retention operation -type PutObjectRetentionURL struct { - BucketName string - - Prefix string - VersionID 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 *PutObjectRetentionURL) WithBasePath(bp string) *PutObjectRetentionURL { - 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 *PutObjectRetentionURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *PutObjectRetentionURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/buckets/{bucket_name}/objects/retention" - - bucketName := o.BucketName - if bucketName != "" { - _path = strings.Replace(_path, "{bucket_name}", bucketName, -1) - } else { - return nil, errors.New("bucketName is required on PutObjectRetentionURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - prefixQ := o.Prefix - if prefixQ != "" { - qs.Set("prefix", prefixQ) - } - - versionIDQ := o.VersionID - if versionIDQ != "" { - qs.Set("version_id", versionIDQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *PutObjectRetentionURL) 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 *PutObjectRetentionURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *PutObjectRetentionURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on PutObjectRetentionURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on PutObjectRetentionURL") - } - - 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 *PutObjectRetentionURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/policy/add_policy.go b/api/operations/policy/add_policy.go deleted file mode 100644 index 9fd696a2c8..0000000000 --- a/api/operations/policy/add_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 policy - -// 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" -) - -// AddPolicyHandlerFunc turns a function with the right signature into a add policy handler -type AddPolicyHandlerFunc func(AddPolicyParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn AddPolicyHandlerFunc) Handle(params AddPolicyParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// AddPolicyHandler interface for that can handle valid add policy params -type AddPolicyHandler interface { - Handle(AddPolicyParams, *models.Principal) middleware.Responder -} - -// NewAddPolicy creates a new http.Handler for the add policy operation -func NewAddPolicy(ctx *middleware.Context, handler AddPolicyHandler) *AddPolicy { - return &AddPolicy{Context: ctx, Handler: handler} -} - -/* - AddPolicy swagger:route POST /policies Policy addPolicy - -Add Policy -*/ -type AddPolicy struct { - Context *middleware.Context - Handler AddPolicyHandler -} - -func (o *AddPolicy) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewAddPolicyParams() - 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/policy/add_policy_parameters.go b/api/operations/policy/add_policy_parameters.go deleted file mode 100644 index 6f2aaaac77..0000000000 --- a/api/operations/policy/add_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 policy - -// 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" -) - -// NewAddPolicyParams creates a new AddPolicyParams object -// -// There are no default values defined in the spec. -func NewAddPolicyParams() AddPolicyParams { - - return AddPolicyParams{} -} - -// AddPolicyParams contains all the bound params for the add policy operation -// typically these are obtained from a http.Request -// -// swagger:parameters AddPolicy -type AddPolicyParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.AddPolicyRequest -} - -// 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 NewAddPolicyParams() beforehand. -func (o *AddPolicyParams) 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.AddPolicyRequest - 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/policy/add_policy_responses.go b/api/operations/policy/add_policy_responses.go deleted file mode 100644 index 5c064c3c54..0000000000 --- a/api/operations/policy/add_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 policy - -// 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" -) - -// AddPolicyCreatedCode is the HTTP code returned for type AddPolicyCreated -const AddPolicyCreatedCode int = 201 - -/* -AddPolicyCreated A successful response. - -swagger:response addPolicyCreated -*/ -type AddPolicyCreated struct { - - /* - In: Body - */ - Payload *models.Policy `json:"body,omitempty"` -} - -// NewAddPolicyCreated creates AddPolicyCreated with default headers values -func NewAddPolicyCreated() *AddPolicyCreated { - - return &AddPolicyCreated{} -} - -// WithPayload adds the payload to the add policy created response -func (o *AddPolicyCreated) WithPayload(payload *models.Policy) *AddPolicyCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the add policy created response -func (o *AddPolicyCreated) SetPayload(payload *models.Policy) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *AddPolicyCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -AddPolicyDefault Generic error response. - -swagger:response addPolicyDefault -*/ -type AddPolicyDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewAddPolicyDefault creates AddPolicyDefault with default headers values -func NewAddPolicyDefault(code int) *AddPolicyDefault { - if code <= 0 { - code = 500 - } - - return &AddPolicyDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the add policy default response -func (o *AddPolicyDefault) WithStatusCode(code int) *AddPolicyDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the add policy default response -func (o *AddPolicyDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the add policy default response -func (o *AddPolicyDefault) WithPayload(payload *models.APIError) *AddPolicyDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the add policy default response -func (o *AddPolicyDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *AddPolicyDefault) 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/policy/add_policy_urlbuilder.go b/api/operations/policy/add_policy_urlbuilder.go deleted file mode 100644 index 56942a433c..0000000000 --- a/api/operations/policy/add_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 policy - -// 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" -) - -// AddPolicyURL generates an URL for the add policy operation -type AddPolicyURL 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 *AddPolicyURL) WithBasePath(bp string) *AddPolicyURL { - 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 *AddPolicyURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *AddPolicyURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/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 *AddPolicyURL) 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 *AddPolicyURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *AddPolicyURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on AddPolicyURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on AddPolicyURL") - } - - 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 *AddPolicyURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/policy/get_s_a_user_policy.go b/api/operations/policy/get_s_a_user_policy.go deleted file mode 100644 index 0fc56e82be..0000000000 --- a/api/operations/policy/get_s_a_user_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 policy - -// 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" -) - -// GetSAUserPolicyHandlerFunc turns a function with the right signature into a get s a user policy handler -type GetSAUserPolicyHandlerFunc func(GetSAUserPolicyParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetSAUserPolicyHandlerFunc) Handle(params GetSAUserPolicyParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// GetSAUserPolicyHandler interface for that can handle valid get s a user policy params -type GetSAUserPolicyHandler interface { - Handle(GetSAUserPolicyParams, *models.Principal) middleware.Responder -} - -// NewGetSAUserPolicy creates a new http.Handler for the get s a user policy operation -func NewGetSAUserPolicy(ctx *middleware.Context, handler GetSAUserPolicyHandler) *GetSAUserPolicy { - return &GetSAUserPolicy{Context: ctx, Handler: handler} -} - -/* - GetSAUserPolicy swagger:route GET /user/{name}/policies Policy getSAUserPolicy - -returns policies assigned for a specified user -*/ -type GetSAUserPolicy struct { - Context *middleware.Context - Handler GetSAUserPolicyHandler -} - -func (o *GetSAUserPolicy) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetSAUserPolicyParams() - 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/policy/get_s_a_user_policy_parameters.go b/api/operations/policy/get_s_a_user_policy_parameters.go deleted file mode 100644 index 38b284770b..0000000000 --- a/api/operations/policy/get_s_a_user_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 policy - -// 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" -) - -// NewGetSAUserPolicyParams creates a new GetSAUserPolicyParams object -// -// There are no default values defined in the spec. -func NewGetSAUserPolicyParams() GetSAUserPolicyParams { - - return GetSAUserPolicyParams{} -} - -// GetSAUserPolicyParams contains all the bound params for the get s a user policy operation -// typically these are obtained from a http.Request -// -// swagger:parameters GetSAUserPolicy -type GetSAUserPolicyParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - 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 NewGetSAUserPolicyParams() beforehand. -func (o *GetSAUserPolicyParams) 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 *GetSAUserPolicyParams) 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/policy/get_s_a_user_policy_responses.go b/api/operations/policy/get_s_a_user_policy_responses.go deleted file mode 100644 index a5d0247f3d..0000000000 --- a/api/operations/policy/get_s_a_user_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 policy - -// 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" -) - -// GetSAUserPolicyOKCode is the HTTP code returned for type GetSAUserPolicyOK -const GetSAUserPolicyOKCode int = 200 - -/* -GetSAUserPolicyOK A successful response. - -swagger:response getSAUserPolicyOK -*/ -type GetSAUserPolicyOK struct { - - /* - In: Body - */ - Payload *models.AUserPolicyResponse `json:"body,omitempty"` -} - -// NewGetSAUserPolicyOK creates GetSAUserPolicyOK with default headers values -func NewGetSAUserPolicyOK() *GetSAUserPolicyOK { - - return &GetSAUserPolicyOK{} -} - -// WithPayload adds the payload to the get s a user policy o k response -func (o *GetSAUserPolicyOK) WithPayload(payload *models.AUserPolicyResponse) *GetSAUserPolicyOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get s a user policy o k response -func (o *GetSAUserPolicyOK) SetPayload(payload *models.AUserPolicyResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetSAUserPolicyOK) 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 - } - } -} - -/* -GetSAUserPolicyDefault Generic error response. - -swagger:response getSAUserPolicyDefault -*/ -type GetSAUserPolicyDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewGetSAUserPolicyDefault creates GetSAUserPolicyDefault with default headers values -func NewGetSAUserPolicyDefault(code int) *GetSAUserPolicyDefault { - if code <= 0 { - code = 500 - } - - return &GetSAUserPolicyDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get s a user policy default response -func (o *GetSAUserPolicyDefault) WithStatusCode(code int) *GetSAUserPolicyDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get s a user policy default response -func (o *GetSAUserPolicyDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the get s a user policy default response -func (o *GetSAUserPolicyDefault) WithPayload(payload *models.APIError) *GetSAUserPolicyDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get s a user policy default response -func (o *GetSAUserPolicyDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetSAUserPolicyDefault) 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/policy/get_s_a_user_policy_urlbuilder.go b/api/operations/policy/get_s_a_user_policy_urlbuilder.go deleted file mode 100644 index 02eff9627f..0000000000 --- a/api/operations/policy/get_s_a_user_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 policy - -// 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" -) - -// GetSAUserPolicyURL generates an URL for the get s a user policy operation -type GetSAUserPolicyURL 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 *GetSAUserPolicyURL) WithBasePath(bp string) *GetSAUserPolicyURL { - 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 *GetSAUserPolicyURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetSAUserPolicyURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/user/{name}/policies" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetSAUserPolicyURL") - } - - _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 *GetSAUserPolicyURL) 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 *GetSAUserPolicyURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetSAUserPolicyURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetSAUserPolicyURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetSAUserPolicyURL") - } - - 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 *GetSAUserPolicyURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/policy/get_user_policy.go b/api/operations/policy/get_user_policy.go deleted file mode 100644 index 67553aa22f..0000000000 --- a/api/operations/policy/get_user_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 policy - -// 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" -) - -// GetUserPolicyHandlerFunc turns a function with the right signature into a get user policy handler -type GetUserPolicyHandlerFunc func(GetUserPolicyParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetUserPolicyHandlerFunc) Handle(params GetUserPolicyParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// GetUserPolicyHandler interface for that can handle valid get user policy params -type GetUserPolicyHandler interface { - Handle(GetUserPolicyParams, *models.Principal) middleware.Responder -} - -// NewGetUserPolicy creates a new http.Handler for the get user policy operation -func NewGetUserPolicy(ctx *middleware.Context, handler GetUserPolicyHandler) *GetUserPolicy { - return &GetUserPolicy{Context: ctx, Handler: handler} -} - -/* - GetUserPolicy swagger:route GET /user/policy Policy getUserPolicy - -returns policies for logged in user -*/ -type GetUserPolicy struct { - Context *middleware.Context - Handler GetUserPolicyHandler -} - -func (o *GetUserPolicy) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetUserPolicyParams() - 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/policy/get_user_policy_parameters.go b/api/operations/policy/get_user_policy_parameters.go deleted file mode 100644 index b053ed0688..0000000000 --- a/api/operations/policy/get_user_policy_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 policy - -// 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" -) - -// NewGetUserPolicyParams creates a new GetUserPolicyParams object -// -// There are no default values defined in the spec. -func NewGetUserPolicyParams() GetUserPolicyParams { - - return GetUserPolicyParams{} -} - -// GetUserPolicyParams contains all the bound params for the get user policy operation -// typically these are obtained from a http.Request -// -// swagger:parameters GetUserPolicy -type GetUserPolicyParams 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 NewGetUserPolicyParams() beforehand. -func (o *GetUserPolicyParams) 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/policy/get_user_policy_responses.go b/api/operations/policy/get_user_policy_responses.go deleted file mode 100644 index fe8754b20d..0000000000 --- a/api/operations/policy/get_user_policy_responses.go +++ /dev/null @@ -1,133 +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 policy - -// 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" -) - -// GetUserPolicyOKCode is the HTTP code returned for type GetUserPolicyOK -const GetUserPolicyOKCode int = 200 - -/* -GetUserPolicyOK A successful response. - -swagger:response getUserPolicyOK -*/ -type GetUserPolicyOK struct { - - /* - In: Body - */ - Payload string `json:"body,omitempty"` -} - -// NewGetUserPolicyOK creates GetUserPolicyOK with default headers values -func NewGetUserPolicyOK() *GetUserPolicyOK { - - return &GetUserPolicyOK{} -} - -// WithPayload adds the payload to the get user policy o k response -func (o *GetUserPolicyOK) WithPayload(payload string) *GetUserPolicyOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get user policy o k response -func (o *GetUserPolicyOK) SetPayload(payload string) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetUserPolicyOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -GetUserPolicyDefault Generic error response. - -swagger:response getUserPolicyDefault -*/ -type GetUserPolicyDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewGetUserPolicyDefault creates GetUserPolicyDefault with default headers values -func NewGetUserPolicyDefault(code int) *GetUserPolicyDefault { - if code <= 0 { - code = 500 - } - - return &GetUserPolicyDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get user policy default response -func (o *GetUserPolicyDefault) WithStatusCode(code int) *GetUserPolicyDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get user policy default response -func (o *GetUserPolicyDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the get user policy default response -func (o *GetUserPolicyDefault) WithPayload(payload *models.APIError) *GetUserPolicyDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get user policy default response -func (o *GetUserPolicyDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetUserPolicyDefault) 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/policy/get_user_policy_urlbuilder.go b/api/operations/policy/get_user_policy_urlbuilder.go deleted file mode 100644 index d87d021e57..0000000000 --- a/api/operations/policy/get_user_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 policy - -// 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" -) - -// GetUserPolicyURL generates an URL for the get user policy operation -type GetUserPolicyURL 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 *GetUserPolicyURL) WithBasePath(bp string) *GetUserPolicyURL { - 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 *GetUserPolicyURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetUserPolicyURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/user/policy" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *GetUserPolicyURL) 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 *GetUserPolicyURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetUserPolicyURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetUserPolicyURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetUserPolicyURL") - } - - 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 *GetUserPolicyURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/policy/list_groups_for_policy.go b/api/operations/policy/list_groups_for_policy.go deleted file mode 100644 index afa77391d7..0000000000 --- a/api/operations/policy/list_groups_for_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 policy - -// 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" -) - -// ListGroupsForPolicyHandlerFunc turns a function with the right signature into a list groups for policy handler -type ListGroupsForPolicyHandlerFunc func(ListGroupsForPolicyParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn ListGroupsForPolicyHandlerFunc) Handle(params ListGroupsForPolicyParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// ListGroupsForPolicyHandler interface for that can handle valid list groups for policy params -type ListGroupsForPolicyHandler interface { - Handle(ListGroupsForPolicyParams, *models.Principal) middleware.Responder -} - -// NewListGroupsForPolicy creates a new http.Handler for the list groups for policy operation -func NewListGroupsForPolicy(ctx *middleware.Context, handler ListGroupsForPolicyHandler) *ListGroupsForPolicy { - return &ListGroupsForPolicy{Context: ctx, Handler: handler} -} - -/* - ListGroupsForPolicy swagger:route GET /policies/{policy}/groups Policy listGroupsForPolicy - -List Groups for a Policy -*/ -type ListGroupsForPolicy struct { - Context *middleware.Context - Handler ListGroupsForPolicyHandler -} - -func (o *ListGroupsForPolicy) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewListGroupsForPolicyParams() - 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/policy/list_groups_for_policy_parameters.go b/api/operations/policy/list_groups_for_policy_parameters.go deleted file mode 100644 index 845199c9d4..0000000000 --- a/api/operations/policy/list_groups_for_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 policy - -// 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" -) - -// NewListGroupsForPolicyParams creates a new ListGroupsForPolicyParams object -// -// There are no default values defined in the spec. -func NewListGroupsForPolicyParams() ListGroupsForPolicyParams { - - return ListGroupsForPolicyParams{} -} - -// ListGroupsForPolicyParams contains all the bound params for the list groups for policy operation -// typically these are obtained from a http.Request -// -// swagger:parameters ListGroupsForPolicy -type ListGroupsForPolicyParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - Policy 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 NewListGroupsForPolicyParams() beforehand. -func (o *ListGroupsForPolicyParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rPolicy, rhkPolicy, _ := route.Params.GetOK("policy") - if err := o.bindPolicy(rPolicy, rhkPolicy, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindPolicy binds and validates parameter Policy from path. -func (o *ListGroupsForPolicyParams) bindPolicy(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.Policy = raw - - return nil -} diff --git a/api/operations/policy/list_groups_for_policy_responses.go b/api/operations/policy/list_groups_for_policy_responses.go deleted file mode 100644 index 23b2cd7c89..0000000000 --- a/api/operations/policy/list_groups_for_policy_responses.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 policy - -// 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" -) - -// ListGroupsForPolicyOKCode is the HTTP code returned for type ListGroupsForPolicyOK -const ListGroupsForPolicyOKCode int = 200 - -/* -ListGroupsForPolicyOK A successful response. - -swagger:response listGroupsForPolicyOK -*/ -type ListGroupsForPolicyOK struct { - - /* - In: Body - */ - Payload []string `json:"body,omitempty"` -} - -// NewListGroupsForPolicyOK creates ListGroupsForPolicyOK with default headers values -func NewListGroupsForPolicyOK() *ListGroupsForPolicyOK { - - return &ListGroupsForPolicyOK{} -} - -// WithPayload adds the payload to the list groups for policy o k response -func (o *ListGroupsForPolicyOK) WithPayload(payload []string) *ListGroupsForPolicyOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list groups for policy o k response -func (o *ListGroupsForPolicyOK) SetPayload(payload []string) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListGroupsForPolicyOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = make([]string, 0, 50) - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -ListGroupsForPolicyDefault Generic error response. - -swagger:response listGroupsForPolicyDefault -*/ -type ListGroupsForPolicyDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewListGroupsForPolicyDefault creates ListGroupsForPolicyDefault with default headers values -func NewListGroupsForPolicyDefault(code int) *ListGroupsForPolicyDefault { - if code <= 0 { - code = 500 - } - - return &ListGroupsForPolicyDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the list groups for policy default response -func (o *ListGroupsForPolicyDefault) WithStatusCode(code int) *ListGroupsForPolicyDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the list groups for policy default response -func (o *ListGroupsForPolicyDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the list groups for policy default response -func (o *ListGroupsForPolicyDefault) WithPayload(payload *models.APIError) *ListGroupsForPolicyDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list groups for policy default response -func (o *ListGroupsForPolicyDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListGroupsForPolicyDefault) 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/policy/list_groups_for_policy_urlbuilder.go b/api/operations/policy/list_groups_for_policy_urlbuilder.go deleted file mode 100644 index 42f9545075..0000000000 --- a/api/operations/policy/list_groups_for_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 policy - -// 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" -) - -// ListGroupsForPolicyURL generates an URL for the list groups for policy operation -type ListGroupsForPolicyURL struct { - Policy 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 *ListGroupsForPolicyURL) WithBasePath(bp string) *ListGroupsForPolicyURL { - 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 *ListGroupsForPolicyURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ListGroupsForPolicyURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/policies/{policy}/groups" - - policy := o.Policy - if policy != "" { - _path = strings.Replace(_path, "{policy}", policy, -1) - } else { - return nil, errors.New("policy is required on ListGroupsForPolicyURL") - } - - _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 *ListGroupsForPolicyURL) 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 *ListGroupsForPolicyURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ListGroupsForPolicyURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ListGroupsForPolicyURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ListGroupsForPolicyURL") - } - - 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 *ListGroupsForPolicyURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/policy/list_policies.go b/api/operations/policy/list_policies.go deleted file mode 100644 index 5892c32f99..0000000000 --- a/api/operations/policy/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 policy - -// 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" -) - -// ListPoliciesHandlerFunc turns a function with the right signature into a list policies handler -type ListPoliciesHandlerFunc func(ListPoliciesParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn ListPoliciesHandlerFunc) Handle(params ListPoliciesParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// ListPoliciesHandler interface for that can handle valid list policies params -type ListPoliciesHandler interface { - Handle(ListPoliciesParams, *models.Principal) middleware.Responder -} - -// NewListPolicies creates a new http.Handler for the list policies operation -func NewListPolicies(ctx *middleware.Context, handler ListPoliciesHandler) *ListPolicies { - return &ListPolicies{Context: ctx, Handler: handler} -} - -/* - ListPolicies swagger:route GET /policies Policy listPolicies - -List Policies -*/ -type ListPolicies struct { - Context *middleware.Context - Handler ListPoliciesHandler -} - -func (o *ListPolicies) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewListPoliciesParams() - 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/policy/list_policies_parameters.go b/api/operations/policy/list_policies_parameters.go deleted file mode 100644 index 5ba782bcab..0000000000 --- a/api/operations/policy/list_policies_parameters.go +++ /dev/null @@ -1,146 +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 policy - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewListPoliciesParams creates a new ListPoliciesParams object -// with the default values initialized. -func NewListPoliciesParams() ListPoliciesParams { - - var ( - // initialize parameters with default values - - limitDefault = int32(20) - offsetDefault = int32(0) - ) - - return ListPoliciesParams{ - Limit: &limitDefault, - - Offset: &offsetDefault, - } -} - -// ListPoliciesParams contains all the bound params for the list policies operation -// typically these are obtained from a http.Request -// -// swagger:parameters ListPolicies -type ListPoliciesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - In: query - Default: 20 - */ - Limit *int32 - /* - In: query - Default: 0 - */ - Offset *int32 -} - -// 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 NewListPoliciesParams() beforehand. -func (o *ListPoliciesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qLimit, qhkLimit, _ := qs.GetOK("limit") - if err := o.bindLimit(qLimit, qhkLimit, route.Formats); err != nil { - res = append(res, err) - } - - qOffset, qhkOffset, _ := qs.GetOK("offset") - if err := o.bindOffset(qOffset, qhkOffset, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindLimit binds and validates parameter Limit from query. -func (o *ListPoliciesParams) bindLimit(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 - // Default values have been previously initialized by NewListPoliciesParams() - return nil - } - - value, err := swag.ConvertInt32(raw) - if err != nil { - return errors.InvalidType("limit", "query", "int32", raw) - } - o.Limit = &value - - return nil -} - -// bindOffset binds and validates parameter Offset from query. -func (o *ListPoliciesParams) bindOffset(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 - // Default values have been previously initialized by NewListPoliciesParams() - return nil - } - - value, err := swag.ConvertInt32(raw) - if err != nil { - return errors.InvalidType("offset", "query", "int32", raw) - } - o.Offset = &value - - return nil -} diff --git a/api/operations/policy/list_policies_responses.go b/api/operations/policy/list_policies_responses.go deleted file mode 100644 index 92da85ab35..0000000000 --- a/api/operations/policy/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 policy - -// 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" -) - -// ListPoliciesOKCode is the HTTP code returned for type ListPoliciesOK -const ListPoliciesOKCode int = 200 - -/* -ListPoliciesOK A successful response. - -swagger:response listPoliciesOK -*/ -type ListPoliciesOK struct { - - /* - In: Body - */ - Payload *models.ListPoliciesResponse `json:"body,omitempty"` -} - -// NewListPoliciesOK creates ListPoliciesOK with default headers values -func NewListPoliciesOK() *ListPoliciesOK { - - return &ListPoliciesOK{} -} - -// WithPayload adds the payload to the list policies o k response -func (o *ListPoliciesOK) WithPayload(payload *models.ListPoliciesResponse) *ListPoliciesOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list policies o k response -func (o *ListPoliciesOK) SetPayload(payload *models.ListPoliciesResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListPoliciesOK) 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 - } - } -} - -/* -ListPoliciesDefault Generic error response. - -swagger:response listPoliciesDefault -*/ -type ListPoliciesDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewListPoliciesDefault creates ListPoliciesDefault with default headers values -func NewListPoliciesDefault(code int) *ListPoliciesDefault { - if code <= 0 { - code = 500 - } - - return &ListPoliciesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the list policies default response -func (o *ListPoliciesDefault) WithStatusCode(code int) *ListPoliciesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the list policies default response -func (o *ListPoliciesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the list policies default response -func (o *ListPoliciesDefault) WithPayload(payload *models.APIError) *ListPoliciesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list policies default response -func (o *ListPoliciesDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListPoliciesDefault) 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/policy/list_policies_urlbuilder.go b/api/operations/policy/list_policies_urlbuilder.go deleted file mode 100644 index 3e4a4a4768..0000000000 --- a/api/operations/policy/list_policies_urlbuilder.go +++ /dev/null @@ -1,131 +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 policy - -// 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" - - "github.com/go-openapi/swag" -) - -// ListPoliciesURL generates an URL for the list policies operation -type ListPoliciesURL struct { - Limit *int32 - Offset *int32 - - _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 *ListPoliciesURL) WithBasePath(bp string) *ListPoliciesURL { - 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 *ListPoliciesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ListPoliciesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/policies" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var limitQ string - if o.Limit != nil { - limitQ = swag.FormatInt32(*o.Limit) - } - if limitQ != "" { - qs.Set("limit", limitQ) - } - - var offsetQ string - if o.Offset != nil { - offsetQ = swag.FormatInt32(*o.Offset) - } - if offsetQ != "" { - qs.Set("offset", offsetQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ListPoliciesURL) 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 *ListPoliciesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ListPoliciesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ListPoliciesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ListPoliciesURL") - } - - 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 *ListPoliciesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/policy/list_users_for_policy.go b/api/operations/policy/list_users_for_policy.go deleted file mode 100644 index b55ee19a35..0000000000 --- a/api/operations/policy/list_users_for_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 policy - -// 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" -) - -// ListUsersForPolicyHandlerFunc turns a function with the right signature into a list users for policy handler -type ListUsersForPolicyHandlerFunc func(ListUsersForPolicyParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn ListUsersForPolicyHandlerFunc) Handle(params ListUsersForPolicyParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// ListUsersForPolicyHandler interface for that can handle valid list users for policy params -type ListUsersForPolicyHandler interface { - Handle(ListUsersForPolicyParams, *models.Principal) middleware.Responder -} - -// NewListUsersForPolicy creates a new http.Handler for the list users for policy operation -func NewListUsersForPolicy(ctx *middleware.Context, handler ListUsersForPolicyHandler) *ListUsersForPolicy { - return &ListUsersForPolicy{Context: ctx, Handler: handler} -} - -/* - ListUsersForPolicy swagger:route GET /policies/{policy}/users Policy listUsersForPolicy - -List Users for a Policy -*/ -type ListUsersForPolicy struct { - Context *middleware.Context - Handler ListUsersForPolicyHandler -} - -func (o *ListUsersForPolicy) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewListUsersForPolicyParams() - 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/policy/list_users_for_policy_parameters.go b/api/operations/policy/list_users_for_policy_parameters.go deleted file mode 100644 index 12f1396481..0000000000 --- a/api/operations/policy/list_users_for_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 policy - -// 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" -) - -// NewListUsersForPolicyParams creates a new ListUsersForPolicyParams object -// -// There are no default values defined in the spec. -func NewListUsersForPolicyParams() ListUsersForPolicyParams { - - return ListUsersForPolicyParams{} -} - -// ListUsersForPolicyParams contains all the bound params for the list users for policy operation -// typically these are obtained from a http.Request -// -// swagger:parameters ListUsersForPolicy -type ListUsersForPolicyParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - Policy 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 NewListUsersForPolicyParams() beforehand. -func (o *ListUsersForPolicyParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rPolicy, rhkPolicy, _ := route.Params.GetOK("policy") - if err := o.bindPolicy(rPolicy, rhkPolicy, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindPolicy binds and validates parameter Policy from path. -func (o *ListUsersForPolicyParams) bindPolicy(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.Policy = raw - - return nil -} diff --git a/api/operations/policy/list_users_for_policy_responses.go b/api/operations/policy/list_users_for_policy_responses.go deleted file mode 100644 index 877f9a6ee3..0000000000 --- a/api/operations/policy/list_users_for_policy_responses.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 policy - -// 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" -) - -// ListUsersForPolicyOKCode is the HTTP code returned for type ListUsersForPolicyOK -const ListUsersForPolicyOKCode int = 200 - -/* -ListUsersForPolicyOK A successful response. - -swagger:response listUsersForPolicyOK -*/ -type ListUsersForPolicyOK struct { - - /* - In: Body - */ - Payload []string `json:"body,omitempty"` -} - -// NewListUsersForPolicyOK creates ListUsersForPolicyOK with default headers values -func NewListUsersForPolicyOK() *ListUsersForPolicyOK { - - return &ListUsersForPolicyOK{} -} - -// WithPayload adds the payload to the list users for policy o k response -func (o *ListUsersForPolicyOK) WithPayload(payload []string) *ListUsersForPolicyOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list users for policy o k response -func (o *ListUsersForPolicyOK) SetPayload(payload []string) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListUsersForPolicyOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = make([]string, 0, 50) - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -ListUsersForPolicyDefault Generic error response. - -swagger:response listUsersForPolicyDefault -*/ -type ListUsersForPolicyDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewListUsersForPolicyDefault creates ListUsersForPolicyDefault with default headers values -func NewListUsersForPolicyDefault(code int) *ListUsersForPolicyDefault { - if code <= 0 { - code = 500 - } - - return &ListUsersForPolicyDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the list users for policy default response -func (o *ListUsersForPolicyDefault) WithStatusCode(code int) *ListUsersForPolicyDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the list users for policy default response -func (o *ListUsersForPolicyDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the list users for policy default response -func (o *ListUsersForPolicyDefault) WithPayload(payload *models.APIError) *ListUsersForPolicyDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list users for policy default response -func (o *ListUsersForPolicyDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListUsersForPolicyDefault) 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/policy/list_users_for_policy_urlbuilder.go b/api/operations/policy/list_users_for_policy_urlbuilder.go deleted file mode 100644 index 7dad9d09bf..0000000000 --- a/api/operations/policy/list_users_for_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 policy - -// 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" -) - -// ListUsersForPolicyURL generates an URL for the list users for policy operation -type ListUsersForPolicyURL struct { - Policy 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 *ListUsersForPolicyURL) WithBasePath(bp string) *ListUsersForPolicyURL { - 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 *ListUsersForPolicyURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ListUsersForPolicyURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/policies/{policy}/users" - - policy := o.Policy - if policy != "" { - _path = strings.Replace(_path, "{policy}", policy, -1) - } else { - return nil, errors.New("policy is required on ListUsersForPolicyURL") - } - - _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 *ListUsersForPolicyURL) 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 *ListUsersForPolicyURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ListUsersForPolicyURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ListUsersForPolicyURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ListUsersForPolicyURL") - } - - 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 *ListUsersForPolicyURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/policy/policy_info.go b/api/operations/policy/policy_info.go deleted file mode 100644 index 70c6a5bb35..0000000000 --- a/api/operations/policy/policy_info.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 policy - -// 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" -) - -// PolicyInfoHandlerFunc turns a function with the right signature into a policy info handler -type PolicyInfoHandlerFunc func(PolicyInfoParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn PolicyInfoHandlerFunc) Handle(params PolicyInfoParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// PolicyInfoHandler interface for that can handle valid policy info params -type PolicyInfoHandler interface { - Handle(PolicyInfoParams, *models.Principal) middleware.Responder -} - -// NewPolicyInfo creates a new http.Handler for the policy info operation -func NewPolicyInfo(ctx *middleware.Context, handler PolicyInfoHandler) *PolicyInfo { - return &PolicyInfo{Context: ctx, Handler: handler} -} - -/* - PolicyInfo swagger:route GET /policy/{name} Policy policyInfo - -Policy info -*/ -type PolicyInfo struct { - Context *middleware.Context - Handler PolicyInfoHandler -} - -func (o *PolicyInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewPolicyInfoParams() - 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/policy/policy_info_parameters.go b/api/operations/policy/policy_info_parameters.go deleted file mode 100644 index 6a2d99e620..0000000000 --- a/api/operations/policy/policy_info_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 policy - -// 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" -) - -// NewPolicyInfoParams creates a new PolicyInfoParams object -// -// There are no default values defined in the spec. -func NewPolicyInfoParams() PolicyInfoParams { - - return PolicyInfoParams{} -} - -// PolicyInfoParams contains all the bound params for the policy info operation -// typically these are obtained from a http.Request -// -// swagger:parameters PolicyInfo -type PolicyInfoParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - 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 NewPolicyInfoParams() beforehand. -func (o *PolicyInfoParams) 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 *PolicyInfoParams) 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/policy/policy_info_responses.go b/api/operations/policy/policy_info_responses.go deleted file mode 100644 index 35e8225500..0000000000 --- a/api/operations/policy/policy_info_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 policy - -// 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" -) - -// PolicyInfoOKCode is the HTTP code returned for type PolicyInfoOK -const PolicyInfoOKCode int = 200 - -/* -PolicyInfoOK A successful response. - -swagger:response policyInfoOK -*/ -type PolicyInfoOK struct { - - /* - In: Body - */ - Payload *models.Policy `json:"body,omitempty"` -} - -// NewPolicyInfoOK creates PolicyInfoOK with default headers values -func NewPolicyInfoOK() *PolicyInfoOK { - - return &PolicyInfoOK{} -} - -// WithPayload adds the payload to the policy info o k response -func (o *PolicyInfoOK) WithPayload(payload *models.Policy) *PolicyInfoOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the policy info o k response -func (o *PolicyInfoOK) SetPayload(payload *models.Policy) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *PolicyInfoOK) 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 - } - } -} - -/* -PolicyInfoDefault Generic error response. - -swagger:response policyInfoDefault -*/ -type PolicyInfoDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewPolicyInfoDefault creates PolicyInfoDefault with default headers values -func NewPolicyInfoDefault(code int) *PolicyInfoDefault { - if code <= 0 { - code = 500 - } - - return &PolicyInfoDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the policy info default response -func (o *PolicyInfoDefault) WithStatusCode(code int) *PolicyInfoDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the policy info default response -func (o *PolicyInfoDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the policy info default response -func (o *PolicyInfoDefault) WithPayload(payload *models.APIError) *PolicyInfoDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the policy info default response -func (o *PolicyInfoDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *PolicyInfoDefault) 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/policy/policy_info_urlbuilder.go b/api/operations/policy/policy_info_urlbuilder.go deleted file mode 100644 index b4a67378b4..0000000000 --- a/api/operations/policy/policy_info_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 policy - -// 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" -) - -// PolicyInfoURL generates an URL for the policy info operation -type PolicyInfoURL 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 *PolicyInfoURL) WithBasePath(bp string) *PolicyInfoURL { - 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 *PolicyInfoURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *PolicyInfoURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/policy/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on PolicyInfoURL") - } - - _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 *PolicyInfoURL) 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 *PolicyInfoURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *PolicyInfoURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on PolicyInfoURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on PolicyInfoURL") - } - - 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 *PolicyInfoURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/policy/remove_policy.go b/api/operations/policy/remove_policy.go deleted file mode 100644 index 9537673d16..0000000000 --- a/api/operations/policy/remove_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 policy - -// 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" -) - -// RemovePolicyHandlerFunc turns a function with the right signature into a remove policy handler -type RemovePolicyHandlerFunc func(RemovePolicyParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn RemovePolicyHandlerFunc) Handle(params RemovePolicyParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// RemovePolicyHandler interface for that can handle valid remove policy params -type RemovePolicyHandler interface { - Handle(RemovePolicyParams, *models.Principal) middleware.Responder -} - -// NewRemovePolicy creates a new http.Handler for the remove policy operation -func NewRemovePolicy(ctx *middleware.Context, handler RemovePolicyHandler) *RemovePolicy { - return &RemovePolicy{Context: ctx, Handler: handler} -} - -/* - RemovePolicy swagger:route DELETE /policy/{name} Policy removePolicy - -Remove policy -*/ -type RemovePolicy struct { - Context *middleware.Context - Handler RemovePolicyHandler -} - -func (o *RemovePolicy) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewRemovePolicyParams() - 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/policy/remove_policy_parameters.go b/api/operations/policy/remove_policy_parameters.go deleted file mode 100644 index efbc574ce5..0000000000 --- a/api/operations/policy/remove_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 policy - -// 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" -) - -// NewRemovePolicyParams creates a new RemovePolicyParams object -// -// There are no default values defined in the spec. -func NewRemovePolicyParams() RemovePolicyParams { - - return RemovePolicyParams{} -} - -// RemovePolicyParams contains all the bound params for the remove policy operation -// typically these are obtained from a http.Request -// -// swagger:parameters RemovePolicy -type RemovePolicyParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - 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 NewRemovePolicyParams() beforehand. -func (o *RemovePolicyParams) 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 *RemovePolicyParams) 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/policy/remove_policy_responses.go b/api/operations/policy/remove_policy_responses.go deleted file mode 100644 index b3147e907a..0000000000 --- a/api/operations/policy/remove_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 policy - -// 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" -) - -// RemovePolicyNoContentCode is the HTTP code returned for type RemovePolicyNoContent -const RemovePolicyNoContentCode int = 204 - -/* -RemovePolicyNoContent A successful response. - -swagger:response removePolicyNoContent -*/ -type RemovePolicyNoContent struct { -} - -// NewRemovePolicyNoContent creates RemovePolicyNoContent with default headers values -func NewRemovePolicyNoContent() *RemovePolicyNoContent { - - return &RemovePolicyNoContent{} -} - -// WriteResponse to the client -func (o *RemovePolicyNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -/* -RemovePolicyDefault Generic error response. - -swagger:response removePolicyDefault -*/ -type RemovePolicyDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewRemovePolicyDefault creates RemovePolicyDefault with default headers values -func NewRemovePolicyDefault(code int) *RemovePolicyDefault { - if code <= 0 { - code = 500 - } - - return &RemovePolicyDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the remove policy default response -func (o *RemovePolicyDefault) WithStatusCode(code int) *RemovePolicyDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the remove policy default response -func (o *RemovePolicyDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the remove policy default response -func (o *RemovePolicyDefault) WithPayload(payload *models.APIError) *RemovePolicyDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the remove policy default response -func (o *RemovePolicyDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *RemovePolicyDefault) 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/policy/remove_policy_urlbuilder.go b/api/operations/policy/remove_policy_urlbuilder.go deleted file mode 100644 index ffcb2802e2..0000000000 --- a/api/operations/policy/remove_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 policy - -// 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" -) - -// RemovePolicyURL generates an URL for the remove policy operation -type RemovePolicyURL 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 *RemovePolicyURL) WithBasePath(bp string) *RemovePolicyURL { - 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 *RemovePolicyURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *RemovePolicyURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/policy/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on RemovePolicyURL") - } - - _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 *RemovePolicyURL) 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 *RemovePolicyURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *RemovePolicyURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on RemovePolicyURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on RemovePolicyURL") - } - - 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 *RemovePolicyURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/policy/set_policy.go b/api/operations/policy/set_policy.go deleted file mode 100644 index dd6f0a1074..0000000000 --- a/api/operations/policy/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 policy - -// 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" -) - -// SetPolicyHandlerFunc turns a function with the right signature into a set policy handler -type SetPolicyHandlerFunc func(SetPolicyParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn SetPolicyHandlerFunc) Handle(params SetPolicyParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// SetPolicyHandler interface for that can handle valid set policy params -type SetPolicyHandler interface { - Handle(SetPolicyParams, *models.Principal) middleware.Responder -} - -// NewSetPolicy creates a new http.Handler for the set policy operation -func NewSetPolicy(ctx *middleware.Context, handler SetPolicyHandler) *SetPolicy { - return &SetPolicy{Context: ctx, Handler: handler} -} - -/* - SetPolicy swagger:route PUT /set-policy Policy setPolicy - -Set policy -*/ -type SetPolicy struct { - Context *middleware.Context - Handler SetPolicyHandler -} - -func (o *SetPolicy) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewSetPolicyParams() - 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/policy/set_policy_multiple.go b/api/operations/policy/set_policy_multiple.go deleted file mode 100644 index 450784ab42..0000000000 --- a/api/operations/policy/set_policy_multiple.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 policy - -// 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" -) - -// SetPolicyMultipleHandlerFunc turns a function with the right signature into a set policy multiple handler -type SetPolicyMultipleHandlerFunc func(SetPolicyMultipleParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn SetPolicyMultipleHandlerFunc) Handle(params SetPolicyMultipleParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// SetPolicyMultipleHandler interface for that can handle valid set policy multiple params -type SetPolicyMultipleHandler interface { - Handle(SetPolicyMultipleParams, *models.Principal) middleware.Responder -} - -// NewSetPolicyMultiple creates a new http.Handler for the set policy multiple operation -func NewSetPolicyMultiple(ctx *middleware.Context, handler SetPolicyMultipleHandler) *SetPolicyMultiple { - return &SetPolicyMultiple{Context: ctx, Handler: handler} -} - -/* - SetPolicyMultiple swagger:route PUT /set-policy-multi Policy setPolicyMultiple - -Set policy to multiple users/groups -*/ -type SetPolicyMultiple struct { - Context *middleware.Context - Handler SetPolicyMultipleHandler -} - -func (o *SetPolicyMultiple) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewSetPolicyMultipleParams() - 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/policy/set_policy_multiple_parameters.go b/api/operations/policy/set_policy_multiple_parameters.go deleted file mode 100644 index 05b027e842..0000000000 --- a/api/operations/policy/set_policy_multiple_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 policy - -// 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" -) - -// NewSetPolicyMultipleParams creates a new SetPolicyMultipleParams object -// -// There are no default values defined in the spec. -func NewSetPolicyMultipleParams() SetPolicyMultipleParams { - - return SetPolicyMultipleParams{} -} - -// SetPolicyMultipleParams contains all the bound params for the set policy multiple operation -// typically these are obtained from a http.Request -// -// swagger:parameters SetPolicyMultiple -type SetPolicyMultipleParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.SetPolicyMultipleNameRequest -} - -// 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 NewSetPolicyMultipleParams() beforehand. -func (o *SetPolicyMultipleParams) 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.SetPolicyMultipleNameRequest - 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/policy/set_policy_multiple_responses.go b/api/operations/policy/set_policy_multiple_responses.go deleted file mode 100644 index e09701e86f..0000000000 --- a/api/operations/policy/set_policy_multiple_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 policy - -// 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" -) - -// SetPolicyMultipleNoContentCode is the HTTP code returned for type SetPolicyMultipleNoContent -const SetPolicyMultipleNoContentCode int = 204 - -/* -SetPolicyMultipleNoContent A successful response. - -swagger:response setPolicyMultipleNoContent -*/ -type SetPolicyMultipleNoContent struct { -} - -// NewSetPolicyMultipleNoContent creates SetPolicyMultipleNoContent with default headers values -func NewSetPolicyMultipleNoContent() *SetPolicyMultipleNoContent { - - return &SetPolicyMultipleNoContent{} -} - -// WriteResponse to the client -func (o *SetPolicyMultipleNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -/* -SetPolicyMultipleDefault Generic error response. - -swagger:response setPolicyMultipleDefault -*/ -type SetPolicyMultipleDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewSetPolicyMultipleDefault creates SetPolicyMultipleDefault with default headers values -func NewSetPolicyMultipleDefault(code int) *SetPolicyMultipleDefault { - if code <= 0 { - code = 500 - } - - return &SetPolicyMultipleDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the set policy multiple default response -func (o *SetPolicyMultipleDefault) WithStatusCode(code int) *SetPolicyMultipleDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the set policy multiple default response -func (o *SetPolicyMultipleDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the set policy multiple default response -func (o *SetPolicyMultipleDefault) WithPayload(payload *models.APIError) *SetPolicyMultipleDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the set policy multiple default response -func (o *SetPolicyMultipleDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *SetPolicyMultipleDefault) 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/policy/set_policy_multiple_urlbuilder.go b/api/operations/policy/set_policy_multiple_urlbuilder.go deleted file mode 100644 index 9df0f5c6c5..0000000000 --- a/api/operations/policy/set_policy_multiple_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 policy - -// 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" -) - -// SetPolicyMultipleURL generates an URL for the set policy multiple operation -type SetPolicyMultipleURL 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 *SetPolicyMultipleURL) WithBasePath(bp string) *SetPolicyMultipleURL { - 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 *SetPolicyMultipleURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *SetPolicyMultipleURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/set-policy-multi" - - _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 *SetPolicyMultipleURL) 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 *SetPolicyMultipleURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *SetPolicyMultipleURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on SetPolicyMultipleURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on SetPolicyMultipleURL") - } - - 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 *SetPolicyMultipleURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/policy/set_policy_parameters.go b/api/operations/policy/set_policy_parameters.go deleted file mode 100644 index c40066d8a2..0000000000 --- a/api/operations/policy/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 policy - -// 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" -) - -// NewSetPolicyParams creates a new SetPolicyParams object -// -// There are no default values defined in the spec. -func NewSetPolicyParams() SetPolicyParams { - - return SetPolicyParams{} -} - -// SetPolicyParams contains all the bound params for the set policy operation -// typically these are obtained from a http.Request -// -// swagger:parameters SetPolicy -type SetPolicyParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.SetPolicyNameRequest -} - -// 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 NewSetPolicyParams() beforehand. -func (o *SetPolicyParams) 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.SetPolicyNameRequest - 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/policy/set_policy_responses.go b/api/operations/policy/set_policy_responses.go deleted file mode 100644 index 3235b94296..0000000000 --- a/api/operations/policy/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 policy - -// 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" -) - -// SetPolicyNoContentCode is the HTTP code returned for type SetPolicyNoContent -const SetPolicyNoContentCode int = 204 - -/* -SetPolicyNoContent A successful response. - -swagger:response setPolicyNoContent -*/ -type SetPolicyNoContent struct { -} - -// NewSetPolicyNoContent creates SetPolicyNoContent with default headers values -func NewSetPolicyNoContent() *SetPolicyNoContent { - - return &SetPolicyNoContent{} -} - -// WriteResponse to the client -func (o *SetPolicyNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -/* -SetPolicyDefault Generic error response. - -swagger:response setPolicyDefault -*/ -type SetPolicyDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewSetPolicyDefault creates SetPolicyDefault with default headers values -func NewSetPolicyDefault(code int) *SetPolicyDefault { - if code <= 0 { - code = 500 - } - - return &SetPolicyDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the set policy default response -func (o *SetPolicyDefault) WithStatusCode(code int) *SetPolicyDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the set policy default response -func (o *SetPolicyDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the set policy default response -func (o *SetPolicyDefault) WithPayload(payload *models.APIError) *SetPolicyDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the set policy default response -func (o *SetPolicyDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *SetPolicyDefault) 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/policy/set_policy_urlbuilder.go b/api/operations/policy/set_policy_urlbuilder.go deleted file mode 100644 index 5797a222ed..0000000000 --- a/api/operations/policy/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 policy - -// 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" -) - -// SetPolicyURL generates an URL for the set policy operation -type SetPolicyURL 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 *SetPolicyURL) WithBasePath(bp string) *SetPolicyURL { - 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 *SetPolicyURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *SetPolicyURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/set-policy" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *SetPolicyURL) 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 *SetPolicyURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *SetPolicyURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on SetPolicyURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on SetPolicyURL") - } - - 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 *SetPolicyURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/release/list_releases.go b/api/operations/release/list_releases.go deleted file mode 100644 index bb2e55b1af..0000000000 --- a/api/operations/release/list_releases.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 release - -// 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" -) - -// ListReleasesHandlerFunc turns a function with the right signature into a list releases handler -type ListReleasesHandlerFunc func(ListReleasesParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn ListReleasesHandlerFunc) Handle(params ListReleasesParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// ListReleasesHandler interface for that can handle valid list releases params -type ListReleasesHandler interface { - Handle(ListReleasesParams, *models.Principal) middleware.Responder -} - -// NewListReleases creates a new http.Handler for the list releases operation -func NewListReleases(ctx *middleware.Context, handler ListReleasesHandler) *ListReleases { - return &ListReleases{Context: ctx, Handler: handler} -} - -/* - ListReleases swagger:route GET /releases release listReleases - -Get repo releases for a given version -*/ -type ListReleases struct { - Context *middleware.Context - Handler ListReleasesHandler -} - -func (o *ListReleases) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewListReleasesParams() - 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/release/list_releases_parameters.go b/api/operations/release/list_releases_parameters.go deleted file mode 100644 index 38fed7b962..0000000000 --- a/api/operations/release/list_releases_parameters.go +++ /dev/null @@ -1,180 +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 release - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" -) - -// NewListReleasesParams creates a new ListReleasesParams object -// -// There are no default values defined in the spec. -func NewListReleasesParams() ListReleasesParams { - - return ListReleasesParams{} -} - -// ListReleasesParams contains all the bound params for the list releases operation -// typically these are obtained from a http.Request -// -// swagger:parameters ListReleases -type ListReleasesParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Current Release - In: query - */ - Current *string - /*filter releases - In: query - */ - Filter *string - /*repo name - Required: true - In: query - */ - Repo string - /*search content - In: query - */ - Search *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 NewListReleasesParams() beforehand. -func (o *ListReleasesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qCurrent, qhkCurrent, _ := qs.GetOK("current") - if err := o.bindCurrent(qCurrent, qhkCurrent, route.Formats); err != nil { - res = append(res, err) - } - - qFilter, qhkFilter, _ := qs.GetOK("filter") - if err := o.bindFilter(qFilter, qhkFilter, route.Formats); err != nil { - res = append(res, err) - } - - qRepo, qhkRepo, _ := qs.GetOK("repo") - if err := o.bindRepo(qRepo, qhkRepo, route.Formats); err != nil { - res = append(res, err) - } - - qSearch, qhkSearch, _ := qs.GetOK("search") - if err := o.bindSearch(qSearch, qhkSearch, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindCurrent binds and validates parameter Current from query. -func (o *ListReleasesParams) bindCurrent(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.Current = &raw - - return nil -} - -// bindFilter binds and validates parameter Filter from query. -func (o *ListReleasesParams) bindFilter(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.Filter = &raw - - return nil -} - -// bindRepo binds and validates parameter Repo from query. -func (o *ListReleasesParams) bindRepo(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("repo", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("repo", "query", raw); err != nil { - return err - } - o.Repo = raw - - return nil -} - -// bindSearch binds and validates parameter Search from query. -func (o *ListReleasesParams) bindSearch(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.Search = &raw - - return nil -} diff --git a/api/operations/release/list_releases_responses.go b/api/operations/release/list_releases_responses.go deleted file mode 100644 index 101c78559f..0000000000 --- a/api/operations/release/list_releases_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 release - -// 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" -) - -// ListReleasesOKCode is the HTTP code returned for type ListReleasesOK -const ListReleasesOKCode int = 200 - -/* -ListReleasesOK A successful response. - -swagger:response listReleasesOK -*/ -type ListReleasesOK struct { - - /* - In: Body - */ - Payload *models.ReleaseListResponse `json:"body,omitempty"` -} - -// NewListReleasesOK creates ListReleasesOK with default headers values -func NewListReleasesOK() *ListReleasesOK { - - return &ListReleasesOK{} -} - -// WithPayload adds the payload to the list releases o k response -func (o *ListReleasesOK) WithPayload(payload *models.ReleaseListResponse) *ListReleasesOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list releases o k response -func (o *ListReleasesOK) SetPayload(payload *models.ReleaseListResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListReleasesOK) 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 - } - } -} - -/* -ListReleasesDefault Generic error response. - -swagger:response listReleasesDefault -*/ -type ListReleasesDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewListReleasesDefault creates ListReleasesDefault with default headers values -func NewListReleasesDefault(code int) *ListReleasesDefault { - if code <= 0 { - code = 500 - } - - return &ListReleasesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the list releases default response -func (o *ListReleasesDefault) WithStatusCode(code int) *ListReleasesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the list releases default response -func (o *ListReleasesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the list releases default response -func (o *ListReleasesDefault) WithPayload(payload *models.APIError) *ListReleasesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list releases default response -func (o *ListReleasesDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListReleasesDefault) 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/release/list_releases_urlbuilder.go b/api/operations/release/list_releases_urlbuilder.go deleted file mode 100644 index ed8ea272bb..0000000000 --- a/api/operations/release/list_releases_urlbuilder.go +++ /dev/null @@ -1,144 +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 release - -// 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" -) - -// ListReleasesURL generates an URL for the list releases operation -type ListReleasesURL struct { - Current *string - Filter *string - Repo string - Search *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 *ListReleasesURL) WithBasePath(bp string) *ListReleasesURL { - 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 *ListReleasesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ListReleasesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/releases" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var currentQ string - if o.Current != nil { - currentQ = *o.Current - } - if currentQ != "" { - qs.Set("current", currentQ) - } - - var filterQ string - if o.Filter != nil { - filterQ = *o.Filter - } - if filterQ != "" { - qs.Set("filter", filterQ) - } - - repoQ := o.Repo - if repoQ != "" { - qs.Set("repo", repoQ) - } - - var searchQ string - if o.Search != nil { - searchQ = *o.Search - } - if searchQ != "" { - qs.Set("search", searchQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ListReleasesURL) 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 *ListReleasesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ListReleasesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ListReleasesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ListReleasesURL") - } - - 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 *ListReleasesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/service/restart_service.go b/api/operations/service/restart_service.go deleted file mode 100644 index 91618dcde8..0000000000 --- a/api/operations/service/restart_service.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 service - -// 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" -) - -// RestartServiceHandlerFunc turns a function with the right signature into a restart service handler -type RestartServiceHandlerFunc func(RestartServiceParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn RestartServiceHandlerFunc) Handle(params RestartServiceParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// RestartServiceHandler interface for that can handle valid restart service params -type RestartServiceHandler interface { - Handle(RestartServiceParams, *models.Principal) middleware.Responder -} - -// NewRestartService creates a new http.Handler for the restart service operation -func NewRestartService(ctx *middleware.Context, handler RestartServiceHandler) *RestartService { - return &RestartService{Context: ctx, Handler: handler} -} - -/* - RestartService swagger:route POST /service/restart Service restartService - -Restart Service -*/ -type RestartService struct { - Context *middleware.Context - Handler RestartServiceHandler -} - -func (o *RestartService) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewRestartServiceParams() - 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/service/restart_service_parameters.go b/api/operations/service/restart_service_parameters.go deleted file mode 100644 index 977829e47c..0000000000 --- a/api/operations/service/restart_service_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 service - -// 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" -) - -// NewRestartServiceParams creates a new RestartServiceParams object -// -// There are no default values defined in the spec. -func NewRestartServiceParams() RestartServiceParams { - - return RestartServiceParams{} -} - -// RestartServiceParams contains all the bound params for the restart service operation -// typically these are obtained from a http.Request -// -// swagger:parameters RestartService -type RestartServiceParams 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 NewRestartServiceParams() beforehand. -func (o *RestartServiceParams) 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/service/restart_service_responses.go b/api/operations/service/restart_service_responses.go deleted file mode 100644 index 0de46508d5..0000000000 --- a/api/operations/service/restart_service_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 service - -// 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" -) - -// RestartServiceNoContentCode is the HTTP code returned for type RestartServiceNoContent -const RestartServiceNoContentCode int = 204 - -/* -RestartServiceNoContent A successful response. - -swagger:response restartServiceNoContent -*/ -type RestartServiceNoContent struct { -} - -// NewRestartServiceNoContent creates RestartServiceNoContent with default headers values -func NewRestartServiceNoContent() *RestartServiceNoContent { - - return &RestartServiceNoContent{} -} - -// WriteResponse to the client -func (o *RestartServiceNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -/* -RestartServiceDefault Generic error response. - -swagger:response restartServiceDefault -*/ -type RestartServiceDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewRestartServiceDefault creates RestartServiceDefault with default headers values -func NewRestartServiceDefault(code int) *RestartServiceDefault { - if code <= 0 { - code = 500 - } - - return &RestartServiceDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the restart service default response -func (o *RestartServiceDefault) WithStatusCode(code int) *RestartServiceDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the restart service default response -func (o *RestartServiceDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the restart service default response -func (o *RestartServiceDefault) WithPayload(payload *models.APIError) *RestartServiceDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the restart service default response -func (o *RestartServiceDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *RestartServiceDefault) 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/service/restart_service_urlbuilder.go b/api/operations/service/restart_service_urlbuilder.go deleted file mode 100644 index 0fff78d811..0000000000 --- a/api/operations/service/restart_service_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 service - -// 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" -) - -// RestartServiceURL generates an URL for the restart service operation -type RestartServiceURL 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 *RestartServiceURL) WithBasePath(bp string) *RestartServiceURL { - 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 *RestartServiceURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *RestartServiceURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/service/restart" - - _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 *RestartServiceURL) 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 *RestartServiceURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *RestartServiceURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on RestartServiceURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on RestartServiceURL") - } - - 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 *RestartServiceURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/service_account/create_service_account.go b/api/operations/service_account/create_service_account.go deleted file mode 100644 index d210f344c5..0000000000 --- a/api/operations/service_account/create_service_account.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 service_account - -// 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" -) - -// CreateServiceAccountHandlerFunc turns a function with the right signature into a create service account handler -type CreateServiceAccountHandlerFunc func(CreateServiceAccountParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateServiceAccountHandlerFunc) Handle(params CreateServiceAccountParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// CreateServiceAccountHandler interface for that can handle valid create service account params -type CreateServiceAccountHandler interface { - Handle(CreateServiceAccountParams, *models.Principal) middleware.Responder -} - -// NewCreateServiceAccount creates a new http.Handler for the create service account operation -func NewCreateServiceAccount(ctx *middleware.Context, handler CreateServiceAccountHandler) *CreateServiceAccount { - return &CreateServiceAccount{Context: ctx, Handler: handler} -} - -/* - CreateServiceAccount swagger:route POST /service-accounts ServiceAccount createServiceAccount - -Create Service Account -*/ -type CreateServiceAccount struct { - Context *middleware.Context - Handler CreateServiceAccountHandler -} - -func (o *CreateServiceAccount) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateServiceAccountParams() - 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/service_account/create_service_account_creds.go b/api/operations/service_account/create_service_account_creds.go deleted file mode 100644 index ec4e097e45..0000000000 --- a/api/operations/service_account/create_service_account_creds.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 service_account - -// 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" -) - -// CreateServiceAccountCredsHandlerFunc turns a function with the right signature into a create service account creds handler -type CreateServiceAccountCredsHandlerFunc func(CreateServiceAccountCredsParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateServiceAccountCredsHandlerFunc) Handle(params CreateServiceAccountCredsParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// CreateServiceAccountCredsHandler interface for that can handle valid create service account creds params -type CreateServiceAccountCredsHandler interface { - Handle(CreateServiceAccountCredsParams, *models.Principal) middleware.Responder -} - -// NewCreateServiceAccountCreds creates a new http.Handler for the create service account creds operation -func NewCreateServiceAccountCreds(ctx *middleware.Context, handler CreateServiceAccountCredsHandler) *CreateServiceAccountCreds { - return &CreateServiceAccountCreds{Context: ctx, Handler: handler} -} - -/* - CreateServiceAccountCreds swagger:route POST /service-account-credentials ServiceAccount createServiceAccountCreds - -Create Service Account With Credentials -*/ -type CreateServiceAccountCreds struct { - Context *middleware.Context - Handler CreateServiceAccountCredsHandler -} - -func (o *CreateServiceAccountCreds) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateServiceAccountCredsParams() - 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/service_account/create_service_account_creds_parameters.go b/api/operations/service_account/create_service_account_creds_parameters.go deleted file mode 100644 index 39ff456b38..0000000000 --- a/api/operations/service_account/create_service_account_creds_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 service_account - -// 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" -) - -// NewCreateServiceAccountCredsParams creates a new CreateServiceAccountCredsParams object -// -// There are no default values defined in the spec. -func NewCreateServiceAccountCredsParams() CreateServiceAccountCredsParams { - - return CreateServiceAccountCredsParams{} -} - -// CreateServiceAccountCredsParams contains all the bound params for the create service account creds operation -// typically these are obtained from a http.Request -// -// swagger:parameters CreateServiceAccountCreds -type CreateServiceAccountCredsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.ServiceAccountRequestCreds -} - -// 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 NewCreateServiceAccountCredsParams() beforehand. -func (o *CreateServiceAccountCredsParams) 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.ServiceAccountRequestCreds - 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/service_account/create_service_account_creds_responses.go b/api/operations/service_account/create_service_account_creds_responses.go deleted file mode 100644 index 417b188a28..0000000000 --- a/api/operations/service_account/create_service_account_creds_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 service_account - -// 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" -) - -// CreateServiceAccountCredsCreatedCode is the HTTP code returned for type CreateServiceAccountCredsCreated -const CreateServiceAccountCredsCreatedCode int = 201 - -/* -CreateServiceAccountCredsCreated A successful response. - -swagger:response createServiceAccountCredsCreated -*/ -type CreateServiceAccountCredsCreated struct { - - /* - In: Body - */ - Payload *models.ServiceAccountCreds `json:"body,omitempty"` -} - -// NewCreateServiceAccountCredsCreated creates CreateServiceAccountCredsCreated with default headers values -func NewCreateServiceAccountCredsCreated() *CreateServiceAccountCredsCreated { - - return &CreateServiceAccountCredsCreated{} -} - -// WithPayload adds the payload to the create service account creds created response -func (o *CreateServiceAccountCredsCreated) WithPayload(payload *models.ServiceAccountCreds) *CreateServiceAccountCredsCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create service account creds created response -func (o *CreateServiceAccountCredsCreated) SetPayload(payload *models.ServiceAccountCreds) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateServiceAccountCredsCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateServiceAccountCredsDefault Generic error response. - -swagger:response createServiceAccountCredsDefault -*/ -type CreateServiceAccountCredsDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewCreateServiceAccountCredsDefault creates CreateServiceAccountCredsDefault with default headers values -func NewCreateServiceAccountCredsDefault(code int) *CreateServiceAccountCredsDefault { - if code <= 0 { - code = 500 - } - - return &CreateServiceAccountCredsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create service account creds default response -func (o *CreateServiceAccountCredsDefault) WithStatusCode(code int) *CreateServiceAccountCredsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create service account creds default response -func (o *CreateServiceAccountCredsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the create service account creds default response -func (o *CreateServiceAccountCredsDefault) WithPayload(payload *models.APIError) *CreateServiceAccountCredsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create service account creds default response -func (o *CreateServiceAccountCredsDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateServiceAccountCredsDefault) 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/service_account/create_service_account_creds_urlbuilder.go b/api/operations/service_account/create_service_account_creds_urlbuilder.go deleted file mode 100644 index 25086df4de..0000000000 --- a/api/operations/service_account/create_service_account_creds_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 service_account - -// 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" -) - -// CreateServiceAccountCredsURL generates an URL for the create service account creds operation -type CreateServiceAccountCredsURL 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 *CreateServiceAccountCredsURL) WithBasePath(bp string) *CreateServiceAccountCredsURL { - 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 *CreateServiceAccountCredsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateServiceAccountCredsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/service-account-credentials" - - _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 *CreateServiceAccountCredsURL) 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 *CreateServiceAccountCredsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateServiceAccountCredsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateServiceAccountCredsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateServiceAccountCredsURL") - } - - 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 *CreateServiceAccountCredsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/service_account/create_service_account_parameters.go b/api/operations/service_account/create_service_account_parameters.go deleted file mode 100644 index 48303ffd27..0000000000 --- a/api/operations/service_account/create_service_account_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 service_account - -// 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" -) - -// NewCreateServiceAccountParams creates a new CreateServiceAccountParams object -// -// There are no default values defined in the spec. -func NewCreateServiceAccountParams() CreateServiceAccountParams { - - return CreateServiceAccountParams{} -} - -// CreateServiceAccountParams contains all the bound params for the create service account operation -// typically these are obtained from a http.Request -// -// swagger:parameters CreateServiceAccount -type CreateServiceAccountParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.ServiceAccountRequest -} - -// 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 NewCreateServiceAccountParams() beforehand. -func (o *CreateServiceAccountParams) 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.ServiceAccountRequest - 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/service_account/create_service_account_responses.go b/api/operations/service_account/create_service_account_responses.go deleted file mode 100644 index 38e12ce18b..0000000000 --- a/api/operations/service_account/create_service_account_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 service_account - -// 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" -) - -// CreateServiceAccountCreatedCode is the HTTP code returned for type CreateServiceAccountCreated -const CreateServiceAccountCreatedCode int = 201 - -/* -CreateServiceAccountCreated A successful response. - -swagger:response createServiceAccountCreated -*/ -type CreateServiceAccountCreated struct { - - /* - In: Body - */ - Payload *models.ServiceAccountCreds `json:"body,omitempty"` -} - -// NewCreateServiceAccountCreated creates CreateServiceAccountCreated with default headers values -func NewCreateServiceAccountCreated() *CreateServiceAccountCreated { - - return &CreateServiceAccountCreated{} -} - -// WithPayload adds the payload to the create service account created response -func (o *CreateServiceAccountCreated) WithPayload(payload *models.ServiceAccountCreds) *CreateServiceAccountCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create service account created response -func (o *CreateServiceAccountCreated) SetPayload(payload *models.ServiceAccountCreds) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateServiceAccountCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateServiceAccountDefault Generic error response. - -swagger:response createServiceAccountDefault -*/ -type CreateServiceAccountDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewCreateServiceAccountDefault creates CreateServiceAccountDefault with default headers values -func NewCreateServiceAccountDefault(code int) *CreateServiceAccountDefault { - if code <= 0 { - code = 500 - } - - return &CreateServiceAccountDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create service account default response -func (o *CreateServiceAccountDefault) WithStatusCode(code int) *CreateServiceAccountDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create service account default response -func (o *CreateServiceAccountDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the create service account default response -func (o *CreateServiceAccountDefault) WithPayload(payload *models.APIError) *CreateServiceAccountDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create service account default response -func (o *CreateServiceAccountDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateServiceAccountDefault) 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/service_account/create_service_account_urlbuilder.go b/api/operations/service_account/create_service_account_urlbuilder.go deleted file mode 100644 index dba369a0b2..0000000000 --- a/api/operations/service_account/create_service_account_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 service_account - -// 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" -) - -// CreateServiceAccountURL generates an URL for the create service account operation -type CreateServiceAccountURL 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 *CreateServiceAccountURL) WithBasePath(bp string) *CreateServiceAccountURL { - 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 *CreateServiceAccountURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateServiceAccountURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/service-accounts" - - _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 *CreateServiceAccountURL) 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 *CreateServiceAccountURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateServiceAccountURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateServiceAccountURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateServiceAccountURL") - } - - 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 *CreateServiceAccountURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/service_account/delete_multiple_service_accounts.go b/api/operations/service_account/delete_multiple_service_accounts.go deleted file mode 100644 index 1faabaeb12..0000000000 --- a/api/operations/service_account/delete_multiple_service_accounts.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 service_account - -// 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" -) - -// DeleteMultipleServiceAccountsHandlerFunc turns a function with the right signature into a delete multiple service accounts handler -type DeleteMultipleServiceAccountsHandlerFunc func(DeleteMultipleServiceAccountsParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteMultipleServiceAccountsHandlerFunc) Handle(params DeleteMultipleServiceAccountsParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// DeleteMultipleServiceAccountsHandler interface for that can handle valid delete multiple service accounts params -type DeleteMultipleServiceAccountsHandler interface { - Handle(DeleteMultipleServiceAccountsParams, *models.Principal) middleware.Responder -} - -// NewDeleteMultipleServiceAccounts creates a new http.Handler for the delete multiple service accounts operation -func NewDeleteMultipleServiceAccounts(ctx *middleware.Context, handler DeleteMultipleServiceAccountsHandler) *DeleteMultipleServiceAccounts { - return &DeleteMultipleServiceAccounts{Context: ctx, Handler: handler} -} - -/* - DeleteMultipleServiceAccounts swagger:route DELETE /service-accounts/delete-multi ServiceAccount deleteMultipleServiceAccounts - -Delete Multiple Service Accounts -*/ -type DeleteMultipleServiceAccounts struct { - Context *middleware.Context - Handler DeleteMultipleServiceAccountsHandler -} - -func (o *DeleteMultipleServiceAccounts) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteMultipleServiceAccountsParams() - 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/service_account/delete_multiple_service_accounts_parameters.go b/api/operations/service_account/delete_multiple_service_accounts_parameters.go deleted file mode 100644 index 3383350f15..0000000000 --- a/api/operations/service_account/delete_multiple_service_accounts_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 service_account - -// 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" -) - -// NewDeleteMultipleServiceAccountsParams creates a new DeleteMultipleServiceAccountsParams object -// -// There are no default values defined in the spec. -func NewDeleteMultipleServiceAccountsParams() DeleteMultipleServiceAccountsParams { - - return DeleteMultipleServiceAccountsParams{} -} - -// DeleteMultipleServiceAccountsParams contains all the bound params for the delete multiple service accounts operation -// typically these are obtained from a http.Request -// -// swagger:parameters DeleteMultipleServiceAccounts -type DeleteMultipleServiceAccountsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - SelectedSA models.SelectedSAs -} - -// 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 NewDeleteMultipleServiceAccountsParams() beforehand. -func (o *DeleteMultipleServiceAccountsParams) 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.SelectedSAs - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("selectedSA", "body", "")) - } else { - res = append(res, errors.NewParseError("selectedSA", "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.SelectedSA = body - } - } - } else { - res = append(res, errors.Required("selectedSA", "body", "")) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/api/operations/service_account/delete_multiple_service_accounts_responses.go b/api/operations/service_account/delete_multiple_service_accounts_responses.go deleted file mode 100644 index fe9b01d728..0000000000 --- a/api/operations/service_account/delete_multiple_service_accounts_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 service_account - -// 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" -) - -// DeleteMultipleServiceAccountsNoContentCode is the HTTP code returned for type DeleteMultipleServiceAccountsNoContent -const DeleteMultipleServiceAccountsNoContentCode int = 204 - -/* -DeleteMultipleServiceAccountsNoContent A successful response. - -swagger:response deleteMultipleServiceAccountsNoContent -*/ -type DeleteMultipleServiceAccountsNoContent struct { -} - -// NewDeleteMultipleServiceAccountsNoContent creates DeleteMultipleServiceAccountsNoContent with default headers values -func NewDeleteMultipleServiceAccountsNoContent() *DeleteMultipleServiceAccountsNoContent { - - return &DeleteMultipleServiceAccountsNoContent{} -} - -// WriteResponse to the client -func (o *DeleteMultipleServiceAccountsNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -/* -DeleteMultipleServiceAccountsDefault Generic error response. - -swagger:response deleteMultipleServiceAccountsDefault -*/ -type DeleteMultipleServiceAccountsDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewDeleteMultipleServiceAccountsDefault creates DeleteMultipleServiceAccountsDefault with default headers values -func NewDeleteMultipleServiceAccountsDefault(code int) *DeleteMultipleServiceAccountsDefault { - if code <= 0 { - code = 500 - } - - return &DeleteMultipleServiceAccountsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete multiple service accounts default response -func (o *DeleteMultipleServiceAccountsDefault) WithStatusCode(code int) *DeleteMultipleServiceAccountsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete multiple service accounts default response -func (o *DeleteMultipleServiceAccountsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the delete multiple service accounts default response -func (o *DeleteMultipleServiceAccountsDefault) WithPayload(payload *models.APIError) *DeleteMultipleServiceAccountsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete multiple service accounts default response -func (o *DeleteMultipleServiceAccountsDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteMultipleServiceAccountsDefault) 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/service_account/delete_multiple_service_accounts_urlbuilder.go b/api/operations/service_account/delete_multiple_service_accounts_urlbuilder.go deleted file mode 100644 index 5008556c91..0000000000 --- a/api/operations/service_account/delete_multiple_service_accounts_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 service_account - -// 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" -) - -// DeleteMultipleServiceAccountsURL generates an URL for the delete multiple service accounts operation -type DeleteMultipleServiceAccountsURL 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 *DeleteMultipleServiceAccountsURL) WithBasePath(bp string) *DeleteMultipleServiceAccountsURL { - 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 *DeleteMultipleServiceAccountsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteMultipleServiceAccountsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/service-accounts/delete-multi" - - _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 *DeleteMultipleServiceAccountsURL) 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 *DeleteMultipleServiceAccountsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteMultipleServiceAccountsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteMultipleServiceAccountsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteMultipleServiceAccountsURL") - } - - 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 *DeleteMultipleServiceAccountsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/service_account/delete_service_account.go b/api/operations/service_account/delete_service_account.go deleted file mode 100644 index fb3ecbd871..0000000000 --- a/api/operations/service_account/delete_service_account.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 service_account - -// 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" -) - -// DeleteServiceAccountHandlerFunc turns a function with the right signature into a delete service account handler -type DeleteServiceAccountHandlerFunc func(DeleteServiceAccountParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteServiceAccountHandlerFunc) Handle(params DeleteServiceAccountParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// DeleteServiceAccountHandler interface for that can handle valid delete service account params -type DeleteServiceAccountHandler interface { - Handle(DeleteServiceAccountParams, *models.Principal) middleware.Responder -} - -// NewDeleteServiceAccount creates a new http.Handler for the delete service account operation -func NewDeleteServiceAccount(ctx *middleware.Context, handler DeleteServiceAccountHandler) *DeleteServiceAccount { - return &DeleteServiceAccount{Context: ctx, Handler: handler} -} - -/* - DeleteServiceAccount swagger:route DELETE /service-accounts/{access_key} ServiceAccount deleteServiceAccount - -Delete Service Account -*/ -type DeleteServiceAccount struct { - Context *middleware.Context - Handler DeleteServiceAccountHandler -} - -func (o *DeleteServiceAccount) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteServiceAccountParams() - 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/service_account/delete_service_account_parameters.go b/api/operations/service_account/delete_service_account_parameters.go deleted file mode 100644 index f5f25425b8..0000000000 --- a/api/operations/service_account/delete_service_account_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 service_account - -// 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" -) - -// NewDeleteServiceAccountParams creates a new DeleteServiceAccountParams object -// -// There are no default values defined in the spec. -func NewDeleteServiceAccountParams() DeleteServiceAccountParams { - - return DeleteServiceAccountParams{} -} - -// DeleteServiceAccountParams contains all the bound params for the delete service account operation -// typically these are obtained from a http.Request -// -// swagger:parameters DeleteServiceAccount -type DeleteServiceAccountParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - AccessKey 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 NewDeleteServiceAccountParams() beforehand. -func (o *DeleteServiceAccountParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rAccessKey, rhkAccessKey, _ := route.Params.GetOK("access_key") - if err := o.bindAccessKey(rAccessKey, rhkAccessKey, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindAccessKey binds and validates parameter AccessKey from path. -func (o *DeleteServiceAccountParams) bindAccessKey(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.AccessKey = raw - - return nil -} diff --git a/api/operations/service_account/delete_service_account_responses.go b/api/operations/service_account/delete_service_account_responses.go deleted file mode 100644 index a4f8968c20..0000000000 --- a/api/operations/service_account/delete_service_account_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 service_account - -// 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" -) - -// DeleteServiceAccountNoContentCode is the HTTP code returned for type DeleteServiceAccountNoContent -const DeleteServiceAccountNoContentCode int = 204 - -/* -DeleteServiceAccountNoContent A successful response. - -swagger:response deleteServiceAccountNoContent -*/ -type DeleteServiceAccountNoContent struct { -} - -// NewDeleteServiceAccountNoContent creates DeleteServiceAccountNoContent with default headers values -func NewDeleteServiceAccountNoContent() *DeleteServiceAccountNoContent { - - return &DeleteServiceAccountNoContent{} -} - -// WriteResponse to the client -func (o *DeleteServiceAccountNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -/* -DeleteServiceAccountDefault Generic error response. - -swagger:response deleteServiceAccountDefault -*/ -type DeleteServiceAccountDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewDeleteServiceAccountDefault creates DeleteServiceAccountDefault with default headers values -func NewDeleteServiceAccountDefault(code int) *DeleteServiceAccountDefault { - if code <= 0 { - code = 500 - } - - return &DeleteServiceAccountDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete service account default response -func (o *DeleteServiceAccountDefault) WithStatusCode(code int) *DeleteServiceAccountDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete service account default response -func (o *DeleteServiceAccountDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the delete service account default response -func (o *DeleteServiceAccountDefault) WithPayload(payload *models.APIError) *DeleteServiceAccountDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete service account default response -func (o *DeleteServiceAccountDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteServiceAccountDefault) 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/service_account/delete_service_account_urlbuilder.go b/api/operations/service_account/delete_service_account_urlbuilder.go deleted file mode 100644 index 5210626a88..0000000000 --- a/api/operations/service_account/delete_service_account_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 service_account - -// 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" -) - -// DeleteServiceAccountURL generates an URL for the delete service account operation -type DeleteServiceAccountURL struct { - AccessKey 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 *DeleteServiceAccountURL) WithBasePath(bp string) *DeleteServiceAccountURL { - 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 *DeleteServiceAccountURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteServiceAccountURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/service-accounts/{access_key}" - - accessKey := o.AccessKey - if accessKey != "" { - _path = strings.Replace(_path, "{access_key}", accessKey, -1) - } else { - return nil, errors.New("accessKey is required on DeleteServiceAccountURL") - } - - _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 *DeleteServiceAccountURL) 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 *DeleteServiceAccountURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteServiceAccountURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteServiceAccountURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteServiceAccountURL") - } - - 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 *DeleteServiceAccountURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/service_account/get_service_account.go b/api/operations/service_account/get_service_account.go deleted file mode 100644 index ab86de0f31..0000000000 --- a/api/operations/service_account/get_service_account.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 service_account - -// 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" -) - -// GetServiceAccountHandlerFunc turns a function with the right signature into a get service account handler -type GetServiceAccountHandlerFunc func(GetServiceAccountParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetServiceAccountHandlerFunc) Handle(params GetServiceAccountParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// GetServiceAccountHandler interface for that can handle valid get service account params -type GetServiceAccountHandler interface { - Handle(GetServiceAccountParams, *models.Principal) middleware.Responder -} - -// NewGetServiceAccount creates a new http.Handler for the get service account operation -func NewGetServiceAccount(ctx *middleware.Context, handler GetServiceAccountHandler) *GetServiceAccount { - return &GetServiceAccount{Context: ctx, Handler: handler} -} - -/* - GetServiceAccount swagger:route GET /service-accounts/{access_key} ServiceAccount getServiceAccount - -Get Service Account -*/ -type GetServiceAccount struct { - Context *middleware.Context - Handler GetServiceAccountHandler -} - -func (o *GetServiceAccount) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetServiceAccountParams() - 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/service_account/get_service_account_parameters.go b/api/operations/service_account/get_service_account_parameters.go deleted file mode 100644 index e7a8ba3a01..0000000000 --- a/api/operations/service_account/get_service_account_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 service_account - -// 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" -) - -// NewGetServiceAccountParams creates a new GetServiceAccountParams object -// -// There are no default values defined in the spec. -func NewGetServiceAccountParams() GetServiceAccountParams { - - return GetServiceAccountParams{} -} - -// GetServiceAccountParams contains all the bound params for the get service account operation -// typically these are obtained from a http.Request -// -// swagger:parameters GetServiceAccount -type GetServiceAccountParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - AccessKey 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 NewGetServiceAccountParams() beforehand. -func (o *GetServiceAccountParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rAccessKey, rhkAccessKey, _ := route.Params.GetOK("access_key") - if err := o.bindAccessKey(rAccessKey, rhkAccessKey, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindAccessKey binds and validates parameter AccessKey from path. -func (o *GetServiceAccountParams) bindAccessKey(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.AccessKey = raw - - return nil -} diff --git a/api/operations/service_account/get_service_account_responses.go b/api/operations/service_account/get_service_account_responses.go deleted file mode 100644 index 723342f6d3..0000000000 --- a/api/operations/service_account/get_service_account_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 service_account - -// 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" -) - -// GetServiceAccountOKCode is the HTTP code returned for type GetServiceAccountOK -const GetServiceAccountOKCode int = 200 - -/* -GetServiceAccountOK A successful response. - -swagger:response getServiceAccountOK -*/ -type GetServiceAccountOK struct { - - /* - In: Body - */ - Payload *models.ServiceAccount `json:"body,omitempty"` -} - -// NewGetServiceAccountOK creates GetServiceAccountOK with default headers values -func NewGetServiceAccountOK() *GetServiceAccountOK { - - return &GetServiceAccountOK{} -} - -// WithPayload adds the payload to the get service account o k response -func (o *GetServiceAccountOK) WithPayload(payload *models.ServiceAccount) *GetServiceAccountOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get service account o k response -func (o *GetServiceAccountOK) SetPayload(payload *models.ServiceAccount) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetServiceAccountOK) 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 - } - } -} - -/* -GetServiceAccountDefault Generic error response. - -swagger:response getServiceAccountDefault -*/ -type GetServiceAccountDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewGetServiceAccountDefault creates GetServiceAccountDefault with default headers values -func NewGetServiceAccountDefault(code int) *GetServiceAccountDefault { - if code <= 0 { - code = 500 - } - - return &GetServiceAccountDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get service account default response -func (o *GetServiceAccountDefault) WithStatusCode(code int) *GetServiceAccountDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get service account default response -func (o *GetServiceAccountDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the get service account default response -func (o *GetServiceAccountDefault) WithPayload(payload *models.APIError) *GetServiceAccountDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get service account default response -func (o *GetServiceAccountDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetServiceAccountDefault) 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/service_account/get_service_account_urlbuilder.go b/api/operations/service_account/get_service_account_urlbuilder.go deleted file mode 100644 index 0c60cea7c4..0000000000 --- a/api/operations/service_account/get_service_account_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 service_account - -// 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" -) - -// GetServiceAccountURL generates an URL for the get service account operation -type GetServiceAccountURL struct { - AccessKey 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 *GetServiceAccountURL) WithBasePath(bp string) *GetServiceAccountURL { - 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 *GetServiceAccountURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetServiceAccountURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/service-accounts/{access_key}" - - accessKey := o.AccessKey - if accessKey != "" { - _path = strings.Replace(_path, "{access_key}", accessKey, -1) - } else { - return nil, errors.New("accessKey is required on GetServiceAccountURL") - } - - _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 *GetServiceAccountURL) 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 *GetServiceAccountURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetServiceAccountURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetServiceAccountURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetServiceAccountURL") - } - - 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 *GetServiceAccountURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/service_account/list_user_service_accounts.go b/api/operations/service_account/list_user_service_accounts.go deleted file mode 100644 index 492c391a49..0000000000 --- a/api/operations/service_account/list_user_service_accounts.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 service_account - -// 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" -) - -// ListUserServiceAccountsHandlerFunc turns a function with the right signature into a list user service accounts handler -type ListUserServiceAccountsHandlerFunc func(ListUserServiceAccountsParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn ListUserServiceAccountsHandlerFunc) Handle(params ListUserServiceAccountsParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// ListUserServiceAccountsHandler interface for that can handle valid list user service accounts params -type ListUserServiceAccountsHandler interface { - Handle(ListUserServiceAccountsParams, *models.Principal) middleware.Responder -} - -// NewListUserServiceAccounts creates a new http.Handler for the list user service accounts operation -func NewListUserServiceAccounts(ctx *middleware.Context, handler ListUserServiceAccountsHandler) *ListUserServiceAccounts { - return &ListUserServiceAccounts{Context: ctx, Handler: handler} -} - -/* - ListUserServiceAccounts swagger:route GET /service-accounts ServiceAccount listUserServiceAccounts - -List User's Service Accounts -*/ -type ListUserServiceAccounts struct { - Context *middleware.Context - Handler ListUserServiceAccountsHandler -} - -func (o *ListUserServiceAccounts) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewListUserServiceAccountsParams() - 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/service_account/list_user_service_accounts_parameters.go b/api/operations/service_account/list_user_service_accounts_parameters.go deleted file mode 100644 index 75fbf5a4a1..0000000000 --- a/api/operations/service_account/list_user_service_accounts_parameters.go +++ /dev/null @@ -1,146 +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 service_account - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewListUserServiceAccountsParams creates a new ListUserServiceAccountsParams object -// with the default values initialized. -func NewListUserServiceAccountsParams() ListUserServiceAccountsParams { - - var ( - // initialize parameters with default values - - limitDefault = int32(20) - offsetDefault = int32(0) - ) - - return ListUserServiceAccountsParams{ - Limit: &limitDefault, - - Offset: &offsetDefault, - } -} - -// ListUserServiceAccountsParams contains all the bound params for the list user service accounts operation -// typically these are obtained from a http.Request -// -// swagger:parameters ListUserServiceAccounts -type ListUserServiceAccountsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - In: query - Default: 20 - */ - Limit *int32 - /* - In: query - Default: 0 - */ - Offset *int32 -} - -// 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 NewListUserServiceAccountsParams() beforehand. -func (o *ListUserServiceAccountsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qLimit, qhkLimit, _ := qs.GetOK("limit") - if err := o.bindLimit(qLimit, qhkLimit, route.Formats); err != nil { - res = append(res, err) - } - - qOffset, qhkOffset, _ := qs.GetOK("offset") - if err := o.bindOffset(qOffset, qhkOffset, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindLimit binds and validates parameter Limit from query. -func (o *ListUserServiceAccountsParams) bindLimit(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 - // Default values have been previously initialized by NewListUserServiceAccountsParams() - return nil - } - - value, err := swag.ConvertInt32(raw) - if err != nil { - return errors.InvalidType("limit", "query", "int32", raw) - } - o.Limit = &value - - return nil -} - -// bindOffset binds and validates parameter Offset from query. -func (o *ListUserServiceAccountsParams) bindOffset(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 - // Default values have been previously initialized by NewListUserServiceAccountsParams() - return nil - } - - value, err := swag.ConvertInt32(raw) - if err != nil { - return errors.InvalidType("offset", "query", "int32", raw) - } - o.Offset = &value - - return nil -} diff --git a/api/operations/service_account/list_user_service_accounts_responses.go b/api/operations/service_account/list_user_service_accounts_responses.go deleted file mode 100644 index 70fba458cd..0000000000 --- a/api/operations/service_account/list_user_service_accounts_responses.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 service_account - -// 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" -) - -// ListUserServiceAccountsOKCode is the HTTP code returned for type ListUserServiceAccountsOK -const ListUserServiceAccountsOKCode int = 200 - -/* -ListUserServiceAccountsOK A successful response. - -swagger:response listUserServiceAccountsOK -*/ -type ListUserServiceAccountsOK struct { - - /* - In: Body - */ - Payload models.ServiceAccounts `json:"body,omitempty"` -} - -// NewListUserServiceAccountsOK creates ListUserServiceAccountsOK with default headers values -func NewListUserServiceAccountsOK() *ListUserServiceAccountsOK { - - return &ListUserServiceAccountsOK{} -} - -// WithPayload adds the payload to the list user service accounts o k response -func (o *ListUserServiceAccountsOK) WithPayload(payload models.ServiceAccounts) *ListUserServiceAccountsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list user service accounts o k response -func (o *ListUserServiceAccountsOK) SetPayload(payload models.ServiceAccounts) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListUserServiceAccountsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.ServiceAccounts{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -ListUserServiceAccountsDefault Generic error response. - -swagger:response listUserServiceAccountsDefault -*/ -type ListUserServiceAccountsDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewListUserServiceAccountsDefault creates ListUserServiceAccountsDefault with default headers values -func NewListUserServiceAccountsDefault(code int) *ListUserServiceAccountsDefault { - if code <= 0 { - code = 500 - } - - return &ListUserServiceAccountsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the list user service accounts default response -func (o *ListUserServiceAccountsDefault) WithStatusCode(code int) *ListUserServiceAccountsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the list user service accounts default response -func (o *ListUserServiceAccountsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the list user service accounts default response -func (o *ListUserServiceAccountsDefault) WithPayload(payload *models.APIError) *ListUserServiceAccountsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list user service accounts default response -func (o *ListUserServiceAccountsDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListUserServiceAccountsDefault) 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/service_account/list_user_service_accounts_urlbuilder.go b/api/operations/service_account/list_user_service_accounts_urlbuilder.go deleted file mode 100644 index d1438f48a6..0000000000 --- a/api/operations/service_account/list_user_service_accounts_urlbuilder.go +++ /dev/null @@ -1,131 +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 service_account - -// 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" - - "github.com/go-openapi/swag" -) - -// ListUserServiceAccountsURL generates an URL for the list user service accounts operation -type ListUserServiceAccountsURL struct { - Limit *int32 - Offset *int32 - - _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 *ListUserServiceAccountsURL) WithBasePath(bp string) *ListUserServiceAccountsURL { - 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 *ListUserServiceAccountsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ListUserServiceAccountsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/service-accounts" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var limitQ string - if o.Limit != nil { - limitQ = swag.FormatInt32(*o.Limit) - } - if limitQ != "" { - qs.Set("limit", limitQ) - } - - var offsetQ string - if o.Offset != nil { - offsetQ = swag.FormatInt32(*o.Offset) - } - if offsetQ != "" { - qs.Set("offset", offsetQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ListUserServiceAccountsURL) 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 *ListUserServiceAccountsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ListUserServiceAccountsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ListUserServiceAccountsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ListUserServiceAccountsURL") - } - - 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 *ListUserServiceAccountsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/service_account/update_service_account.go b/api/operations/service_account/update_service_account.go deleted file mode 100644 index 045fbe7589..0000000000 --- a/api/operations/service_account/update_service_account.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 service_account - -// 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" -) - -// UpdateServiceAccountHandlerFunc turns a function with the right signature into a update service account handler -type UpdateServiceAccountHandlerFunc func(UpdateServiceAccountParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn UpdateServiceAccountHandlerFunc) Handle(params UpdateServiceAccountParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// UpdateServiceAccountHandler interface for that can handle valid update service account params -type UpdateServiceAccountHandler interface { - Handle(UpdateServiceAccountParams, *models.Principal) middleware.Responder -} - -// NewUpdateServiceAccount creates a new http.Handler for the update service account operation -func NewUpdateServiceAccount(ctx *middleware.Context, handler UpdateServiceAccountHandler) *UpdateServiceAccount { - return &UpdateServiceAccount{Context: ctx, Handler: handler} -} - -/* - UpdateServiceAccount swagger:route PUT /service-accounts/{access_key} ServiceAccount updateServiceAccount - -Set Service Account Policy -*/ -type UpdateServiceAccount struct { - Context *middleware.Context - Handler UpdateServiceAccountHandler -} - -func (o *UpdateServiceAccount) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewUpdateServiceAccountParams() - 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/service_account/update_service_account_parameters.go b/api/operations/service_account/update_service_account_parameters.go deleted file mode 100644 index f7789db0a1..0000000000 --- a/api/operations/service_account/update_service_account_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 service_account - -// 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" -) - -// NewUpdateServiceAccountParams creates a new UpdateServiceAccountParams object -// -// There are no default values defined in the spec. -func NewUpdateServiceAccountParams() UpdateServiceAccountParams { - - return UpdateServiceAccountParams{} -} - -// UpdateServiceAccountParams contains all the bound params for the update service account operation -// typically these are obtained from a http.Request -// -// swagger:parameters UpdateServiceAccount -type UpdateServiceAccountParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - AccessKey string - /* - Required: true - In: body - */ - Body *models.UpdateServiceAccountRequest -} - -// 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 NewUpdateServiceAccountParams() beforehand. -func (o *UpdateServiceAccountParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - rAccessKey, rhkAccessKey, _ := route.Params.GetOK("access_key") - if err := o.bindAccessKey(rAccessKey, rhkAccessKey, route.Formats); err != nil { - res = append(res, err) - } - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.UpdateServiceAccountRequest - 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 -} - -// bindAccessKey binds and validates parameter AccessKey from path. -func (o *UpdateServiceAccountParams) bindAccessKey(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.AccessKey = raw - - return nil -} diff --git a/api/operations/service_account/update_service_account_responses.go b/api/operations/service_account/update_service_account_responses.go deleted file mode 100644 index 668a55e962..0000000000 --- a/api/operations/service_account/update_service_account_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 service_account - -// 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" -) - -// UpdateServiceAccountOKCode is the HTTP code returned for type UpdateServiceAccountOK -const UpdateServiceAccountOKCode int = 200 - -/* -UpdateServiceAccountOK A successful response. - -swagger:response updateServiceAccountOK -*/ -type UpdateServiceAccountOK struct { -} - -// NewUpdateServiceAccountOK creates UpdateServiceAccountOK with default headers values -func NewUpdateServiceAccountOK() *UpdateServiceAccountOK { - - return &UpdateServiceAccountOK{} -} - -// WriteResponse to the client -func (o *UpdateServiceAccountOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(200) -} - -/* -UpdateServiceAccountDefault Generic error response. - -swagger:response updateServiceAccountDefault -*/ -type UpdateServiceAccountDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewUpdateServiceAccountDefault creates UpdateServiceAccountDefault with default headers values -func NewUpdateServiceAccountDefault(code int) *UpdateServiceAccountDefault { - if code <= 0 { - code = 500 - } - - return &UpdateServiceAccountDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the update service account default response -func (o *UpdateServiceAccountDefault) WithStatusCode(code int) *UpdateServiceAccountDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the update service account default response -func (o *UpdateServiceAccountDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the update service account default response -func (o *UpdateServiceAccountDefault) WithPayload(payload *models.APIError) *UpdateServiceAccountDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the update service account default response -func (o *UpdateServiceAccountDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *UpdateServiceAccountDefault) 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/service_account/update_service_account_urlbuilder.go b/api/operations/service_account/update_service_account_urlbuilder.go deleted file mode 100644 index 56deccd30f..0000000000 --- a/api/operations/service_account/update_service_account_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 service_account - -// 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" -) - -// UpdateServiceAccountURL generates an URL for the update service account operation -type UpdateServiceAccountURL struct { - AccessKey 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 *UpdateServiceAccountURL) WithBasePath(bp string) *UpdateServiceAccountURL { - 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 *UpdateServiceAccountURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *UpdateServiceAccountURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/service-accounts/{access_key}" - - accessKey := o.AccessKey - if accessKey != "" { - _path = strings.Replace(_path, "{access_key}", accessKey, -1) - } else { - return nil, errors.New("accessKey is required on UpdateServiceAccountURL") - } - - _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 *UpdateServiceAccountURL) 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 *UpdateServiceAccountURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *UpdateServiceAccountURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on UpdateServiceAccountURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on UpdateServiceAccountURL") - } - - 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 *UpdateServiceAccountURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/system/arn_list.go b/api/operations/system/arn_list.go deleted file mode 100644 index 678117e576..0000000000 --- a/api/operations/system/arn_list.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 system - -// 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" -) - -// ArnListHandlerFunc turns a function with the right signature into a arn list handler -type ArnListHandlerFunc func(ArnListParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn ArnListHandlerFunc) Handle(params ArnListParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// ArnListHandler interface for that can handle valid arn list params -type ArnListHandler interface { - Handle(ArnListParams, *models.Principal) middleware.Responder -} - -// NewArnList creates a new http.Handler for the arn list operation -func NewArnList(ctx *middleware.Context, handler ArnListHandler) *ArnList { - return &ArnList{Context: ctx, Handler: handler} -} - -/* - ArnList swagger:route GET /admin/arns System arnList - -Returns a list of active ARNs in the instance -*/ -type ArnList struct { - Context *middleware.Context - Handler ArnListHandler -} - -func (o *ArnList) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewArnListParams() - 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/system/arn_list_parameters.go b/api/operations/system/arn_list_parameters.go deleted file mode 100644 index 9a7446776a..0000000000 --- a/api/operations/system/arn_list_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 system - -// 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" -) - -// NewArnListParams creates a new ArnListParams object -// -// There are no default values defined in the spec. -func NewArnListParams() ArnListParams { - - return ArnListParams{} -} - -// ArnListParams contains all the bound params for the arn list operation -// typically these are obtained from a http.Request -// -// swagger:parameters ArnList -type ArnListParams 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 NewArnListParams() beforehand. -func (o *ArnListParams) 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/system/arn_list_responses.go b/api/operations/system/arn_list_responses.go deleted file mode 100644 index bb81982147..0000000000 --- a/api/operations/system/arn_list_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 system - -// 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" -) - -// ArnListOKCode is the HTTP code returned for type ArnListOK -const ArnListOKCode int = 200 - -/* -ArnListOK A successful response. - -swagger:response arnListOK -*/ -type ArnListOK struct { - - /* - In: Body - */ - Payload *models.ArnsResponse `json:"body,omitempty"` -} - -// NewArnListOK creates ArnListOK with default headers values -func NewArnListOK() *ArnListOK { - - return &ArnListOK{} -} - -// WithPayload adds the payload to the arn list o k response -func (o *ArnListOK) WithPayload(payload *models.ArnsResponse) *ArnListOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the arn list o k response -func (o *ArnListOK) SetPayload(payload *models.ArnsResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ArnListOK) 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 - } - } -} - -/* -ArnListDefault Generic error response. - -swagger:response arnListDefault -*/ -type ArnListDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewArnListDefault creates ArnListDefault with default headers values -func NewArnListDefault(code int) *ArnListDefault { - if code <= 0 { - code = 500 - } - - return &ArnListDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the arn list default response -func (o *ArnListDefault) WithStatusCode(code int) *ArnListDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the arn list default response -func (o *ArnListDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the arn list default response -func (o *ArnListDefault) WithPayload(payload *models.APIError) *ArnListDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the arn list default response -func (o *ArnListDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ArnListDefault) 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/system/arn_list_urlbuilder.go b/api/operations/system/arn_list_urlbuilder.go deleted file mode 100644 index 8d7ae1766b..0000000000 --- a/api/operations/system/arn_list_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 system - -// 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" -) - -// ArnListURL generates an URL for the arn list operation -type ArnListURL 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 *ArnListURL) WithBasePath(bp string) *ArnListURL { - 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 *ArnListURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ArnListURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/admin/arns" - - _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 *ArnListURL) 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 *ArnListURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ArnListURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ArnListURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ArnListURL") - } - - 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 *ArnListURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/system/dashboard_widget_details.go b/api/operations/system/dashboard_widget_details.go deleted file mode 100644 index c60f2be21d..0000000000 --- a/api/operations/system/dashboard_widget_details.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 system - -// 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" -) - -// DashboardWidgetDetailsHandlerFunc turns a function with the right signature into a dashboard widget details handler -type DashboardWidgetDetailsHandlerFunc func(DashboardWidgetDetailsParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn DashboardWidgetDetailsHandlerFunc) Handle(params DashboardWidgetDetailsParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// DashboardWidgetDetailsHandler interface for that can handle valid dashboard widget details params -type DashboardWidgetDetailsHandler interface { - Handle(DashboardWidgetDetailsParams, *models.Principal) middleware.Responder -} - -// NewDashboardWidgetDetails creates a new http.Handler for the dashboard widget details operation -func NewDashboardWidgetDetails(ctx *middleware.Context, handler DashboardWidgetDetailsHandler) *DashboardWidgetDetails { - return &DashboardWidgetDetails{Context: ctx, Handler: handler} -} - -/* - DashboardWidgetDetails swagger:route GET /admin/info/widgets/{widgetId} System dashboardWidgetDetails - -Returns information about the deployment -*/ -type DashboardWidgetDetails struct { - Context *middleware.Context - Handler DashboardWidgetDetailsHandler -} - -func (o *DashboardWidgetDetails) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDashboardWidgetDetailsParams() - 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/system/dashboard_widget_details_parameters.go b/api/operations/system/dashboard_widget_details_parameters.go deleted file mode 100644 index 7a052435ff..0000000000 --- a/api/operations/system/dashboard_widget_details_parameters.go +++ /dev/null @@ -1,193 +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 system - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewDashboardWidgetDetailsParams creates a new DashboardWidgetDetailsParams object -// -// There are no default values defined in the spec. -func NewDashboardWidgetDetailsParams() DashboardWidgetDetailsParams { - - return DashboardWidgetDetailsParams{} -} - -// DashboardWidgetDetailsParams contains all the bound params for the dashboard widget details operation -// typically these are obtained from a http.Request -// -// swagger:parameters DashboardWidgetDetails -type DashboardWidgetDetailsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - In: query - */ - End *int64 - /* - In: query - */ - Start *int64 - /* - In: query - */ - Step *int32 - /* - Required: true - In: path - */ - WidgetID int32 -} - -// 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 NewDashboardWidgetDetailsParams() beforehand. -func (o *DashboardWidgetDetailsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qEnd, qhkEnd, _ := qs.GetOK("end") - if err := o.bindEnd(qEnd, qhkEnd, route.Formats); err != nil { - res = append(res, err) - } - - qStart, qhkStart, _ := qs.GetOK("start") - if err := o.bindStart(qStart, qhkStart, route.Formats); err != nil { - res = append(res, err) - } - - qStep, qhkStep, _ := qs.GetOK("step") - if err := o.bindStep(qStep, qhkStep, route.Formats); err != nil { - res = append(res, err) - } - - rWidgetID, rhkWidgetID, _ := route.Params.GetOK("widgetId") - if err := o.bindWidgetID(rWidgetID, rhkWidgetID, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindEnd binds and validates parameter End from query. -func (o *DashboardWidgetDetailsParams) bindEnd(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 - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("end", "query", "int64", raw) - } - o.End = &value - - return nil -} - -// bindStart binds and validates parameter Start from query. -func (o *DashboardWidgetDetailsParams) bindStart(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 - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("start", "query", "int64", raw) - } - o.Start = &value - - return nil -} - -// bindStep binds and validates parameter Step from query. -func (o *DashboardWidgetDetailsParams) bindStep(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 - } - - value, err := swag.ConvertInt32(raw) - if err != nil { - return errors.InvalidType("step", "query", "int32", raw) - } - o.Step = &value - - return nil -} - -// bindWidgetID binds and validates parameter WidgetID from path. -func (o *DashboardWidgetDetailsParams) bindWidgetID(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 - - value, err := swag.ConvertInt32(raw) - if err != nil { - return errors.InvalidType("widgetId", "path", "int32", raw) - } - o.WidgetID = value - - return nil -} diff --git a/api/operations/system/dashboard_widget_details_responses.go b/api/operations/system/dashboard_widget_details_responses.go deleted file mode 100644 index 35e95d0929..0000000000 --- a/api/operations/system/dashboard_widget_details_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 system - -// 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" -) - -// DashboardWidgetDetailsOKCode is the HTTP code returned for type DashboardWidgetDetailsOK -const DashboardWidgetDetailsOKCode int = 200 - -/* -DashboardWidgetDetailsOK A successful response. - -swagger:response dashboardWidgetDetailsOK -*/ -type DashboardWidgetDetailsOK struct { - - /* - In: Body - */ - Payload *models.WidgetDetails `json:"body,omitempty"` -} - -// NewDashboardWidgetDetailsOK creates DashboardWidgetDetailsOK with default headers values -func NewDashboardWidgetDetailsOK() *DashboardWidgetDetailsOK { - - return &DashboardWidgetDetailsOK{} -} - -// WithPayload adds the payload to the dashboard widget details o k response -func (o *DashboardWidgetDetailsOK) WithPayload(payload *models.WidgetDetails) *DashboardWidgetDetailsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the dashboard widget details o k response -func (o *DashboardWidgetDetailsOK) SetPayload(payload *models.WidgetDetails) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DashboardWidgetDetailsOK) 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 - } - } -} - -/* -DashboardWidgetDetailsDefault Generic error response. - -swagger:response dashboardWidgetDetailsDefault -*/ -type DashboardWidgetDetailsDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewDashboardWidgetDetailsDefault creates DashboardWidgetDetailsDefault with default headers values -func NewDashboardWidgetDetailsDefault(code int) *DashboardWidgetDetailsDefault { - if code <= 0 { - code = 500 - } - - return &DashboardWidgetDetailsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the dashboard widget details default response -func (o *DashboardWidgetDetailsDefault) WithStatusCode(code int) *DashboardWidgetDetailsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the dashboard widget details default response -func (o *DashboardWidgetDetailsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the dashboard widget details default response -func (o *DashboardWidgetDetailsDefault) WithPayload(payload *models.APIError) *DashboardWidgetDetailsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the dashboard widget details default response -func (o *DashboardWidgetDetailsDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DashboardWidgetDetailsDefault) 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/system/dashboard_widget_details_urlbuilder.go b/api/operations/system/dashboard_widget_details_urlbuilder.go deleted file mode 100644 index 2b61453456..0000000000 --- a/api/operations/system/dashboard_widget_details_urlbuilder.go +++ /dev/null @@ -1,150 +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 system - -// 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" - - "github.com/go-openapi/swag" -) - -// DashboardWidgetDetailsURL generates an URL for the dashboard widget details operation -type DashboardWidgetDetailsURL struct { - WidgetID int32 - - End *int64 - Start *int64 - Step *int32 - - _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 *DashboardWidgetDetailsURL) WithBasePath(bp string) *DashboardWidgetDetailsURL { - 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 *DashboardWidgetDetailsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DashboardWidgetDetailsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/admin/info/widgets/{widgetId}" - - widgetID := swag.FormatInt32(o.WidgetID) - if widgetID != "" { - _path = strings.Replace(_path, "{widgetId}", widgetID, -1) - } else { - return nil, errors.New("widgetId is required on DashboardWidgetDetailsURL") - } - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/api/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - var endQ string - if o.End != nil { - endQ = swag.FormatInt64(*o.End) - } - if endQ != "" { - qs.Set("end", endQ) - } - - var startQ string - if o.Start != nil { - startQ = swag.FormatInt64(*o.Start) - } - if startQ != "" { - qs.Set("start", startQ) - } - - var stepQ string - if o.Step != nil { - stepQ = swag.FormatInt32(*o.Step) - } - if stepQ != "" { - qs.Set("step", stepQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *DashboardWidgetDetailsURL) 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 *DashboardWidgetDetailsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DashboardWidgetDetailsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DashboardWidgetDetailsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DashboardWidgetDetailsURL") - } - - 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 *DashboardWidgetDetailsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/system/list_nodes.go b/api/operations/system/list_nodes.go deleted file mode 100644 index 6580a461eb..0000000000 --- a/api/operations/system/list_nodes.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 system - -// 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" -) - -// ListNodesHandlerFunc turns a function with the right signature into a list nodes handler -type ListNodesHandlerFunc func(ListNodesParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn ListNodesHandlerFunc) Handle(params ListNodesParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// ListNodesHandler interface for that can handle valid list nodes params -type ListNodesHandler interface { - Handle(ListNodesParams, *models.Principal) middleware.Responder -} - -// NewListNodes creates a new http.Handler for the list nodes operation -func NewListNodes(ctx *middleware.Context, handler ListNodesHandler) *ListNodes { - return &ListNodes{Context: ctx, Handler: handler} -} - -/* - ListNodes swagger:route GET /nodes System listNodes - -Lists Nodes -*/ -type ListNodes struct { - Context *middleware.Context - Handler ListNodesHandler -} - -func (o *ListNodes) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewListNodesParams() - 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/system/list_nodes_parameters.go b/api/operations/system/list_nodes_parameters.go deleted file mode 100644 index 96324cfed1..0000000000 --- a/api/operations/system/list_nodes_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 system - -// 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" -) - -// NewListNodesParams creates a new ListNodesParams object -// -// There are no default values defined in the spec. -func NewListNodesParams() ListNodesParams { - - return ListNodesParams{} -} - -// ListNodesParams contains all the bound params for the list nodes operation -// typically these are obtained from a http.Request -// -// swagger:parameters ListNodes -type ListNodesParams 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 NewListNodesParams() beforehand. -func (o *ListNodesParams) 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/system/list_nodes_responses.go b/api/operations/system/list_nodes_responses.go deleted file mode 100644 index 8246bbeef1..0000000000 --- a/api/operations/system/list_nodes_responses.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 system - -// 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" -) - -// ListNodesOKCode is the HTTP code returned for type ListNodesOK -const ListNodesOKCode int = 200 - -/* -ListNodesOK A successful response. - -swagger:response listNodesOK -*/ -type ListNodesOK struct { - - /* - In: Body - */ - Payload []string `json:"body,omitempty"` -} - -// NewListNodesOK creates ListNodesOK with default headers values -func NewListNodesOK() *ListNodesOK { - - return &ListNodesOK{} -} - -// WithPayload adds the payload to the list nodes o k response -func (o *ListNodesOK) WithPayload(payload []string) *ListNodesOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list nodes o k response -func (o *ListNodesOK) SetPayload(payload []string) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListNodesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = make([]string, 0, 50) - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -ListNodesDefault Generic error response. - -swagger:response listNodesDefault -*/ -type ListNodesDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewListNodesDefault creates ListNodesDefault with default headers values -func NewListNodesDefault(code int) *ListNodesDefault { - if code <= 0 { - code = 500 - } - - return &ListNodesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the list nodes default response -func (o *ListNodesDefault) WithStatusCode(code int) *ListNodesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the list nodes default response -func (o *ListNodesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the list nodes default response -func (o *ListNodesDefault) WithPayload(payload *models.APIError) *ListNodesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list nodes default response -func (o *ListNodesDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListNodesDefault) 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/user/add_user.go b/api/operations/user/add_user.go deleted file mode 100644 index 4a6ee5e726..0000000000 --- a/api/operations/user/add_user.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 user - -// 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" -) - -// AddUserHandlerFunc turns a function with the right signature into a add user handler -type AddUserHandlerFunc func(AddUserParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn AddUserHandlerFunc) Handle(params AddUserParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// AddUserHandler interface for that can handle valid add user params -type AddUserHandler interface { - Handle(AddUserParams, *models.Principal) middleware.Responder -} - -// NewAddUser creates a new http.Handler for the add user operation -func NewAddUser(ctx *middleware.Context, handler AddUserHandler) *AddUser { - return &AddUser{Context: ctx, Handler: handler} -} - -/* - AddUser swagger:route POST /users User addUser - -Add User -*/ -type AddUser struct { - Context *middleware.Context - Handler AddUserHandler -} - -func (o *AddUser) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewAddUserParams() - 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/user/add_user_parameters.go b/api/operations/user/add_user_parameters.go deleted file mode 100644 index 2236cb4a2d..0000000000 --- a/api/operations/user/add_user_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 user - -// 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" -) - -// NewAddUserParams creates a new AddUserParams object -// -// There are no default values defined in the spec. -func NewAddUserParams() AddUserParams { - - return AddUserParams{} -} - -// AddUserParams contains all the bound params for the add user operation -// typically these are obtained from a http.Request -// -// swagger:parameters AddUser -type AddUserParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.AddUserRequest -} - -// 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 NewAddUserParams() beforehand. -func (o *AddUserParams) 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.AddUserRequest - 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/user/add_user_responses.go b/api/operations/user/add_user_responses.go deleted file mode 100644 index 1864447521..0000000000 --- a/api/operations/user/add_user_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 user - -// 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" -) - -// AddUserCreatedCode is the HTTP code returned for type AddUserCreated -const AddUserCreatedCode int = 201 - -/* -AddUserCreated A successful response. - -swagger:response addUserCreated -*/ -type AddUserCreated struct { - - /* - In: Body - */ - Payload *models.User `json:"body,omitempty"` -} - -// NewAddUserCreated creates AddUserCreated with default headers values -func NewAddUserCreated() *AddUserCreated { - - return &AddUserCreated{} -} - -// WithPayload adds the payload to the add user created response -func (o *AddUserCreated) WithPayload(payload *models.User) *AddUserCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the add user created response -func (o *AddUserCreated) SetPayload(payload *models.User) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *AddUserCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -AddUserDefault Generic error response. - -swagger:response addUserDefault -*/ -type AddUserDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewAddUserDefault creates AddUserDefault with default headers values -func NewAddUserDefault(code int) *AddUserDefault { - if code <= 0 { - code = 500 - } - - return &AddUserDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the add user default response -func (o *AddUserDefault) WithStatusCode(code int) *AddUserDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the add user default response -func (o *AddUserDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the add user default response -func (o *AddUserDefault) WithPayload(payload *models.APIError) *AddUserDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the add user default response -func (o *AddUserDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *AddUserDefault) 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/user/add_user_urlbuilder.go b/api/operations/user/add_user_urlbuilder.go deleted file mode 100644 index 035e883d8a..0000000000 --- a/api/operations/user/add_user_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 user - -// 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" -) - -// AddUserURL generates an URL for the add user operation -type AddUserURL 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 *AddUserURL) WithBasePath(bp string) *AddUserURL { - 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 *AddUserURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *AddUserURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/users" - - _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 *AddUserURL) 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 *AddUserURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *AddUserURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on AddUserURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on AddUserURL") - } - - 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 *AddUserURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/user/bulk_update_users_groups.go b/api/operations/user/bulk_update_users_groups.go deleted file mode 100644 index f787afbd77..0000000000 --- a/api/operations/user/bulk_update_users_groups.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 user - -// 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" -) - -// BulkUpdateUsersGroupsHandlerFunc turns a function with the right signature into a bulk update users groups handler -type BulkUpdateUsersGroupsHandlerFunc func(BulkUpdateUsersGroupsParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn BulkUpdateUsersGroupsHandlerFunc) Handle(params BulkUpdateUsersGroupsParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// BulkUpdateUsersGroupsHandler interface for that can handle valid bulk update users groups params -type BulkUpdateUsersGroupsHandler interface { - Handle(BulkUpdateUsersGroupsParams, *models.Principal) middleware.Responder -} - -// NewBulkUpdateUsersGroups creates a new http.Handler for the bulk update users groups operation -func NewBulkUpdateUsersGroups(ctx *middleware.Context, handler BulkUpdateUsersGroupsHandler) *BulkUpdateUsersGroups { - return &BulkUpdateUsersGroups{Context: ctx, Handler: handler} -} - -/* - BulkUpdateUsersGroups swagger:route PUT /users-groups-bulk User bulkUpdateUsersGroups - -Bulk functionality to Add Users to Groups -*/ -type BulkUpdateUsersGroups struct { - Context *middleware.Context - Handler BulkUpdateUsersGroupsHandler -} - -func (o *BulkUpdateUsersGroups) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewBulkUpdateUsersGroupsParams() - 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/user/bulk_update_users_groups_parameters.go b/api/operations/user/bulk_update_users_groups_parameters.go deleted file mode 100644 index 20ac3b7f11..0000000000 --- a/api/operations/user/bulk_update_users_groups_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 user - -// 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" -) - -// NewBulkUpdateUsersGroupsParams creates a new BulkUpdateUsersGroupsParams object -// -// There are no default values defined in the spec. -func NewBulkUpdateUsersGroupsParams() BulkUpdateUsersGroupsParams { - - return BulkUpdateUsersGroupsParams{} -} - -// BulkUpdateUsersGroupsParams contains all the bound params for the bulk update users groups operation -// typically these are obtained from a http.Request -// -// swagger:parameters BulkUpdateUsersGroups -type BulkUpdateUsersGroupsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.BulkUserGroups -} - -// 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 NewBulkUpdateUsersGroupsParams() beforehand. -func (o *BulkUpdateUsersGroupsParams) 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.BulkUserGroups - 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/user/bulk_update_users_groups_responses.go b/api/operations/user/bulk_update_users_groups_responses.go deleted file mode 100644 index 43e844f86a..0000000000 --- a/api/operations/user/bulk_update_users_groups_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 user - -// 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" -) - -// BulkUpdateUsersGroupsOKCode is the HTTP code returned for type BulkUpdateUsersGroupsOK -const BulkUpdateUsersGroupsOKCode int = 200 - -/* -BulkUpdateUsersGroupsOK A successful response. - -swagger:response bulkUpdateUsersGroupsOK -*/ -type BulkUpdateUsersGroupsOK struct { -} - -// NewBulkUpdateUsersGroupsOK creates BulkUpdateUsersGroupsOK with default headers values -func NewBulkUpdateUsersGroupsOK() *BulkUpdateUsersGroupsOK { - - return &BulkUpdateUsersGroupsOK{} -} - -// WriteResponse to the client -func (o *BulkUpdateUsersGroupsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(200) -} - -/* -BulkUpdateUsersGroupsDefault Generic error response. - -swagger:response bulkUpdateUsersGroupsDefault -*/ -type BulkUpdateUsersGroupsDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewBulkUpdateUsersGroupsDefault creates BulkUpdateUsersGroupsDefault with default headers values -func NewBulkUpdateUsersGroupsDefault(code int) *BulkUpdateUsersGroupsDefault { - if code <= 0 { - code = 500 - } - - return &BulkUpdateUsersGroupsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the bulk update users groups default response -func (o *BulkUpdateUsersGroupsDefault) WithStatusCode(code int) *BulkUpdateUsersGroupsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the bulk update users groups default response -func (o *BulkUpdateUsersGroupsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the bulk update users groups default response -func (o *BulkUpdateUsersGroupsDefault) WithPayload(payload *models.APIError) *BulkUpdateUsersGroupsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the bulk update users groups default response -func (o *BulkUpdateUsersGroupsDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *BulkUpdateUsersGroupsDefault) 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/user/bulk_update_users_groups_urlbuilder.go b/api/operations/user/bulk_update_users_groups_urlbuilder.go deleted file mode 100644 index c15977f6e4..0000000000 --- a/api/operations/user/bulk_update_users_groups_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 user - -// 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" -) - -// BulkUpdateUsersGroupsURL generates an URL for the bulk update users groups operation -type BulkUpdateUsersGroupsURL 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 *BulkUpdateUsersGroupsURL) WithBasePath(bp string) *BulkUpdateUsersGroupsURL { - 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 *BulkUpdateUsersGroupsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *BulkUpdateUsersGroupsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/users-groups-bulk" - - _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 *BulkUpdateUsersGroupsURL) 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 *BulkUpdateUsersGroupsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *BulkUpdateUsersGroupsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on BulkUpdateUsersGroupsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on BulkUpdateUsersGroupsURL") - } - - 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 *BulkUpdateUsersGroupsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/user/check_user_service_accounts.go b/api/operations/user/check_user_service_accounts.go deleted file mode 100644 index 420bc83694..0000000000 --- a/api/operations/user/check_user_service_accounts.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 user - -// 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" -) - -// CheckUserServiceAccountsHandlerFunc turns a function with the right signature into a check user service accounts handler -type CheckUserServiceAccountsHandlerFunc func(CheckUserServiceAccountsParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn CheckUserServiceAccountsHandlerFunc) Handle(params CheckUserServiceAccountsParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// CheckUserServiceAccountsHandler interface for that can handle valid check user service accounts params -type CheckUserServiceAccountsHandler interface { - Handle(CheckUserServiceAccountsParams, *models.Principal) middleware.Responder -} - -// NewCheckUserServiceAccounts creates a new http.Handler for the check user service accounts operation -func NewCheckUserServiceAccounts(ctx *middleware.Context, handler CheckUserServiceAccountsHandler) *CheckUserServiceAccounts { - return &CheckUserServiceAccounts{Context: ctx, Handler: handler} -} - -/* - CheckUserServiceAccounts swagger:route POST /users/service-accounts User checkUserServiceAccounts - -Check number of service accounts for each user specified -*/ -type CheckUserServiceAccounts struct { - Context *middleware.Context - Handler CheckUserServiceAccountsHandler -} - -func (o *CheckUserServiceAccounts) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCheckUserServiceAccountsParams() - 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/user/check_user_service_accounts_parameters.go b/api/operations/user/check_user_service_accounts_parameters.go deleted file mode 100644 index 0a68774246..0000000000 --- a/api/operations/user/check_user_service_accounts_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 user - -// 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" -) - -// NewCheckUserServiceAccountsParams creates a new CheckUserServiceAccountsParams object -// -// There are no default values defined in the spec. -func NewCheckUserServiceAccountsParams() CheckUserServiceAccountsParams { - - return CheckUserServiceAccountsParams{} -} - -// CheckUserServiceAccountsParams contains all the bound params for the check user service accounts operation -// typically these are obtained from a http.Request -// -// swagger:parameters CheckUserServiceAccounts -type CheckUserServiceAccountsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - SelectedUsers models.SelectedUsers -} - -// 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 NewCheckUserServiceAccountsParams() beforehand. -func (o *CheckUserServiceAccountsParams) 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.SelectedUsers - if err := route.Consumer.Consume(r.Body, &body); err != nil { - if err == io.EOF { - res = append(res, errors.Required("selectedUsers", "body", "")) - } else { - res = append(res, errors.NewParseError("selectedUsers", "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.SelectedUsers = body - } - } - } else { - res = append(res, errors.Required("selectedUsers", "body", "")) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/api/operations/user/check_user_service_accounts_responses.go b/api/operations/user/check_user_service_accounts_responses.go deleted file mode 100644 index cf3fe2cf43..0000000000 --- a/api/operations/user/check_user_service_accounts_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 user - -// 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" -) - -// CheckUserServiceAccountsOKCode is the HTTP code returned for type CheckUserServiceAccountsOK -const CheckUserServiceAccountsOKCode int = 200 - -/* -CheckUserServiceAccountsOK A successful response. - -swagger:response checkUserServiceAccountsOK -*/ -type CheckUserServiceAccountsOK struct { - - /* - In: Body - */ - Payload *models.UserServiceAccountSummary `json:"body,omitempty"` -} - -// NewCheckUserServiceAccountsOK creates CheckUserServiceAccountsOK with default headers values -func NewCheckUserServiceAccountsOK() *CheckUserServiceAccountsOK { - - return &CheckUserServiceAccountsOK{} -} - -// WithPayload adds the payload to the check user service accounts o k response -func (o *CheckUserServiceAccountsOK) WithPayload(payload *models.UserServiceAccountSummary) *CheckUserServiceAccountsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the check user service accounts o k response -func (o *CheckUserServiceAccountsOK) SetPayload(payload *models.UserServiceAccountSummary) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CheckUserServiceAccountsOK) 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 - } - } -} - -/* -CheckUserServiceAccountsDefault Generic error response. - -swagger:response checkUserServiceAccountsDefault -*/ -type CheckUserServiceAccountsDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewCheckUserServiceAccountsDefault creates CheckUserServiceAccountsDefault with default headers values -func NewCheckUserServiceAccountsDefault(code int) *CheckUserServiceAccountsDefault { - if code <= 0 { - code = 500 - } - - return &CheckUserServiceAccountsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the check user service accounts default response -func (o *CheckUserServiceAccountsDefault) WithStatusCode(code int) *CheckUserServiceAccountsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the check user service accounts default response -func (o *CheckUserServiceAccountsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the check user service accounts default response -func (o *CheckUserServiceAccountsDefault) WithPayload(payload *models.APIError) *CheckUserServiceAccountsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the check user service accounts default response -func (o *CheckUserServiceAccountsDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CheckUserServiceAccountsDefault) 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/user/check_user_service_accounts_urlbuilder.go b/api/operations/user/check_user_service_accounts_urlbuilder.go deleted file mode 100644 index 8f3c9d0087..0000000000 --- a/api/operations/user/check_user_service_accounts_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 user - -// 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" -) - -// CheckUserServiceAccountsURL generates an URL for the check user service accounts operation -type CheckUserServiceAccountsURL 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 *CheckUserServiceAccountsURL) WithBasePath(bp string) *CheckUserServiceAccountsURL { - 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 *CheckUserServiceAccountsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CheckUserServiceAccountsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/users/service-accounts" - - _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 *CheckUserServiceAccountsURL) 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 *CheckUserServiceAccountsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CheckUserServiceAccountsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CheckUserServiceAccountsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CheckUserServiceAccountsURL") - } - - 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 *CheckUserServiceAccountsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/user/create_a_user_service_account.go b/api/operations/user/create_a_user_service_account.go deleted file mode 100644 index a8dfe71977..0000000000 --- a/api/operations/user/create_a_user_service_account.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 user - -// 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" -) - -// CreateAUserServiceAccountHandlerFunc turns a function with the right signature into a create a user service account handler -type CreateAUserServiceAccountHandlerFunc func(CreateAUserServiceAccountParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateAUserServiceAccountHandlerFunc) Handle(params CreateAUserServiceAccountParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// CreateAUserServiceAccountHandler interface for that can handle valid create a user service account params -type CreateAUserServiceAccountHandler interface { - Handle(CreateAUserServiceAccountParams, *models.Principal) middleware.Responder -} - -// NewCreateAUserServiceAccount creates a new http.Handler for the create a user service account operation -func NewCreateAUserServiceAccount(ctx *middleware.Context, handler CreateAUserServiceAccountHandler) *CreateAUserServiceAccount { - return &CreateAUserServiceAccount{Context: ctx, Handler: handler} -} - -/* - CreateAUserServiceAccount swagger:route POST /user/{name}/service-accounts User createAUserServiceAccount - -Create Service Account for User -*/ -type CreateAUserServiceAccount struct { - Context *middleware.Context - Handler CreateAUserServiceAccountHandler -} - -func (o *CreateAUserServiceAccount) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateAUserServiceAccountParams() - 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/user/create_a_user_service_account_parameters.go b/api/operations/user/create_a_user_service_account_parameters.go deleted file mode 100644 index 651250849d..0000000000 --- a/api/operations/user/create_a_user_service_account_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 user - -// 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" -) - -// NewCreateAUserServiceAccountParams creates a new CreateAUserServiceAccountParams object -// -// There are no default values defined in the spec. -func NewCreateAUserServiceAccountParams() CreateAUserServiceAccountParams { - - return CreateAUserServiceAccountParams{} -} - -// CreateAUserServiceAccountParams contains all the bound params for the create a user service account operation -// typically these are obtained from a http.Request -// -// swagger:parameters CreateAUserServiceAccount -type CreateAUserServiceAccountParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.ServiceAccountRequest - /* - 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 NewCreateAUserServiceAccountParams() beforehand. -func (o *CreateAUserServiceAccountParams) 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.ServiceAccountRequest - 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 *CreateAUserServiceAccountParams) 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/user/create_a_user_service_account_responses.go b/api/operations/user/create_a_user_service_account_responses.go deleted file mode 100644 index 3f54779e9d..0000000000 --- a/api/operations/user/create_a_user_service_account_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 user - -// 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" -) - -// CreateAUserServiceAccountCreatedCode is the HTTP code returned for type CreateAUserServiceAccountCreated -const CreateAUserServiceAccountCreatedCode int = 201 - -/* -CreateAUserServiceAccountCreated A successful response. - -swagger:response createAUserServiceAccountCreated -*/ -type CreateAUserServiceAccountCreated struct { - - /* - In: Body - */ - Payload *models.ServiceAccountCreds `json:"body,omitempty"` -} - -// NewCreateAUserServiceAccountCreated creates CreateAUserServiceAccountCreated with default headers values -func NewCreateAUserServiceAccountCreated() *CreateAUserServiceAccountCreated { - - return &CreateAUserServiceAccountCreated{} -} - -// WithPayload adds the payload to the create a user service account created response -func (o *CreateAUserServiceAccountCreated) WithPayload(payload *models.ServiceAccountCreds) *CreateAUserServiceAccountCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create a user service account created response -func (o *CreateAUserServiceAccountCreated) SetPayload(payload *models.ServiceAccountCreds) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateAUserServiceAccountCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateAUserServiceAccountDefault Generic error response. - -swagger:response createAUserServiceAccountDefault -*/ -type CreateAUserServiceAccountDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewCreateAUserServiceAccountDefault creates CreateAUserServiceAccountDefault with default headers values -func NewCreateAUserServiceAccountDefault(code int) *CreateAUserServiceAccountDefault { - if code <= 0 { - code = 500 - } - - return &CreateAUserServiceAccountDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create a user service account default response -func (o *CreateAUserServiceAccountDefault) WithStatusCode(code int) *CreateAUserServiceAccountDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create a user service account default response -func (o *CreateAUserServiceAccountDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the create a user service account default response -func (o *CreateAUserServiceAccountDefault) WithPayload(payload *models.APIError) *CreateAUserServiceAccountDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create a user service account default response -func (o *CreateAUserServiceAccountDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateAUserServiceAccountDefault) 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/user/create_a_user_service_account_urlbuilder.go b/api/operations/user/create_a_user_service_account_urlbuilder.go deleted file mode 100644 index 9ade9686aa..0000000000 --- a/api/operations/user/create_a_user_service_account_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 user - -// 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" -) - -// CreateAUserServiceAccountURL generates an URL for the create a user service account operation -type CreateAUserServiceAccountURL 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 *CreateAUserServiceAccountURL) WithBasePath(bp string) *CreateAUserServiceAccountURL { - 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 *CreateAUserServiceAccountURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateAUserServiceAccountURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/user/{name}/service-accounts" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on CreateAUserServiceAccountURL") - } - - _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 *CreateAUserServiceAccountURL) 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 *CreateAUserServiceAccountURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateAUserServiceAccountURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateAUserServiceAccountURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateAUserServiceAccountURL") - } - - 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 *CreateAUserServiceAccountURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/user/create_service_account_credentials.go b/api/operations/user/create_service_account_credentials.go deleted file mode 100644 index dcf43faffa..0000000000 --- a/api/operations/user/create_service_account_credentials.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 user - -// 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" -) - -// CreateServiceAccountCredentialsHandlerFunc turns a function with the right signature into a create service account credentials handler -type CreateServiceAccountCredentialsHandlerFunc func(CreateServiceAccountCredentialsParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn CreateServiceAccountCredentialsHandlerFunc) Handle(params CreateServiceAccountCredentialsParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// CreateServiceAccountCredentialsHandler interface for that can handle valid create service account credentials params -type CreateServiceAccountCredentialsHandler interface { - Handle(CreateServiceAccountCredentialsParams, *models.Principal) middleware.Responder -} - -// NewCreateServiceAccountCredentials creates a new http.Handler for the create service account credentials operation -func NewCreateServiceAccountCredentials(ctx *middleware.Context, handler CreateServiceAccountCredentialsHandler) *CreateServiceAccountCredentials { - return &CreateServiceAccountCredentials{Context: ctx, Handler: handler} -} - -/* - CreateServiceAccountCredentials swagger:route POST /user/{name}/service-account-credentials User createServiceAccountCredentials - -Create Service Account for User With Credentials -*/ -type CreateServiceAccountCredentials struct { - Context *middleware.Context - Handler CreateServiceAccountCredentialsHandler -} - -func (o *CreateServiceAccountCredentials) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewCreateServiceAccountCredentialsParams() - 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/user/create_service_account_credentials_parameters.go b/api/operations/user/create_service_account_credentials_parameters.go deleted file mode 100644 index 9b3991aa7b..0000000000 --- a/api/operations/user/create_service_account_credentials_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 user - -// 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" -) - -// NewCreateServiceAccountCredentialsParams creates a new CreateServiceAccountCredentialsParams object -// -// There are no default values defined in the spec. -func NewCreateServiceAccountCredentialsParams() CreateServiceAccountCredentialsParams { - - return CreateServiceAccountCredentialsParams{} -} - -// CreateServiceAccountCredentialsParams contains all the bound params for the create service account credentials operation -// typically these are obtained from a http.Request -// -// swagger:parameters CreateServiceAccountCredentials -type CreateServiceAccountCredentialsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.ServiceAccountRequestCreds - /* - 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 NewCreateServiceAccountCredentialsParams() beforehand. -func (o *CreateServiceAccountCredentialsParams) 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.ServiceAccountRequestCreds - 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 *CreateServiceAccountCredentialsParams) 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/user/create_service_account_credentials_responses.go b/api/operations/user/create_service_account_credentials_responses.go deleted file mode 100644 index 1007c6ff07..0000000000 --- a/api/operations/user/create_service_account_credentials_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 user - -// 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" -) - -// CreateServiceAccountCredentialsCreatedCode is the HTTP code returned for type CreateServiceAccountCredentialsCreated -const CreateServiceAccountCredentialsCreatedCode int = 201 - -/* -CreateServiceAccountCredentialsCreated A successful response. - -swagger:response createServiceAccountCredentialsCreated -*/ -type CreateServiceAccountCredentialsCreated struct { - - /* - In: Body - */ - Payload *models.ServiceAccountCreds `json:"body,omitempty"` -} - -// NewCreateServiceAccountCredentialsCreated creates CreateServiceAccountCredentialsCreated with default headers values -func NewCreateServiceAccountCredentialsCreated() *CreateServiceAccountCredentialsCreated { - - return &CreateServiceAccountCredentialsCreated{} -} - -// WithPayload adds the payload to the create service account credentials created response -func (o *CreateServiceAccountCredentialsCreated) WithPayload(payload *models.ServiceAccountCreds) *CreateServiceAccountCredentialsCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create service account credentials created response -func (o *CreateServiceAccountCredentialsCreated) SetPayload(payload *models.ServiceAccountCreds) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateServiceAccountCredentialsCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -/* -CreateServiceAccountCredentialsDefault Generic error response. - -swagger:response createServiceAccountCredentialsDefault -*/ -type CreateServiceAccountCredentialsDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewCreateServiceAccountCredentialsDefault creates CreateServiceAccountCredentialsDefault with default headers values -func NewCreateServiceAccountCredentialsDefault(code int) *CreateServiceAccountCredentialsDefault { - if code <= 0 { - code = 500 - } - - return &CreateServiceAccountCredentialsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the create service account credentials default response -func (o *CreateServiceAccountCredentialsDefault) WithStatusCode(code int) *CreateServiceAccountCredentialsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the create service account credentials default response -func (o *CreateServiceAccountCredentialsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the create service account credentials default response -func (o *CreateServiceAccountCredentialsDefault) WithPayload(payload *models.APIError) *CreateServiceAccountCredentialsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the create service account credentials default response -func (o *CreateServiceAccountCredentialsDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *CreateServiceAccountCredentialsDefault) 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/user/create_service_account_credentials_urlbuilder.go b/api/operations/user/create_service_account_credentials_urlbuilder.go deleted file mode 100644 index a47a42e874..0000000000 --- a/api/operations/user/create_service_account_credentials_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 user - -// 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" -) - -// CreateServiceAccountCredentialsURL generates an URL for the create service account credentials operation -type CreateServiceAccountCredentialsURL 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 *CreateServiceAccountCredentialsURL) WithBasePath(bp string) *CreateServiceAccountCredentialsURL { - 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 *CreateServiceAccountCredentialsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *CreateServiceAccountCredentialsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/user/{name}/service-account-credentials" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on CreateServiceAccountCredentialsURL") - } - - _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 *CreateServiceAccountCredentialsURL) 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 *CreateServiceAccountCredentialsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *CreateServiceAccountCredentialsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on CreateServiceAccountCredentialsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on CreateServiceAccountCredentialsURL") - } - - 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 *CreateServiceAccountCredentialsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/user/get_user_info.go b/api/operations/user/get_user_info.go deleted file mode 100644 index c552908eb2..0000000000 --- a/api/operations/user/get_user_info.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 user - -// 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" -) - -// GetUserInfoHandlerFunc turns a function with the right signature into a get user info handler -type GetUserInfoHandlerFunc func(GetUserInfoParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetUserInfoHandlerFunc) Handle(params GetUserInfoParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// GetUserInfoHandler interface for that can handle valid get user info params -type GetUserInfoHandler interface { - Handle(GetUserInfoParams, *models.Principal) middleware.Responder -} - -// NewGetUserInfo creates a new http.Handler for the get user info operation -func NewGetUserInfo(ctx *middleware.Context, handler GetUserInfoHandler) *GetUserInfo { - return &GetUserInfo{Context: ctx, Handler: handler} -} - -/* - GetUserInfo swagger:route GET /user/{name} User getUserInfo - -Get User Info -*/ -type GetUserInfo struct { - Context *middleware.Context - Handler GetUserInfoHandler -} - -func (o *GetUserInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetUserInfoParams() - 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/user/get_user_info_parameters.go b/api/operations/user/get_user_info_parameters.go deleted file mode 100644 index 494bcd2c81..0000000000 --- a/api/operations/user/get_user_info_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 user - -// 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" -) - -// NewGetUserInfoParams creates a new GetUserInfoParams object -// -// There are no default values defined in the spec. -func NewGetUserInfoParams() GetUserInfoParams { - - return GetUserInfoParams{} -} - -// GetUserInfoParams contains all the bound params for the get user info operation -// typically these are obtained from a http.Request -// -// swagger:parameters GetUserInfo -type GetUserInfoParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - 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 NewGetUserInfoParams() beforehand. -func (o *GetUserInfoParams) 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 *GetUserInfoParams) 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/user/get_user_info_responses.go b/api/operations/user/get_user_info_responses.go deleted file mode 100644 index 8f3a18cff4..0000000000 --- a/api/operations/user/get_user_info_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 user - -// 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" -) - -// GetUserInfoOKCode is the HTTP code returned for type GetUserInfoOK -const GetUserInfoOKCode int = 200 - -/* -GetUserInfoOK A successful response. - -swagger:response getUserInfoOK -*/ -type GetUserInfoOK struct { - - /* - In: Body - */ - Payload *models.User `json:"body,omitempty"` -} - -// NewGetUserInfoOK creates GetUserInfoOK with default headers values -func NewGetUserInfoOK() *GetUserInfoOK { - - return &GetUserInfoOK{} -} - -// WithPayload adds the payload to the get user info o k response -func (o *GetUserInfoOK) WithPayload(payload *models.User) *GetUserInfoOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get user info o k response -func (o *GetUserInfoOK) SetPayload(payload *models.User) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetUserInfoOK) 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 - } - } -} - -/* -GetUserInfoDefault Generic error response. - -swagger:response getUserInfoDefault -*/ -type GetUserInfoDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewGetUserInfoDefault creates GetUserInfoDefault with default headers values -func NewGetUserInfoDefault(code int) *GetUserInfoDefault { - if code <= 0 { - code = 500 - } - - return &GetUserInfoDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get user info default response -func (o *GetUserInfoDefault) WithStatusCode(code int) *GetUserInfoDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get user info default response -func (o *GetUserInfoDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the get user info default response -func (o *GetUserInfoDefault) WithPayload(payload *models.APIError) *GetUserInfoDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get user info default response -func (o *GetUserInfoDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetUserInfoDefault) 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/user/get_user_info_urlbuilder.go b/api/operations/user/get_user_info_urlbuilder.go deleted file mode 100644 index 203c594647..0000000000 --- a/api/operations/user/get_user_info_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 user - -// 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" -) - -// GetUserInfoURL generates an URL for the get user info operation -type GetUserInfoURL 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 *GetUserInfoURL) WithBasePath(bp string) *GetUserInfoURL { - 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 *GetUserInfoURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetUserInfoURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/user/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetUserInfoURL") - } - - _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 *GetUserInfoURL) 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 *GetUserInfoURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetUserInfoURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetUserInfoURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetUserInfoURL") - } - - 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 *GetUserInfoURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/user/list_a_user_service_accounts.go b/api/operations/user/list_a_user_service_accounts.go deleted file mode 100644 index 26740705af..0000000000 --- a/api/operations/user/list_a_user_service_accounts.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 user - -// 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" -) - -// ListAUserServiceAccountsHandlerFunc turns a function with the right signature into a list a user service accounts handler -type ListAUserServiceAccountsHandlerFunc func(ListAUserServiceAccountsParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn ListAUserServiceAccountsHandlerFunc) Handle(params ListAUserServiceAccountsParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// ListAUserServiceAccountsHandler interface for that can handle valid list a user service accounts params -type ListAUserServiceAccountsHandler interface { - Handle(ListAUserServiceAccountsParams, *models.Principal) middleware.Responder -} - -// NewListAUserServiceAccounts creates a new http.Handler for the list a user service accounts operation -func NewListAUserServiceAccounts(ctx *middleware.Context, handler ListAUserServiceAccountsHandler) *ListAUserServiceAccounts { - return &ListAUserServiceAccounts{Context: ctx, Handler: handler} -} - -/* - ListAUserServiceAccounts swagger:route GET /user/{name}/service-accounts User listAUserServiceAccounts - -returns a list of service accounts for a user -*/ -type ListAUserServiceAccounts struct { - Context *middleware.Context - Handler ListAUserServiceAccountsHandler -} - -func (o *ListAUserServiceAccounts) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewListAUserServiceAccountsParams() - 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/user/list_a_user_service_accounts_parameters.go b/api/operations/user/list_a_user_service_accounts_parameters.go deleted file mode 100644 index c111e7b1e5..0000000000 --- a/api/operations/user/list_a_user_service_accounts_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 user - -// 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" -) - -// NewListAUserServiceAccountsParams creates a new ListAUserServiceAccountsParams object -// -// There are no default values defined in the spec. -func NewListAUserServiceAccountsParams() ListAUserServiceAccountsParams { - - return ListAUserServiceAccountsParams{} -} - -// ListAUserServiceAccountsParams contains all the bound params for the list a user service accounts operation -// typically these are obtained from a http.Request -// -// swagger:parameters ListAUserServiceAccounts -type ListAUserServiceAccountsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - 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 NewListAUserServiceAccountsParams() beforehand. -func (o *ListAUserServiceAccountsParams) 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 *ListAUserServiceAccountsParams) 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/user/list_a_user_service_accounts_responses.go b/api/operations/user/list_a_user_service_accounts_responses.go deleted file mode 100644 index 0d39569999..0000000000 --- a/api/operations/user/list_a_user_service_accounts_responses.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 user - -// 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" -) - -// ListAUserServiceAccountsOKCode is the HTTP code returned for type ListAUserServiceAccountsOK -const ListAUserServiceAccountsOKCode int = 200 - -/* -ListAUserServiceAccountsOK A successful response. - -swagger:response listAUserServiceAccountsOK -*/ -type ListAUserServiceAccountsOK struct { - - /* - In: Body - */ - Payload models.ServiceAccounts `json:"body,omitempty"` -} - -// NewListAUserServiceAccountsOK creates ListAUserServiceAccountsOK with default headers values -func NewListAUserServiceAccountsOK() *ListAUserServiceAccountsOK { - - return &ListAUserServiceAccountsOK{} -} - -// WithPayload adds the payload to the list a user service accounts o k response -func (o *ListAUserServiceAccountsOK) WithPayload(payload models.ServiceAccounts) *ListAUserServiceAccountsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list a user service accounts o k response -func (o *ListAUserServiceAccountsOK) SetPayload(payload models.ServiceAccounts) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListAUserServiceAccountsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.ServiceAccounts{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -/* -ListAUserServiceAccountsDefault Generic error response. - -swagger:response listAUserServiceAccountsDefault -*/ -type ListAUserServiceAccountsDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewListAUserServiceAccountsDefault creates ListAUserServiceAccountsDefault with default headers values -func NewListAUserServiceAccountsDefault(code int) *ListAUserServiceAccountsDefault { - if code <= 0 { - code = 500 - } - - return &ListAUserServiceAccountsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the list a user service accounts default response -func (o *ListAUserServiceAccountsDefault) WithStatusCode(code int) *ListAUserServiceAccountsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the list a user service accounts default response -func (o *ListAUserServiceAccountsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the list a user service accounts default response -func (o *ListAUserServiceAccountsDefault) WithPayload(payload *models.APIError) *ListAUserServiceAccountsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list a user service accounts default response -func (o *ListAUserServiceAccountsDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListAUserServiceAccountsDefault) 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/user/list_a_user_service_accounts_urlbuilder.go b/api/operations/user/list_a_user_service_accounts_urlbuilder.go deleted file mode 100644 index 6e133b3bbc..0000000000 --- a/api/operations/user/list_a_user_service_accounts_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 user - -// 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" -) - -// ListAUserServiceAccountsURL generates an URL for the list a user service accounts operation -type ListAUserServiceAccountsURL 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 *ListAUserServiceAccountsURL) WithBasePath(bp string) *ListAUserServiceAccountsURL { - 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 *ListAUserServiceAccountsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ListAUserServiceAccountsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/user/{name}/service-accounts" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on ListAUserServiceAccountsURL") - } - - _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 *ListAUserServiceAccountsURL) 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 *ListAUserServiceAccountsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ListAUserServiceAccountsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ListAUserServiceAccountsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ListAUserServiceAccountsURL") - } - - 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 *ListAUserServiceAccountsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/user/remove_user.go b/api/operations/user/remove_user.go deleted file mode 100644 index c912d42e6a..0000000000 --- a/api/operations/user/remove_user.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 user - -// 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" -) - -// RemoveUserHandlerFunc turns a function with the right signature into a remove user handler -type RemoveUserHandlerFunc func(RemoveUserParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn RemoveUserHandlerFunc) Handle(params RemoveUserParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// RemoveUserHandler interface for that can handle valid remove user params -type RemoveUserHandler interface { - Handle(RemoveUserParams, *models.Principal) middleware.Responder -} - -// NewRemoveUser creates a new http.Handler for the remove user operation -func NewRemoveUser(ctx *middleware.Context, handler RemoveUserHandler) *RemoveUser { - return &RemoveUser{Context: ctx, Handler: handler} -} - -/* - RemoveUser swagger:route DELETE /user/{name} User removeUser - -Remove user -*/ -type RemoveUser struct { - Context *middleware.Context - Handler RemoveUserHandler -} - -func (o *RemoveUser) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewRemoveUserParams() - 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/user/remove_user_parameters.go b/api/operations/user/remove_user_parameters.go deleted file mode 100644 index 686b11550a..0000000000 --- a/api/operations/user/remove_user_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 user - -// 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" -) - -// NewRemoveUserParams creates a new RemoveUserParams object -// -// There are no default values defined in the spec. -func NewRemoveUserParams() RemoveUserParams { - - return RemoveUserParams{} -} - -// RemoveUserParams contains all the bound params for the remove user operation -// typically these are obtained from a http.Request -// -// swagger:parameters RemoveUser -type RemoveUserParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - 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 NewRemoveUserParams() beforehand. -func (o *RemoveUserParams) 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 *RemoveUserParams) 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/user/remove_user_responses.go b/api/operations/user/remove_user_responses.go deleted file mode 100644 index 258ee44c21..0000000000 --- a/api/operations/user/remove_user_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 user - -// 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" -) - -// RemoveUserNoContentCode is the HTTP code returned for type RemoveUserNoContent -const RemoveUserNoContentCode int = 204 - -/* -RemoveUserNoContent A successful response. - -swagger:response removeUserNoContent -*/ -type RemoveUserNoContent struct { -} - -// NewRemoveUserNoContent creates RemoveUserNoContent with default headers values -func NewRemoveUserNoContent() *RemoveUserNoContent { - - return &RemoveUserNoContent{} -} - -// WriteResponse to the client -func (o *RemoveUserNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -/* -RemoveUserDefault Generic error response. - -swagger:response removeUserDefault -*/ -type RemoveUserDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewRemoveUserDefault creates RemoveUserDefault with default headers values -func NewRemoveUserDefault(code int) *RemoveUserDefault { - if code <= 0 { - code = 500 - } - - return &RemoveUserDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the remove user default response -func (o *RemoveUserDefault) WithStatusCode(code int) *RemoveUserDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the remove user default response -func (o *RemoveUserDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the remove user default response -func (o *RemoveUserDefault) WithPayload(payload *models.APIError) *RemoveUserDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the remove user default response -func (o *RemoveUserDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *RemoveUserDefault) 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/user/remove_user_urlbuilder.go b/api/operations/user/remove_user_urlbuilder.go deleted file mode 100644 index 546c36c844..0000000000 --- a/api/operations/user/remove_user_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 user - -// 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" -) - -// RemoveUserURL generates an URL for the remove user operation -type RemoveUserURL 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 *RemoveUserURL) WithBasePath(bp string) *RemoveUserURL { - 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 *RemoveUserURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *RemoveUserURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/user/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on RemoveUserURL") - } - - _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 *RemoveUserURL) 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 *RemoveUserURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *RemoveUserURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on RemoveUserURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on RemoveUserURL") - } - - 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 *RemoveUserURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/user/update_user_groups.go b/api/operations/user/update_user_groups.go deleted file mode 100644 index 782295ee75..0000000000 --- a/api/operations/user/update_user_groups.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 user - -// 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" -) - -// UpdateUserGroupsHandlerFunc turns a function with the right signature into a update user groups handler -type UpdateUserGroupsHandlerFunc func(UpdateUserGroupsParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn UpdateUserGroupsHandlerFunc) Handle(params UpdateUserGroupsParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// UpdateUserGroupsHandler interface for that can handle valid update user groups params -type UpdateUserGroupsHandler interface { - Handle(UpdateUserGroupsParams, *models.Principal) middleware.Responder -} - -// NewUpdateUserGroups creates a new http.Handler for the update user groups operation -func NewUpdateUserGroups(ctx *middleware.Context, handler UpdateUserGroupsHandler) *UpdateUserGroups { - return &UpdateUserGroups{Context: ctx, Handler: handler} -} - -/* - UpdateUserGroups swagger:route PUT /user/{name}/groups User updateUserGroups - -Update Groups for a user -*/ -type UpdateUserGroups struct { - Context *middleware.Context - Handler UpdateUserGroupsHandler -} - -func (o *UpdateUserGroups) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewUpdateUserGroupsParams() - 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/user/update_user_groups_parameters.go b/api/operations/user/update_user_groups_parameters.go deleted file mode 100644 index ebaf18a2c7..0000000000 --- a/api/operations/user/update_user_groups_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 user - -// 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" -) - -// NewUpdateUserGroupsParams creates a new UpdateUserGroupsParams object -// -// There are no default values defined in the spec. -func NewUpdateUserGroupsParams() UpdateUserGroupsParams { - - return UpdateUserGroupsParams{} -} - -// UpdateUserGroupsParams contains all the bound params for the update user groups operation -// typically these are obtained from a http.Request -// -// swagger:parameters UpdateUserGroups -type UpdateUserGroupsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.UpdateUserGroups - /* - 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 NewUpdateUserGroupsParams() beforehand. -func (o *UpdateUserGroupsParams) 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.UpdateUserGroups - 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 *UpdateUserGroupsParams) 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/user/update_user_groups_responses.go b/api/operations/user/update_user_groups_responses.go deleted file mode 100644 index abcb4b9916..0000000000 --- a/api/operations/user/update_user_groups_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 user - -// 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" -) - -// UpdateUserGroupsOKCode is the HTTP code returned for type UpdateUserGroupsOK -const UpdateUserGroupsOKCode int = 200 - -/* -UpdateUserGroupsOK A successful response. - -swagger:response updateUserGroupsOK -*/ -type UpdateUserGroupsOK struct { - - /* - In: Body - */ - Payload *models.User `json:"body,omitempty"` -} - -// NewUpdateUserGroupsOK creates UpdateUserGroupsOK with default headers values -func NewUpdateUserGroupsOK() *UpdateUserGroupsOK { - - return &UpdateUserGroupsOK{} -} - -// WithPayload adds the payload to the update user groups o k response -func (o *UpdateUserGroupsOK) WithPayload(payload *models.User) *UpdateUserGroupsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the update user groups o k response -func (o *UpdateUserGroupsOK) SetPayload(payload *models.User) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *UpdateUserGroupsOK) 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 - } - } -} - -/* -UpdateUserGroupsDefault Generic error response. - -swagger:response updateUserGroupsDefault -*/ -type UpdateUserGroupsDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewUpdateUserGroupsDefault creates UpdateUserGroupsDefault with default headers values -func NewUpdateUserGroupsDefault(code int) *UpdateUserGroupsDefault { - if code <= 0 { - code = 500 - } - - return &UpdateUserGroupsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the update user groups default response -func (o *UpdateUserGroupsDefault) WithStatusCode(code int) *UpdateUserGroupsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the update user groups default response -func (o *UpdateUserGroupsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the update user groups default response -func (o *UpdateUserGroupsDefault) WithPayload(payload *models.APIError) *UpdateUserGroupsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the update user groups default response -func (o *UpdateUserGroupsDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *UpdateUserGroupsDefault) 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/user/update_user_groups_urlbuilder.go b/api/operations/user/update_user_groups_urlbuilder.go deleted file mode 100644 index 1598f037a9..0000000000 --- a/api/operations/user/update_user_groups_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 user - -// 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" -) - -// UpdateUserGroupsURL generates an URL for the update user groups operation -type UpdateUserGroupsURL 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 *UpdateUserGroupsURL) WithBasePath(bp string) *UpdateUserGroupsURL { - 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 *UpdateUserGroupsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *UpdateUserGroupsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/user/{name}/groups" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on UpdateUserGroupsURL") - } - - _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 *UpdateUserGroupsURL) 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 *UpdateUserGroupsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *UpdateUserGroupsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on UpdateUserGroupsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on UpdateUserGroupsURL") - } - - 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 *UpdateUserGroupsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/user/update_user_info.go b/api/operations/user/update_user_info.go deleted file mode 100644 index e6f811ade9..0000000000 --- a/api/operations/user/update_user_info.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 user - -// 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" -) - -// UpdateUserInfoHandlerFunc turns a function with the right signature into a update user info handler -type UpdateUserInfoHandlerFunc func(UpdateUserInfoParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn UpdateUserInfoHandlerFunc) Handle(params UpdateUserInfoParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// UpdateUserInfoHandler interface for that can handle valid update user info params -type UpdateUserInfoHandler interface { - Handle(UpdateUserInfoParams, *models.Principal) middleware.Responder -} - -// NewUpdateUserInfo creates a new http.Handler for the update user info operation -func NewUpdateUserInfo(ctx *middleware.Context, handler UpdateUserInfoHandler) *UpdateUserInfo { - return &UpdateUserInfo{Context: ctx, Handler: handler} -} - -/* - UpdateUserInfo swagger:route PUT /user/{name} User updateUserInfo - -Update User Info -*/ -type UpdateUserInfo struct { - Context *middleware.Context - Handler UpdateUserInfoHandler -} - -func (o *UpdateUserInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewUpdateUserInfoParams() - 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/user/update_user_info_parameters.go b/api/operations/user/update_user_info_parameters.go deleted file mode 100644 index 55fe48059c..0000000000 --- a/api/operations/user/update_user_info_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 user - -// 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" -) - -// NewUpdateUserInfoParams creates a new UpdateUserInfoParams object -// -// There are no default values defined in the spec. -func NewUpdateUserInfoParams() UpdateUserInfoParams { - - return UpdateUserInfoParams{} -} - -// UpdateUserInfoParams contains all the bound params for the update user info operation -// typically these are obtained from a http.Request -// -// swagger:parameters UpdateUserInfo -type UpdateUserInfoParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.UpdateUser - /* - 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 NewUpdateUserInfoParams() beforehand. -func (o *UpdateUserInfoParams) 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.UpdateUser - 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 *UpdateUserInfoParams) 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/user/update_user_info_responses.go b/api/operations/user/update_user_info_responses.go deleted file mode 100644 index 3fc8092f84..0000000000 --- a/api/operations/user/update_user_info_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 user - -// 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" -) - -// UpdateUserInfoOKCode is the HTTP code returned for type UpdateUserInfoOK -const UpdateUserInfoOKCode int = 200 - -/* -UpdateUserInfoOK A successful response. - -swagger:response updateUserInfoOK -*/ -type UpdateUserInfoOK struct { - - /* - In: Body - */ - Payload *models.User `json:"body,omitempty"` -} - -// NewUpdateUserInfoOK creates UpdateUserInfoOK with default headers values -func NewUpdateUserInfoOK() *UpdateUserInfoOK { - - return &UpdateUserInfoOK{} -} - -// WithPayload adds the payload to the update user info o k response -func (o *UpdateUserInfoOK) WithPayload(payload *models.User) *UpdateUserInfoOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the update user info o k response -func (o *UpdateUserInfoOK) SetPayload(payload *models.User) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *UpdateUserInfoOK) 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 - } - } -} - -/* -UpdateUserInfoDefault Generic error response. - -swagger:response updateUserInfoDefault -*/ -type UpdateUserInfoDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewUpdateUserInfoDefault creates UpdateUserInfoDefault with default headers values -func NewUpdateUserInfoDefault(code int) *UpdateUserInfoDefault { - if code <= 0 { - code = 500 - } - - return &UpdateUserInfoDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the update user info default response -func (o *UpdateUserInfoDefault) WithStatusCode(code int) *UpdateUserInfoDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the update user info default response -func (o *UpdateUserInfoDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the update user info default response -func (o *UpdateUserInfoDefault) WithPayload(payload *models.APIError) *UpdateUserInfoDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the update user info default response -func (o *UpdateUserInfoDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *UpdateUserInfoDefault) 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/user/update_user_info_urlbuilder.go b/api/operations/user/update_user_info_urlbuilder.go deleted file mode 100644 index ff7daed92c..0000000000 --- a/api/operations/user/update_user_info_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 user - -// 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" -) - -// UpdateUserInfoURL generates an URL for the update user info operation -type UpdateUserInfoURL 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 *UpdateUserInfoURL) WithBasePath(bp string) *UpdateUserInfoURL { - 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 *UpdateUserInfoURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *UpdateUserInfoURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/user/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on UpdateUserInfoURL") - } - - _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 *UpdateUserInfoURL) 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 *UpdateUserInfoURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *UpdateUserInfoURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on UpdateUserInfoURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on UpdateUserInfoURL") - } - - 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 *UpdateUserInfoURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/service_accounts_handlers.go b/api/service_accounts_handlers.go deleted file mode 100644 index 13fe7b277c..0000000000 --- a/api/service_accounts_handlers.go +++ /dev/null @@ -1,505 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 api - -import ( - "context" - "encoding/json" - "errors" - "time" - - "github.com/go-openapi/runtime/middleware" - "github.com/minio/console/api/operations" - saApi "github.com/minio/console/api/operations/service_account" - userApi "github.com/minio/console/api/operations/user" - "github.com/minio/console/models" - "github.com/minio/madmin-go/v3" - iampolicy "github.com/minio/pkg/v3/policy" -) - -func registerServiceAccountsHandlers(api *operations.ConsoleAPI) { - // Create Service Account - api.ServiceAccountCreateServiceAccountHandler = saApi.CreateServiceAccountHandlerFunc(func(params saApi.CreateServiceAccountParams, session *models.Principal) middleware.Responder { - creds, err := getCreateServiceAccountResponse(session, params) - if err != nil { - return saApi.NewCreateServiceAccountDefault(err.Code).WithPayload(err.APIError) - } - return saApi.NewCreateServiceAccountCreated().WithPayload(creds) - }) - // Create User Service Account - api.UserCreateAUserServiceAccountHandler = userApi.CreateAUserServiceAccountHandlerFunc(func(params userApi.CreateAUserServiceAccountParams, session *models.Principal) middleware.Responder { - creds, err := getCreateAUserServiceAccountResponse(session, params) - if err != nil { - return saApi.NewCreateServiceAccountDefault(err.Code).WithPayload(err.APIError) - } - return userApi.NewCreateAUserServiceAccountCreated().WithPayload(creds) - }) - // Create User Service Account - api.UserCreateServiceAccountCredentialsHandler = userApi.CreateServiceAccountCredentialsHandlerFunc(func(params userApi.CreateServiceAccountCredentialsParams, session *models.Principal) middleware.Responder { - creds, err := getCreateAUserServiceAccountCredsResponse(session, params) - if err != nil { - return saApi.NewCreateServiceAccountDefault(err.Code).WithPayload(err.APIError) - } - return userApi.NewCreateServiceAccountCredentialsCreated().WithPayload(creds) - }) - api.ServiceAccountCreateServiceAccountCredsHandler = saApi.CreateServiceAccountCredsHandlerFunc(func(params saApi.CreateServiceAccountCredsParams, session *models.Principal) middleware.Responder { - creds, err := getCreateServiceAccountCredsResponse(session, params) - if err != nil { - return saApi.NewCreateServiceAccountDefault(err.Code).WithPayload(err.APIError) - } - return userApi.NewCreateServiceAccountCredentialsCreated().WithPayload(creds) - }) - // List Service Accounts for User - api.ServiceAccountListUserServiceAccountsHandler = saApi.ListUserServiceAccountsHandlerFunc(func(params saApi.ListUserServiceAccountsParams, session *models.Principal) middleware.Responder { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - serviceAccounts, err := getUserServiceAccountsResponse(ctx, session, "") - if err != nil { - return saApi.NewListUserServiceAccountsDefault(err.Code).WithPayload(err.APIError) - } - return saApi.NewListUserServiceAccountsOK().WithPayload(serviceAccounts) - }) - - // Delete a User's service account - api.ServiceAccountDeleteServiceAccountHandler = saApi.DeleteServiceAccountHandlerFunc(func(params saApi.DeleteServiceAccountParams, session *models.Principal) middleware.Responder { - if err := getDeleteServiceAccountResponse(session, params); err != nil { - return saApi.NewDeleteServiceAccountDefault(err.Code).WithPayload(err.APIError) - } - return saApi.NewDeleteServiceAccountNoContent() - }) - - // List Service Accounts for User - api.UserListAUserServiceAccountsHandler = userApi.ListAUserServiceAccountsHandlerFunc(func(params userApi.ListAUserServiceAccountsParams, session *models.Principal) middleware.Responder { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - serviceAccounts, err := getUserServiceAccountsResponse(ctx, session, params.Name) - if err != nil { - return saApi.NewListUserServiceAccountsDefault(err.Code).WithPayload(err.APIError) - } - return saApi.NewListUserServiceAccountsOK().WithPayload(serviceAccounts) - }) - - api.ServiceAccountGetServiceAccountHandler = saApi.GetServiceAccountHandlerFunc(func(params saApi.GetServiceAccountParams, session *models.Principal) middleware.Responder { - serviceAccounts, err := getServiceAccountInfo(session, params) - if err != nil { - return saApi.NewGetServiceAccountDefault(err.Code).WithPayload(err.APIError) - } - return saApi.NewGetServiceAccountOK().WithPayload(serviceAccounts) - }) - - api.ServiceAccountUpdateServiceAccountHandler = saApi.UpdateServiceAccountHandlerFunc(func(params saApi.UpdateServiceAccountParams, session *models.Principal) middleware.Responder { - err := updateSetServiceAccountResponse(session, params) - if err != nil { - return saApi.NewUpdateServiceAccountDefault(err.Code).WithPayload(err.APIError) - } - return saApi.NewUpdateServiceAccountOK() - }) - - // Delete multiple service accounts - api.ServiceAccountDeleteMultipleServiceAccountsHandler = saApi.DeleteMultipleServiceAccountsHandlerFunc(func(params saApi.DeleteMultipleServiceAccountsParams, session *models.Principal) middleware.Responder { - if err := getDeleteMultipleServiceAccountsResponse(session, params); err != nil { - return saApi.NewDeleteMultipleServiceAccountsDefault(err.Code).WithPayload(err.APIError) - } - return saApi.NewDeleteMultipleServiceAccountsNoContent() - }) -} - -// createServiceAccount adds a service account to the userClient and assigns a policy to him if defined. -func createServiceAccount(ctx context.Context, userClient MinioAdmin, policy string, name string, description string, expiry *time.Time, comment string) (*models.ServiceAccountCreds, error) { - creds, err := userClient.addServiceAccount(ctx, policy, "", "", "", name, description, expiry, comment) - if err != nil { - return nil, err - } - return &models.ServiceAccountCreds{AccessKey: creds.AccessKey, SecretKey: creds.SecretKey, URL: getMinIOServer()}, nil -} - -// createServiceAccount adds a service account with the given credentials to the -// userClient and assigns a policy to him if defined. -func createServiceAccountCreds(ctx context.Context, userClient MinioAdmin, policy string, accessKey string, secretKey string, name string, description string, expiry *time.Time, comment string) (*models.ServiceAccountCreds, error) { - creds, err := userClient.addServiceAccount(ctx, policy, "", accessKey, secretKey, name, description, expiry, comment) - if err != nil { - return nil, err - } - return &models.ServiceAccountCreds{AccessKey: creds.AccessKey, SecretKey: creds.SecretKey, URL: getMinIOServer()}, nil -} - -// getCreateServiceAccountResponse creates a service account with the defined policy for the user that -// is requesting, it first gets the credentials of the user and creates a client which is going to -// make the call to create the Service Account -func getCreateServiceAccountResponse(session *models.Principal, params saApi.CreateServiceAccountParams) (*models.ServiceAccountCreds, *CodedAPIError) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - - userAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - // create a MinIO user Admin Client interface implementation - // defining the client to be used - userAdminClient := AdminClient{Client: userAdmin} - - var expiry *time.Time - if params.Body.Expiry != "" { - parsedExpiry, err := time.Parse(time.RFC3339, params.Body.Expiry) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - expiry = &parsedExpiry - } - saCreds, err := createServiceAccount(ctx, userAdminClient, params.Body.Policy, params.Body.Name, params.Body.Description, expiry, params.Body.Comment) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return saCreds, nil -} - -// createServiceAccount adds a service account to a given user and assigns a policy to him if defined. -func createAUserServiceAccount(ctx context.Context, userClient MinioAdmin, policy string, user string, name string, description string, expiry *time.Time, comment string) (*models.ServiceAccountCreds, error) { - creds, err := userClient.addServiceAccount(ctx, policy, user, "", "", name, description, expiry, comment) - if err != nil { - return nil, err - } - return &models.ServiceAccountCreds{AccessKey: creds.AccessKey, SecretKey: creds.SecretKey, URL: getMinIOServer()}, nil -} - -func createAUserServiceAccountCreds(ctx context.Context, userClient MinioAdmin, policy string, user string, accessKey string, secretKey string, name string, description string, expiry *time.Time, comment string) (*models.ServiceAccountCreds, error) { - creds, err := userClient.addServiceAccount(ctx, policy, user, accessKey, secretKey, name, description, expiry, comment) - if err != nil { - return nil, err - } - return &models.ServiceAccountCreds{AccessKey: creds.AccessKey, SecretKey: creds.SecretKey, URL: getMinIOServer()}, nil -} - -// getCreateServiceAccountResponse creates a service account with the defined policy for the user that -// is requesting it ,it first gets the credentials of the user and creates a client which is going to -// make the call to create the Service Account -func getCreateAUserServiceAccountResponse(session *models.Principal, params userApi.CreateAUserServiceAccountParams) (*models.ServiceAccountCreds, *CodedAPIError) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - - userAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - // create a MinIO user Admin Client interface implementation - // defining the client to be used - userAdminClient := AdminClient{Client: userAdmin} - - var expiry *time.Time - if params.Body.Expiry != "" { - parsedExpiry, err := time.Parse(time.RFC3339, params.Body.Expiry) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - expiry = &parsedExpiry - } - saCreds, err := createAUserServiceAccount(ctx, userAdminClient, params.Body.Policy, params.Name, params.Body.Name, params.Body.Description, expiry, params.Body.Comment) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return saCreds, nil -} - -// getCreateServiceAccountCredsResponse creates a service account with the defined policy for the user that -// is requesting it, and with the credentials provided -func getCreateAUserServiceAccountCredsResponse(session *models.Principal, params userApi.CreateServiceAccountCredentialsParams) (*models.ServiceAccountCreds, *CodedAPIError) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - - userAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - // create a MinIO user Admin Client interface implementation - // defining the client to be used - userAdminClient := AdminClient{Client: userAdmin} - serviceAccount := params.Body - if params.Name == serviceAccount.AccessKey { - return nil, ErrorWithContext(ctx, errors.New("Access Key already in use")) - } - accounts, err := userAdminClient.listServiceAccounts(ctx, params.Name) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - for i := 0; i < len(accounts.Accounts); i++ { - if accounts.Accounts[i].AccessKey == serviceAccount.AccessKey { - return nil, ErrorWithContext(ctx, errors.New("Access Key already in use")) - } - } - - var expiry *time.Time - if serviceAccount.Expiry != "" { - parsedExpiry, err := time.Parse(time.RFC3339, serviceAccount.Expiry) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - expiry = &parsedExpiry - } - saCreds, err := createAUserServiceAccountCreds(ctx, userAdminClient, serviceAccount.Policy, params.Name, serviceAccount.AccessKey, serviceAccount.SecretKey, serviceAccount.Name, serviceAccount.Description, expiry, serviceAccount.Comment) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return saCreds, nil -} - -func getCreateServiceAccountCredsResponse(session *models.Principal, params saApi.CreateServiceAccountCredsParams) (*models.ServiceAccountCreds, *CodedAPIError) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - serviceAccount := params.Body - userAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - // create a MinIO user Admin Client interface implementation - // defining the client to be used - userAdminClient := AdminClient{Client: userAdmin} - - if session.AccountAccessKey == serviceAccount.AccessKey { - return nil, ErrorWithContext(ctx, errors.New("Access Key already in use")) - } - - accounts, err := userAdminClient.listServiceAccounts(ctx, "") - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - - for i := 0; i < len(accounts.Accounts); i++ { - if accounts.Accounts[i].AccessKey == serviceAccount.AccessKey { - return nil, ErrorWithContext(ctx, errors.New("Access Key already in use")) - } - } - - var expiry *time.Time - if params.Body.Expiry != "" { - parsedExpiry, err := time.Parse(time.RFC3339, params.Body.Expiry) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - expiry = &parsedExpiry - } - - saCreds, err := createServiceAccountCreds(ctx, userAdminClient, serviceAccount.Policy, serviceAccount.AccessKey, serviceAccount.SecretKey, params.Body.Name, params.Body.Description, expiry, params.Body.Comment) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return saCreds, nil -} - -// getUserServiceAccount gets list of the user's service accounts -func getUserServiceAccounts(ctx context.Context, userClient MinioAdmin, user string) (models.ServiceAccounts, error) { - listServAccs, err := userClient.listServiceAccounts(ctx, user) - if err != nil { - return nil, err - } - saList := models.ServiceAccounts{} - - for _, acc := range listServAccs.Accounts { - if acc.AccountStatus != "" { - // Newer releases of MinIO would support enhanced listServiceAccounts() - // we can avoid infoServiceAccount() at that point, this scales well - // for 100's of service accounts. - expiry := "" - if acc.Expiration != nil { - expiry = acc.Expiration.Format(time.RFC3339) - } - - saList = append(saList, &models.ServiceAccountsItems0{ - AccountStatus: acc.AccountStatus, - Description: acc.Description, - Expiration: expiry, - Name: acc.Name, - AccessKey: acc.AccessKey, - }) - continue - } - - aInfo, err := userClient.infoServiceAccount(ctx, acc.AccessKey) - if err != nil { - continue - } - expiry := "" - if aInfo.Expiration != nil { - expiry = aInfo.Expiration.Format(time.RFC3339) - } - - saList = append(saList, &models.ServiceAccountsItems0{ - AccountStatus: aInfo.AccountStatus, - Description: aInfo.Description, - Expiration: expiry, - Name: aInfo.Name, - AccessKey: acc.AccessKey, - }) - } - return saList, nil -} - -// getUserServiceAccountsResponse authenticates the user and calls -// getUserServiceAccounts to list the user's service accounts -func getUserServiceAccountsResponse(ctx context.Context, session *models.Principal, user string) (models.ServiceAccounts, *CodedAPIError) { - userAdmin, err := NewMinioAdminClient(ctx, session) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - // create a MinIO user Admin Client interface implementation - // defining the client to be used - userAdminClient := AdminClient{Client: userAdmin} - serviceAccounts, err := getUserServiceAccounts(ctx, userAdminClient, user) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return serviceAccounts, nil -} - -// deleteServiceAccount calls delete service account api -func deleteServiceAccount(ctx context.Context, userClient MinioAdmin, accessKey string) error { - return userClient.deleteServiceAccount(ctx, accessKey) -} - -// getDeleteServiceAccountResponse authenticates the user and calls deleteServiceAccount -func getDeleteServiceAccountResponse(session *models.Principal, params saApi.DeleteServiceAccountParams) *CodedAPIError { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - userAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return ErrorWithContext(ctx, err) - } - // create a MinIO user Admin Client interface implementation - // defining the client to be used - userAdminClient := AdminClient{Client: userAdmin} - if err := deleteServiceAccount(ctx, userAdminClient, params.AccessKey); err != nil { - return ErrorWithContext(ctx, err) - } - return nil -} - -// getServiceAccountDetails gets policy for a service account -func getServiceAccountDetails(ctx context.Context, userClient MinioAdmin, accessKey string) (*models.ServiceAccount, error) { - saInfo, err := userClient.infoServiceAccount(ctx, accessKey) - if err != nil { - return nil, err - } - - var policyJSON string - var policy iampolicy.Policy - json.Unmarshal([]byte(saInfo.Policy), &policy) - if policy.Statements == nil { - policyJSON = "" - } else { - policyJSON = saInfo.Policy - } - - expiry := "" - if saInfo.Expiration != nil { - expiry = saInfo.Expiration.Format(time.RFC3339) - } - - sa := models.ServiceAccount{ - AccountStatus: saInfo.AccountStatus, - Description: saInfo.Description, - Expiration: expiry, - ImpliedPolicy: saInfo.ImpliedPolicy, - Name: saInfo.Name, - ParentUser: saInfo.ParentUser, - Policy: policyJSON, - } - return &sa, nil -} - -// getServiceAccountInfo authenticates the user and calls -// getServiceAccountInfo to get the policy for a service account -func getServiceAccountInfo(session *models.Principal, params saApi.GetServiceAccountParams) (*models.ServiceAccount, *CodedAPIError) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - userAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - // create a MinIO user Admin Client interface implementation - // defining the client to be used - userAdminClient := AdminClient{Client: userAdmin} - - serviceAccount, err := getServiceAccountDetails(ctx, userAdminClient, params.AccessKey) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - - return serviceAccount, nil -} - -// setServiceAccountPolicy sets policy for a service account -func updateServiceAccountDetails(ctx context.Context, userClient MinioAdmin, accessKey string, policy string, expiry *time.Time, name string, description string, status string, secretKey string) error { - req := madmin.UpdateServiceAccountReq{ - NewPolicy: json.RawMessage(policy), - NewSecretKey: secretKey, - NewStatus: status, - NewName: name, - NewDescription: description, - NewExpiration: expiry, - } - - err := userClient.updateServiceAccount(ctx, accessKey, req) - return err -} - -// updateSetServiceAccountResponse authenticates the user and calls -// getSetServiceAccountPolicy to set the policy for a service account -func updateSetServiceAccountResponse(session *models.Principal, params saApi.UpdateServiceAccountParams) *CodedAPIError { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - policy := *params.Body.Policy - userAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return ErrorWithContext(ctx, err) - } - // create a MinIO user Admin Client interface implementation - // defining the client to be used - userAdminClient := AdminClient{Client: userAdmin} - - var expiry *time.Time - if params.Body.Expiry != "" { - parsedExpiry, err := time.Parse(time.RFC3339, params.Body.Expiry) - if err != nil { - return ErrorWithContext(ctx, err) - } - expiry = &parsedExpiry - } - err = updateServiceAccountDetails(ctx, userAdminClient, params.AccessKey, policy, expiry, params.Body.Name, params.Body.Description, params.Body.Status, params.Body.SecretKey) - if err != nil { - return ErrorWithContext(ctx, err) - } - return nil -} - -// getDeleteMultipleServiceAccountsResponse authenticates the user and calls deleteServiceAccount for each account listed in selectedSAs -func getDeleteMultipleServiceAccountsResponse(session *models.Principal, params saApi.DeleteMultipleServiceAccountsParams) *CodedAPIError { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - selectedSAs := params.SelectedSA - userAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return ErrorWithContext(ctx, err) - } - // create a MinIO user Admin Client interface implementation - // defining the client to be used - userAdminClient := AdminClient{Client: userAdmin} - for _, sa := range selectedSAs { - if err := deleteServiceAccount(ctx, userAdminClient, sa); err != nil { - return ErrorWithContext(ctx, err) - } - } - return nil -} diff --git a/api/service_accounts_handlers_test.go b/api/service_accounts_handlers_test.go deleted file mode 100644 index f1f5ede009..0000000000 --- a/api/service_accounts_handlers_test.go +++ /dev/null @@ -1,188 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 api - -import ( - "context" - "errors" - "fmt" - "testing" - "time" - - "github.com/minio/madmin-go/v3" - "github.com/stretchr/testify/assert" -) - -func TestAddServiceAccount(t *testing.T) { - assert := assert.New(t) - // mock minIO client - client := AdminClientMock{} - function := "createServiceAccount()" - // Test-1: createServiceAccount create a service account by assigning it a policy - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - policyDefinition := "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"s3:GetBucketLocation\",\"s3:GetObject\",\"s3:ListAllMyBuckets\"],\"Resource\":[\"arn:aws:s3:::bucket1/*\"]}]}" - mockResponse := madmin.Credentials{ - AccessKey: "minio", - SecretKey: "minio123", - } - minioAddServiceAccountMock = func(_ context.Context, _ string, _ string, _ string, _ string, _ string, _ string, _ *time.Time, _ string) (madmin.Credentials, error) { - return mockResponse, nil - } - saCreds, err := createServiceAccount(ctx, client, policyDefinition, "", "", nil, "") - if err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - assert.Equal(mockResponse.AccessKey, saCreds.AccessKey, fmt.Sprintf("Failed on %s:, error occurred: AccessKey differ", function)) - assert.Equal(mockResponse.SecretKey, saCreds.SecretKey, fmt.Sprintf("Failed on %s:, error occurred: SecretKey differ", function)) - - // Test-2: if an error occurs on server while creating service account (valid policy), handle it - policyDefinition = "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"s3:GetBucketLocation\",\"s3:GetObject\",\"s3:ListAllMyBuckets\"],\"Resource\":[\"arn:aws:s3:::bucket1/*\"]}]}" - mockResponse = madmin.Credentials{ - AccessKey: "minio", - SecretKey: "minio123", - } - minioAddServiceAccountMock = func(_ context.Context, _ string, _ string, _ string, _ string, _ string, _ string, _ *time.Time, _ string) (madmin.Credentials, error) { - return madmin.Credentials{}, errors.New("error") - } - _, err = createServiceAccount(ctx, client, policyDefinition, "", "", nil, "") - if assert.Error(err) { - assert.Equal("error", err.Error()) - } -} - -func TestListServiceAccounts(t *testing.T) { - assert := assert.New(t) - // mock minIO client - client := AdminClientMock{} - function := "getUserServiceAccounts()" - - // Test-1: getUserServiceAccounts list serviceaccounts for a user - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - mockResponse := madmin.ListServiceAccountsResp{ - Accounts: []madmin.ServiceAccountInfo{ - { - AccessKey: "accesskey1", - }, { - AccessKey: "accesskey2", - }, - }, - } - minioListServiceAccountsMock = func(_ context.Context, _ string) (madmin.ListServiceAccountsResp, error) { - return mockResponse, nil - } - - mockInfoResp := madmin.InfoServiceAccountResp{ - ParentUser: "", - AccountStatus: "", - ImpliedPolicy: false, - Policy: "", - Name: "", - Description: "", - Expiration: nil, - } - minioInfoServiceAccountMock = func(_ context.Context, _ string) (madmin.InfoServiceAccountResp, error) { - return mockInfoResp, nil - } - _, err := getUserServiceAccounts(ctx, client, "") - if err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - - // Test-2: getUserServiceAccounts returns an error, handle it properly - minioListServiceAccountsMock = func(_ context.Context, _ string) (madmin.ListServiceAccountsResp, error) { - return madmin.ListServiceAccountsResp{}, errors.New("error") - } - _, err = getUserServiceAccounts(ctx, client, "") - if assert.Error(err) { - assert.Equal("error", err.Error()) - } -} - -func TestDeleteServiceAccount(t *testing.T) { - assert := assert.New(t) - // mock minIO client - client := AdminClientMock{} - function := "deleteServiceAccount()" - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - // Test-1: deleteServiceAccount receive a service account to delete - testServiceAccount := "accesskeytest" - minioDeleteServiceAccountMock = func(_ context.Context, _ string) error { - return nil - } - if err := deleteServiceAccount(ctx, client, testServiceAccount); err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - - // Test-2: if an invalid policy is assigned to the service account, this will raise an error - minioDeleteServiceAccountMock = func(_ context.Context, _ string) error { - return errors.New("error") - } - - if err := deleteServiceAccount(ctx, client, testServiceAccount); assert.Error(err) { - assert.Equal("error", err.Error()) - } -} - -func TestGetServiceAccountDetails(t *testing.T) { - assert := assert.New(t) - // mock minIO client - client := AdminClientMock{} - function := "getServiceAccountDetails()" - - // Test-1: getServiceAccountPolicy list serviceaccounts for a user - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - mockResponse := madmin.InfoServiceAccountResp{ - Policy: ` -{ - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "s3:PutObject" - ], - "Resource": [ - "arn:aws:s3:::*" - ] - } - ] -}`, - } - - minioInfoServiceAccountMock = func(_ context.Context, _ string) (madmin.InfoServiceAccountResp, error) { - return mockResponse, nil - } - serviceAccount, err := getServiceAccountDetails(ctx, client, "") - if err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - assert.Equal(mockResponse.Policy, serviceAccount.Policy) - - // Test-2: getServiceAccountPolicy returns an error, handle it properly - minioInfoServiceAccountMock = func(_ context.Context, _ string) (madmin.InfoServiceAccountResp, error) { - return madmin.InfoServiceAccountResp{}, errors.New("error") - } - _, err = getServiceAccountDetails(ctx, client, "") - if assert.Error(err) { - assert.Equal("error", err.Error()) - } -} diff --git a/api/user_account.go b/api/user_account.go deleted file mode 100644 index 95b034d4b5..0000000000 --- a/api/user_account.go +++ /dev/null @@ -1,97 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 api - -import ( - "context" - "net/http" - - authApi "github.com/minio/console/api/operations/auth" - - "github.com/minio/console/pkg/auth" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/minio/console/api/operations" - accountApi "github.com/minio/console/api/operations/account" - "github.com/minio/console/models" -) - -func registerAccountHandlers(api *operations.ConsoleAPI) { - // change user password - api.AccountAccountChangePasswordHandler = accountApi.AccountChangePasswordHandlerFunc(func(params accountApi.AccountChangePasswordParams, session *models.Principal) middleware.Responder { - changePasswordResponse, err := getChangePasswordResponse(session, params) - if err != nil { - return accountApi.NewAccountChangePasswordDefault(err.Code).WithPayload(err.APIError) - } - // Custom response writer to update the session cookies - return middleware.ResponderFunc(func(w http.ResponseWriter, p runtime.Producer) { - cookie := NewSessionCookieForConsole(changePasswordResponse.SessionID) - http.SetCookie(w, &cookie) - authApi.NewLoginNoContent().WriteResponse(w, p) - }) - }) -} - -// changePassword validate current current user password and if it's correct set the new password -func changePassword(ctx context.Context, client MinioAdmin, session *models.Principal, newSecretKey string) error { - return client.changePassword(ctx, session.AccountAccessKey, newSecretKey) -} - -// getChangePasswordResponse will validate user knows what is the current password (avoid account hijacking), update user account password -// and authenticate the user generating a new session token/cookie -func getChangePasswordResponse(session *models.Principal, params accountApi.AccountChangePasswordParams) (*models.LoginResponse, *CodedAPIError) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - clientIP := getClientIP(params.HTTPRequest) - client := GetConsoleHTTPClient(clientIP) - - // changePassword operations requires an AdminClient initialized with parent account credentials not - // STS credentials - parentAccountClient, err := NewMinioAdminClient(params.HTTPRequest.Context(), &models.Principal{ - STSAccessKeyID: session.AccountAccessKey, - STSSecretAccessKey: *params.Body.CurrentSecretKey, - }) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - // parentAccountClient will contain access and secret key credentials for the user - userClient := AdminClient{Client: parentAccountClient} - accessKey := session.AccountAccessKey - newSecretKey := *params.Body.NewSecretKey - - // currentSecretKey will compare currentSecretKey against the stored secret key inside the encrypted session - if err := changePassword(ctx, userClient, session, newSecretKey); err != nil { - return nil, ErrorWithContext(ctx, ErrChangePassword, nil, err) - } - // user credentials are updated at this point, we need to generate a new admin client and authenticate using - // the new credentials - credentials, err := getConsoleCredentials(accessKey, newSecretKey, client) - if err != nil { - return nil, ErrorWithContext(ctx, ErrInvalidLogin, nil, err) - } - // authenticate user and generate new session token - sessionID, err := login(credentials, &auth.SessionFeatures{HideMenu: session.Hm}) - if err != nil { - return nil, ErrorWithContext(ctx, ErrInvalidLogin, nil, err) - } - // serialize output - loginResponse := &models.LoginResponse{ - SessionID: *sessionID, - } - return loginResponse, nil -} diff --git a/api/user_account_test.go b/api/user_account_test.go deleted file mode 100644 index 1da4070080..0000000000 --- a/api/user_account_test.go +++ /dev/null @@ -1,130 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 api - -import ( - "context" - "errors" - "net/http" - "testing" - - accountApi "github.com/minio/console/api/operations/account" - "github.com/minio/console/models" - "github.com/stretchr/testify/assert" -) - -func Test_getChangePasswordResponse(t *testing.T) { - assert := assert.New(t) - session := &models.Principal{ - AccountAccessKey: "TESTTEST", - } - CurrentSecretKey := "string" - NewSecretKey := "string" - changePasswordParameters := accountApi.AccountChangePasswordParams{ - HTTPRequest: &http.Request{}, - Body: &models.AccountChangePasswordRequest{ - CurrentSecretKey: &CurrentSecretKey, - NewSecretKey: &NewSecretKey, - }, - } - loginResponse, actualError := getChangePasswordResponse(session, changePasswordParameters) - expected := (*models.LoginResponse)(nil) - assert.Equal(expected, loginResponse) - expectedError := "error please check your current password" // errChangePassword - assert.Equal(expectedError, actualError.APIError.DetailedMessage) -} - -func Test_changePassword(t *testing.T) { - client := AdminClientMock{} - type args struct { - ctx context.Context - client AdminClientMock - session *models.Principal - currentSecretKey string - newSecretKey string - } - tests := []struct { - name string - args args - wantErr bool - mock func() - }{ - { - name: "password changed successfully", - args: args{ - client: client, - ctx: context.Background(), - session: &models.Principal{ - AccountAccessKey: "TESTTEST", - }, - currentSecretKey: "TESTTEST", - newSecretKey: "TESTTEST2", - }, - mock: func() { - minioChangePasswordMock = func(_ context.Context, _, _ string) error { - return nil - } - }, - }, - { - name: "error when changing password", - args: args{ - client: client, - ctx: context.Background(), - session: &models.Principal{ - AccountAccessKey: "TESTTEST", - }, - currentSecretKey: "TESTTEST", - newSecretKey: "TESTTEST2", - }, - mock: func() { - minioChangePasswordMock = func(_ context.Context, _, _ string) error { - return errors.New("there was an error, please try again") - } - }, - wantErr: true, - }, - { - name: "error because current password doesn't match", - args: args{ - client: client, - ctx: context.Background(), - session: &models.Principal{ - AccountAccessKey: "TESTTEST", - }, - currentSecretKey: "TESTTEST", - newSecretKey: "TESTTEST2", - }, - mock: func() { - minioChangePasswordMock = func(_ context.Context, _, _ string) error { - return errors.New("there was an error, please try again") - } - }, - wantErr: true, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - if tt.mock != nil { - tt.mock() - } - if err := changePassword(tt.args.ctx, tt.args.client, tt.args.session, tt.args.newSecretKey); (err != nil) != tt.wantErr { - t.Errorf("changePassword() error = %v, wantErr %v", err, tt.wantErr) - } - }) - } -} diff --git a/api/user_bucket_quota.go b/api/user_bucket_quota.go index 22c3f6afa5..fa0e504df1 100644 --- a/api/user_bucket_quota.go +++ b/api/user_bucket_quota.go @@ -18,28 +18,15 @@ package api import ( "context" - "errors" - "fmt" "github.com/go-openapi/runtime/middleware" "github.com/minio/console/api/operations" bucektApi "github.com/minio/console/api/operations/bucket" - "github.com/minio/madmin-go/v3" - "github.com/minio/console/models" ) func registerBucketQuotaHandlers(api *operations.ConsoleAPI) { - // set bucket quota - api.BucketSetBucketQuotaHandler = bucektApi.SetBucketQuotaHandlerFunc(func(params bucektApi.SetBucketQuotaParams, session *models.Principal) middleware.Responder { - err := setBucketQuotaResponse(session, params) - if err != nil { - return bucektApi.NewSetBucketQuotaDefault(err.Code).WithPayload(err.APIError) - } - return bucektApi.NewSetBucketQuotaOK() - }) - // get bucket quota api.BucketGetBucketQuotaHandler = bucektApi.GetBucketQuotaHandlerFunc(func(params bucektApi.GetBucketQuotaParams, session *models.Principal) middleware.Responder { resp, err := getBucketQuotaResponse(session, params) @@ -50,48 +37,6 @@ func registerBucketQuotaHandlers(api *operations.ConsoleAPI) { }) } -func setBucketQuotaResponse(session *models.Principal, params bucektApi.SetBucketQuotaParams) *CodedAPIError { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return ErrorWithContext(ctx, err) - } - // create a minioClient interface implementation - // defining the client to be used - adminClient := AdminClient{Client: mAdmin} - if err := setBucketQuota(ctx, &adminClient, ¶ms.Name, params.Body); err != nil { - return ErrorWithContext(ctx, err) - } - return nil -} - -func setBucketQuota(ctx context.Context, ac *AdminClient, bucket *string, bucketQuota *models.SetBucketQuota) error { - if bucketQuota == nil { - return errors.New("nil bucket quota was provided") - } - if *bucketQuota.Enabled { - var quotaType madmin.QuotaType - switch bucketQuota.QuotaType { - case models.SetBucketQuotaQuotaTypeHard: - quotaType = madmin.HardQuota - default: - return fmt.Errorf("unsupported quota type %s", bucketQuota.QuotaType) - } - if err := ac.setBucketQuota(ctx, *bucket, &madmin.BucketQuota{ - Quota: uint64(bucketQuota.Amount), - Type: quotaType, - }); err != nil { - return err - } - } else { - if err := ac.Client.SetBucketQuota(ctx, *bucket, &madmin.BucketQuota{}); err != nil { - return err - } - } - return nil -} - func getBucketQuotaResponse(session *models.Principal, params bucektApi.GetBucketQuotaParams) (*models.BucketQuota, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() diff --git a/api/user_buckets.go b/api/user_buckets.go index f95cd47af1..10394caad3 100644 --- a/api/user_buckets.go +++ b/api/user_buckets.go @@ -41,7 +41,6 @@ import ( "github.com/minio/console/models" "github.com/minio/console/pkg/auth/token" "github.com/minio/minio-go/v7/pkg/policy" - "github.com/minio/minio-go/v7/pkg/replication" minioIAMPolicy "github.com/minio/pkg/v3/policy" ) @@ -62,13 +61,6 @@ func registerBucketsHandlers(api *operations.ConsoleAPI) { } return bucketApi.NewMakeBucketOK().WithPayload(makeBucketResponse) }) - // delete bucket - api.BucketDeleteBucketHandler = bucketApi.DeleteBucketHandlerFunc(func(params bucketApi.DeleteBucketParams, session *models.Principal) middleware.Responder { - if err := getDeleteBucketResponse(session, params); err != nil { - return bucketApi.NewMakeBucketDefault(err.Code).WithPayload(err.APIError) - } - return bucketApi.NewDeleteBucketNoContent() - }) // get bucket info api.BucketBucketInfoHandler = bucketApi.BucketInfoHandlerFunc(func(params bucketApi.BucketInfoParams, session *models.Principal) middleware.Responder { bucketInfoResp, err := getBucketInfoResponse(session, params) @@ -78,14 +70,6 @@ func registerBucketsHandlers(api *operations.ConsoleAPI) { return bucketApi.NewBucketInfoOK().WithPayload(bucketInfoResp) }) - // set bucket policy - api.BucketBucketSetPolicyHandler = bucketApi.BucketSetPolicyHandlerFunc(func(params bucketApi.BucketSetPolicyParams, session *models.Principal) middleware.Responder { - bucketSetPolicyResp, err := getBucketSetPolicyResponse(session, params) - if err != nil { - return bucketApi.NewBucketSetPolicyDefault(err.Code).WithPayload(err.APIError) - } - return bucketApi.NewBucketSetPolicyOK().WithPayload(bucketSetPolicyResp) - }) // set bucket tags api.BucketPutBucketTagsHandler = bucketApi.PutBucketTagsHandlerFunc(func(params bucketApi.PutBucketTagsParams, session *models.Principal) middleware.Responder { err := getPutBucketTagsResponse(session, params) @@ -110,68 +94,6 @@ func registerBucketsHandlers(api *operations.ConsoleAPI) { } return bucketApi.NewSetBucketVersioningCreated() }) - // get bucket replication - api.BucketGetBucketReplicationHandler = bucketApi.GetBucketReplicationHandlerFunc(func(params bucketApi.GetBucketReplicationParams, session *models.Principal) middleware.Responder { - getBucketReplication, err := getBucketReplicationResponse(session, params) - if err != nil { - return bucketApi.NewGetBucketReplicationDefault(err.Code).WithPayload(err.APIError) - } - return bucketApi.NewGetBucketReplicationOK().WithPayload(getBucketReplication) - }) - // get single bucket replication rule - api.BucketGetBucketReplicationRuleHandler = bucketApi.GetBucketReplicationRuleHandlerFunc(func(params bucketApi.GetBucketReplicationRuleParams, session *models.Principal) middleware.Responder { - getBucketReplicationRule, err := getBucketReplicationRuleResponse(session, params) - if err != nil { - return bucketApi.NewGetBucketReplicationRuleDefault(err.Code).WithPayload(err.APIError) - } - return bucketApi.NewGetBucketReplicationRuleOK().WithPayload(getBucketReplicationRule) - }) - - // enable bucket encryption - api.BucketEnableBucketEncryptionHandler = bucketApi.EnableBucketEncryptionHandlerFunc(func(params bucketApi.EnableBucketEncryptionParams, session *models.Principal) middleware.Responder { - if err := enableBucketEncryptionResponse(session, params); err != nil { - return bucketApi.NewEnableBucketEncryptionDefault(err.Code).WithPayload(err.APIError) - } - return bucketApi.NewEnableBucketEncryptionOK() - }) - // disable bucket encryption - api.BucketDisableBucketEncryptionHandler = bucketApi.DisableBucketEncryptionHandlerFunc(func(params bucketApi.DisableBucketEncryptionParams, session *models.Principal) middleware.Responder { - if err := disableBucketEncryptionResponse(session, params); err != nil { - return bucketApi.NewDisableBucketEncryptionDefault(err.Code).WithPayload(err.APIError) - } - return bucketApi.NewDisableBucketEncryptionOK() - }) - // get bucket encryption info - api.BucketGetBucketEncryptionInfoHandler = bucketApi.GetBucketEncryptionInfoHandlerFunc(func(params bucketApi.GetBucketEncryptionInfoParams, session *models.Principal) middleware.Responder { - response, err := getBucketEncryptionInfoResponse(session, params) - if err != nil { - return bucketApi.NewGetBucketEncryptionInfoDefault(err.Code).WithPayload(err.APIError) - } - return bucketApi.NewGetBucketEncryptionInfoOK().WithPayload(response) - }) - // set bucket retention config - api.BucketSetBucketRetentionConfigHandler = bucketApi.SetBucketRetentionConfigHandlerFunc(func(params bucketApi.SetBucketRetentionConfigParams, session *models.Principal) middleware.Responder { - if err := getSetBucketRetentionConfigResponse(session, params); err != nil { - return bucketApi.NewSetBucketRetentionConfigDefault(err.Code).WithPayload(err.APIError) - } - return bucketApi.NewSetBucketRetentionConfigOK() - }) - // get bucket retention config - api.BucketGetBucketRetentionConfigHandler = bucketApi.GetBucketRetentionConfigHandlerFunc(func(params bucketApi.GetBucketRetentionConfigParams, session *models.Principal) middleware.Responder { - response, err := getBucketRetentionConfigResponse(session, params) - if err != nil { - return bucketApi.NewGetBucketRetentionConfigDefault(err.Code).WithPayload(err.APIError) - } - return bucketApi.NewGetBucketRetentionConfigOK().WithPayload(response) - }) - // get bucket object locking status - api.BucketGetBucketObjectLockingStatusHandler = bucketApi.GetBucketObjectLockingStatusHandlerFunc(func(params bucketApi.GetBucketObjectLockingStatusParams, session *models.Principal) middleware.Responder { - getBucketObjectLockingStatus, err := getBucketObjectLockingResponse(session, params) - if err != nil { - return bucketApi.NewGetBucketObjectLockingStatusDefault(err.Code).WithPayload(err.APIError) - } - return bucketApi.NewGetBucketObjectLockingStatusOK().WithPayload(getBucketObjectLockingStatus) - }) // get objects rewind for a bucket api.BucketGetBucketRewindHandler = bucketApi.GetBucketRewindHandlerFunc(func(params bucketApi.GetBucketRewindParams, session *models.Principal) middleware.Responder { getBucketRewind, err := getBucketRewindResponse(session, params) @@ -240,105 +162,6 @@ func setBucketVersioningResponse(session *models.Principal, params bucketApi.Set return nil } -func getBucketReplicationResponse(session *models.Principal, params bucketApi.GetBucketReplicationParams) (*models.BucketReplicationResponse, *CodedAPIError) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - - mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - // create a minioClient interface implementation - // defining the client to be used - minioClient := minioClient{client: mClient} - - // we will tolerate this call failing - res, err := minioClient.getBucketReplication(ctx, params.BucketName) - if err != nil { - ErrorWithContext(ctx, err) - } - - var rules []*models.BucketReplicationRule - - for _, rule := range res.Rules { - repDelMarkerStatus := rule.DeleteMarkerReplication.Status == replication.Enabled - repDelStatus := rule.DeleteReplication.Status == replication.Enabled - - rules = append(rules, &models.BucketReplicationRule{ - DeleteMarkerReplication: repDelMarkerStatus, - DeletesReplication: repDelStatus, - Destination: &models.BucketReplicationDestination{Bucket: rule.Destination.Bucket}, - Tags: rule.Tags(), - Prefix: rule.Prefix(), - ID: rule.ID, - Priority: int32(rule.Priority), - Status: string(rule.Status), - StorageClass: rule.Destination.StorageClass, - }) - } - - // serialize output - bucketRResponse := &models.BucketReplicationResponse{ - Rules: rules, - } - return bucketRResponse, nil -} - -func getBucketReplicationRuleResponse(session *models.Principal, params bucketApi.GetBucketReplicationRuleParams) (*models.BucketReplicationRule, *CodedAPIError) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - - mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - // create a minioClient interface implementation - - // defining the client to be used - minioClient := minioClient{client: mClient} - - replicationRules, err := minioClient.getBucketReplication(ctx, params.BucketName) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - - var foundRule replication.Rule - found := false - - for i := range replicationRules.Rules { - if replicationRules.Rules[i].ID == params.RuleID { - foundRule = replicationRules.Rules[i] - found = true - break - } - } - - if !found { - return nil, ErrorWithContext(ctx, errors.New("no rule is set with this ID")) - } - - repDelMarkerStatus := foundRule.DeleteMarkerReplication.Status == replication.Enabled - repDelStatus := foundRule.DeleteReplication.Status == replication.Enabled - existingObjects := foundRule.ExistingObjectReplication.Status == replication.Enabled - metadataModifications := foundRule.SourceSelectionCriteria.ReplicaModifications.Status == replication.Enabled - - returnRule := &models.BucketReplicationRule{ - DeleteMarkerReplication: repDelMarkerStatus, - DeletesReplication: repDelStatus, - Destination: &models.BucketReplicationDestination{Bucket: foundRule.Destination.Bucket}, - Tags: foundRule.Tags(), - Prefix: foundRule.Prefix(), - ID: foundRule.ID, - Priority: int32(foundRule.Priority), - Status: string(foundRule.Status), - StorageClass: foundRule.Destination.StorageClass, - ExistingObjects: existingObjects, - MetadataReplication: metadataModifications, - } - - return returnRule, nil -} - func getBucketVersionedResponse(session *models.Principal, params bucketApi.GetBucketVersioningParams) (*models.BucketVersioningResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() @@ -467,12 +290,7 @@ func getMakeBucketResponse(session *models.Principal, params bucketApi.MakeBucke // defining the client to be used minioClient := minioClient{client: mClient} - // if we need retention, then object locking needs to be enabled - if br.Retention != nil { - br.Locking = true - } - - if err := makeBucket(ctx, minioClient, *br.Name, br.Locking); err != nil { + if err := makeBucket(ctx, minioClient, *br.Name, false); err != nil { return nil, ErrorWithContext(ctx, err) } @@ -486,60 +304,6 @@ func getMakeBucketResponse(session *models.Principal, params bucketApi.MakeBucke } }() - versioningEnabled := false - - if br.Versioning != nil && br.Versioning.Enabled { - versioningEnabled = true - } - - // enable versioning if indicated or retention enabled - if versioningEnabled || br.Retention != nil { - s3Client, err := newS3BucketClient(session, *br.Name, "", getClientIP(params.HTTPRequest)) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - // create a mc S3Client interface implementation - // defining the client to be used - amcClient := mcClient{client: s3Client} - - excludePrefixes := []string{} - excludeFolders := false - - if br.Versioning.ExcludeFolders && !br.Locking { - excludeFolders = true - } - - if br.Versioning.ExcludePrefixes != nil && !br.Locking { - excludePrefixes = br.Versioning.ExcludePrefixes - } - - if err = doSetVersioning(ctx, amcClient, VersionEnable, excludePrefixes, excludeFolders); err != nil { - return nil, ErrorWithContext(ctx, fmt.Errorf("error setting versioning for bucket: %s", err)) - } - } - - // if it has support for - if br.Quota != nil && br.Quota.Enabled != nil && *br.Quota.Enabled { - mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - // create a minioClient interface implementation - // defining the client to be used - adminClient := AdminClient{Client: mAdmin} - // we will tolerate this call failing - if err := setBucketQuota(ctx, &adminClient, br.Name, br.Quota); err != nil { - ErrorWithContext(ctx, fmt.Errorf("error versioning bucket: %v", err)) - } - } - - // Set Bucket Retention Configuration if defined - if br.Retention != nil { - err = setBucketRetentionConfig(ctx, minioClient, *br.Name, *br.Retention.Mode, *br.Retention.Unit, br.Retention.Validity) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - } return &models.MakeBucketsResponse{BucketName: *br.Name}, nil } @@ -574,41 +338,6 @@ func setBucketAccessPolicy(ctx context.Context, client MinioClient, bucketName s return client.setBucketPolicyWithContext(ctx, bucketName, string(policyJSON)) } -// getBucketSetPolicyResponse calls setBucketAccessPolicy() to set a access policy to a bucket -// and returns the serialized output. -func getBucketSetPolicyResponse(session *models.Principal, params bucketApi.BucketSetPolicyParams) (*models.Bucket, *CodedAPIError) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - - // get updated bucket details and return it - mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - // create a minioClient interface implementation - // defining the client to be used - minioClient := minioClient{client: mClient} - - mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - // create a minioClient interface implementation - // defining the client to be used - adminClient := AdminClient{Client: mAdmin} - bucketName := params.Name - req := params.Body - if err := setBucketAccessPolicy(ctx, minioClient, bucketName, *req.Access, req.Definition); err != nil { - return nil, ErrorWithContext(ctx, err) - } - // set bucket access policy - bucket, err := getBucketInfo(ctx, minioClient, adminClient, bucketName) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return bucket, nil -} - // putBucketTags sets tags for a bucket func getPutBucketTagsResponse(session *models.Principal, params bucketApi.PutBucketTagsParams) *CodedAPIError { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) @@ -642,33 +371,6 @@ func removeBucket(client MinioClient, bucketName string) error { return client.removeBucket(context.Background(), bucketName) } -// getDeleteBucketResponse performs removeBucket() to delete a bucket -func getDeleteBucketResponse(session *models.Principal, params bucketApi.DeleteBucketParams) *CodedAPIError { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - if params.Name == "" { - return ErrorWithContext(ctx, ErrBucketNameNotInRequest) - } - bucketName := params.Name - - mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) - if err != nil { - return ErrorWithContext(ctx, err) - } - // create a minioClient interface implementation - // defining the client to be used - minioClient := minioClient{client: mClient} - if err := removeBucket(minioClient, bucketName); err != nil { - resp := ErrorWithContext(ctx, err) - errResp := minio.ToErrorResponse(err) - if errResp.Code == "NoSuchBucket" { - resp.Code = 404 - } - return resp - } - return nil -} - // getBucketInfo return bucket information including name, policy access, size and creation date func getBucketInfo(ctx context.Context, client MinioClient, adminClient MinioAdmin, bucketName string) (*models.Bucket, error) { var bucketAccess models.BucketAccess @@ -792,45 +494,11 @@ func enableBucketEncryption(ctx context.Context, client MinioClient, bucketName return client.setBucketEncryption(ctx, bucketName, config) } -// enableBucketEncryptionResponse calls enableBucketEncryption() to create new encryption configuration for provided bucket name -func enableBucketEncryptionResponse(session *models.Principal, params bucketApi.EnableBucketEncryptionParams) *CodedAPIError { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) - if err != nil { - return ErrorWithContext(ctx, err) - } - // create a minioClient interface implementation - // defining the client to be used - minioClient := minioClient{client: mClient} - if err := enableBucketEncryption(ctx, minioClient, params.BucketName, *params.Body.EncType, params.Body.KmsKeyID); err != nil { - return ErrorWithContext(ctx, err) - } - return nil -} - // disableBucketEncryption will disable bucket for the provided bucket name func disableBucketEncryption(ctx context.Context, client MinioClient, bucketName string) error { return client.removeBucketEncryption(ctx, bucketName) } -// disableBucketEncryptionResponse calls disableBucketEncryption() -func disableBucketEncryptionResponse(session *models.Principal, params bucketApi.DisableBucketEncryptionParams) *CodedAPIError { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) - if err != nil { - return ErrorWithContext(ctx, err) - } - // create a minioClient interface implementation - // defining the client to be used - minioClient := minioClient{client: mClient} - if err := disableBucketEncryption(ctx, minioClient, params.BucketName); err != nil { - return ErrorWithContext(ctx, err) - } - return nil -} - func getBucketEncryptionInfo(ctx context.Context, client MinioClient, bucketName string) (*models.BucketEncryptionInfo, error) { bucketInfo, err := client.getBucketEncryption(ctx, bucketName) if err != nil { @@ -842,23 +510,6 @@ func getBucketEncryptionInfo(ctx context.Context, client MinioClient, bucketName return &models.BucketEncryptionInfo{Algorithm: bucketInfo.Rules[0].Apply.SSEAlgorithm, KmsMasterKeyID: bucketInfo.Rules[0].Apply.KmsMasterKeyID}, nil } -func getBucketEncryptionInfoResponse(session *models.Principal, params bucketApi.GetBucketEncryptionInfoParams) (*models.BucketEncryptionInfo, *CodedAPIError) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - // create a minioClient interface implementation - // defining the client to be used - minioClient := minioClient{client: mClient} - bucketInfo, err := getBucketEncryptionInfo(ctx, minioClient, params.BucketName) - if err != nil { - return nil, ErrorWithContext(ctx, ErrSSENotConfigured, err) - } - return bucketInfo, nil -} - // setBucketRetentionConfig sets object lock configuration on a bucket func setBucketRetentionConfig(ctx context.Context, client MinioClient, bucketName string, mode models.ObjectRetentionMode, unit models.ObjectRetentionUnit, validity *int32) error { if validity == nil { @@ -889,23 +540,6 @@ func setBucketRetentionConfig(ctx context.Context, client MinioClient, bucketNam return client.setObjectLockConfig(ctx, bucketName, &retentionMode, &retentionValidity, &retentionUnit) } -func getSetBucketRetentionConfigResponse(session *models.Principal, params bucketApi.SetBucketRetentionConfigParams) *CodedAPIError { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) - if err != nil { - return ErrorWithContext(ctx, err) - } - // create a minioClient interface implementation - // defining the client to be used - minioClient := minioClient{client: mClient} - err = setBucketRetentionConfig(ctx, minioClient, params.BucketName, *params.Body.Mode, *params.Body.Unit, params.Body.Validity) - if err != nil { - return ErrorWithContext(ctx, err) - } - return nil -} - func getBucketRetentionConfig(ctx context.Context, client MinioClient, bucketName string) (*models.GetBucketRetentionConfig, error) { m, v, u, err := client.getBucketObjectLockConfig(ctx, bucketName) if err != nil { @@ -961,55 +595,6 @@ func getBucketRetentionConfig(ctx context.Context, client MinioClient, bucketNam return config, nil } -func getBucketRetentionConfigResponse(session *models.Principal, params bucketApi.GetBucketRetentionConfigParams) (*models.GetBucketRetentionConfig, *CodedAPIError) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - bucketName := params.BucketName - mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - - // create a minioClient interface implementation - // defining the client to be used - minioClient := minioClient{client: mClient} - - config, err := getBucketRetentionConfig(ctx, minioClient, bucketName) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return config, nil -} - -func getBucketObjectLockingResponse(session *models.Principal, params bucketApi.GetBucketObjectLockingStatusParams) (*models.BucketObLockingResponse, *CodedAPIError) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - bucketName := params.BucketName - mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) - if err != nil { - return nil, ErrorWithContext(ctx, fmt.Errorf("error creating MinIO Client: %v", err)) - } - // create a minioClient interface implementation - // defining the client to be used - minioClient := minioClient{client: mClient} - - // we will tolerate this call failing - _, _, _, _, err = minioClient.getObjectLockConfig(ctx, bucketName) - if err != nil { - if minio.ToErrorResponse(err).Code == "ObjectLockConfigurationNotFoundError" { - return &models.BucketObLockingResponse{ - ObjectLockingEnabled: false, - }, nil - } - return nil, ErrorWithContext(ctx, err) - } - - // serialize output - return &models.BucketObLockingResponse{ - ObjectLockingEnabled: true, - }, nil -} - func getBucketRewindResponse(session *models.Principal, params bucketApi.GetBucketRewindParams) (*models.RewindResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() diff --git a/api/user_buckets_events.go b/api/user_buckets_events.go deleted file mode 100644 index b1d173f5cc..0000000000 --- a/api/user_buckets_events.go +++ /dev/null @@ -1,252 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 api - -import ( - "context" - "strings" - - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/swag" - "github.com/minio/console/api/operations" - bucketApi "github.com/minio/console/api/operations/bucket" - "github.com/minio/console/models" - "github.com/minio/minio-go/v7/pkg/notification" -) - -func registerBucketEventsHandlers(api *operations.ConsoleAPI) { - // list bucket events - api.BucketListBucketEventsHandler = bucketApi.ListBucketEventsHandlerFunc(func(params bucketApi.ListBucketEventsParams, session *models.Principal) middleware.Responder { - listBucketEventsResponse, err := getListBucketEventsResponse(session, params) - if err != nil { - return bucketApi.NewListBucketEventsDefault(err.Code).WithPayload(err.APIError) - } - return bucketApi.NewListBucketEventsOK().WithPayload(listBucketEventsResponse) - }) - // create bucket event - api.BucketCreateBucketEventHandler = bucketApi.CreateBucketEventHandlerFunc(func(params bucketApi.CreateBucketEventParams, session *models.Principal) middleware.Responder { - if err := getCreateBucketEventsResponse(session, params); err != nil { - return bucketApi.NewCreateBucketEventDefault(err.Code).WithPayload(err.APIError) - } - return bucketApi.NewCreateBucketEventCreated() - }) - // delete bucket event - api.BucketDeleteBucketEventHandler = bucketApi.DeleteBucketEventHandlerFunc(func(params bucketApi.DeleteBucketEventParams, session *models.Principal) middleware.Responder { - if err := getDeleteBucketEventsResponse(session, params); err != nil { - return bucketApi.NewDeleteBucketEventDefault(err.Code).WithPayload(err.APIError) - } - return bucketApi.NewDeleteBucketEventNoContent() - }) -} - -// listBucketEvents fetches a list of all events set for a bucket and serializes them for a proper output -func listBucketEvents(client MinioClient, bucketName string) ([]*models.NotificationConfig, error) { - var configs []*models.NotificationConfig - bn, err := client.getBucketNotification(context.Background(), bucketName) - if err != nil { - return nil, err - } - - // Generate pretty event names from event types - prettyEventNames := func(eventsTypes []notification.EventType) []models.NotificationEventType { - var result []models.NotificationEventType - for _, eventType := range eventsTypes { - var eventTypePretty models.NotificationEventType - switch eventType { - case notification.ObjectAccessedAll: - eventTypePretty = models.NotificationEventTypeGet - case notification.ObjectCreatedAll: - eventTypePretty = models.NotificationEventTypePut - case notification.ObjectRemovedAll: - eventTypePretty = models.NotificationEventTypeDelete - case notification.ObjectReplicationAll: - eventTypePretty = models.NotificationEventTypeReplica - case notification.ObjectTransitionAll: - eventTypePretty = models.NotificationEventTypeIlm - case notification.ObjectScannerManyVersions, notification.ObjectScannerBigPrefix: - eventTypePretty = models.NotificationEventTypeScanner - default: - continue - } - - result = append(result, eventTypePretty) - } - return result - } - // part of implementation taken from minio/mc - // s3Client.ListNotificationConfigs()... to serialize configurations - getFilters := func(config notification.Config) (prefix, suffix string) { - if config.Filter == nil { - return - } - for _, filter := range config.Filter.S3Key.FilterRules { - if strings.ToLower(filter.Name) == "prefix" { - prefix = filter.Value - } - if strings.ToLower(filter.Name) == "suffix" { - suffix = filter.Value - } - - } - return prefix, suffix - } - for _, embed := range bn.TopicConfigs { - prefix, suffix := getFilters(embed.Config) - configs = append(configs, &models.NotificationConfig{ - ID: embed.ID, - Arn: swag.String(embed.Topic), - Events: prettyEventNames(embed.Events), - Prefix: prefix, - Suffix: suffix, - }) - } - for _, embed := range bn.QueueConfigs { - prefix, suffix := getFilters(embed.Config) - configs = append(configs, &models.NotificationConfig{ - ID: embed.ID, - Arn: swag.String(embed.Queue), - Events: prettyEventNames(embed.Events), - Prefix: prefix, - Suffix: suffix, - }) - } - for _, embed := range bn.LambdaConfigs { - prefix, suffix := getFilters(embed.Config) - configs = append(configs, &models.NotificationConfig{ - ID: embed.ID, - Arn: swag.String(embed.Lambda), - Events: prettyEventNames(embed.Events), - Prefix: prefix, - Suffix: suffix, - }) - } - return configs, nil -} - -// getListBucketsResponse performs listBucketEvents() and serializes it to the handler's output -func getListBucketEventsResponse(session *models.Principal, params bucketApi.ListBucketEventsParams) (*models.ListBucketEventsResponse, *CodedAPIError) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - // create a minioClient interface implementation - // defining the client to be used - minioClient := minioClient{client: mClient} - - bucketEvents, err := listBucketEvents(minioClient, params.BucketName) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - // serialize output - listBucketsResponse := &models.ListBucketEventsResponse{ - Events: bucketEvents, - Total: int64(len(bucketEvents)), - } - return listBucketsResponse, nil -} - -// createBucketEvent calls mc AddNotificationConfig() to create a bucket nofication -// -// If notificationEvents is empty, by default will set [get, put, delete], else the provided -// ones will be set. -// this function follows same behavior as minio/mc for adding a bucket event -func createBucketEvent(ctx context.Context, client MCClient, arn string, notificationEvents []models.NotificationEventType, prefix, suffix string, ignoreExisting bool) error { - var events []string - if len(notificationEvents) == 0 { - // default event values are [get, put, delete] - events = []string{ - string(models.NotificationEventTypeGet), - string(models.NotificationEventTypePut), - string(models.NotificationEventTypeDelete), - } - } else { - // else use defined events in request - // cast type models.NotificationEventType to string - for _, e := range notificationEvents { - events = append(events, string(e)) - } - } - - perr := client.addNotificationConfig(ctx, arn, events, prefix, suffix, ignoreExisting) - if perr != nil { - return perr.Cause - } - return nil -} - -// getCreateBucketEventsResponse calls createBucketEvent to add a bucket event notification -func getCreateBucketEventsResponse(session *models.Principal, params bucketApi.CreateBucketEventParams) *CodedAPIError { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - bucketName := params.BucketName - eventReq := params.Body - s3Client, err := newS3BucketClient(session, bucketName, "", getClientIP(params.HTTPRequest)) - if err != nil { - return ErrorWithContext(ctx, err) - } - // create a mc S3Client interface implementation - // defining the client to be used - mcClient := mcClient{client: s3Client} - err = createBucketEvent(ctx, mcClient, *eventReq.Configuration.Arn, eventReq.Configuration.Events, eventReq.Configuration.Prefix, eventReq.Configuration.Suffix, eventReq.IgnoreExisting) - if err != nil { - return ErrorWithContext(ctx, err) - } - return nil -} - -// deleteBucketEventNotification calls S3Client.RemoveNotificationConfig to remove a bucket event notification -func deleteBucketEventNotification(ctx context.Context, client MCClient, arn string, events []models.NotificationEventType, prefix, suffix *string) error { - eventSingleString := joinNotificationEvents(events) - perr := client.removeNotificationConfig(ctx, arn, eventSingleString, *prefix, *suffix) - if perr != nil { - return perr.Cause - } - return nil -} - -func joinNotificationEvents(events []models.NotificationEventType) string { - var eventsArn []string - for _, e := range events { - eventsArn = append(eventsArn, string(e)) - } - return strings.Join(eventsArn, ",") -} - -// getDeleteBucketEventsResponse calls deleteBucketEventNotification() to delete a bucket event notification -func getDeleteBucketEventsResponse(session *models.Principal, params bucketApi.DeleteBucketEventParams) *CodedAPIError { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - bucketName := params.BucketName - arn := params.Arn - events := params.Body.Events - prefix := params.Body.Prefix - suffix := params.Body.Suffix - s3Client, err := newS3BucketClient(session, bucketName, "", getClientIP(params.HTTPRequest)) - if err != nil { - return ErrorWithContext(ctx, err) - } - // create a mc S3Client interface implementation - // defining the client to be used - mcClient := mcClient{client: s3Client} - err = deleteBucketEventNotification(ctx, mcClient, arn, events, prefix, suffix) - if err != nil { - return ErrorWithContext(ctx, err) - } - return nil -} diff --git a/api/user_buckets_events_test.go b/api/user_buckets_events_test.go deleted file mode 100644 index 07f042a230..0000000000 --- a/api/user_buckets_events_test.go +++ /dev/null @@ -1,388 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 api - -import ( - "context" - "errors" - "fmt" - "testing" - - "github.com/go-openapi/swag" - "github.com/minio/console/models" - "github.com/minio/mc/pkg/probe" - "github.com/minio/minio-go/v7/pkg/notification" - "github.com/stretchr/testify/assert" -) - -// assigning mock at runtime instead of compile time -var minioGetBucketNotificationMock func(ctx context.Context, bucketName string) (bucketNotification notification.Configuration, err error) - -// mock function of getBucketNotification() -func (mc minioClientMock) getBucketNotification(ctx context.Context, bucketName string) (bucketNotification notification.Configuration, err error) { - return minioGetBucketNotificationMock(ctx, bucketName) -} - -// // Mock mc S3Client functions //// -var ( - mcAddNotificationConfigMock func(ctx context.Context, arn string, events []string, prefix, suffix string, ignoreExisting bool) *probe.Error - mcRemoveNotificationConfigMock func(ctx context.Context, arn string, event string, prefix string, suffix string) *probe.Error -) - -// Define a mock struct of mc S3Client interface implementation -type s3ClientMock struct{} - -// implements mc.S3Client.AddNotificationConfigMock() -func (c s3ClientMock) addNotificationConfig(ctx context.Context, arn string, events []string, prefix, suffix string, ignoreExisting bool) *probe.Error { - return mcAddNotificationConfigMock(ctx, arn, events, prefix, suffix, ignoreExisting) -} - -// implements mc.S3Client.DeleteBucketEventNotification() -func (c s3ClientMock) removeNotificationConfig(ctx context.Context, arn string, event string, prefix string, suffix string) *probe.Error { - return mcRemoveNotificationConfigMock(ctx, arn, event, prefix, suffix) -} - -func TestAddBucketNotification(t *testing.T) { - assert := assert.New(t) - // mock minIO client - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - client := s3ClientMock{} - function := "createBucketEvent()" - // Test-1: createBucketEvent() set an event with empty parameters and events, should set default values with no error - testArn := "arn:minio:sqs::test:postgresql" - testNotificationEvents := []models.NotificationEventType{} - testPrefix := "" - testSuffix := "" - testIgnoreExisting := false - mcAddNotificationConfigMock = func(_ context.Context, _ string, _ []string, _, _ string, _ bool) *probe.Error { - return nil - } - if err := createBucketEvent(ctx, client, testArn, testNotificationEvents, testPrefix, testSuffix, testIgnoreExisting); err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - - // Test-2: createBucketEvent() with different even types in list shouls create event with no errors - testArn = "arn:minio:sqs::test:postgresql" - testNotificationEvents = []models.NotificationEventType{ - models.NotificationEventTypePut, - models.NotificationEventTypeGet, - } - testPrefix = "photos/" - testSuffix = ".jpg" - testIgnoreExisting = true - mcAddNotificationConfigMock = func(_ context.Context, _ string, _ []string, _, _ string, _ bool) *probe.Error { - return nil - } - if err := createBucketEvent(ctx, client, testArn, testNotificationEvents, testPrefix, testSuffix, testIgnoreExisting); err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - - // Test-3 createBucketEvent() S3Client.AddNotificationConfig returns an error and is handled correctly - mcAddNotificationConfigMock = func(_ context.Context, _ string, _ []string, _, _ string, _ bool) *probe.Error { - return probe.NewError(errors.New("error")) - } - if err := createBucketEvent(ctx, client, testArn, testNotificationEvents, testPrefix, testSuffix, testIgnoreExisting); assert.Error(err) { - assert.Equal("error", err.Error()) - } -} - -func TestDeleteBucketNotification(t *testing.T) { - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - assert := assert.New(t) - // mock minIO client - client := s3ClientMock{} - function := "deleteBucketEventNotification()" - // Test-1: deleteBucketEventNotification() delete a bucket event notification - testArn := "arn:minio:sqs::test:postgresql" - // arn string, events []models.NotificationEventType, prefix, suffix *string - events := []models.NotificationEventType{ - models.NotificationEventTypeGet, - models.NotificationEventTypeDelete, - models.NotificationEventTypePut, - } - prefix := "/photos" - suffix := ".jpg" - mcRemoveNotificationConfigMock = func(_ context.Context, _ string, _ string, _ string, _ string) *probe.Error { - return nil - } - if err := deleteBucketEventNotification(ctx, client, testArn, events, swag.String(prefix), swag.String(suffix)); err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - - // Test-2 deleteBucketEventNotification() S3Client.DeleteBucketEventNotification returns an error and is handled correctly - mcRemoveNotificationConfigMock = func(_ context.Context, _ string, _ string, _ string, _ string) *probe.Error { - return probe.NewError(errors.New("error")) - } - if err := deleteBucketEventNotification(ctx, client, testArn, events, swag.String(prefix), swag.String(suffix)); assert.Error(err) { - assert.Equal("error", err.Error()) - } - - // Test-3 joinNotificationEvents() verify that it returns the events as a single string separated by commas - function = "joinNotificationEvents()" - eventString := joinNotificationEvents(events) - assert.Equal("get,delete,put", eventString, fmt.Sprintf("Failed on %s:", function)) -} - -func TestListBucketEvents(t *testing.T) { - assert := assert.New(t) - // mock minIO client - minClient := minioClientMock{} - function := "listBucketEvents()" - - ////// Test-1 : listBucketEvents() get list of events for a particular bucket only one config - // mock bucketNotification response from MinIO - mockBucketN := notification.Configuration{ - LambdaConfigs: []notification.LambdaConfig{}, - TopicConfigs: []notification.TopicConfig{}, - QueueConfigs: []notification.QueueConfig{ - { - Queue: "arn:minio:sqs::test:postgresql", - Config: notification.Config{ - ID: "", - Events: []notification.EventType{ - notification.ObjectAccessedAll, - notification.ObjectCreatedAll, - notification.ObjectRemovedAll, - }, - Filter: ¬ification.Filter{ - S3Key: notification.S3Key{ - FilterRules: []notification.FilterRule{ - { - Name: "suffix", - Value: ".jpg", - }, - { - Name: "prefix", - Value: "file/", - }, - }, - }, - }, - }, - }, - }, - } - expectedOutput := []*models.NotificationConfig{ - { - Arn: swag.String("arn:minio:sqs::test:postgresql"), - ID: "", - Prefix: "file/", - Suffix: ".jpg", - Events: []models.NotificationEventType{ - models.NotificationEventTypeGet, - models.NotificationEventTypePut, - models.NotificationEventTypeDelete, - }, - }, - } - minioGetBucketNotificationMock = func(_ context.Context, _ string) (bucketNotification notification.Configuration, err error) { - return mockBucketN, nil - } - eventConfigs, err := listBucketEvents(minClient, "bucket") - if err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - // verify length of buckets is correct - assert.Equal(len(expectedOutput), len(eventConfigs), fmt.Sprintf("Failed on %s: length of lists is not the same", function)) - for i, conf := range eventConfigs { - assert.Equal(expectedOutput[i].Arn, conf.Arn) - assert.Equal(expectedOutput[i].ID, conf.ID) - assert.Equal(expectedOutput[i].Suffix, conf.Suffix) - assert.Equal(expectedOutput[i].Prefix, conf.Prefix) - assert.Equal(len(expectedOutput[i].Events), len(conf.Events), fmt.Sprintf("Failed on %s: length of lists is not the same", function)) - for j, event := range conf.Events { - assert.Equal(expectedOutput[i].Events[j], event) - } - } - - ////// Test-2 : listBucketEvents() get list of events no filters - mockBucketN = notification.Configuration{ - LambdaConfigs: []notification.LambdaConfig{}, - TopicConfigs: []notification.TopicConfig{}, - QueueConfigs: []notification.QueueConfig{ - { - Queue: "arn:minio:sqs::test:postgresql", - Config: notification.Config{ - ID: "", - Events: []notification.EventType{ - notification.ObjectRemovedAll, - }, - }, - }, - }, - } - expectedOutput = []*models.NotificationConfig{ - { - Arn: swag.String("arn:minio:sqs::test:postgresql"), - ID: "", - Prefix: "", - Suffix: "", - Events: []models.NotificationEventType{ - models.NotificationEventTypeDelete, - }, - }, - } - minioGetBucketNotificationMock = func(_ context.Context, _ string) (bucketNotification notification.Configuration, err error) { - return mockBucketN, nil - } - eventConfigs, err = listBucketEvents(minClient, "bucket") - if err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - // verify length of buckets is correct - assert.Equal(len(expectedOutput), len(eventConfigs), fmt.Sprintf("Failed on %s: length of lists is not the same", function)) - for i, conf := range eventConfigs { - assert.Equal(expectedOutput[i].Arn, conf.Arn) - assert.Equal(expectedOutput[i].ID, conf.ID) - assert.Equal(expectedOutput[i].Suffix, conf.Suffix) - assert.Equal(expectedOutput[i].Prefix, conf.Prefix) - assert.Equal(len(expectedOutput[i].Events), len(conf.Events), fmt.Sprintf("Failed on %s: length of lists is not the same", function)) - for j, event := range conf.Events { - assert.Equal(expectedOutput[i].Events[j], event) - } - } - - ////// Test-3 : listBucketEvents() get list of events - mockBucketN = notification.Configuration{ - LambdaConfigs: []notification.LambdaConfig{ - { - Lambda: "lambda", - Config: notification.Config{ - ID: "", - Events: []notification.EventType{ - notification.ObjectRemovedAll, - }, - Filter: ¬ification.Filter{ - S3Key: notification.S3Key{ - FilterRules: []notification.FilterRule{ - { - Name: "suffix", - Value: ".png", - }, - { - Name: "prefix", - Value: "lambda/", - }, - }, - }, - }, - }, - }, - }, - TopicConfigs: []notification.TopicConfig{ - { - Topic: "topic", - Config: notification.Config{ - ID: "", - Events: []notification.EventType{ - notification.ObjectRemovedAll, - }, - Filter: ¬ification.Filter{ - S3Key: notification.S3Key{ - FilterRules: []notification.FilterRule{ - { - Name: "suffix", - Value: ".gif", - }, - { - Name: "prefix", - Value: "topic/", - }, - }, - }, - }, - }, - }, - }, - QueueConfigs: []notification.QueueConfig{ - { - Queue: "arn:minio:sqs::test:postgresql", - Config: notification.Config{ - ID: "", - Events: []notification.EventType{ - notification.ObjectRemovedAll, - }, - Filter: ¬ification.Filter{ - S3Key: notification.S3Key{ - FilterRules: []notification.FilterRule{}, - }, - }, - }, - }, - }, - } - // order matters in output: topic,queue then lambda are given respectively - expectedOutput = []*models.NotificationConfig{ - { - Arn: swag.String("topic"), - ID: "", - Prefix: "topic/", - Suffix: ".gif", - Events: []models.NotificationEventType{ - models.NotificationEventTypeDelete, - }, - }, - { - Arn: swag.String("arn:minio:sqs::test:postgresql"), - ID: "", - Prefix: "", - Suffix: "", - Events: []models.NotificationEventType{ - models.NotificationEventTypeDelete, - }, - }, - { - Arn: swag.String("lambda"), - ID: "", - Prefix: "lambda/", - Suffix: ".png", - Events: []models.NotificationEventType{ - models.NotificationEventTypeDelete, - }, - }, - } - minioGetBucketNotificationMock = func(_ context.Context, _ string) (bucketNotification notification.Configuration, err error) { - return mockBucketN, nil - } - eventConfigs, err = listBucketEvents(minClient, "bucket") - if err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - // verify length of buckets is correct - assert.Equal(len(expectedOutput), len(eventConfigs), fmt.Sprintf("Failed on %s: length of lists is not the same", function)) - for i, conf := range eventConfigs { - assert.Equal(expectedOutput[i].Arn, conf.Arn) - assert.Equal(expectedOutput[i].ID, conf.ID) - assert.Equal(expectedOutput[i].Suffix, conf.Suffix) - assert.Equal(expectedOutput[i].Prefix, conf.Prefix) - assert.Equal(len(expectedOutput[i].Events), len(conf.Events), fmt.Sprintf("Failed on %s: length of lists is not the same", function)) - for j, event := range conf.Events { - assert.Equal(expectedOutput[i].Events[j], event) - } - } - - ////// Test-2 : listBucketEvents() Returns error and see that the error is handled correctly and returned - minioGetBucketNotificationMock = func(_ context.Context, _ string) (bucketNotification notification.Configuration, err error) { - return notification.Configuration{}, errors.New("error") - } - _, err = listBucketEvents(minClient, "bucket") - if assert.Error(err) { - assert.Equal("error", err.Error()) - } -} diff --git a/api/user_buckets_test.go b/api/user_buckets_test.go index d0c2f5f532..9a3684c324 100644 --- a/api/user_buckets_test.go +++ b/api/user_buckets_test.go @@ -25,6 +25,8 @@ import ( "testing" "time" + "github.com/minio/minio-go/v7/pkg/notification" + "github.com/minio/console/pkg/auth/token" "github.com/minio/console/pkg/utils" @@ -38,6 +40,31 @@ import ( "github.com/stretchr/testify/assert" ) +// // Mock mc S3Client functions //// +var ( + mcAddNotificationConfigMock func(ctx context.Context, arn string, events []string, prefix, suffix string, ignoreExisting bool) *probe.Error + mcRemoveNotificationConfigMock func(ctx context.Context, arn string, event string, prefix string, suffix string) *probe.Error + minioGetBucketNotificationMock func(ctx context.Context, bucketName string) (bucketNotification notification.Configuration, err error) +) + +// Define a mock struct of mc S3Client interface implementation +type s3ClientMock struct{} + +// implements mc.S3Client.AddNotificationConfigMock() +func (c s3ClientMock) addNotificationConfig(ctx context.Context, arn string, events []string, prefix, suffix string, ignoreExisting bool) *probe.Error { + return mcAddNotificationConfigMock(ctx, arn, events, prefix, suffix, ignoreExisting) +} + +// implements mc.S3Client.DeleteBucketEventNotification() +func (c s3ClientMock) removeNotificationConfig(ctx context.Context, arn string, event string, prefix string, suffix string) *probe.Error { + return mcRemoveNotificationConfigMock(ctx, arn, event, prefix, suffix) +} + +// mock function of getBucketNotification() +func (mc minioClientMock) getBucketNotification(ctx context.Context, bucketName string) (bucketNotification notification.Configuration, err error) { + return minioGetBucketNotificationMock(ctx, bucketName) +} + // assigning mock at runtime instead of compile time var minioListBucketsWithContextMock func(ctx context.Context) ([]minio.BucketInfo, error) @@ -161,31 +188,6 @@ func TestMakeBucket(t *testing.T) { } } -func TestDeleteBucket(t *testing.T) { - assert := assert.New(t) - // mock minIO client - minClient := minioClientMock{} - function := "removeBucket()" - - // Test-1: removeBucket() delete a bucket - // mock function response from removeBucket(bucketName) - minioRemoveBucketMock = func(_ string) error { - return nil - } - if err := removeBucket(minClient, "bucktest1"); err != nil { - t.Errorf("Failed on %s:, errors occurred: %s", function, err.Error()) - } - - // Test-2: removeBucket() make sure errors are handled correctly when errors on DeleteBucket() - // mock function response from removeBucket(bucketName) - minioRemoveBucketMock = func(_ string) error { - return errors.New("error") - } - if err := removeBucket(minClient, "bucktest1"); assert.Error(err) { - assert.Equal("error", err.Error()) - } -} - func TestBucketInfo(t *testing.T) { assert := assert.New(t) // mock minIO client diff --git a/api/user_log_search.go b/api/user_log_search.go deleted file mode 100644 index 783292cce8..0000000000 --- a/api/user_log_search.go +++ /dev/null @@ -1,120 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 api - -import ( - "context" - "encoding/json" - "fmt" - "net/http" - - "github.com/go-openapi/runtime/middleware" - "github.com/minio/console/api/operations" - logApi "github.com/minio/console/api/operations/logging" - "github.com/minio/console/models" - iampolicy "github.com/minio/pkg/v3/policy" -) - -func registerLogSearchHandlers(api *operations.ConsoleAPI) { - // log search - api.LoggingLogSearchHandler = logApi.LogSearchHandlerFunc(func(params logApi.LogSearchParams, session *models.Principal) middleware.Responder { - searchResp, err := getLogSearchResponse(session, params) - if err != nil { - return logApi.NewLogSearchDefault(err.Code).WithPayload(err.APIError) - } - return logApi.NewLogSearchOK().WithPayload(searchResp) - }) -} - -// getLogSearchResponse performs a query to Log Search if Enabled -func getLogSearchResponse(session *models.Principal, params logApi.LogSearchParams) (*models.LogSearchResponse, *CodedAPIError) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - sessionResp, err := getSessionResponse(ctx, session) - if err != nil { - return nil, err - } - var allowedToQueryLogSearchAPI bool - if permissions, ok := sessionResp.Permissions[ConsoleResourceName]; ok { - for _, permission := range permissions { - if permission == iampolicy.HealthInfoAdminAction { - allowedToQueryLogSearchAPI = true - break - } - } - } - - if !allowedToQueryLogSearchAPI { - return nil, &CodedAPIError{ - Code: 403, - APIError: &models.APIError{ - Message: "Forbidden", - DetailedMessage: "The Log Search API not available.", - }, - } - } - - token := getLogSearchAPIToken() - endpoint := fmt.Sprintf("%s/api/query?token=%s&q=reqinfo", getLogSearchURL(), token) - for _, fp := range params.Fp { - endpoint = fmt.Sprintf("%s&fp=%s", endpoint, fp) - } - - endpoint = fmt.Sprintf("%s&%s=ok", endpoint, *params.Order) - - // timeStart - if params.TimeStart != nil && *params.TimeStart != "" { - endpoint = fmt.Sprintf("%s&timeStart=%s", endpoint, *params.TimeStart) - } - - // timeEnd - if params.TimeEnd != nil && *params.TimeEnd != "" { - endpoint = fmt.Sprintf("%s&timeEnd=%s", endpoint, *params.TimeEnd) - } - - // page size and page number - endpoint = fmt.Sprintf("%s&pageSize=%d", endpoint, *params.PageSize) - endpoint = fmt.Sprintf("%s&pageNo=%d", endpoint, *params.PageNo) - - response, errLogSearch := logSearch(endpoint, getClientIP(params.HTTPRequest)) - if errLogSearch != nil { - return nil, ErrorWithContext(ctx, errLogSearch) - } - return response, nil -} - -func logSearch(endpoint string, clientIP string) (*models.LogSearchResponse, error) { - httpClnt := GetConsoleHTTPClient(clientIP) - resp, err := httpClnt.Get(endpoint) - if err != nil { - return nil, fmt.Errorf("the Log Search API cannot be reached. Please review the URL and try again %v", err) - } - defer resp.Body.Close() - - if resp.StatusCode != 200 { - return nil, fmt.Errorf("error retrieving logs: %s", http.StatusText(resp.StatusCode)) - } - - var results []map[string]interface{} - if err = json.NewDecoder(resp.Body).Decode(&results); err != nil { - return nil, err - } - - return &models.LogSearchResponse{ - Results: results, - }, nil -} diff --git a/api/user_log_search_test.go b/api/user_log_search_test.go deleted file mode 100644 index c78d2d2085..0000000000 --- a/api/user_log_search_test.go +++ /dev/null @@ -1,138 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 api - -import ( - "encoding/json" - "fmt" - "net/http" - "net/http/httptest" - "reflect" - "testing" - - "github.com/minio/console/models" -) - -func TestLogSearch(t *testing.T) { - responseItem := []map[string]interface{}{ - { - "time": "2006-01-02T15:04:05Z", - "api_time": "GetConfigKV", - "bucket": "", - "object": "", - "time_to_response_ns": float64(452546530), - "remote_host": "10.116.1.94", - "request_id": "16595A4E30CCFE79", - "user_agent": "MinIO (linux; amd64) madmin-go/0.0.1", - "response_status": "OK", - "response_status_code": float64(200), - "request_content_length": nil, - "response_content_length": nil, - }, { - "time": "2006-01-02T15:04:05Z", - "api_time": "AssumeRole", - "bucket": "", - "object": "", - "time_to_response_ns": float64(307423794), - "remote_host": "127.0.0.1", - "request_id": "16595A4DA906FBA9", - "user_agent": "Go-http-client/1.1", - "response_status": "OK", - "response_status_code": float64(200), - "request_content_length": nil, - "response_content_length": nil, - }, - } - - type args struct { - apiResponse string - apiResponseCode int - } - - response, _ := json.Marshal(responseItem) - - successfulResponse := &models.LogSearchResponse{ - Results: responseItem, - } - - tests := []struct { - name string - args args - expectedResponse *models.LogSearchResponse - wantErr bool - }{ - { - name: "200 Success response", - args: args{ - apiResponse: string(response), - apiResponseCode: 200, - }, - expectedResponse: successfulResponse, - wantErr: false, - }, - { - name: "500 unsuccessful response", - args: args{ - apiResponse: "Some random error", - apiResponseCode: 500, - }, - expectedResponse: nil, - wantErr: true, - }, - } - - for _, tt := range tests { - tt := tt - t.Run(tt.name, func(_ *testing.T) { - testRequest := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { - w.WriteHeader(tt.args.apiResponseCode) - fmt.Fprintln(w, tt.args.apiResponse) - })) - defer testRequest.Close() - - resp, err := logSearch(testRequest.URL, "127.0.0.1") - - if (err != nil) != tt.wantErr { - t.Errorf("logSearch() error = %v, wantErr %v", err, tt.wantErr) - } - if !reflect.DeepEqual(resp, tt.expectedResponse) { - t.Errorf("\ngot: %d \nwant: %d", resp, tt.expectedResponse) - } - // if tt.wantErr { - // assert.Equal(tt.expectedError.Code, err.Code, fmt.Sprintf("logSearch() error code: `%v`, wantErr: `%v`", err.Code, tt.expectedError)) - // assert.Equal(tt.expectedError.Message, err.Message, fmt.Sprintf("logSearch() error message: `%v`, wantErr: `%v`", err.Message, tt.expectedError)) - // } else { - // assert.Nil(err, fmt.Sprintf("logSearch() error: %v, wantErr: %v", err, tt.expectedError)) - // buf1, err1 := tt.expectedResponse.MarshalBinary() - // buf2, err2 := resp.MarshalBinary() - // if err1 != err2 { - // t.Errorf("logSearch() resp: %v, expectedResponse: %v", resp, tt.expectedResponse) - // return - // } - // h := sha256.New() - // h.Write(buf1) - // checkSum1 := fmt.Sprintf("%x\n", h.Sum(nil)) - // h.Reset() - // h.Write(buf2) - // checkSum2 := fmt.Sprintf("%x\n", h.Sum(nil)) - // if checkSum1 != checkSum2 { - // t.Errorf("logSearch() resp: %v, expectedResponse: %v", resp, tt.expectedResponse) - // } - // } - }) - } -} diff --git a/api/user_objects.go b/api/user_objects.go index 32eac7064f..ffd3ff389c 100644 --- a/api/user_objects.go +++ b/api/user_objects.go @@ -131,27 +131,6 @@ func registerObjectsHandlers(api *operations.ConsoleAPI) { } return objectApi.NewShareObjectOK().WithPayload(*resp) }) - // set object legalhold status - api.ObjectPutObjectLegalHoldHandler = objectApi.PutObjectLegalHoldHandlerFunc(func(params objectApi.PutObjectLegalHoldParams, session *models.Principal) middleware.Responder { - if err := getSetObjectLegalHoldResponse(session, params); err != nil { - return objectApi.NewPutObjectLegalHoldDefault(err.Code).WithPayload(err.APIError) - } - return objectApi.NewPutObjectLegalHoldOK() - }) - // set object retention - api.ObjectPutObjectRetentionHandler = objectApi.PutObjectRetentionHandlerFunc(func(params objectApi.PutObjectRetentionParams, session *models.Principal) middleware.Responder { - if err := getSetObjectRetentionResponse(session, params); err != nil { - return objectApi.NewPutObjectRetentionDefault(err.Code).WithPayload(err.APIError) - } - return objectApi.NewPutObjectRetentionOK() - }) - // delete object retention - api.ObjectDeleteObjectRetentionHandler = objectApi.DeleteObjectRetentionHandlerFunc(func(params objectApi.DeleteObjectRetentionParams, session *models.Principal) middleware.Responder { - if err := deleteObjectRetentionResponse(session, params); err != nil { - return objectApi.NewDeleteObjectRetentionDefault(err.Code).WithPayload(err.APIError) - } - return objectApi.NewDeleteObjectRetentionOK() - }) // set tags in object api.ObjectPutObjectTagsHandler = objectApi.PutObjectTagsHandlerFunc(func(params objectApi.PutObjectTagsParams, session *models.Principal) middleware.Responder { if err := getPutObjectTagsResponse(session, params); err != nil { @@ -1053,22 +1032,6 @@ func getRequestURLWithScheme(r *http.Request) string { return fmt.Sprintf("%s://%s", scheme, r.Host) } -func getSetObjectLegalHoldResponse(session *models.Principal, params objectApi.PutObjectLegalHoldParams) *CodedAPIError { - ctx := params.HTTPRequest.Context() - mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) - if err != nil { - return ErrorWithContext(ctx, err) - } - // create a minioClient interface implementation - // defining the client to be used - minioClient := minioClient{client: mClient} - err = setObjectLegalHold(ctx, minioClient, params.BucketName, params.Prefix, params.VersionID, *params.Body.Status) - if err != nil { - return ErrorWithContext(ctx, err) - } - return nil -} - func setObjectLegalHold(ctx context.Context, client MinioClient, bucketName, prefix, versionID string, status models.ObjectLegalHoldStatus) error { var lstatus minio.LegalHoldStatus if status == models.ObjectLegalHoldStatusEnabled { @@ -1079,22 +1042,6 @@ func setObjectLegalHold(ctx context.Context, client MinioClient, bucketName, pre return client.putObjectLegalHold(ctx, bucketName, prefix, minio.PutObjectLegalHoldOptions{VersionID: versionID, Status: &lstatus}) } -func getSetObjectRetentionResponse(session *models.Principal, params objectApi.PutObjectRetentionParams) *CodedAPIError { - ctx := params.HTTPRequest.Context() - mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) - if err != nil { - return ErrorWithContext(ctx, err) - } - // create a minioClient interface implementation - // defining the client to be used - minioClient := minioClient{client: mClient} - err = setObjectRetention(ctx, minioClient, params.BucketName, params.VersionID, params.Prefix, params.Body) - if err != nil { - return ErrorWithContext(ctx, err) - } - return nil -} - func setObjectRetention(ctx context.Context, client MinioClient, bucketName, versionID, prefix string, retentionOps *models.PutObjectRetentionRequest) error { if retentionOps == nil { return errors.New("object retention options can't be nil") @@ -1122,22 +1069,6 @@ func setObjectRetention(ctx context.Context, client MinioClient, bucketName, ver return client.putObjectRetention(ctx, bucketName, prefix, opts) } -func deleteObjectRetentionResponse(session *models.Principal, params objectApi.DeleteObjectRetentionParams) *CodedAPIError { - ctx := params.HTTPRequest.Context() - mClient, err := newMinioClient(session, getClientIP(params.HTTPRequest)) - if err != nil { - return ErrorWithContext(ctx, err) - } - // create a minioClient interface implementation - // defining the client to be used - minioClient := minioClient{client: mClient} - err = deleteObjectRetention(ctx, minioClient, params.BucketName, params.Prefix, params.VersionID) - if err != nil { - return ErrorWithContext(ctx, err) - } - return nil -} - func deleteObjectRetention(ctx context.Context, client MinioClient, bucketName, prefix, versionID string) error { opts := minio.PutObjectRetentionOptions{ GovernanceBypass: true, diff --git a/integration/access_rules_test.go b/integration/access_rules_test.go deleted file mode 100644 index 4d9565ed67..0000000000 --- a/integration/access_rules_test.go +++ /dev/null @@ -1,216 +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 . - -package integration - -import ( - "bytes" - "encoding/json" - "fmt" - "log" - "net/http" - "testing" - "time" - - "github.com/stretchr/testify/assert" -) - -func Test_AddAccessRuleAPI(t *testing.T) { - assert := assert.New(t) - - AddBucket("testaccessruleadd", false, nil, nil, nil) - - type args struct { - bucket string - prefix string - access string - } - tests := []struct { - name string - args args - expectedStatus int - expectedError error - }{ - { - name: "Create Access Rule - Valid", - args: args{ - bucket: "testaccessruleadd", - prefix: "/test/", - access: "readonly", - }, - expectedStatus: 200, - expectedError: nil, - }, - { - name: "Add Access Rule - Invalid", - args: args{ - bucket: "testaccessruleadd", - prefix: "/test/", - access: "readonl", - }, - expectedStatus: 500, - expectedError: nil, - }, - { - name: "Add Access Rule - Invalid Bucket", - args: args{ - bucket: "fakebucket", - prefix: "/test/", - access: "readonl", - }, - expectedStatus: 404, - expectedError: nil, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - client := &http.Client{ - Timeout: 3 * time.Second, - } - - requestDataPolicy := map[string]interface{}{} - requestDataPolicy["prefix"] = tt.args.prefix - requestDataPolicy["access"] = tt.args.access - - requestDataJSON, _ := json.Marshal(requestDataPolicy) - requestDataBody := bytes.NewReader(requestDataJSON) - request, err := http.NewRequest( - "PUT", fmt.Sprintf("http://localhost:9090/api/v1/bucket/%s/access-rules", tt.args.bucket), requestDataBody) - if err != nil { - log.Println(err) - return - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - response, err := client.Do(request) - if err != nil { - log.Println(err) - return - } - if response != nil { - assert.Equal(tt.expectedStatus, response.StatusCode, "Status Code is incorrect") - } - }) - } -} - -func Test_GetAccessRulesAPI(t *testing.T) { - assert := assert.New(t) - - AddBucket("testaccessruleget", false, nil, nil, nil) - - type args struct { - bucket string - } - tests := []struct { - name string - args args - expectedStatus int - expectedError error - }{ - { - name: "Get Access Rule - Valid", - args: args{ - bucket: "testaccessruleget", - }, - expectedStatus: 200, - expectedError: nil, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - client := &http.Client{ - Timeout: 3 * time.Second, - } - - request, err := http.NewRequest( - "GET", fmt.Sprintf("http://localhost:9090/api/v1/bucket/%s/access-rules", tt.args.bucket), nil) - if err != nil { - log.Println(err) - return - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - response, err := client.Do(request) - if err != nil { - log.Println(err) - return - } - if response != nil { - assert.Equal(tt.expectedStatus, response.StatusCode, "Status Code is incorrect") - } - }) - } -} - -func Test_DeleteAccessRuleAPI(t *testing.T) { - assert := assert.New(t) - - AddBucket("testaccessruledelete", false, nil, nil, nil) - - type args struct { - prefix string - access string - } - tests := []struct { - name string - args args - expectedStatus int - expectedError error - }{ - { - name: "Delete Access Rule - Valid", - args: args{ - prefix: "/test/", - }, - expectedStatus: 200, - expectedError: nil, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - client := &http.Client{ - Timeout: 3 * time.Second, - } - - requestDataPolicy := map[string]interface{}{} - requestDataPolicy["prefix"] = tt.args.prefix - requestDataPolicy["access"] = tt.args.access - - requestDataJSON, _ := json.Marshal(requestDataPolicy) - requestDataBody := bytes.NewReader(requestDataJSON) - request, err := http.NewRequest( - "DELETE", "http://localhost:9090/api/v1/bucket/testaccessruledelete/access-rules", requestDataBody) - if err != nil { - log.Println(err) - return - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - response, err := client.Do(request) - if err != nil { - log.Println(err) - return - } - if response != nil { - assert.Equal(tt.expectedStatus, response.StatusCode, "Status Code is incorrect") - } - }) - } -} diff --git a/integration/admin_api_integration_test.go b/integration/admin_api_integration_test.go deleted file mode 100644 index ee0a39e05b..0000000000 --- a/integration/admin_api_integration_test.go +++ /dev/null @@ -1,407 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 . - -// These tests are for AdminAPI Tag based on swagger-console.yml - -package integration - -import ( - "bytes" - "encoding/json" - "fmt" - "io" - "log" - "mime/multipart" - "net/http" - "os" - "path" - "testing" - "time" - - "github.com/minio/console/models" - - "github.com/stretchr/testify/assert" -) - -func RestartService() (*http.Response, error) { - /* - Helper function to restart service - HTTP Verb: POST - URL: /api/v1/service/restart - */ - request, err := http.NewRequest( - "POST", - "http://localhost:9090/api/v1/service/restart", - nil, - ) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - client := &http.Client{ - Timeout: 2000 * time.Second, // increased timeout since restart takes time, more than other APIs. - } - response, err := client.Do(request) - return response, err -} - -func GetNodes() (*http.Response, error) { - /* - Helper function to get nodes - HTTP Verb: GET - URL: /api/v1/nodes - */ - request, err := http.NewRequest( - "GET", - "http://localhost:9090/api/v1/nodes", - nil, - ) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - client := &http.Client{ - Timeout: 2000 * time.Second, // increased timeout since restart takes time, more than other APIs. - } - response, err := client.Do(request) - return response, err -} - -func NotifyPostgres() (*http.Response, error) { - /* - Helper function to add Postgres Notification - HTTP Verb: PUT - URL: api/v1/configs/notify_postgres - Body: - { - "key_values":[ - { - "key":"connection_string", - "value":"user=postgres password=password host=localhost dbname=postgres port=5432 sslmode=disable" - }, - { - "key":"table", - "value":"accountsssss" - }, - { - "key":"format", - "value":"namespace" - }, - { - "key":"queue_limit", - "value":"10000" - }, - { - "key":"comment", - "value":"comment" - } - ] - } - */ - Body := models.SetConfigRequest{ - KeyValues: []*models.ConfigurationKV{ - { - Key: "connection_string", - Value: "user=postgres password=password host=173.18.0.4 dbname=postgres port=5432 sslmode=disable", - }, - { - Key: "table", - Value: "accountsssss", - }, - { - Key: "format", - Value: "namespace", - }, - { - Key: "queue_limit", - Value: "10000", - }, - { - Key: "comment", - Value: "comment", - }, - }, - } - - requestDataJSON, _ := json.Marshal(Body) - requestDataBody := bytes.NewReader(requestDataJSON) - request, err := http.NewRequest( - "PUT", - "http://localhost:9090/api/v1/configs/notify_postgres", - requestDataBody, - ) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - client := &http.Client{ - Timeout: 2 * time.Second, - } - response, err := client.Do(request) - return response, err -} - -func TestNotifyPostgres(t *testing.T) { - // Variables - asserter := assert.New(t) - - // Test - response, err := NotifyPostgres() - finalResponse := inspectHTTPResponse(response) - asserter.Nil(err) - if err != nil { - log.Println(err) - asserter.Fail(finalResponse) - return - } - if response != nil { - asserter.Equal(200, response.StatusCode, finalResponse) - } -} - -func TestRestartService(t *testing.T) { - asserter := assert.New(t) - restartResponse, restartError := RestartService() - asserter.Nil(restartError) - if restartError != nil { - log.Println(restartError) - return - } - addObjRsp := inspectHTTPResponse(restartResponse) - if restartResponse != nil { - asserter.Equal( - 204, - restartResponse.StatusCode, - addObjRsp, - ) - } -} - -func ListPoliciesWithBucket(bucketName string) (*http.Response, error) { - /* - Helper function to List Policies With Given Bucket - HTTP Verb: GET - URL: /bucket-policy/{bucket} - */ - request, err := http.NewRequest( - "GET", "http://localhost:9090/api/v1/bucket-policy/"+bucketName, nil) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - client := &http.Client{ - Timeout: 2 * time.Second, - } - response, err := client.Do(request) - return response, err -} - -func TestListPoliciesWithBucket(t *testing.T) { - // Test Variables - bucketName := "testlistpolicieswithbucket" - asserter := assert.New(t) - - // Test - response, err := ListPoliciesWithBucket(bucketName) - asserter.Nil(err) - if err != nil { - log.Println(err) - return - } - parsedResponse := inspectHTTPResponse(response) - if response != nil { - asserter.Equal( - 200, - response.StatusCode, - parsedResponse, - ) - } -} - -func ListUsersWithAccessToBucket(bucketName string) (*http.Response, error) { - /* - Helper function to List Users With Access to a Given Bucket - HTTP Verb: GET - URL: /bucket-users/{bucket} - */ - request, err := http.NewRequest( - "GET", "http://localhost:9090/api/v1/bucket-users/"+bucketName, nil) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - client := &http.Client{ - Timeout: 2 * time.Second, - } - response, err := client.Do(request) - return response, err -} - -func TestListUsersWithAccessToBucket(t *testing.T) { - // Test Variables - bucketName := "testlistuserswithaccesstobucket1" - asserter := assert.New(t) - - // Test - response, err := ListUsersWithAccessToBucket(bucketName) - asserter.Nil(err) - if err != nil { - log.Println(err) - return - } - parsedResponse := inspectHTTPResponse(response) - if response != nil { - asserter.Equal( - 200, - response.StatusCode, - parsedResponse, - ) - } -} - -func TestGetNodes(t *testing.T) { - asserter := assert.New(t) - getNodesResponse, getNodesError := GetNodes() - asserter.Nil(getNodesError) - if getNodesError != nil { - log.Println(getNodesError) - return - } - addObjRsp := inspectHTTPResponse(getNodesResponse) - if getNodesResponse != nil { - asserter.Equal( - 200, - getNodesResponse.StatusCode, - addObjRsp, - ) - } -} - -func ArnList() (*http.Response, error) { - /* - Helper function to get arn list - HTTP Verb: GET - URL: /api/v1/admin/arns - */ - request, err := http.NewRequest( - "GET", "http://localhost:9090/api/v1/admin/arns", nil) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - client := &http.Client{ - Timeout: 2 * time.Second, - } - response, err := client.Do(request) - return response, err -} - -func TestArnList(t *testing.T) { - asserter := assert.New(t) - resp, err := ArnList() - asserter.Nil(err) - if err != nil { - log.Println(err) - return - } - objRsp := inspectHTTPResponse(resp) - if resp != nil { - asserter.Equal( - 200, - resp.StatusCode, - objRsp, - ) - } -} - -func ExportConfig() (*http.Response, error) { - request, err := http.NewRequest( - "GET", "http://localhost:9090/api/v1/configs/export", nil) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - client := &http.Client{ - Timeout: 2 * time.Second, - } - response, err := client.Do(request) - return response, err -} - -func ImportConfig() (*http.Response, error) { - body := &bytes.Buffer{} - writer := multipart.NewWriter(body) - formFile, _ := writer.CreateFormFile("file", "sample-import-config.txt") - fileDir, _ := os.Getwd() - fileName := "sample-import-config.txt" - filePath := path.Join(fileDir, fileName) - file, _ := os.Open(filePath) - io.Copy(formFile, file) - writer.Close() - request, err := http.NewRequest( - "POST", "http://localhost:9090/api/v1/configs/import", - bytes.NewReader(body.Bytes()), - ) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Set("Content-Type", writer.FormDataContentType()) - - client := &http.Client{ - Timeout: 2 * time.Second, - } - - rsp, _ := client.Do(request) - if rsp.StatusCode != http.StatusOK { - log.Printf("Request failed with response code: %d", rsp.StatusCode) - } - return rsp, err -} - -func TestExportConfig(t *testing.T) { - asserter := assert.New(t) - resp, err := ExportConfig() - asserter.Nil(err) - objRsp := inspectHTTPResponse(resp) - if resp != nil { - asserter.Equal( - 200, - resp.StatusCode, - objRsp, - ) - } -} - -func TestImportConfig(t *testing.T) { - asserter := assert.New(t) - resp, err := ImportConfig() - asserter.Nil(err) - objRsp := inspectHTTPResponse(resp) - if resp != nil { - asserter.Equal( - 200, - resp.StatusCode, - objRsp, - ) - } -} diff --git a/integration/config_test.go b/integration/config_test.go deleted file mode 100644 index 15bd2f780c..0000000000 --- a/integration/config_test.go +++ /dev/null @@ -1,250 +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 . - -package integration - -import ( - "bytes" - "encoding/json" - "fmt" - "log" - "net/http" - "testing" - "time" - - "github.com/stretchr/testify/assert" -) - -func Test_ConfigAPI(t *testing.T) { - assert := assert.New(t) - - tests := []struct { - name string - expectedStatus int - expectedError error - }{ - { - name: "Config - Valid", - expectedStatus: 200, - expectedError: nil, - }, - } - - client := &http.Client{ - Timeout: 3 * time.Second, - } - - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - request, err := http.NewRequest("GET", "http://localhost:9090/api/v1/configs", nil) - if err != nil { - log.Println(err) - return - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - response, err := client.Do(request) - if err != nil { - log.Println(err) - return - } - if response != nil { - assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed") - } - }) - } -} - -func Test_GetConfigAPI(t *testing.T) { - assert := assert.New(t) - - type args struct { - name string - } - tests := []struct { - name string - args args - expectedStatus int - expectedError error - }{ - { - name: "Get Config - Valid", - args: args{ - name: "storage_class", - }, - expectedStatus: 200, - expectedError: nil, - }, - { - name: "Get Config - Invalid", - args: args{ - name: "asdf", - }, - expectedStatus: 404, - expectedError: nil, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - client := &http.Client{ - Timeout: 3 * time.Second, - } - - request, err := http.NewRequest( - "GET", fmt.Sprintf("http://localhost:9090/api/v1/configs/%s", tt.args.name), nil) - if err != nil { - log.Println(err) - return - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - response, err := client.Do(request) - if err != nil { - log.Println(err) - return - } - if response != nil { - assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed") - } - }) - } -} - -func Test_SetConfigAPI(t *testing.T) { - assert := assert.New(t) - - type args struct { - name string - keyValues []map[string]interface{} - } - tests := []struct { - name string - args args - expectedStatus int - expectedError error - }{ - { - name: "Set Config - Valid", - args: args{ - name: "region", - keyValues: []map[string]interface{}{{"key": "name", "value": "testServer"}, {"key": "region", "value": "us-west-1"}}, - }, - expectedStatus: 200, - expectedError: nil, - }, - { - name: "Set Config - Invalid", - args: args{ - name: "regiontest", - keyValues: []map[string]interface{}{{"key": "name", "value": "testServer"}, {"key": "region", "value": "us-west-1"}}, - }, - expectedStatus: 500, - expectedError: nil, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - client := &http.Client{ - Timeout: 3 * time.Second, - } - - requestDataPolicy := map[string]interface{}{} - - requestDataPolicy["key_values"] = tt.args.keyValues - - requestDataJSON, _ := json.Marshal(requestDataPolicy) - requestDataBody := bytes.NewReader(requestDataJSON) - request, err := http.NewRequest( - "PUT", fmt.Sprintf("http://localhost:9090/api/v1/configs/%s", tt.args.name), requestDataBody) - if err != nil { - log.Println(err) - return - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - response, err := client.Do(request) - if err != nil { - log.Println(err) - return - } - if response != nil { - assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed") - } - }) - } -} - -func Test_ResetConfigAPI(t *testing.T) { - assert := assert.New(t) - - type args struct { - name string - } - tests := []struct { - name string - args args - expectedStatus int - expectedError error - }{ - { - name: "Reset Config - Valid", - args: args{ - name: "region", - }, - expectedStatus: 200, - expectedError: nil, - }, - { - name: "Reset Config - Invalid", - args: args{ - name: "regiontest", - }, - expectedStatus: 500, - expectedError: nil, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - client := &http.Client{ - Timeout: 3 * time.Second, - } - - requestDataPolicy := map[string]interface{}{} - - requestDataJSON, _ := json.Marshal(requestDataPolicy) - requestDataBody := bytes.NewReader(requestDataJSON) - request, err := http.NewRequest( - "POST", fmt.Sprintf("http://localhost:9090/api/v1/configs/%s/reset", tt.args.name), requestDataBody) - if err != nil { - log.Println(err) - return - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - response, err := client.Do(request) - if err != nil { - log.Println(err) - return - } - if response != nil { - assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed") - } - }) - } -} diff --git a/integration/groups_test.go b/integration/groups_test.go deleted file mode 100644 index 0fba202e36..0000000000 --- a/integration/groups_test.go +++ /dev/null @@ -1,351 +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 . - -package integration - -import ( - "bytes" - "encoding/json" - "fmt" - "log" - "net/http" - "net/url" - "testing" - "time" - - "github.com/stretchr/testify/assert" -) - -func Test_AddGroupAPI(t *testing.T) { - assert := assert.New(t) - - AddUser("member1", "testtest", []string{}, []string{"consoleAdmin"}) - - type args struct { - group string - members []string - } - tests := []struct { - name string - args args - expectedStatus int - expectedError error - }{ - { - name: "Create Group - Valid", - args: args{ - group: "test", - members: []string{"member1"}, - }, - expectedStatus: 201, - expectedError: nil, - }, - { - name: "Create Group - Invalid", - args: args{ - group: "test", - members: []string{}, - }, - expectedStatus: 400, - expectedError: nil, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - client := &http.Client{ - Timeout: 3 * time.Second, - } - - requestDataPolicy := map[string]interface{}{} - requestDataPolicy["group"] = tt.args.group - requestDataPolicy["members"] = tt.args.members - - requestDataJSON, _ := json.Marshal(requestDataPolicy) - requestDataBody := bytes.NewReader(requestDataJSON) - request, err := http.NewRequest( - "POST", "http://localhost:9090/api/v1/groups", requestDataBody) - if err != nil { - log.Println(err) - return - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - response, err := client.Do(request) - if err != nil { - log.Println(err) - return - } - if response != nil { - assert.Equal(tt.expectedStatus, response.StatusCode, "Status Code is incorrect") - } - }) - } -} - -func Test_GetGroupAPI(t *testing.T) { - assert := assert.New(t) - - AddUser("member2", "testtest", []string{}, []string{"consoleAdmin"}) - AddGroup("getgroup1", []string{"member2"}) - - type args struct { - api string - } - tests := []struct { - name string - args args - expectedStatus int - expectedError error - }{ - { - name: "Get Group - Valid", - args: args{ - api: "getgroup1", - }, - expectedStatus: 200, - expectedError: nil, - }, - { - name: "Get Group - Invalid", - args: args{ - api: "askfjalkd", - }, - expectedStatus: 500, - expectedError: nil, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - client := &http.Client{ - Timeout: 3 * time.Second, - } - - requestDataPolicy := map[string]interface{}{} - - requestDataJSON, _ := json.Marshal(requestDataPolicy) - requestDataBody := bytes.NewReader(requestDataJSON) - request, err := http.NewRequest( - "GET", fmt.Sprintf("http://localhost:9090/api/v1/group/%s", url.PathEscape(tt.args.api)), requestDataBody) - if err != nil { - log.Println(err) - return - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - response, err := client.Do(request) - if err != nil { - log.Println(err) - return - } - if response != nil { - assert.Equal(tt.expectedStatus, response.StatusCode, "Status Code is incorrect") - } - }) - } -} - -func Test_ListGroupsAPI(t *testing.T) { - assert := assert.New(t) - - tests := []struct { - name string - expectedStatus int - expectedError error - }{ - { - name: "Get Group - Valid", - expectedStatus: 200, - expectedError: nil, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - client := &http.Client{ - Timeout: 3 * time.Second, - } - - requestDataPolicy := map[string]interface{}{} - - requestDataJSON, _ := json.Marshal(requestDataPolicy) - requestDataBody := bytes.NewReader(requestDataJSON) - request, err := http.NewRequest( - "GET", "http://localhost:9090/api/v1/groups", requestDataBody) - if err != nil { - log.Println(err) - return - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - response, err := client.Do(request) - if err != nil { - log.Println(err) - return - } - if response != nil { - assert.Equal(tt.expectedStatus, response.StatusCode, "Status Code is incorrect") - } - }) - } -} - -func Test_PutGroupsAPI(t *testing.T) { - assert := assert.New(t) - - AddUser("member3", "testtest", []string{}, []string{"consoleAdmin"}) - AddGroup("putgroup1", []string{}) - - type args struct { - api string - members []string - status string - } - tests := []struct { - name string - args args - expectedStatus int - expectedError error - }{ - { - name: "Put Group - Valid", - args: args{ - api: "putgroup1", - members: []string{"member3"}, - status: "enabled", - }, - expectedStatus: 200, - expectedError: nil, - }, - { - name: "Put Group - Invalid", - args: args{ - api: "gdgfdfgd", - members: []string{"member3"}, - status: "enabled", - }, - expectedStatus: 500, - expectedError: nil, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - client := &http.Client{ - Timeout: 3 * time.Second, - } - - requestDataPolicy := map[string]interface{}{} - - requestDataPolicy["members"] = tt.args.members - requestDataPolicy["status"] = tt.args.status - - requestDataJSON, _ := json.Marshal(requestDataPolicy) - requestDataBody := bytes.NewReader(requestDataJSON) - request, err := http.NewRequest( - "PUT", fmt.Sprintf("http://localhost:9090/api/v1/group/%s", url.PathEscape(tt.args.api)), requestDataBody) - if err != nil { - log.Println(err) - return - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - response, err := client.Do(request) - if err != nil { - log.Println(err) - return - } - if response != nil { - assert.Equal(tt.expectedStatus, response.StatusCode, "Status Code is incorrect") - } - }) - } -} - -func Test_DeleteGroupAPI(t *testing.T) { - assert := assert.New(t) - - AddGroup("grouptests1", []string{}) - - type args struct { - api string - } - tests := []struct { - name string - args args - expectedStatus int - expectedError error - verb string - }{ - { - name: "Delete Group - Valid", - args: args{ - api: "grouptests1", - }, - verb: "DELETE", - expectedStatus: 204, - expectedError: nil, - }, - { - name: "Delete Group - Invalid", - args: args{ - api: "grouptests12345", - }, - verb: "DELETE", - expectedStatus: 404, - expectedError: nil, - }, - { - name: "Access Group After Delete - Invalid", - args: args{ - api: "grouptests1", - }, - verb: "GET", - expectedStatus: 500, - expectedError: nil, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - client := &http.Client{ - Timeout: 3 * time.Second, - } - - requestDataPolicy := map[string]interface{}{} - - requestDataJSON, _ := json.Marshal(requestDataPolicy) - requestDataBody := bytes.NewReader(requestDataJSON) - request, err := http.NewRequest( - tt.verb, fmt.Sprintf("http://localhost:9090/api/v1/group/%s", url.PathEscape(tt.args.api)), requestDataBody) - if err != nil { - log.Println(err) - return - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - response, err := client.Do(request) - if err != nil { - log.Println(err) - return - } - if response != nil { - assert.Equal(tt.expectedStatus, response.StatusCode, "Status Code is incorrect") - } - }) - } -} diff --git a/integration/inspect_test.go b/integration/inspect_test.go deleted file mode 100644 index 5188f02d31..0000000000 --- a/integration/inspect_test.go +++ /dev/null @@ -1,106 +0,0 @@ -package integration - -import ( - "fmt" - "log" - "net/http" - "testing" - "time" - - "github.com/stretchr/testify/assert" -) - -func Inspect(volume string, file string, enc bool) (*http.Response, error) { - requestURL := fmt.Sprintf("http://localhost:9090/api/v1/admin/inspect?volume=%s&file=%s&encrypt=%t", volume, file, enc) - request, err := http.NewRequest( - "GET", requestURL, nil) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - client := &http.Client{ - Timeout: 2 * time.Second, - } - response, err := client.Do(request) - return response, err -} - -func TestInspect(t *testing.T) { - assert := assert.New(t) - - type args struct { - volume string - file string - encrypt bool - } - - // Inspect returns successful response always - tests := []struct { - name string - args args - expStatusCode int - expectedError bool - }{ - { - name: "Test Invalid Path", - args: args{ - volume: "/test-with-slash", - file: "/test-with-slash", - encrypt: false, - }, - expStatusCode: 200, - expectedError: false, - }, - - { - name: "Test Invalid characters in Path", - args: args{ - volume: "//test", - file: "//bucket", - encrypt: false, - }, - expStatusCode: 200, - expectedError: true, - }, - { - name: "Test valid bucket", - args: args{ - volume: "test-bucket", - file: "test.txt", - encrypt: true, - }, - expStatusCode: 200, - expectedError: false, - }, - { - name: "Test Empty Path", // Un processable entity error - args: args{ - volume: "", - file: "", - encrypt: false, - }, - expStatusCode: 422, - expectedError: false, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - resp, err := Inspect(tt.args.volume, tt.args.file, tt.args.encrypt) - if tt.expectedError { - assert.Nil(err) - if err != nil { - log.Println(err) - return - } - } - if resp != nil { - assert.Equal( - tt.expStatusCode, - resp.StatusCode, - ) - } - }) - } -} diff --git a/integration/policy_test.go b/integration/policy_test.go deleted file mode 100644 index 9a9a655921..0000000000 --- a/integration/policy_test.go +++ /dev/null @@ -1,882 +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 . - -package integration - -import ( - "bytes" - "encoding/json" - "fmt" - "io" - "log" - "net/http" - "net/url" - "testing" - "time" - - "github.com/go-openapi/swag" - - "github.com/stretchr/testify/assert" -) - -func AddPolicy(name, definition string) (*http.Response, error) { - /* - This is an atomic function to add user and can be reused across - different functions. - */ - client := &http.Client{ - Timeout: 3 * time.Second, - } - - requestDataAdd := map[string]interface{}{ - "name": name, - "policy": definition, - } - - requestDataJSON, _ := json.Marshal(requestDataAdd) - requestDataBody := bytes.NewReader(requestDataJSON) - request, err := http.NewRequest( - "POST", "http://localhost:9090/api/v1/policies", requestDataBody) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - - response, err := client.Do(request) - return response, err -} - -func SetPolicy(policies []string, entityName, entityType string) (*http.Response, error) { - /* - This is an atomic function to add user and can be reused across - different functions. - */ - client := &http.Client{ - Timeout: 3 * time.Second, - } - - requestDataAdd := map[string]interface{}{ - "name": policies, - "entityType": entityType, - "entityName": entityName, - } - - requestDataJSON, _ := json.Marshal(requestDataAdd) - requestDataBody := bytes.NewReader(requestDataJSON) - request, err := http.NewRequest( - "PUT", "http://localhost:9090/api/v1/set-policy", requestDataBody) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - - response, err := client.Do(request) - return response, err -} - -func Test_AddPolicyAPI(t *testing.T) { - assert := assert.New(t) - - type args struct { - api string - name string - policy *string - } - tests := []struct { - name string - args args - expectedStatus int - expectedError error - }{ - { - name: "Create Policy - Valid", - args: args{ - api: "/policies", - name: "test", - policy: swag.String(` - { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "s3:GetBucketLocation", - "s3:GetObject" - ], - "Resource": [ - "arn:aws:s3:::*" - ] - } - ] -}`), - }, - expectedStatus: 201, - expectedError: nil, - }, - - { - name: "Create Policy - Invalid", - args: args{ - api: "/policies", - name: "test2", - policy: swag.String(` - { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "s3:GetBucketLocation" - "s3:GetObject" - ], - "Resource": [ - "arn:aws:s3:::*" - ] - } - ] -}`), - }, - expectedStatus: 500, - expectedError: nil, - }, - { - name: "Create Policy - Space in Name", - args: args{ - api: "/policies", - name: "space test", - policy: swag.String(` - { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "s3:GetBucketLocation", - "s3:GetObject" - ], - "Resource": [ - "arn:aws:s3:::*" - ] - } - ] -}`), - }, - expectedStatus: 201, // Changed the expected status from 400 to 201, as spaces are now allowed in policy names. - expectedError: nil, - }, - { - name: "Create Policy - Reserved character in name", - args: args{ - api: "/policies", - name: "space/test?", - policy: swag.String(` - { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "s3:GetBucketLocation", - "s3:GetObject" - ], - "Resource": [ - "arn:aws:s3:::*" - ] - } - ] -}`), - }, - expectedStatus: 201, - expectedError: nil, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - client := &http.Client{ - Timeout: 3 * time.Second, - } - - requestDataPolicy := map[string]interface{}{} - requestDataPolicy["name"] = tt.args.name - if tt.args.policy != nil { - requestDataPolicy["policy"] = *tt.args.policy - } - - requestDataJSON, _ := json.Marshal(requestDataPolicy) - requestDataBody := bytes.NewReader(requestDataJSON) - request, err := http.NewRequest( - "POST", fmt.Sprintf("http://localhost:9090/api/v1%s", tt.args.api), requestDataBody) - if err != nil { - log.Println(err) - return - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - response, err := client.Do(request) - if err != nil { - log.Println(err) - return - } - if response != nil { - assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed") - } - }) - } -} - -func Test_SetPolicyAPI(t *testing.T) { - assert := assert.New(t) - - AddUser("policyuser1", "testtest", []string{}, []string{"readwrite"}) - AddGroup("testgroup123", []string{}) - AddPolicy("setpolicytest", ` - { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "s3:GetBucketLocation", - "s3:GetObject" - ], - "Resource": [ - "arn:aws:s3:::*" - ] - } - ] - }`) - - type args struct { - api string - entityType string - entityName string - policyName []string - } - tests := []struct { - name string - args args - expectedStatus int - expectedError error - }{ - { - name: "Set Policy - Valid", - args: args{ - api: "/set-policy", - policyName: []string{"setpolicytest"}, - entityType: "user", - entityName: "policyuser1", - }, - expectedStatus: 204, - expectedError: nil, - }, - { - name: "Set Policy - Invalid", - args: args{ - api: "/set-policy", - policyName: []string{"test3"}, - entityType: "user", - entityName: "policyuser1", - }, - expectedStatus: 500, - expectedError: nil, - }, - { - name: "Set Policy Group - Valid", - args: args{ - api: "/set-policy", - policyName: []string{"setpolicytest"}, - entityType: "group", - entityName: "testgroup123", - }, - expectedStatus: 204, - expectedError: nil, - }, - { - name: "Set Policy Group - Invalid", - args: args{ - api: "/set-policy", - policyName: []string{"test3"}, - entityType: "group", - entityName: "testgroup123", - }, - expectedStatus: 500, - expectedError: nil, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - client := &http.Client{ - Timeout: 3 * time.Second, - } - - requestDataPolicy := map[string]interface{}{} - requestDataPolicy["entityName"] = tt.args.entityName - requestDataPolicy["entityType"] = tt.args.entityType - if tt.args.policyName != nil { - requestDataPolicy["name"] = tt.args.policyName - } - - requestDataJSON, _ := json.Marshal(requestDataPolicy) - requestDataBody := bytes.NewReader(requestDataJSON) - request, err := http.NewRequest( - "PUT", fmt.Sprintf("http://localhost:9090/api/v1%s", tt.args.api), requestDataBody) - if err != nil { - log.Println(err) - return - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - response, err := client.Do(request) - if err != nil { - log.Println(err) - return - } - if response != nil { - assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed") - } - }) - } -} - -func Test_SetPolicyMultipleAPI(t *testing.T) { - assert := assert.New(t) - - AddUser("policyuser2", "testtest", []string{}, []string{"readwrite"}) - AddUser("policyuser3", "testtest", []string{}, []string{"readwrite"}) - AddGroup("testgroup1234", []string{}) - AddPolicy("setpolicytest2", ` - { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "s3:GetBucketLocation", - "s3:GetObject" - ], - "Resource": [ - "arn:aws:s3:::*" - ] - } - ] - }`) - - type args struct { - api string - users []string - groups []string - name []string - } - tests := []struct { - name string - args args - expectedStatus int - expectedError error - }{ - { - name: "Set Policy - Valid", - args: args{ - api: "/set-policy-multi", - name: []string{"setpolicytest2"}, - users: []string{"policyuser2", "policyuser3"}, - }, - expectedStatus: 204, - expectedError: nil, - }, - { - name: "Set Policy - Invalid", - args: args{ - api: "/set-policy-multi", - name: []string{"test3"}, - users: []string{"policyuser2", "policyuser3"}, - }, - expectedStatus: 500, - expectedError: nil, - }, - { - name: "Set Policy Group - Valid", - args: args{ - api: "/set-policy-multi", - name: []string{"setpolicytest2"}, - groups: []string{"testgroup1234"}, - }, - expectedStatus: 204, - expectedError: nil, - }, - { - name: "Set Policy Group - Valid", - args: args{ - api: "/set-policy-multi", - name: []string{"setpolicytest23"}, - groups: []string{"testgroup1234"}, - }, - expectedStatus: 500, - expectedError: nil, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - client := &http.Client{ - Timeout: 3 * time.Second, - } - - requestDataPolicy := map[string]interface{}{} - requestDataPolicy["name"] = tt.args.name - requestDataPolicy["users"] = tt.args.users - requestDataPolicy["groups"] = tt.args.groups - - requestDataJSON, _ := json.Marshal(requestDataPolicy) - requestDataBody := bytes.NewReader(requestDataJSON) - request, err := http.NewRequest( - "PUT", fmt.Sprintf("http://localhost:9090/api/v1%s", tt.args.api), requestDataBody) - if err != nil { - log.Println(err) - return - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - response, err := client.Do(request) - if err != nil { - log.Println(err) - return - } - if response != nil { - assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed") - } - }) - } -} - -func Test_ListPoliciesAPI(t *testing.T) { - assert := assert.New(t) - - type args struct { - api string - } - tests := []struct { - name string - args args - expectedStatus int - expectedError error - }{ - { - name: "List Policies", - args: args{ - api: "/policies", - }, - expectedStatus: 200, - expectedError: nil, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - client := &http.Client{ - Timeout: 3 * time.Second, - } - - request, err := http.NewRequest( - "GET", fmt.Sprintf("http://localhost:9090/api/v1%s", tt.args.api), nil) - if err != nil { - log.Println(err) - return - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - response, err := client.Do(request) - if err != nil { - log.Println(err) - return - } - if response != nil { - assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed") - } - }) - } -} - -func Test_GetPolicyAPI(t *testing.T) { - assert := assert.New(t) - - AddPolicy("test/policy?", ` - { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "s3:GetBucketLocation", - "s3:GetObject" - ], - "Resource": [ - "arn:aws:s3:::*" - ] - } - ] - }`) - - type args struct { - api string - } - tests := []struct { - name string - args args - expectedStatus int - expectedError error - }{ - { - name: "Get Policies - Invalid", - args: args{ - api: "test3", - }, - expectedStatus: 500, - expectedError: nil, - }, - { - name: "Get Policies - Valid", - args: args{ - api: "test/policy?", - }, - expectedStatus: 200, - expectedError: nil, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - client := &http.Client{ - Timeout: 3 * time.Second, - } - - request, err := http.NewRequest( - "GET", fmt.Sprintf("http://localhost:9090/api/v1/policy/%s", url.PathEscape(tt.args.api)), nil) - if err != nil { - log.Println(err) - return - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - response, err := client.Do(request) - if err != nil { - log.Println(err) - return - } - if response != nil { - assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed") - } - }) - } -} - -func Test_PolicyListUsersAPI(t *testing.T) { - assert := assert.New(t) - - AddUser("policyuser4", "testtest", []string{}, []string{"readwrite"}) - AddPolicy("policylistusers", ` - { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "s3:GetBucketLocation", - "s3:GetObject" - ], - "Resource": [ - "arn:aws:s3:::*" - ] - } - ] - }`) - SetPolicy([]string{"policylistusers"}, "policyuser4", "user") - - type args struct { - api string - } - tests := []struct { - name string - args args - expectedStatus int - expectedError error - }{ - { - name: "List Users for Policy - Valid", - args: args{ - api: "/policies/" + url.PathEscape("policylistusers") + "/users", - }, - expectedStatus: 200, - expectedError: nil, - }, - { - name: "List Users for Policy - Invalid", - args: args{ - api: "/policies/" + url.PathEscape("test2") + "/users", - }, - expectedStatus: 404, - expectedError: nil, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - client := &http.Client{ - Timeout: 3 * time.Second, - } - - request, err := http.NewRequest( - "GET", fmt.Sprintf("http://localhost:9090/api/v1%s", tt.args.api), nil) - if err != nil { - log.Println(err) - return - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - response, err := client.Do(request) - if err != nil { - log.Println(err) - return - } - if response != nil { - bodyBytes, _ := io.ReadAll(response.Body) - assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed") - if response.StatusCode == 200 { - assert.Equal("[\"policyuser4\"]\n", string(bodyBytes)) - } - } - }) - } -} - -func Test_PolicyListGroupsAPI(t *testing.T) { - assert := assert.New(t) - - AddGroup("testgroup12345", []string{}) - AddPolicy("policylistgroups", ` - { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "s3:GetBucketLocation", - "s3:GetObject" - ], - "Resource": [ - "arn:aws:s3:::*" - ] - } - ] - }`) - SetPolicy([]string{"policylistgroups"}, "testgroup12345", "group") - - type args struct { - api string - } - tests := []struct { - name string - args args - expectedStatus int - expectedError error - }{ - { - name: "List Users for Policy - Valid", - args: args{ - api: "/policies/" + url.PathEscape("policylistgroups") + "/groups", - }, - expectedStatus: 200, - expectedError: nil, - }, - { - name: "List Users for Policy - Invalid", - args: args{ - api: "/policies/" + url.PathEscape("test3") + "/groups", - }, - expectedStatus: 404, - expectedError: nil, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - client := &http.Client{ - Timeout: 3 * time.Second, - } - - request, err := http.NewRequest( - "GET", fmt.Sprintf("http://localhost:9090/api/v1%s", tt.args.api), nil) - if err != nil { - log.Println(err) - return - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - response, err := client.Do(request) - if err != nil { - log.Println(err) - return - } - if response != nil { - bodyBytes, _ := io.ReadAll(response.Body) - assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed") - if response.StatusCode == 200 { - assert.Equal("[\"testgroup12345\"]\n", string(bodyBytes)) - } - } - }) - } -} - -func Test_DeletePolicyAPI(t *testing.T) { - assert := assert.New(t) - - AddPolicy("testdelete", ` - { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "s3:GetBucketLocation", - "s3:GetObject" - ], - "Resource": [ - "arn:aws:s3:::*" - ] - } - ] - }`) - type args struct { - api string - method string - } - tests := []struct { - name string - args args - expectedStatus int - expectedError error - }{ - { - name: "Delete Policies - Valid", - args: args{ - api: "testdelete", - method: "DELETE", - }, - expectedStatus: 204, - expectedError: nil, - }, - { - name: "Get Policy After Delete - Invalid", - args: args{ - api: "testdelete", - method: "GET", - }, - expectedStatus: 500, - expectedError: nil, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - client := &http.Client{ - Timeout: 3 * time.Second, - } - - request, err := http.NewRequest( - tt.args.method, fmt.Sprintf("http://localhost:9090/api/v1/policy/%s", url.PathEscape(tt.args.api)), nil) - if err != nil { - log.Println(err) - return - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - response, err := client.Do(request) - if err != nil { - log.Println(err) - return - } - if response != nil { - assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed") - } - }) - } -} - -func Test_GetAUserPolicyAPI(t *testing.T) { - assert := assert.New(t) - // Create a User with a Policy to use for testing - groups := []string{} - policies := []string{"readwrite"} - _, err := AddUser("getuserpolicyuser", "secretKey", groups, policies) - if err != nil { - log.Println(err) - return - } - - type args struct { - api string - } - tests := []struct { - name string - args args - expectedStatus int - expectedError error - }{ - { - name: "Get User Policy - Invalid", - args: args{ - api: "/user/" + url.PathEscape("failname") + "/policies", - }, - expectedStatus: 401, - expectedError: nil, - }, - { - name: "Get User Policy - Valid", - args: args{ - api: "/user/" + url.PathEscape("getuserpolicyuser") + "/policies", - }, - expectedStatus: 200, - expectedError: nil, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - client := &http.Client{ - Timeout: 3 * time.Second, - } - request, err := http.NewRequest( - "GET", fmt.Sprintf("http://localhost:9090/api/v1%s", tt.args.api), nil) - if err != nil { - log.Println(err) - return - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - response, err := client.Do(request) - if err != nil { - log.Println(err) - return - } - if response != nil { - assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed") - } - }) - } -} diff --git a/integration/service_account_test.go b/integration/service_account_test.go deleted file mode 100644 index ce6ee4690f..0000000000 --- a/integration/service_account_test.go +++ /dev/null @@ -1,349 +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 . - -package integration - -import ( - "bytes" - "encoding/json" - "fmt" - "log" - "net/http" - "net/url" - "testing" - "time" - - "github.com/go-openapi/swag" - - "github.com/stretchr/testify/assert" -) - -func TestAddServiceAccount(t *testing.T) { - /* - This is an atomic API Test to add a user service account, the intention - is simple, add a user and make sure the response is 201 meaning that the - user got added successfully. - After test completion, it is expected that user is removed, so other - tests like users.ts can run over clean data and we don't collide against - it. - */ - - assert := assert.New(t) - - client := &http.Client{ - Timeout: 3 * time.Second, - } - - // Add service account - requestDataAddServiceAccount := map[string]interface{}{ - "accessKey": "testuser1", - "secretKey": "password", - "policy": `{ - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "s3:GetBucketLocation", - "s3:GetObject" - ], - "Resource": [ - "arn:aws:s3:::*" - ] - } - ] -}`, - } - - requestDataJSON, _ := json.Marshal(requestDataAddServiceAccount) - requestDataBody := bytes.NewReader(requestDataJSON) - request, err := http.NewRequest( - "POST", "http://localhost:9090/api/v1/service-account-credentials", requestDataBody) - if err != nil { - log.Println(err) - return - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - - response, err := client.Do(request) - if err != nil { - log.Println(err) - return - } - if response != nil { - fmt.Println("POST StatusCode:", response.StatusCode) - assert.Equal(201, response.StatusCode, "Status Code is incorrect") - } - - // {{baseUrl}}/user?name=proident velit - // Investiga como se borra en el browser. - request, err = http.NewRequest( - "DELETE", "http://localhost:9090/api/v1/service-accounts/"+url.PathEscape("testuser1"), nil) - if err != nil { - log.Println(err) - return - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - response, err = client.Do(request) - if err != nil { - log.Println(err) - return - } - if response != nil { - fmt.Println("DELETE StatusCode:", response.StatusCode) - assert.Equal(204, response.StatusCode, "has to be 204 when delete user") - } -} - -func Test_ServiceAccountsAPI(t *testing.T) { - assert := assert.New(t) - - type args struct { - api string - policy *string - } - tests := []struct { - name string - args args - expectedStatus int - expectedError error - }{ - { - name: "Create Service Account - Default", - args: args{ - api: "/service-accounts", - policy: nil, - }, - expectedStatus: 201, - expectedError: nil, - }, - { - name: "Create Service Account - Valid Policy", - args: args{ - api: "/service-accounts", - policy: swag.String(` - { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "s3:GetBucketLocation", - "s3:GetObject" - ], - "Resource": [ - "arn:aws:s3:::*" - ] - } - ] -}`), - }, - expectedStatus: 201, - expectedError: nil, - }, - { - name: "Create Service Account - Invalid Policy", - args: args{ - api: "/service-accounts", - policy: swag.String(` - { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "s3:GetBucketLocation" - "s3:GetObject" - ], - "Resource": [ - "arn:aws:s3:::*" - ] - } - ] -}`), - }, - expectedStatus: 500, - expectedError: nil, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - client := &http.Client{ - Timeout: 3 * time.Second, - } - - // Add service account - - requestDataPolicy := map[string]interface{}{} - if tt.args.policy != nil { - requestDataPolicy["policy"] = *tt.args.policy - } - - requestDataJSON, _ := json.Marshal(requestDataPolicy) - requestDataBody := bytes.NewReader(requestDataJSON) - request, err := http.NewRequest( - "POST", fmt.Sprintf("http://localhost:9090/api/v1%s", tt.args.api), requestDataBody) - if err != nil { - log.Println(err) - return - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - response, err := client.Do(request) - if err != nil { - log.Println(err) - return - } - if response != nil { - assert.Equal(tt.expectedStatus, response.StatusCode, "Status Code is incorrect") - } - }) - } -} - -func DeleteMultipleServiceAccounts(serviceAccounts []string) (*http.Response, error) { - /* - Helper function to delete multiple service accounts - URL: http://localhost:9001/api/v1/service-accounts/delete-multi - HTTP Verb: DELETE - Data: ["U3RADB7J2ZZHELR0WSBB","ZE8H1HYOA6AVGKFCV6YU"] - Response: Status Code: 204 No Content - */ - client := &http.Client{ - Timeout: 3 * time.Second, - } - requestDataJSON, _ := json.Marshal(serviceAccounts) - requestDataBody := bytes.NewReader(requestDataJSON) - request, err := http.NewRequest( - "DELETE", "http://localhost:9090/api/v1/service-accounts/delete-multi", requestDataBody) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - response, err := client.Do(request) - return response, err -} - -func TestCreateServiceAccountForUserWithCredentials(t *testing.T) { - /* - To test creation of service account for a user. - */ - - // Test's variables - userName := "testcreateserviceaccountforuserwithcredentials1" - assert := assert.New(t) - policy := "" - - // 1. Create the user - groups := []string{} - policies := []string{} - secretKey := "testcreateserviceaccountforuserwithcrede" - response, err := AddUser(userName, "secretKey", groups, policies) - if err != nil { - log.Println(err) - return - } - if response != nil { - fmt.Println("StatusCode:", response.StatusCode) - assert.Equal(201, response.StatusCode, "Status Code is incorrect") - } - - // Table driven testing part - type args struct { - accessKey string - } - tests := []struct { - name string - args args - expectedStatus int - }{ - { - name: "Service Account With Valid Credentials", - expectedStatus: 201, - args: args{ - accessKey: "testcreateserviceacc", - }, - }, - { - name: "Service Account With Invalid Credentials", - expectedStatus: 500, - args: args{ - accessKey: "tooooooooooooooooooooolongggggggggggggggggg", - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - // 2. Create the service account for the user - createServiceAccountWithCredentialsResponse, - createServiceAccountWithCredentialsError := CreateServiceAccountForUserWithCredentials( - userName, - policy, - tt.args.accessKey, - secretKey, - ) - if createServiceAccountWithCredentialsError != nil { - log.Println(createServiceAccountWithCredentialsError) - assert.Fail("Error in createServiceAccountWithCredentialsError") - } - if createServiceAccountWithCredentialsResponse != nil { - fmt.Println("StatusCode:", createServiceAccountWithCredentialsResponse.StatusCode) - assert.Equal( - tt.expectedStatus, // different status expected per table's row - createServiceAccountWithCredentialsResponse.StatusCode, - inspectHTTPResponse(createServiceAccountWithCredentialsResponse), - ) - } - - // 3. Verify the service account for the user - listOfAccountsResponse, - listOfAccountsError := ReturnsAListOfServiceAccountsForAUser(userName) - if listOfAccountsError != nil { - log.Println(listOfAccountsError) - assert.Fail("Error in listOfAccountsError") - } - finalResponse := inspectHTTPResponse(listOfAccountsResponse) - if listOfAccountsResponse != nil { - fmt.Println("StatusCode:", listOfAccountsResponse.StatusCode) - assert.Equal( - 200, listOfAccountsResponse.StatusCode, - finalResponse, - ) - } - }) - } - - // Delete Multiple Service Accounts - serviceAccount := make([]string, 1) - serviceAccount[0] = "testcreateserviceacc" - response, err = DeleteMultipleServiceAccounts(serviceAccount) - if err != nil { - log.Println(err) - return - } - if response != nil { - fmt.Println("StatusCode:", response.StatusCode) - assert.Equal( - 204, - response.StatusCode, - inspectHTTPResponse(response), - ) - } -} diff --git a/integration/user_api_bucket_test.go b/integration/user_api_bucket_test.go index 2db5b3b4fb..00cfc565a4 100644 --- a/integration/user_api_bucket_test.go +++ b/integration/user_api_bucket_test.go @@ -20,7 +20,6 @@ package integration import ( "bytes" - "context" "encoding/json" "errors" "fmt" @@ -34,10 +33,7 @@ import ( "testing" "time" - "github.com/minio/minio-go/v7" - "github.com/minio/console/models" - "github.com/minio/minio-go/v7/pkg/credentials" "github.com/stretchr/testify/assert" ) @@ -103,47 +99,6 @@ func AddBucketWithOpts(opts *AddBucketOps) (*http.Response, error) { return response, err } -func getTokenForEndpoint(endpoint string) string { - var loginToken string - client := &http.Client{ - Timeout: 2 * time.Second, - } - // get login credentials - - requestData := map[string]string{ - "accessKey": "minioadmin", - "secretKey": "minioadmin", - } - - requestDataJSON, _ := json.Marshal(requestData) - - requestDataBody := bytes.NewReader(requestDataJSON) - - request, err := http.NewRequest("POST", fmt.Sprintf("%s/api/v1/login", endpoint), requestDataBody) - if err != nil { - log.Println(err) - return "" - } - - request.Header.Add("Content-Type", "application/json") - - response, err := client.Do(request) - if err != nil { - log.Println(err) - return "" - } - - if response != nil { - for _, cookie := range response.Cookies() { - if cookie.Name == "token" { - loginToken = cookie.Value - break - } - } - } - return loginToken -} - func setupBucket(name string, locking bool, versioning, quota, retention map[string]interface{}, assert *assert.Assertions, expected int) bool { return setupBucketForEndpoint(name, locking, versioning, quota, retention, assert, expected, nil, nil) } @@ -748,13 +703,12 @@ func PutObjectsLegalholdStatus(bucketName, prefix, status, versionID string) (*h return response, err } -func TestPutObjectsLegalholdStatus(t *testing.T) { +func TestRestoreObjectToASelectedVersion(t *testing.T) { // Variables assert := assert.New(t) - bucketName := "testputobjectslegalholdstatus" - objName := "testputobjectslegalholdstatus.txt" - objectNameEncoded := url.QueryEscape(objName) - status := "enabled" + bucketName := "testrestoreobjectstoselectedversion" + fileName := "testrestoreobjectstoselectedversion.txt" + validPrefix := url.QueryEscape(fileName) // 1. Create bucket if !setupBucket(bucketName, true, map[string]interface{}{"enabled": true}, nil, nil, assert, 200) { @@ -764,7 +718,7 @@ func TestPutObjectsLegalholdStatus(t *testing.T) { // 2. Add object uploadResponse, uploadError := UploadAnObject( bucketName, - objName, + fileName, ) assert.Nil(uploadError) if uploadError != nil { @@ -780,8 +734,8 @@ func TestPutObjectsLegalholdStatus(t *testing.T) { ) } - // Get versionID - listResponse, _ := ListObjects(bucketName, "", true) + // 3. Get versionID + listResponse, _ := ListObjects(bucketName, validPrefix, true) bodyBytes, _ := io.ReadAll(listResponse.Body) listObjs := models.ListObjectsResponse{} err := json.Unmarshal(bodyBytes, &listObjs) @@ -789,82 +743,10 @@ func TestPutObjectsLegalholdStatus(t *testing.T) { log.Println(err) assert.Nil(err) } - validVersionID := listObjs.Objects[0].VersionID - - type args struct { - versionID string - } - tests := []struct { - name string - expectedStatus int - args args - }{ - { - name: "Valid VersionID when putting object's legal hold status", - expectedStatus: 200, - args: args{ - versionID: validVersionID, - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - // 3. Put Objects Legal Status - putResponse, putError := PutObjectsLegalholdStatus( - bucketName, - objectNameEncoded, - status, - tt.args.versionID, - ) - if putError != nil { - log.Println(putError) - assert.Fail("Error putting object's legal hold status") - } - if putResponse != nil { - assert.Equal( - tt.expectedStatus, - putResponse.StatusCode, - inspectHTTPResponse(putResponse), - ) - } - }) - } -} - -func TestGetBucketQuota(t *testing.T) { - // Variables - assert := assert.New(t) - validBucket := "testgetbucketquota" - - // 1. Create bucket - if !setupBucket(validBucket, true, map[string]interface{}{"enabled": true}, nil, nil, assert, 200) { - return - } - - // 2. Put Bucket Quota - restResp, restErr := PutBucketQuota( - validBucket, - true, // enabled - "hard", // quotaType - 1099511627776, // amount - ) - assert.Nil(restErr) - if restErr != nil { - log.Println(restErr) - return - } - finalResponse := inspectHTTPResponse(restResp) - if restResp != nil { - assert.Equal( - 200, - restResp.StatusCode, - finalResponse, - ) - } + versionID := listObjs.Objects[0].VersionID - // 3. Get Bucket Quota type args struct { - bucketName string + prefix string } tests := []struct { name string @@ -872,24 +754,27 @@ func TestGetBucketQuota(t *testing.T) { args args }{ { - name: "Valid bucket when getting quota", + name: "Valid prefix when restoring object", expectedStatus: 200, args: args{ - bucketName: validBucket, + prefix: validPrefix, }, }, { - name: "Invalid bucket when getting quota", + name: "Invalid prefix when restoring object", expectedStatus: 500, args: args{ - bucketName: "askdaklsjdkasjdklasjdklasjdklajsdklasjdklasjdlkas", + prefix: "fakefile", }, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { - restResp, restErr := GetBucketQuota( - tt.args.bucketName, + // 4. Restore Object to a selected version + restResp, restErr := RestoreObjectToASelectedVersion( + bucketName, + tt.args.prefix, + versionID, ) assert.Nil(restErr) if restErr != nil { @@ -908,17 +793,16 @@ func TestGetBucketQuota(t *testing.T) { } } -func TestPutBucketQuota(t *testing.T) { - // Variables - assert := assert.New(t) - validBucket := "testputbucketquota" +func TestPutBucketsTags(t *testing.T) { + // Focused test for "Put Bucket's tags" endpoint - // 1. Create bucket - if !setupBucket(validBucket, true, map[string]interface{}{"enabled": true}, nil, nil, assert, 200) { + // 1. Create the bucket + assert := assert.New(t) + validBucketName := "testputbuckettags1" + if !setupBucket(validBucketName, false, nil, nil, nil, assert, 200) { return } - // 2. Put Bucket Quota type args struct { bucketName string } @@ -928,58 +812,72 @@ func TestPutBucketQuota(t *testing.T) { args args }{ { - name: "Valid bucket when putting quota", + name: "Put a tag to a valid bucket", expectedStatus: 200, args: args{ - bucketName: validBucket, + bucketName: validBucketName, }, }, { - name: "Invalid bucket when putting quota", + name: "Put a tag to an invalid bucket", expectedStatus: 500, args: args{ - bucketName: "lksdjakldjklajdlkasjdklasjdkljaskdljaslkdjalksjdklasjdklajsdlkajs", + bucketName: "invalidbucketname", }, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { - restResp, restErr := PutBucketQuota( - tt.args.bucketName, - true, // enabled - "hard", // quotaType - 1099511627776, // amount - ) - assert.Nil(restErr) - if restErr != nil { - log.Println(restErr) + // 2. Add a tag to the bucket + tags := make(map[string]string) + tags["tag2"] = "tag2" + putBucketTagResponse, putBucketTagError := PutBucketsTags( + tt.args.bucketName, tags) + if putBucketTagError != nil { + log.Println(putBucketTagError) + assert.Fail("Error putting the bucket's tags") return } - finalResponse := inspectHTTPResponse(restResp) - if restResp != nil { + if putBucketTagResponse != nil { assert.Equal( - tt.expectedStatus, - restResp.StatusCode, - finalResponse, - ) + tt.expectedStatus, putBucketTagResponse.StatusCode, + inspectHTTPResponse(putBucketTagResponse)) } }) } } -func TestListBucketEvents(t *testing.T) { - // Variables +func TestGetsTheMetadataOfAnObject(t *testing.T) { + // Vars assert := assert.New(t) - validBucket := "testlistbucketevents" + bucketName := "testgetsthemetadataofanobject" + fileName := "testshareobjectonurl.txt" + validPrefix := url.QueryEscape(fileName) + tags := make(map[string]string) + tags["tag"] = "testputobjecttagbucketonetagone" - // 1. Create bucket - if !setupBucket(validBucket, true, map[string]interface{}{"enabled": true}, nil, nil, assert, 200) { + // 1. Create the bucket + if !setupBucket(bucketName, false, nil, nil, nil, assert, 200) { + return + } + + // 2. Upload the object to the bucket + uploadResponse, uploadError := UploadAnObject(bucketName, fileName) + assert.Nil(uploadError) + if uploadError != nil { + log.Println(uploadError) return } + if uploadResponse != nil { + assert.Equal( + 200, + uploadResponse.StatusCode, + inspectHTTPResponse(uploadResponse), + ) + } - // 2. List bucket events type args struct { - bucketName string + prefix string } tests := []struct { name string @@ -987,102 +885,72 @@ func TestListBucketEvents(t *testing.T) { args args }{ { - name: "Valid bucket when listing events", + name: "Get metadata with valid prefix", expectedStatus: 200, args: args{ - bucketName: validBucket, + prefix: validPrefix, }, }, { - name: "Invalid bucket when listing events", + name: "Get metadata with invalid prefix", expectedStatus: 500, args: args{ - bucketName: "alksdjalksdjklasjdklasjdlkasjdkljaslkdjaskldjaklsjd", + prefix: "invalidprefix", }, }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { - restResp, restErr := ListBucketEvents( - tt.args.bucketName, - ) - assert.Nil(restErr) - if restErr != nil { - log.Println(restErr) + // 3. Get the metadata from an object + getRsp, getErr := GetsTheMetadataOfAnObject( + bucketName, tt.args.prefix) + assert.Nil(getErr) + if getErr != nil { + log.Println(getErr) return } - finalResponse := inspectHTTPResponse(restResp) - if restResp != nil { + if getRsp != nil { assert.Equal( tt.expectedStatus, - restResp.StatusCode, - finalResponse, + getRsp.StatusCode, + inspectHTTPResponse(getRsp), ) } }) } } -func TestDeleteObjectsRetentionStatus(t *testing.T) { - // Variables +func TestShareObjectOnURL(t *testing.T) { + /* + Test to share an object via URL + */ + + // Vars assert := assert.New(t) - bucketName := "testdeleteobjectslegalholdstatus" - fileName := "testdeleteobjectslegalholdstatus.txt" + bucketName := "testshareobjectonurl" + fileName := "testshareobjectonurl.txt" validPrefix := url.QueryEscape(fileName) + tags := make(map[string]string) + tags["tag"] = "testputobjecttagbucketonetagone" + versionID := "null" - // 1. Create bucket - if !setupBucket(bucketName, true, map[string]interface{}{"enabled": true}, nil, nil, assert, 200) { + // 1. Create the bucket + if !setupBucket(bucketName, false, nil, nil, nil, assert, 200) { return } - // 2. Add object - uploadResponse, uploadError := UploadAnObject( - bucketName, - fileName, - ) + // 2. Upload the object to the bucket + uploadResponse, uploadError := UploadAnObject(bucketName, fileName) assert.Nil(uploadError) if uploadError != nil { log.Println(uploadError) return } - addObjRsp := inspectHTTPResponse(uploadResponse) if uploadResponse != nil { assert.Equal( 200, uploadResponse.StatusCode, - addObjRsp, - ) - } - - // Get versionID - listResponse, _ := ListObjects(bucketName, validPrefix, true) - bodyBytes, _ := io.ReadAll(listResponse.Body) - listObjs := models.ListObjectsResponse{} - err := json.Unmarshal(bodyBytes, &listObjs) - if err != nil { - log.Println(err) - assert.Nil(err) - } - versionID := listObjs.Objects[0].VersionID - - // 3. Put Objects Retention Status - putResponse, putError := PutObjectsRetentionStatus( - bucketName, - validPrefix, - versionID, - "governance", - "2033-01-11T23:59:59Z", - false, - ) - if putError != nil { - log.Println(putError) - assert.Fail("Error putting the object retention status") - } - if putResponse != nil { - assert.Equal( - 200, - putResponse.StatusCode, - inspectHTTPResponse(putResponse), + inspectHTTPResponse(uploadResponse), ) } @@ -1095,495 +963,55 @@ func TestDeleteObjectsRetentionStatus(t *testing.T) { args args }{ { - name: "Valid prefix when deleting object's retention status", + name: "Share File with valid prefix", expectedStatus: 200, args: args{ prefix: validPrefix, }, }, - { - name: "Invalid prefix when deleting object's retention status", - expectedStatus: 500, - args: args{ - prefix: "fakefile", - }, - }, } for _, tt := range tests { t.Run(tt.name, func(_ *testing.T) { - // 4. Delete Objects Retention Status - putResponse, putError := DeleteObjectsRetentionStatus( - bucketName, - tt.args.prefix, - versionID, - ) - if putError != nil { - log.Println(putError) - assert.Fail("Error deleting the object retention status") + // 3. Share the object on a URL + shareResponse, shareError := SharesAnObjectOnAUrl(bucketName, tt.args.prefix, versionID, "604800s") + assert.Nil(shareError) + if shareError != nil { + log.Println(shareError) + return } - if putResponse != nil { + finalResponse := inspectHTTPResponse(shareResponse) + if shareResponse != nil { assert.Equal( tt.expectedStatus, - putResponse.StatusCode, - inspectHTTPResponse(putResponse), + shareResponse.StatusCode, + finalResponse, ) } }) } } -func TestBucketSetPolicy(t *testing.T) { - // Variables +func TestListObjects(t *testing.T) { + /* + To test list objects end point. + */ + + // Test's variables assert := assert.New(t) - validBucketName := "testbucketsetpolicy" + bucketName := "testlistobjecttobucket1" + fileName := "testlistobjecttobucket1.txt" - // 1. Create bucket - if !setupBucket(validBucketName, true, map[string]interface{}{"enabled": true}, nil, nil, assert, 200) { + // 1. Create the bucket + if !setupBucket(bucketName, false, nil, nil, nil, assert, 200) { return } - // 2. Set a bucket's policy using table driven tests - type args struct { - bucketName string - } - tests := []struct { - name string - expectedStatus int - args args - }{ - { - name: "Valid bucket when setting a policy", - expectedStatus: 200, - args: args{ - bucketName: validBucketName, - }, - }, - { - name: "Invalid bucket when setting a bucket", - expectedStatus: 500, - args: args{ - bucketName: "wlkjsdkalsjdklajsdlkajsdlkajsdlkajsdklajsdkljaslkdjaslkdj", - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - // Set Policy - restResp, restErr := BucketSetPolicy( - tt.args.bucketName, - "PUBLIC", - "", - ) - assert.Nil(restErr) - if restErr != nil { - log.Println(restErr) - return - } - finalResponse := inspectHTTPResponse(restResp) - if restResp != nil { - assert.Equal( - tt.expectedStatus, - restResp.StatusCode, - finalResponse, - ) - } - }) - } -} - -func TestRestoreObjectToASelectedVersion(t *testing.T) { - // Variables - assert := assert.New(t) - bucketName := "testrestoreobjectstoselectedversion" - fileName := "testrestoreobjectstoselectedversion.txt" - validPrefix := url.QueryEscape(fileName) - - // 1. Create bucket - if !setupBucket(bucketName, true, map[string]interface{}{"enabled": true}, nil, nil, assert, 200) { - return - } - - // 2. Add object - uploadResponse, uploadError := UploadAnObject( - bucketName, - fileName, - ) - assert.Nil(uploadError) - if uploadError != nil { - log.Println(uploadError) - return - } - addObjRsp := inspectHTTPResponse(uploadResponse) - if uploadResponse != nil { - assert.Equal( - 200, - uploadResponse.StatusCode, - addObjRsp, - ) - } - - // 3. Get versionID - listResponse, _ := ListObjects(bucketName, validPrefix, true) - bodyBytes, _ := io.ReadAll(listResponse.Body) - listObjs := models.ListObjectsResponse{} - err := json.Unmarshal(bodyBytes, &listObjs) - if err != nil { - log.Println(err) - assert.Nil(err) - } - versionID := listObjs.Objects[0].VersionID - - type args struct { - prefix string - } - tests := []struct { - name string - expectedStatus int - args args - }{ - { - name: "Valid prefix when restoring object", - expectedStatus: 200, - args: args{ - prefix: validPrefix, - }, - }, - { - name: "Invalid prefix when restoring object", - expectedStatus: 500, - args: args{ - prefix: "fakefile", - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - // 4. Restore Object to a selected version - restResp, restErr := RestoreObjectToASelectedVersion( - bucketName, - tt.args.prefix, - versionID, - ) - assert.Nil(restErr) - if restErr != nil { - log.Println(restErr) - return - } - finalResponse := inspectHTTPResponse(restResp) - if restResp != nil { - assert.Equal( - tt.expectedStatus, - restResp.StatusCode, - finalResponse, - ) - } - }) - } -} - -func TestPutBucketsTags(t *testing.T) { - // Focused test for "Put Bucket's tags" endpoint - - // 1. Create the bucket - assert := assert.New(t) - validBucketName := "testputbuckettags1" - if !setupBucket(validBucketName, false, nil, nil, nil, assert, 200) { - return - } - - type args struct { - bucketName string - } - tests := []struct { - name string - expectedStatus int - args args - }{ - { - name: "Put a tag to a valid bucket", - expectedStatus: 200, - args: args{ - bucketName: validBucketName, - }, - }, - { - name: "Put a tag to an invalid bucket", - expectedStatus: 500, - args: args{ - bucketName: "invalidbucketname", - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - // 2. Add a tag to the bucket - tags := make(map[string]string) - tags["tag2"] = "tag2" - putBucketTagResponse, putBucketTagError := PutBucketsTags( - tt.args.bucketName, tags) - if putBucketTagError != nil { - log.Println(putBucketTagError) - assert.Fail("Error putting the bucket's tags") - return - } - if putBucketTagResponse != nil { - assert.Equal( - tt.expectedStatus, putBucketTagResponse.StatusCode, - inspectHTTPResponse(putBucketTagResponse)) - } - }) - } -} - -func TestGetsTheMetadataOfAnObject(t *testing.T) { - // Vars - assert := assert.New(t) - bucketName := "testgetsthemetadataofanobject" - fileName := "testshareobjectonurl.txt" - validPrefix := url.QueryEscape(fileName) - tags := make(map[string]string) - tags["tag"] = "testputobjecttagbucketonetagone" - - // 1. Create the bucket - if !setupBucket(bucketName, false, nil, nil, nil, assert, 200) { - return - } - - // 2. Upload the object to the bucket - uploadResponse, uploadError := UploadAnObject(bucketName, fileName) - assert.Nil(uploadError) - if uploadError != nil { - log.Println(uploadError) - return - } - if uploadResponse != nil { - assert.Equal( - 200, - uploadResponse.StatusCode, - inspectHTTPResponse(uploadResponse), - ) - } - - type args struct { - prefix string - } - tests := []struct { - name string - expectedStatus int - args args - }{ - { - name: "Get metadata with valid prefix", - expectedStatus: 200, - args: args{ - prefix: validPrefix, - }, - }, - { - name: "Get metadata with invalid prefix", - expectedStatus: 500, - args: args{ - prefix: "invalidprefix", - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - // 3. Get the metadata from an object - getRsp, getErr := GetsTheMetadataOfAnObject( - bucketName, tt.args.prefix) - assert.Nil(getErr) - if getErr != nil { - log.Println(getErr) - return - } - if getRsp != nil { - assert.Equal( - tt.expectedStatus, - getRsp.StatusCode, - inspectHTTPResponse(getRsp), - ) - } - }) - } -} - -func TestPutObjectsRetentionStatus(t *testing.T) { - // Variables - assert := assert.New(t) - bucketName := "testputobjectsretentionstatus" - fileName := "testputobjectsretentionstatus.txt" - prefix := url.QueryEscape(fileName) - - // 1. Create bucket - if !setupBucket(bucketName, true, map[string]interface{}{"enabled": true}, nil, nil, assert, 200) { - return - } - - // 2. Add object - uploadResponse, uploadError := UploadAnObject( - bucketName, - fileName, - ) - assert.Nil(uploadError) - if uploadError != nil { - log.Println(uploadError) - return - } - addObjRsp := inspectHTTPResponse(uploadResponse) - if uploadResponse != nil { - assert.Equal( - 200, - uploadResponse.StatusCode, - addObjRsp, - ) - } - - // Get versionID - listResponse, _ := ListObjects(bucketName, prefix, true) - bodyBytes, _ := io.ReadAll(listResponse.Body) - listObjs := models.ListObjectsResponse{} - err := json.Unmarshal(bodyBytes, &listObjs) - if err != nil { - log.Println(err) - assert.Nil(err) - } - validVersionID := listObjs.Objects[0].VersionID - - type args struct { - versionID string - } - tests := []struct { - name string - expectedStatus int - args args - }{ - { - name: "Valid VersionID when putting object's retention status", - expectedStatus: 200, - args: args{ - versionID: url.QueryEscape(validVersionID), - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - // 3. Put Objects Legal Status - putResponse, putError := PutObjectsRetentionStatus( - bucketName, - prefix, - tt.args.versionID, - "compliance", - "2033-01-13T23:59:59Z", - false, - ) - if putError != nil { - log.Println(putError) - assert.Fail("Error putting the object's retention status") - } - if putResponse != nil { - assert.Equal( - tt.expectedStatus, - putResponse.StatusCode, - inspectHTTPResponse(putResponse), - ) - } - }) - } -} - -func TestShareObjectOnURL(t *testing.T) { - /* - Test to share an object via URL - */ - - // Vars - assert := assert.New(t) - bucketName := "testshareobjectonurl" - fileName := "testshareobjectonurl.txt" - validPrefix := url.QueryEscape(fileName) - tags := make(map[string]string) - tags["tag"] = "testputobjecttagbucketonetagone" - versionID := "null" - - // 1. Create the bucket - if !setupBucket(bucketName, false, nil, nil, nil, assert, 200) { - return - } - - // 2. Upload the object to the bucket - uploadResponse, uploadError := UploadAnObject(bucketName, fileName) - assert.Nil(uploadError) - if uploadError != nil { - log.Println(uploadError) - return - } - if uploadResponse != nil { - assert.Equal( - 200, - uploadResponse.StatusCode, - inspectHTTPResponse(uploadResponse), - ) - } - - type args struct { - prefix string - } - tests := []struct { - name string - expectedStatus int - args args - }{ - { - name: "Share File with valid prefix", - expectedStatus: 200, - args: args{ - prefix: validPrefix, - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - // 3. Share the object on a URL - shareResponse, shareError := SharesAnObjectOnAUrl(bucketName, tt.args.prefix, versionID, "604800s") - assert.Nil(shareError) - if shareError != nil { - log.Println(shareError) - return - } - finalResponse := inspectHTTPResponse(shareResponse) - if shareResponse != nil { - assert.Equal( - tt.expectedStatus, - shareResponse.StatusCode, - finalResponse, - ) - } - }) - } -} - -func TestListObjects(t *testing.T) { - /* - To test list objects end point. - */ - - // Test's variables - assert := assert.New(t) - bucketName := "testlistobjecttobucket1" - fileName := "testlistobjecttobucket1.txt" - - // 1. Create the bucket - if !setupBucket(bucketName, false, nil, nil, nil, assert, 200) { - return - } - - // 2. Upload the object to the bucket - uploadResponse, uploadError := UploadAnObject(bucketName, fileName) - assert.Nil(uploadError) - if uploadError != nil { - log.Println(uploadError) - return + // 2. Upload the object to the bucket + uploadResponse, uploadError := UploadAnObject(bucketName, fileName) + assert.Nil(uploadError) + if uploadError != nil { + log.Println(uploadError) + return } if uploadResponse != nil { assert.Equal(200, uploadResponse.StatusCode, @@ -1912,74 +1340,6 @@ func TestPutObjectTag(t *testing.T) { finalResponse) } -func TestBucketRetention(t *testing.T) { - /* - To test bucket retention feature - */ - - // 1. Create the bucket with 2 years validity retention - assert := assert.New(t) - /* - { - "name":"setbucketretention1", - "versioning":true, - "locking":true, - "retention": - { - "mode":"compliance", - "unit":"years", - "validity":2 - } - } - */ - retention := make(map[string]interface{}) - retention["mode"] = "compliance" - retention["unit"] = "years" - retention["validity"] = 2 - if !setupBucket("setbucketretention1", true, map[string]interface{}{"enabled": true}, nil, retention, assert, 200) { - return - } - - // 2. Set the bucket's retention from 2 years to 3 years - setBucketRetentionResponse, setBucketRetentionError := SetBucketRetention( - "setbucketretention1", - "compliance", - "years", - 3, - ) - assert.Nil(setBucketRetentionError) - if setBucketRetentionError != nil { - log.Println(setBucketRetentionError) - assert.Fail("Error setting the bucket retention") - return - } - if setBucketRetentionResponse != nil { - assert.Equal(200, setBucketRetentionResponse.StatusCode, - inspectHTTPResponse(setBucketRetentionResponse)) - } - - // 3. Verify the bucket's retention was properly set. - getBucketRetentionResponse, getBucketRetentionError := GetBucketRetention( - "setbucketretention1", - ) - assert.Nil(getBucketRetentionError) - if getBucketRetentionError != nil { - log.Println(getBucketRetentionError) - assert.Fail("Error getting the bucket's retention") - return - } - finalResponse := inspectHTTPResponse(getBucketRetentionResponse) - if getBucketRetentionResponse != nil { - assert.Equal( - 200, - getBucketRetentionResponse.StatusCode, - finalResponse, - ) - } - expected := "Http Response: {\"mode\":\"compliance\",\"unit\":\"years\",\"validity\":3}\n" - assert.Equal(expected, finalResponse, finalResponse) -} - func TestBucketInformationGenericErrorResponse(t *testing.T) { /* Test Bucket Info End Point with a Generic Error Response. @@ -2075,66 +1435,6 @@ func TestBucketInformationSuccessfulResponse(t *testing.T) { inspectHTTPResponse(bucketInfoResponse)) } -func TestDeleteBucket(t *testing.T) { - /* - Test to delete a bucket - */ - assert := assert.New(t) - type args struct { - bucketName string - createBucketName string - } - tests := []struct { - name string - args args - expectedStatus int - }{ - { - name: "Delete a bucket", - expectedStatus: 204, - args: args{ - bucketName: "testdeletebucket1", - createBucketName: "testdeletebucket1", - }, - }, { - name: "Delete invalid bucket", - expectedStatus: 404, - args: args{ - bucketName: "nonexistingbucket", - createBucketName: "", - }, - }, - } - - // Initialize minio client object. - minioClient, err := minio.New("localhost:9000", &minio.Options{ - Creds: credentials.NewStaticV4("minioadmin", "minioadmin", ""), - Secure: false, - }) - if err != nil { - log.Fatalln(err) - } - - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - // Create bucket if needed for the test - if tt.args.createBucketName != "" { - if err := minioClient.MakeBucket(context.Background(), tt.args.createBucketName, minio.MakeBucketOptions{}); err != nil { - assert.Failf("Failed to create bucket", "Could not create bucket %s: %v", tt.args.createBucketName, err) - } - } - - // Delete the bucket - deleteBucketResponse, deleteBucketError := DeleteBucket(tt.args.bucketName) - assert.Nil(deleteBucketError) - if deleteBucketResponse != nil { - assert.Equal( - tt.expectedStatus, deleteBucketResponse.StatusCode, "Status Code is incorrect") - } - }) - } -} - func TestListBuckets(t *testing.T) { /* Test the list of buckets without query parameters. @@ -2163,59 +1463,20 @@ func TestListBuckets(t *testing.T) { assert.Equal(200, listBucketsResponse.StatusCode, "Status Code is incorrect: "+string(b)) for i := 1; i <= numberOfBuckets; i++ { - assert.True(strings.Contains(string(b), - "testlistbuckets"+strconv.Itoa(i))) - } -} - -func TestBucketsGet(t *testing.T) { - assert := assert.New(t) - - client := &http.Client{ - Timeout: 2 * time.Second, - } - - // get list of buckets - request, err := http.NewRequest("GET", "http://localhost:9090/api/v1/buckets", nil) - if err != nil { - log.Println(err) - return - } - - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - - response, err := client.Do(request) - assert.Nil(err) - if err != nil { - log.Println(err) - return - } - - if response != nil { - assert.Equal(200, response.StatusCode, "Status Code is incorrect") - bodyBytes, _ := io.ReadAll(response.Body) - - listBuckets := models.ListBucketsResponse{} - err = json.Unmarshal(bodyBytes, &listBuckets) - if err != nil { - log.Println(err) - assert.Nil(err) - } - - assert.Greater(len(listBuckets.Buckets), 0, "No bucket was returned") - assert.Greater(listBuckets.Total, int64(0), "Total buckets is 0") - + assert.True(strings.Contains(string(b), + "testlistbuckets"+strconv.Itoa(i))) } } -func TestBucketVersioning(t *testing.T) { +func TestBucketsGet(t *testing.T) { assert := assert.New(t) client := &http.Client{ Timeout: 2 * time.Second, } - request, err := http.NewRequest("GET", "http://localhost:9090/api/v1/session", nil) + // get list of buckets + request, err := http.NewRequest("GET", "http://localhost:9090/api/v1/buckets", nil) if err != nil { log.Println(err) return @@ -2229,89 +1490,21 @@ func TestBucketVersioning(t *testing.T) { log.Println(err) return } - var distributedSystem bool if response != nil { - + assert.Equal(200, response.StatusCode, "Status Code is incorrect") bodyBytes, _ := io.ReadAll(response.Body) - sessionResponse := models.SessionResponse{} - err = json.Unmarshal(bodyBytes, &sessionResponse) + listBuckets := models.ListBucketsResponse{} + err = json.Unmarshal(bodyBytes, &listBuckets) if err != nil { log.Println(err) + assert.Nil(err) } - distributedSystem = sessionResponse.DistributedMode - - } - - requestDataVersioning := map[string]interface{}{ - "name": "test2", - "versioning": true, - "locking": false, - } - - requestDataJSON, _ := json.Marshal(requestDataVersioning) - - requestDataBody := bytes.NewReader(requestDataJSON) - - if !setupBucket("test2", true, nil, nil, nil, assert, 200) { - return - } - - // Read the HTTP Response and make sure we get: {"is_versioned":true} - getVersioningResult, getVersioningError := GetBucketVersioning("test2") - assert.Nil(getVersioningError) - if getVersioningError != nil { - log.Println(getVersioningError) - return - } - if getVersioningResult != nil { - assert.Equal( - 200, getVersioningResult.StatusCode, "Status Code is incorrect") - } - bodyBytes, _ := io.ReadAll(getVersioningResult.Body) - structBucketRepl := models.BucketVersioningResponse{ - ExcludeFolders: false, - ExcludedPrefixes: nil, - MFADelete: "", - Status: "", - } - err = json.Unmarshal(bodyBytes, &structBucketRepl) - if err != nil { - log.Println(err) - assert.Nil(err) - } - assert.Equal( - structBucketRepl.Status, - "Enabled", - structBucketRepl.Status, - ) - - fmt.Println("Versioned bucket creation test status:", response.Status) - if distributedSystem { - assert.Equal(200, response.StatusCode, "Versioning test Status Code is incorrect - bucket failed to create") - } else { - assert.NotEqual(200, response.StatusCode, "Versioning test Status Code is incorrect - versioned bucket created on non-distributed system") - } - - request, err = http.NewRequest("DELETE", "http://localhost:9090/api/v1/buckets/test2", requestDataBody) - if err != nil { - log.Println(err) - return - } - - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - - response, err = client.Do(request) - if err != nil { - log.Println(err) - return - } + assert.Greater(len(listBuckets.Buckets), 0, "No bucket was returned") + assert.Greater(listBuckets.Total, int64(0), "Total buckets is 0") - if response != nil { - fmt.Println("DELETE StatusCode:", response.StatusCode) } } @@ -2528,88 +1721,6 @@ func DeleteBucketEvent(bucketName, arn string, events []string, prefix, suffix s return response, err } -func TestDeleteBucketEvent(t *testing.T) { - // Variables - assert := assert.New(t) - - // 1. Add postgres notification - response, err := NotifyPostgres() - finalResponse := inspectHTTPResponse(response) - assert.Nil(err) - if err != nil { - log.Println(err) - assert.Fail(finalResponse) - return - } - if response != nil { - assert.Equal(200, response.StatusCode, finalResponse) - } - - // 2. Restart the system - restartResponse, restartError := RestartService() - assert.Nil(restartError) - if restartError != nil { - log.Println(restartError) - return - } - addObjRsp := inspectHTTPResponse(restartResponse) - if restartResponse != nil { - assert.Equal( - 204, - restartResponse.StatusCode, - addObjRsp, - ) - } - - // 3. Subscribe bucket to event - events := make([]string, 1) - events[0] = "put" - eventResponse, eventError := CreateBucketEvent( - "testputobjectslegalholdstatus", // bucket name - true, // ignore existing param - "arn:minio:sqs::_:postgresql", // arn - "", // prefix - "", // suffix - events, // events - ) - assert.Nil(eventError) - if eventError != nil { - log.Println(eventError) - return - } - finalResponseEvent := inspectHTTPResponse(eventResponse) - if eventResponse != nil { - assert.Equal( - 201, - eventResponse.StatusCode, - finalResponseEvent, - ) - } - - // 4. Delete Bucket Event - events[0] = "put" - deletEventResponse, deventError := DeleteBucketEvent( - "testputobjectslegalholdstatus", // bucket name - "arn:minio:sqs::_:postgresql", // arn - events, // events - "", // prefix - "", // suffix - ) - assert.Nil(deventError) - if deventError != nil { - log.Println(deventError) - return - } - efinalResponseEvent := inspectHTTPResponse(deletEventResponse) - if deletEventResponse != nil { - assert.Equal( - 204, - deletEventResponse.StatusCode, - efinalResponseEvent, - ) - } -} - func SetMultiBucketReplication(accessKey, secretKey, targetURL, region, originBucket, destinationBucket, syncMode string, bandwidth, healthCheckPeriod int, prefix, tags string, replicateDeleteMarkers, replicateDeletes bool, priority int, storageClass string, replicateMetadata bool) (*http.Response, error) { /* Helper function @@ -2775,150 +1886,6 @@ func DeleteBucketReplicationRule(bucketName, ruleID string) (*http.Response, err return response, err } -func TestReplication(t *testing.T) { - // Vars - assert := assert.New(t) - originBucket := "testputobjectslegalholdstatus" - destinationBuckets := []string{"testgetbucketquota", "testputbucketquota", "testlistbucketevents"} // an array of strings to iterate over - - // 1. Set replication rules with DIFFERENT PRIORITY <------- NOT SAME BUT DIFFERENT! 1, 2, etc. - for index, destinationBucket := range destinationBuckets { - response, err := SetMultiBucketReplication( - "minioadmin", // accessKey string - "minioadmin", // secretKey string - "http://localhost:9000/", // targetURL string - "", // region string - originBucket, // originBucket string - destinationBucket, // destinationBucket string - "async", // syncMode string - 107374182400, // bandwidth int - 60, // healthCheckPeriod int - "", // prefix string - "", // tags string - true, // replicateDeleteMarkers bool - true, // replicateDeletes bool - index+1, // priority int - "", // storageClass string - true, // replicateMetadata bool - ) - assert.Nil(err) - if err != nil { - log.Println(err) - return - } - finalResponse := inspectHTTPResponse(response) - if response != nil { - assert.Equal(200, response.StatusCode, finalResponse) - } - - } - - // 2. Get replication, at this point four rules are expected - response, err := GetBucketReplication(originBucket) - assert.Nil(err) - if err != nil { - log.Println(err) - return - } - if response != nil { - assert.Equal(200, response.StatusCode, "error invalid status") - } - - // 3. Get rule ID and status from response's body - bodyBytes, _ := io.ReadAll(response.Body) - structBucketRepl := models.BucketReplicationResponse{} - err = json.Unmarshal(bodyBytes, &structBucketRepl) - if err != nil { - log.Println(err) - assert.Nil(err) - } - - assert.Greater(len(structBucketRepl.Rules), 0, "Number of expected rules is 0") - if len(structBucketRepl.Rules) == 0 || len(structBucketRepl.Rules) < 3 { - return - } - // 4. Verify rules are enabled - for index := 0; index < 3; index++ { - Status := structBucketRepl.Rules[index].Status - assert.Equal(Status, "Enabled") - } - - // 5. Delete 3rd and 4th rules with endpoint for multiple rules: - // /buckets/{bucket_name}/replication/{rule_id} - ruleIDs := []string{structBucketRepl.Rules[2].ID} // To delete 3rd rule with the multi delete function - response, err = DeleteMultipleReplicationRules( - originBucket, - ruleIDs, - ) - assert.Nil(err) - if err != nil { - log.Println(err) - return - } - finalResponse := inspectHTTPResponse(response) - if response != nil { - assert.Equal(204, response.StatusCode, finalResponse) - } - - // 6. Delete 2nd rule only with dedicated end point for single rules: - // /buckets/{bucket_name}/replication/{rule_id} - ruleID := structBucketRepl.Rules[1].ID // To delete 2nd rule in a single way - response, err = DeleteBucketReplicationRule( - originBucket, - ruleID, - ) - assert.Nil(err) - if err != nil { - log.Println(err) - return - } - finalResponse = inspectHTTPResponse(response) - if response != nil { - // https://github.com/minio/minio/pull/14972 - // Disallow deletion of arn when active replication config - // 204 is no longer expected but 500 - assert.Equal(500, response.StatusCode, finalResponse) - } - - // 7. Delete remaining Bucket Replication Rule with generic end point: - // /buckets/{bucket_name}/delete-all-replication-rules - response, err = DeletesAllReplicationRulesOnABucket( - originBucket, - ) - assert.Nil(err) - if err != nil { - log.Println(err) - return - } - finalResponse = inspectHTTPResponse(response) - if response != nil { - assert.Equal(204, response.StatusCode, finalResponse) - } - - // 8. Get replication, at this point zero rules are expected - response, err = GetBucketReplication(originBucket) - assert.Nil(err) - if err != nil { - log.Println(err) - return - } - if response != nil { - assert.Equal(200, response.StatusCode, "error invalid status") - } - - // 9. Get rule ID and status from response's body - bodyBytes, _ = io.ReadAll(response.Body) - structBucketRepl = models.BucketReplicationResponse{} - err = json.Unmarshal(bodyBytes, &structBucketRepl) - if err != nil { - log.Println(err) - assert.Nil(err) - } - expected := 0 - actual := len(structBucketRepl.Rules) - assert.Equal(expected, actual, "Delete failed") -} - func GetBucketVersioning(bucketName string) (*http.Response, error) { /* Helper function to get bucket's versioning @@ -2953,41 +1920,6 @@ func BaseGetFunction(bucketName, endPoint string) (*http.Response, error) { return response, err } -func TestReturnsTheStatusOfObjectLockingSupportOnTheBucket(t *testing.T) { - // Test for end point: /buckets/{bucket_name}/object-locking - - // Vars - assert := assert.New(t) - bucketName := "testputobjectslegalholdstatus" - - // 1. Get the status - response, err := ReturnsTheStatusOfObjectLockingSupportOnTheBucket( - bucketName, - ) - assert.Nil(err) - if err != nil { - log.Println(err) - return - } - if response != nil { - assert.Equal(200, response.StatusCode, "error invalid status") - } - - // 2. Verify the status to be enabled for this bucket - bodyBytes, _ := io.ReadAll(response.Body) - structBucketLocking := models.BucketObLockingResponse{} - err = json.Unmarshal(bodyBytes, &structBucketLocking) - if err != nil { - log.Println(err) - assert.Nil(err) - } - assert.Equal( - structBucketLocking.ObjectLockingEnabled, - true, - structBucketLocking, - ) -} - func SetBucketVersioning(bucketName string, versioning map[string]interface{}, endpoint, useToken *string) (*http.Response, error) { /* Helper function to set Bucket Versioning @@ -3055,129 +1987,50 @@ func TestSetBucketVersioning(t *testing.T) { assert.Equal( 200, getVersioningResult.StatusCode, "Status Code is incorrect") } - bodyBytes, _ := io.ReadAll(getVersioningResult.Body) - result := models.BucketVersioningResponse{ - ExcludeFolders: false, - ExcludedPrefixes: nil, - MFADelete: "", - Status: "", - } - err = json.Unmarshal(bodyBytes, &result) - if err != nil { - log.Println(err) - assert.Nil(err) - } - assert.Equal("Suspended", result.Status, result) -} - -func EnableBucketEncryption(bucketName, encType, kmsKeyID string) (*http.Response, error) { - // Helper function to enable bucket encryption - // HTTP Verb: POST - // URL: /buckets/{bucket_name}/encryption/enable - // Body: - // { - // "encType":"sse-s3", - // "kmsKeyID":"" - // } - requestDataAdd := map[string]interface{}{ - "encType": encType, - "kmsKeyID": kmsKeyID, - } - requestDataJSON, _ := json.Marshal(requestDataAdd) - requestDataBody := bytes.NewReader(requestDataJSON) - request, err := http.NewRequest( - "POST", "http://localhost:9090/api/v1/buckets/"+bucketName+"/encryption/enable", requestDataBody) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - - // Performing the call - client := &http.Client{ - Timeout: 2 * time.Second, - } - response, err := client.Do(request) - return response, err -} - -func TestEnableBucketEncryption(t *testing.T) { - // Variables - assert := assert.New(t) - bucketName := "test-enable-bucket-encryption" - locking := false - encType := "sse-s3" - kmsKeyID := "" - - // 1. Add bucket - if !setupBucket(bucketName, locking, nil, nil, nil, assert, 200) { - return - } - - // 2. Enable Bucket's Encryption - resp, err := EnableBucketEncryption(bucketName, encType, kmsKeyID) - assert.Nil(err) - if err != nil { - log.Println(err) - return - } - if resp != nil { - assert.Equal( - 200, resp.StatusCode, "Status Code is incorrect") - } - - // 3. Get Bucket Encryption Information to verify it got encrypted. - resp, err = GetBucketEncryptionInformation(bucketName) - assert.Nil(err) - if err != nil { - log.Println(err) - return - } - if resp != nil { - assert.Equal( - 200, resp.StatusCode, "Status Code is incorrect") - } - bodyBytes, _ := io.ReadAll(resp.Body) - result := models.BucketEncryptionInfo{} + bodyBytes, _ := io.ReadAll(getVersioningResult.Body) + result := models.BucketVersioningResponse{ + ExcludeFolders: false, + ExcludedPrefixes: nil, + MFADelete: "", + Status: "", + } err = json.Unmarshal(bodyBytes, &result) if err != nil { log.Println(err) assert.Nil(err) } - assert.Equal("AES256", result.Algorithm, result) + assert.Equal("Suspended", result.Status, result) +} - // 4. Disable Bucket's Encryption - resp, err = DisableBucketEncryption(bucketName) - assert.Nil(err) - if err != nil { - log.Println(err) - return - } - if resp != nil { - assert.Equal( - 200, resp.StatusCode, "Status Code is incorrect") +func EnableBucketEncryption(bucketName, encType, kmsKeyID string) (*http.Response, error) { + // Helper function to enable bucket encryption + // HTTP Verb: POST + // URL: /buckets/{bucket_name}/encryption/enable + // Body: + // { + // "encType":"sse-s3", + // "kmsKeyID":"" + // } + requestDataAdd := map[string]interface{}{ + "encType": encType, + "kmsKeyID": kmsKeyID, } - - // 5. Verify encryption got disabled. - resp, err = GetBucketEncryptionInformation(bucketName) - assert.Nil(err) + requestDataJSON, _ := json.Marshal(requestDataAdd) + requestDataBody := bytes.NewReader(requestDataJSON) + request, err := http.NewRequest( + "POST", "http://localhost:9090/api/v1/buckets/"+bucketName+"/encryption/enable", requestDataBody) if err != nil { log.Println(err) - return - } - if resp != nil { - assert.Equal( - 404, resp.StatusCode, "Status Code is incorrect") } - bodyBytes, _ = io.ReadAll(resp.Body) - result2 := models.APIError{} - err = json.Unmarshal(bodyBytes, &result2) - if err != nil { - log.Println(err) - assert.Nil(err) + request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) + request.Header.Add("Content-Type", "application/json") + + // Performing the call + client := &http.Client{ + Timeout: 2 * time.Second, } - dereferencedPointerDetailedMessage := result2.DetailedMessage - assert.Equal("error server side encryption configuration not found", dereferencedPointerDetailedMessage, dereferencedPointerDetailedMessage) + response, err := client.Do(request) + return response, err } func GetBucketEncryptionInformation(bucketName string) (*http.Response, error) { @@ -3308,99 +2161,6 @@ func DeleteAccessRuleWithBucket(bucketName, prefix string) (*http.Response, erro return response, err } -func TestAccessRule(t *testing.T) { - // Variables - assert := assert.New(t) - bucketName := "test-access-rule-bucket" - locking := false - prefix := "prefix" - access := "readonly" - - // 1. Add bucket - if !setupBucket(bucketName, locking, nil, nil, nil, assert, 200) { - return - } - - // 2. Set Access Rule With Bucket - resp, err := SetAccessRuleWithBucket( - bucketName, - prefix, - access, - ) - assert.Nil(err) - if err != nil { - log.Println(err) - return - } - if resp != nil { - assert.Equal( - 200, resp.StatusCode, "Status Code is incorrect") - } - - // 3. List Access Rule - resp, err = ListAccessRulesWithBucket(bucketName) - assert.Nil(err) - if err != nil { - log.Println(err) - return - } - if resp != nil { - assert.Equal( - 200, resp.StatusCode, "Status Code is incorrect") - } - bodyBytes, _ := io.ReadAll(resp.Body) - result := models.ListAccessRulesResponse{} - err = json.Unmarshal(bodyBytes, &result) - if err != nil { - log.Println(err) - assert.Nil(err) - } - Access := &result.AccessRules[0].Access - Prefix := &result.AccessRules[0].Prefix - assert.Equal("readonly", *Access, *Access) - assert.Equal("prefix", *Prefix, *Prefix) - - // 4. Delete Access Rule - resp, err = DeleteAccessRuleWithBucket( - bucketName, - prefix, - ) - assert.Nil(err) - if err != nil { - log.Println(err) - return - } - if resp != nil { - assert.Equal( - 200, resp.StatusCode, "Status Code is incorrect") - } - - // 5. Verify access rule was deleted - resp, err = ListAccessRulesWithBucket(bucketName) - assert.Nil(err) - if err != nil { - log.Println(err) - return - } - if resp != nil { - assert.Equal( - 200, resp.StatusCode, "Status Code is incorrect") - } - bodyBytes, _ = io.ReadAll(resp.Body) - result = models.ListAccessRulesResponse{} - err = json.Unmarshal(bodyBytes, &result) - if err != nil { - log.Println(err) - assert.Nil(err) - } - AccessRules := &result.AccessRules // The array has to be empty, no index accessible - if len(*AccessRules) == 0 { - fmt.Println("Cool, access rules are gone from this bucket") - } else { - assert.Fail("Access Rule not deleted") - } -} - func GetBucketRewind(bucketName, date string) (*http.Response, error) { /* Helper function to get objects in a bucket for a rewind date @@ -3442,241 +2202,3 @@ func TestGetBucketRewind(t *testing.T) { 200, resp.StatusCode, inspectHTTPResponse(resp)) } } - -func GetRemoteBucket() (*http.Response, error) { - request, err := http.NewRequest( - "GET", - "http://localhost:9090/api/v1/remote-buckets", - nil, - ) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - client := &http.Client{ - Timeout: 2 * time.Second, - } - response, err := client.Do(request) - return response, err -} - -func GetRemoteBucketARN(sourceBucket string) (*http.Response, error) { - request, err := http.NewRequest( - "GET", - fmt.Sprintf("http://localhost:9090/api/v1/remote-buckets/%s", sourceBucket), - nil, - ) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - client := &http.Client{ - Timeout: 2 * time.Second, - } - response, err := client.Do(request) - return response, err -} - -func AddRemoteBucket(accessKey, secretKey, targetURL, sourceBucket, targetBucket string) (*http.Response, error) { - // Needed Parameters for API Call - bucketsRelationArray := make([]map[string]interface{}, 1) - bucketsRelationIndex0 := map[string]interface{}{ - "originBucket": sourceBucket, - "destinationBucket": targetBucket, - } - bucketsRelationArray[0] = bucketsRelationIndex0 - requestDataAdd := map[string]interface{}{ - "accessKey": accessKey, - "secretKey": secretKey, - "targetURL": targetURL, - "sourceBucket": sourceBucket, - "targetBucket": targetBucket, - "region": "", - "bucketsRelation": bucketsRelationArray, - "syncMode": "async", - "bandwidth": 107374182400, - "healthCheckPeriod": 60, - "prefix": "", - "tags": "", - "replicateDeleteMarkers": true, - "replicateDeletes": true, - "priority": 1, - "storageClass": "", - "replicateMetadata": true, - } - - // Creating the Call by adding the URL and Headers - requestDataJSON, _ := json.Marshal(requestDataAdd) - requestDataBody := bytes.NewReader(requestDataJSON) - request, err := http.NewRequest( - "POST", - "http://localhost:9090/api/v1/remote-buckets", - requestDataBody, - ) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - - // Performing the call - client := &http.Client{ - Timeout: 2 * time.Second, - } - response, err := client.Do(request) - return response, err -} - -func DeleteRemoteBucket(sourceBucket string, arn string) (*http.Response, error) { - // Needed Parameters for API Call - request, err := http.NewRequest( - "DELETE", - fmt.Sprintf("http://localhost:9090/api/v1/remote-buckets/%s/%s", sourceBucket, arn), - nil, - ) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - - // Performing the call - client := &http.Client{ - Timeout: 2 * time.Second, - } - response, err := client.Do(request) - return response, err -} - -func TestAddRemoteBucket(t *testing.T) { - // Variables - assert := assert.New(t) - accessKey := "minioadmin" - secretKey := "minioadmin" - targetURL := "http://173.18.0.3:9001" - sourceBucket := "source" - targetBucket := "targetbucket" - fmt.Println("targetBucket: ", targetBucket) - - // 1. Create bucket - if !setupBucket("source", true, map[string]interface{}{"enabled": true}, nil, nil, assert, 200) { - return - } - // 1.1. Create target bucket - targetEndpoint := "http://localhost:9092" - targetToken := getTokenForEndpoint(targetEndpoint) - if !setupBucketForEndpoint(targetBucket, true, map[string]interface{}{"enabled": true}, nil, nil, assert, 200, &targetEndpoint, &targetToken) { - log.Println("bucket already exists") - } - _, err := SetBucketVersioning(targetBucket, map[string]interface{}{"enabled": false}, &targetURL, &targetToken) - if err != nil { - log.Println("bucket already has versioning") - } - - // 2. Add Remote Bucket - resp, err := AddRemoteBucket( - accessKey, - secretKey, - targetURL, - sourceBucket, - targetBucket, - ) - assert.Nil(err) - if err != nil { - log.Println(err) - return - } - if resp != nil { - assert.Equal( - 201, resp.StatusCode, inspectHTTPResponse(resp)) - } - - // 3. Verify Remote Bucket was created - resp, err = GetRemoteBucket() - assert.Nil(err) - if err != nil { - log.Println(err) - return - } - finalResponse := inspectHTTPResponse(resp) - if resp != nil { - assert.Equal( - 200, resp.StatusCode, finalResponse) - } - fmt.Println("finalResponse: ", finalResponse) - assert.Equal(strings.Contains(finalResponse, targetBucket), true) -} - -func TestDeleteRemoteBucket(t *testing.T) { - // Variables - assert := assert.New(t) - accessKey := "minioadmin" - secretKey := "minioadmin" - targetURL := "http://173.18.0.3:9001" - sourceBucket := "deletesource" - targetBucket := "targetbucket2" - fmt.Println("targetBucket: ", targetBucket) - - // 1. Create bucket - if !setupBucket("deletesource", true, map[string]interface{}{"enabled": true}, nil, nil, assert, 200) { - return - } - // 1.1. Create target bucket - targetEndpoint := "http://localhost:9092" - targetToken := getTokenForEndpoint(targetEndpoint) - if !setupBucketForEndpoint(targetBucket, true, map[string]interface{}{"enabled": true}, nil, nil, assert, 200, &targetEndpoint, &targetToken) { - log.Println("bucket already exists") - } - _, err := SetBucketVersioning(targetBucket, map[string]interface{}{"enabled": false}, &targetURL, &targetToken) - if err != nil { - log.Println("bucket already has versioning") - } - - // 2. Add Remote Bucket - resp, err := AddRemoteBucket( - accessKey, - secretKey, - targetURL, - sourceBucket, - targetBucket, - ) - assert.Nil(err) - if err != nil { - log.Println(err) - return - } - if resp != nil { - assert.Equal( - 201, resp.StatusCode, inspectHTTPResponse(resp)) - } - - // 3. Get ARN - resp, err = GetRemoteBucketARN(sourceBucket) - assert.Nil(err) - assert.NotNil(resp) - assert.NotNil(resp.Body) - bodyBytes, _ := io.ReadAll(resp.Body) - remoteBucket := models.RemoteBucket{} - err = json.Unmarshal(bodyBytes, &remoteBucket) - assert.Nil(err) - assert.Equal(200, resp.StatusCode, inspectHTTPResponse(resp)) - - // 4. Delete Remote Bucket - if remoteBucket.RemoteARN != nil { - resp, err = DeleteRemoteBucket(sourceBucket, *remoteBucket.RemoteARN) - assert.Nil(err) - if err != nil { - log.Println(err) - return - } - finalResponse := inspectHTTPResponse(resp) - if resp != nil { - assert.Equal( - 204, resp.StatusCode, finalResponse) - } - } else { - assert.Fail("No remote arn response") - } -} diff --git a/integration/users_test.go b/integration/users_test.go deleted file mode 100644 index 2b7df9db03..0000000000 --- a/integration/users_test.go +++ /dev/null @@ -1,911 +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 . - -package integration - -import ( - "bytes" - "encoding/json" - "fmt" - "io" - "log" - "net/http" - "net/url" - "strconv" - "strings" - "testing" - "time" - - "github.com/stretchr/testify/assert" -) - -func AddUser(accessKey, secretKey string, groups, policies []string) (*http.Response, error) { - /* - This is an atomic function to add user and can be reused across - different functions. - */ - client := &http.Client{ - Timeout: 3 * time.Second, - } - - requestDataAdd := map[string]interface{}{ - "accessKey": accessKey, - "secretKey": secretKey, - "groups": groups, - "policies": policies, - } - - requestDataJSON, _ := json.Marshal(requestDataAdd) - requestDataBody := bytes.NewReader(requestDataJSON) - request, err := http.NewRequest( - "POST", "http://localhost:9090/api/v1/users", requestDataBody) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - - response, err := client.Do(request) - return response, err -} - -func DeleteUser(userName string) (*http.Response, error) { - /* - This is an atomic function to delete user and can be reused across - different functions. - */ - client := &http.Client{ - Timeout: 3 * time.Second, - } - request, err := http.NewRequest( - "DELETE", "http://localhost:9090/api/v1/user/"+url.PathEscape(userName), nil) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - response, err := client.Do(request) - return response, err -} - -func ListUsers(offset, limit string) (*http.Response, error) { - /* - This is an atomic function to list users. - {{baseUrl}}/users?offset=-5480083&limit=-5480083 - */ - client := &http.Client{ - Timeout: 3 * time.Second, - } - request, err := http.NewRequest( - "GET", - "http://localhost:9090/api/v1/users?offset="+offset+"&limit="+limit, - nil) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - response, err := client.Do(request) - return response, err -} - -func GetUserInformation(userName string) (*http.Response, error) { - /* - Helper function to get user information via API: - {{baseUrl}}/user?name=proident velit - */ - client := &http.Client{ - Timeout: 3 * time.Second, - } - request, err := http.NewRequest( - "GET", - "http://localhost:9090/api/v1/user/"+url.PathEscape(userName), - nil) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - response, err := client.Do(request) - return response, err -} - -func UpdateUserInformation(name, status string, groups []string) (*http.Response, error) { - /* - Helper function to update user information: - PUT: {{baseUrl}}/user?name=proident velit - Body: - { - "status": "nisi voluptate amet ea", - "groups": [ - "ipsum eu cupidatat", - "aliquip non nulla" - ] - } - */ - client := &http.Client{ - Timeout: 3 * time.Second, - } - requestDataAdd := map[string]interface{}{ - "status": status, - "groups": groups, - } - requestDataJSON, _ := json.Marshal(requestDataAdd) - requestDataBody := bytes.NewReader(requestDataJSON) - request, err := http.NewRequest( - "PUT", "http://localhost:9090/api/v1/user/"+url.PathEscape(name), requestDataBody) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - response, err := client.Do(request) - return response, err -} - -func RemoveUser(name string) (*http.Response, error) { - /* - Helper function to remove user. - DELETE: {{baseUrl}}/user?name=proident velit - */ - client := &http.Client{ - Timeout: 3 * time.Second, - } - request, err := http.NewRequest( - "DELETE", "http://localhost:9090/api/v1/user/"+url.PathEscape(name), nil) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - response, err := client.Do(request) - return response, err -} - -func UpdateGroupsForAUser(userName string, groups []string) (*http.Response, error) { - /* - Helper function to update groups for a user - PUT: {{baseUrl}}/user/groups?name=username - { - "groups":[ - "groupone", - "grouptwo" - ] - } - */ - client := &http.Client{ - Timeout: 3 * time.Second, - } - requestDataAdd := map[string]interface{}{ - "groups": groups, - } - requestDataJSON, _ := json.Marshal(requestDataAdd) - requestDataBody := bytes.NewReader(requestDataJSON) - request, err := http.NewRequest( - "PUT", - "http://localhost:9090/api/v1/user/"+url.PathEscape(userName)+"/groups", - requestDataBody, - ) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - response, err := client.Do(request) - return response, err -} - -func CreateServiceAccountForUser(userName, policy string) (*http.Response, error) { - /* - Helper function to Create Service Account for user - POST: api/v1/user/username/service-accounts - { - "policy": "ad magna" - } - */ - client := &http.Client{ - Timeout: 3 * time.Second, - } - requestDataAdd := map[string]interface{}{ - "policy": policy, - } - requestDataJSON, _ := json.Marshal(requestDataAdd) - requestDataBody := bytes.NewReader(requestDataJSON) - request, err := http.NewRequest( - "POST", - "http://localhost:9090/api/v1/user/"+url.PathEscape(userName)+"/service-accounts", - requestDataBody, - ) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - response, err := client.Do(request) - return response, err -} - -func CreateServiceAccountForUserWithCredentials(userName, policy, accessKey, secretKey string) (*http.Response, error) { - // Helper function to test "Create Service Account for User With Credentials" end point. - client := &http.Client{ - Timeout: 3 * time.Second, - } - requestDataAdd := map[string]interface{}{ - "policy": policy, - "accessKey": accessKey, - "secretKey": secretKey, - } - requestDataJSON, _ := json.Marshal(requestDataAdd) - requestDataBody := bytes.NewReader(requestDataJSON) - request, err := http.NewRequest( - "POST", - "http://localhost:9090/api/v1/user/"+url.PathEscape(userName)+"/service-account-credentials", - requestDataBody, - ) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - response, err := client.Do(request) - return response, err -} - -func ReturnsAListOfServiceAccountsForAUser(userName string) (*http.Response, error) { - /* - Helper function to return a list of service accounts for a user. - GET: {{baseUrl}}/user/:name/service-accounts - */ - client := &http.Client{ - Timeout: 3 * time.Second, - } - request, err := http.NewRequest( - "GET", - "http://localhost:9090/api/v1/user/"+url.PathEscape(userName)+"/service-accounts", - nil, - ) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - response, err := client.Do(request) - return response, err -} - -func AddGroup(group string, members []string) (*http.Response, error) { - /* - Helper function to add a group. - */ - client := &http.Client{ - Timeout: 3 * time.Second, - } - requestDataAdd := map[string]interface{}{ - "group": group, - "members": members, - } - requestDataJSON, _ := json.Marshal(requestDataAdd) - requestDataBody := bytes.NewReader(requestDataJSON) - request, err := http.NewRequest( - "POST", - "http://localhost:9090/api/v1/groups", - requestDataBody, - ) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - response, err := client.Do(request) - return response, err -} - -func UsersGroupsBulk(users, groups []string) (*http.Response, error) { - /* - Helper function to test Bulk functionality to Add Users to Groups. - PUT: {{baseUrl}}/users-groups-bulk - { - "users": [ - "magna id", - "enim sit tempor incididunt" - ], - "groups": [ - "nisi est esse", - "fugiat eu" - ] - } - */ - requestDataAdd := map[string]interface{}{ - "users": users, - "groups": groups, - } - requestDataJSON, _ := json.Marshal(requestDataAdd) - requestDataBody := bytes.NewReader(requestDataJSON) - request, err := http.NewRequest( - "PUT", - "http://localhost:9090/api/v1/users-groups-bulk", - requestDataBody, - ) - if err != nil { - log.Println(err) - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - client := &http.Client{ - Timeout: 2 * time.Second, - } - response, err := client.Do(request) - return response, err -} - -func TestAddUser(t *testing.T) { - /* - This is an API Test to add a user via api/v1/users, the intention - is simple, add a user and make sure the response is 201 meaning that the - user got added successfully. - After test completion, it is expected that user is removed, so other - tests like users.ts can run over clean data and we don't collide against - it. - */ - - assert := assert.New(t) - - // With no groups & no policies - groups := []string{} - policies := []string{} - response, err := AddUser("accessKey", "secretKey", groups, policies) - if err != nil { - log.Println(err) - return - } - if response != nil { - fmt.Println("POST StatusCode:", response.StatusCode) - assert.Equal(201, response.StatusCode, "Status Code is incorrect") - } - - response, err = DeleteUser("accessKey") - if err != nil { - log.Println(err) - return - } - if response != nil { - fmt.Println("DELETE StatusCode:", response.StatusCode) - assert.Equal(204, response.StatusCode, "has to be 204 when delete user") - } -} - -func TestListUsers(t *testing.T) { - /* - This test is intended to list users via API. - 1. First, it creates the users - 2. Then, it lists the users <------ 200 is expected when listing them. - 3. Finally, it deletes the users - */ - - assert := assert.New(t) - - // With no groups & no policies - groups := []string{} - policies := []string{} - - // 1. Create the users - numberOfUsers := 5 - for i := 1; i < numberOfUsers; i++ { - response, err := AddUser( - strconv.Itoa(i)+"accessKey"+strconv.Itoa(i), - "secretKey"+strconv.Itoa(i), groups, policies) - if err != nil { - log.Println(err) - return - } - if response != nil { - fmt.Println("POST StatusCode:", response.StatusCode) - assert.Equal(201, response.StatusCode, - "Status Code is incorrect on index: "+strconv.Itoa(i)) - } - - b, err := io.ReadAll(response.Body) - if err != nil { - log.Fatalln(err) - } - fmt.Println(string(b)) - } - - // 2. List the users - listResponse, listError := ListUsers("-5480083", "-5480083") - if listError != nil { - log.Fatalln(listError) - } - if listResponse != nil { - fmt.Println("POST StatusCode:", listResponse.StatusCode) - assert.Equal(200, listResponse.StatusCode, - "TestListUsers(): Status Code is incorrect when listing users") - } - b, err := io.ReadAll(listResponse.Body) - if err != nil { - log.Fatalln(err) - } - fmt.Println(string(b)) - - // 3. Delete the users - for i := 1; i < numberOfUsers; i++ { - response, err := DeleteUser( - strconv.Itoa(i) + "accessKey" + strconv.Itoa(i)) - if err != nil { - log.Println(err) - return - } - if response != nil { - fmt.Println("DELETE StatusCode:", response.StatusCode) - assert.Equal(204, - response.StatusCode, "has to be 204 when delete user") - } - } -} - -func TestGetUserInfo(t *testing.T) { - /* - Test to get the user information via API. - */ - - // 1. Create the user - fmt.Println("TestGetUserInfo(): 1. Create the user") - assert := assert.New(t) - groups := []string{} - policies := []string{} - response, err := AddUser("accessKey", "secretKey", groups, policies) - if err != nil { - log.Println(err) - return - } - if response != nil { - fmt.Println("POST StatusCode:", response.StatusCode) - assert.Equal(201, response.StatusCode, "Status Code is incorrect") - } - - // 2. Get user information - fmt.Println("TestGetUserInfo(): 2. Get user information") - response, err = GetUserInformation("accessKey") - if err != nil { - log.Println(err) - assert.Fail("There was an error in the response") - return - } - - // 3. Verify user information - fmt.Println("TestGetUserInfo(): 3. Verify user information") - if response != nil { - fmt.Println("POST StatusCode:", response.StatusCode) - assert.Equal(200, response.StatusCode, "Status Code is incorrect") - } - b, err := io.ReadAll(response.Body) - if err != nil { - log.Fatalln(err) - } - fmt.Println(string(b)) - expected := "{\"accessKey\":\"accessKey\",\"memberOf\":null,\"policy\":[],\"status\":\"enabled\"}\n" - obtained := string(b) - assert.Equal(expected, obtained, "User Information is wrong") -} - -func TestUpdateUserInfoSuccessfulResponse(t *testing.T) { - /* - Update User Information Test with Successful Response - */ - - assert := assert.New(t) - - // 1. Create an active user - groups := []string{} - policies := []string{} - addUserResponse, addUserError := AddUser( - "updateuser", "secretKey", groups, policies) - if addUserError != nil { - log.Println(addUserError) - return - } - if addUserResponse != nil { - fmt.Println("StatusCode:", addUserResponse.StatusCode) - assert.Equal( - 201, addUserResponse.StatusCode, "Status Code is incorrect") - } - - // 2. Deactivate the user - // '{"status":"disabled","groups":[]}' - updateUserResponse, UpdateUserError := UpdateUserInformation( - "updateuser", "disabled", groups) - - // 3. Verify user got deactivated - if UpdateUserError != nil { - log.Println(UpdateUserError) - return - } - if updateUserResponse != nil { - fmt.Println("StatusCode:", updateUserResponse.StatusCode) - assert.Equal( - 200, updateUserResponse.StatusCode, "Status Code is incorrect") - } - b, err := io.ReadAll(updateUserResponse.Body) - if err != nil { - log.Fatalln(err) - } - assert.True(strings.Contains(string(b), "disabled")) -} - -func TestUpdateUserInfoGenericErrorResponse(t *testing.T) { - /* - Update User Information Test with Generic Error Response - */ - - assert := assert.New(t) - - // 1. Create an active user - groups := []string{} - policies := []string{} - addUserResponse, addUserError := AddUser( - "updateusererror", "secretKey", groups, policies) - if addUserError != nil { - log.Println(addUserError) - return - } - if addUserResponse != nil { - fmt.Println("StatusCode:", addUserResponse.StatusCode) - assert.Equal( - 201, addUserResponse.StatusCode, "Status Code is incorrect") - } - - // 2. Deactivate the user with wrong status - updateUserResponse, UpdateUserError := UpdateUserInformation( - "updateusererror", "inactive", groups) - - // 3. Verify user got deactivated - if UpdateUserError != nil { - log.Println(UpdateUserError) - assert.Fail("There was an error while updating user info") - return - } - if updateUserResponse != nil { - fmt.Println("StatusCode:", updateUserResponse.StatusCode) - assert.Equal( - 500, updateUserResponse.StatusCode, "Status Code is incorrect") - } - b, err := io.ReadAll(updateUserResponse.Body) - if err != nil { - log.Fatalln(err) - } - assert.True(strings.Contains(string(b), "status not valid")) -} - -func TestRemoveUserSuccessfulResponse(t *testing.T) { - /* - To test removing a user from API - */ - - assert := assert.New(t) - - // 1. Create an active user - groups := []string{} - policies := []string{} - addUserResponse, addUserError := AddUser( - "testremoveuser1", "secretKey", groups, policies) - if addUserError != nil { - log.Println(addUserError) - return - } - if addUserResponse != nil { - fmt.Println("StatusCode:", addUserResponse.StatusCode) - assert.Equal( - 201, addUserResponse.StatusCode, "Status Code is incorrect") - } - - // 2. Remove the user - removeUserResponse, removeUserError := RemoveUser("testremoveuser1") - if removeUserError != nil { - log.Println(removeUserError) - return - } - if removeUserResponse != nil { - fmt.Println("StatusCode:", removeUserResponse.StatusCode) - assert.Equal( - 204, removeUserResponse.StatusCode, "Status Code is incorrect") - } - - // 3. Verify the user got removed - getUserInfoResponse, getUserInfoError := GetUserInformation( - "testremoveuser1") - if getUserInfoError != nil { - log.Println(getUserInfoError) - assert.Fail("There was an error in the response") - return - } - if getUserInfoResponse != nil { - fmt.Println("StatusCode:", getUserInfoResponse.StatusCode) - assert.Equal( - 404, getUserInfoResponse.StatusCode, "Status Code is incorrect") - } - finalResponse := inspectHTTPResponse(getUserInfoResponse) - fmt.Println(finalResponse) - assert.True(strings.Contains( - finalResponse, "The specified user does not exist"), finalResponse) -} - -func TestUpdateGroupsForAUser(t *testing.T) { - /* - To test Update Groups For a User End Point. - */ - - // 1. Create the user - numberOfGroups := 3 - groupName := "updategroupforausergroup" - userName := "updategroupsforauser1" - assert := assert.New(t) - groups := []string{} - policies := []string{} - response, err := AddUser(userName, "secretKey", groups, policies) - if err != nil { - log.Println(err) - return - } - if response != nil { - fmt.Println("StatusCode:", response.StatusCode) - assert.Equal(201, response.StatusCode, "Status Code is incorrect") - } - - // 2. Update the groups of the created user with newGroups - newGroups := make([]string, 3) - for i := 0; i < numberOfGroups; i++ { - newGroups[i] = groupName + strconv.Itoa(i) - } - response, err = UpdateGroupsForAUser(userName, newGroups) - if err != nil { - log.Println(err) - return - } - if response != nil { - fmt.Println("StatusCode:", response.StatusCode) - assert.Equal(200, response.StatusCode, "Status Code is incorrect") - } - - // 3. Verify the newGroups were updated accordingly - getUserInfoResponse, getUserInfoErr := GetUserInformation(userName) - if getUserInfoErr != nil { - log.Println(getUserInfoErr) - assert.Fail("There was an error in the response") - return - } - if getUserInfoResponse != nil { - fmt.Println("StatusCode:", getUserInfoResponse.StatusCode) - assert.Equal( - 200, getUserInfoResponse.StatusCode, "Status Code is incorrect") - } - finalResponse := inspectHTTPResponse(getUserInfoResponse) - for i := 0; i < numberOfGroups; i++ { - assert.True(strings.Contains( - finalResponse, groupName+strconv.Itoa(i)), finalResponse) - } -} - -func TestCreateServiceAccountForUser(t *testing.T) { - /* - To test creation of service account for a user. - */ - - // Test's variables - userName := "testcreateserviceaccountforuser1" - assert := assert.New(t) - policy := "" - - // 1. Create the user - groups := []string{} - policies := []string{} - response, err := AddUser(userName, "secretKey", groups, policies) - if err != nil { - log.Println(err) - return - } - if response != nil { - fmt.Println("StatusCode:", response.StatusCode) - assert.Equal(201, response.StatusCode, "Status Code is incorrect") - } - - // 2. Create the service account for the user - createServiceAccountResponse, - createServiceAccountError := CreateServiceAccountForUser( - userName, - policy, - ) - if createServiceAccountError != nil { - log.Println(createServiceAccountError) - assert.Fail("Error in createServiceAccountError") - } - if createServiceAccountResponse != nil { - fmt.Println("StatusCode:", createServiceAccountResponse.StatusCode) - assert.Equal( - 201, createServiceAccountResponse.StatusCode, - inspectHTTPResponse(createServiceAccountResponse), - ) - } - - // 3. Verify the service account for the user - listOfAccountsResponse, listOfAccountsError := ReturnsAListOfServiceAccountsForAUser(userName) - - fmt.Println(listOfAccountsResponse, listOfAccountsError) - - if listOfAccountsError != nil { - log.Println(listOfAccountsError) - assert.Fail("Error in listOfAccountsError") - } - finalResponse := inspectHTTPResponse(listOfAccountsResponse) - if listOfAccountsResponse != nil { - fmt.Println("StatusCode:", listOfAccountsResponse.StatusCode) - assert.Equal( - 200, listOfAccountsResponse.StatusCode, - finalResponse, - ) - } -} - -func TestUsersGroupsBulk(t *testing.T) { - /* - To test UsersGroupsBulk End Point - */ - - // Vars - assert := assert.New(t) - numberOfUsers := 5 - numberOfGroups := 1 - // var groups = []string{} - policies := []string{} - username := "testusersgroupbulk" - groupName := "testusersgroupsbulkgroupone" - members := []string{} - users := make([]string, numberOfUsers) - groups := make([]string, numberOfGroups) - - // 1. Create some users - for i := 0; i < numberOfUsers; i++ { - users[i] = username + strconv.Itoa(i) - response, err := AddUser( - users[i], - "secretKey"+strconv.Itoa(i), []string{}, policies) - if err != nil { - log.Println(err) - return - } - if response != nil { - fmt.Println("POST StatusCode:", response.StatusCode) - assert.Equal(201, response.StatusCode, - "Status Code is incorrect on index: "+strconv.Itoa(i)) - } - } - - // 2. Create a group with no members - responseAddGroup, errorAddGroup := AddGroup(groupName, members) - if errorAddGroup != nil { - log.Println(errorAddGroup) - return - } - finalResponse := inspectHTTPResponse(responseAddGroup) - if responseAddGroup != nil { - fmt.Println("POST StatusCode:", responseAddGroup.StatusCode) - assert.Equal( - 201, - responseAddGroup.StatusCode, - finalResponse, - ) - } - - // 3. Add users to the group - groups[0] = groupName - responseUsersGroupsBulk, errorUsersGroupsBulk := UsersGroupsBulk( - users, - groups, - ) - if errorUsersGroupsBulk != nil { - log.Println(errorUsersGroupsBulk) - return - } - finalResponse = inspectHTTPResponse(responseUsersGroupsBulk) - if responseUsersGroupsBulk != nil { - fmt.Println("POST StatusCode:", responseUsersGroupsBulk.StatusCode) - assert.Equal( - 200, - responseUsersGroupsBulk.StatusCode, - finalResponse, - ) - } - - // 4. Verify users got added to the group - for i := 0; i < numberOfUsers; i++ { - responseGetUserInfo, errGetUserInfo := GetUserInformation( - username + strconv.Itoa(i), - ) - if errGetUserInfo != nil { - log.Println(errGetUserInfo) - assert.Fail("There was an error in the response") - return - } - finalResponse = inspectHTTPResponse(responseGetUserInfo) - if responseGetUserInfo != nil { - assert.Equal(200, responseGetUserInfo.StatusCode, finalResponse) - } - // Make sure the user belongs to the created group - assert.True(strings.Contains(finalResponse, groupName)) - } -} - -func Test_GetUserPolicyAPI(t *testing.T) { - assert := assert.New(t) - - // 1. Create an active user with valid policy - groups := []string{} - policies := []string{"readwrite"} - addUserResponse, addUserError := AddUser( - "getpolicyuser", "secretKey", groups, policies) - if addUserError != nil { - log.Println(addUserError) - return - } - if addUserResponse != nil { - fmt.Println("StatusCode:", addUserResponse.StatusCode) - assert.Equal( - 201, addUserResponse.StatusCode, "Status Code is incorrect") - } - - type args struct { - api string - } - tests := []struct { - name string - args args - expectedStatus int - expectedError error - }{ - { - name: "Get User Policies", - args: args{ - api: "/user/policy", - }, - expectedStatus: 200, - expectedError: nil, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(_ *testing.T) { - client := &http.Client{ - Timeout: 3 * time.Second, - } - - request, err := http.NewRequest( - "GET", fmt.Sprintf("http://localhost:9090/api/v1%s", tt.args.api), nil) - if err != nil { - log.Println(err) - return - } - request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) - request.Header.Add("Content-Type", "application/json") - response, err := client.Do(request) - if err != nil { - log.Println(err) - return - } - if response != nil { - assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed") - } - }) - } -} diff --git a/models/admin_info_response.go b/models/admin_info_response.go index 8f9855d1ac..1349867c18 100644 --- a/models/admin_info_response.go +++ b/models/admin_info_response.go @@ -39,7 +39,7 @@ import ( type AdminInfoResponse struct { // advanced metrics status - // Enum: ["not configured","available","unavailable"] + // Enum: [not configured available unavailable] AdvancedMetricsStatus string `json:"advancedMetricsStatus,omitempty"` // backend diff --git a/models/bucket.go b/models/bucket.go index e2456a5975..2fc06bca45 100644 --- a/models/bucket.go +++ b/models/bucket.go @@ -382,7 +382,7 @@ type BucketDetailsQuota struct { Quota int64 `json:"quota,omitempty"` // type - // Enum: ["hard"] + // Enum: [hard] Type string `json:"type,omitempty"` } diff --git a/models/bucket_quota.go b/models/bucket_quota.go index 4f606f4d26..51b5b3dc28 100644 --- a/models/bucket_quota.go +++ b/models/bucket_quota.go @@ -41,7 +41,7 @@ type BucketQuota struct { Quota int64 `json:"quota,omitempty"` // type - // Enum: ["hard"] + // Enum: [hard] Type string `json:"type,omitempty"` } diff --git a/models/bucket_replication_rule.go b/models/bucket_replication_rule.go index f13e00e9a6..6a68308763 100644 --- a/models/bucket_replication_rule.go +++ b/models/bucket_replication_rule.go @@ -68,14 +68,14 @@ type BucketReplicationRule struct { Priority int32 `json:"priority,omitempty"` // status - // Enum: ["Enabled","Disabled"] + // Enum: [Enabled Disabled] Status string `json:"status,omitempty"` // storage class StorageClass string `json:"storageClass,omitempty"` // sync mode - // Enum: ["async","sync"] + // Enum: [async sync] SyncMode *string `json:"syncMode,omitempty"` // tags diff --git a/models/create_remote_bucket.go b/models/create_remote_bucket.go index 4469c2c627..f595a95296 100644 --- a/models/create_remote_bucket.go +++ b/models/create_remote_bucket.go @@ -61,7 +61,7 @@ type CreateRemoteBucket struct { SourceBucket *string `json:"sourceBucket"` // sync mode - // Enum: ["async","sync"] + // Enum: [async sync] SyncMode *string `json:"syncMode,omitempty"` // target bucket diff --git a/models/login_details.go b/models/login_details.go index 9e908335ff..3055f7336f 100644 --- a/models/login_details.go +++ b/models/login_details.go @@ -45,7 +45,7 @@ type LoginDetails struct { IsK8S bool `json:"isK8S,omitempty"` // login strategy - // Enum: ["form","redirect","service-account","redirect-service-account"] + // Enum: [form redirect service-account redirect-service-account] LoginStrategy string `json:"loginStrategy,omitempty"` // redirect rules diff --git a/models/make_bucket_request.go b/models/make_bucket_request.go index 903e0379c8..bb24d0ead0 100644 --- a/models/make_bucket_request.go +++ b/models/make_bucket_request.go @@ -36,21 +36,9 @@ import ( // swagger:model makeBucketRequest type MakeBucketRequest struct { - // locking - Locking bool `json:"locking,omitempty"` - // name // Required: true Name *string `json:"name"` - - // quota - Quota *SetBucketQuota `json:"quota,omitempty"` - - // retention - Retention *PutBucketRetentionRequest `json:"retention,omitempty"` - - // versioning - Versioning *SetBucketVersioning `json:"versioning,omitempty"` } // Validate validates this make bucket request @@ -61,18 +49,6 @@ func (m *MakeBucketRequest) Validate(formats strfmt.Registry) error { res = append(res, err) } - if err := m.validateQuota(formats); err != nil { - res = append(res, err) - } - - if err := m.validateRetention(formats); err != nil { - res = append(res, err) - } - - if err := m.validateVersioning(formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -88,145 +64,8 @@ func (m *MakeBucketRequest) validateName(formats strfmt.Registry) error { return nil } -func (m *MakeBucketRequest) validateQuota(formats strfmt.Registry) error { - if swag.IsZero(m.Quota) { // not required - return nil - } - - if m.Quota != nil { - if err := m.Quota.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("quota") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("quota") - } - return err - } - } - - return nil -} - -func (m *MakeBucketRequest) validateRetention(formats strfmt.Registry) error { - if swag.IsZero(m.Retention) { // not required - return nil - } - - if m.Retention != nil { - if err := m.Retention.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("retention") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("retention") - } - return err - } - } - - return nil -} - -func (m *MakeBucketRequest) validateVersioning(formats strfmt.Registry) error { - if swag.IsZero(m.Versioning) { // not required - return nil - } - - if m.Versioning != nil { - if err := m.Versioning.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("versioning") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("versioning") - } - return err - } - } - - return nil -} - -// ContextValidate validate this make bucket request based on the context it is used +// ContextValidate validates this make bucket request based on context it is used func (m *MakeBucketRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateQuota(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateRetention(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateVersioning(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *MakeBucketRequest) contextValidateQuota(ctx context.Context, formats strfmt.Registry) error { - - if m.Quota != nil { - - if swag.IsZero(m.Quota) { // not required - return nil - } - - if err := m.Quota.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("quota") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("quota") - } - return err - } - } - - return nil -} - -func (m *MakeBucketRequest) contextValidateRetention(ctx context.Context, formats strfmt.Registry) error { - - if m.Retention != nil { - - if swag.IsZero(m.Retention) { // not required - return nil - } - - if err := m.Retention.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("retention") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("retention") - } - return err - } - } - - return nil -} - -func (m *MakeBucketRequest) contextValidateVersioning(ctx context.Context, formats strfmt.Registry) error { - - if m.Versioning != nil { - - if swag.IsZero(m.Versioning) { // not required - return nil - } - - if err := m.Versioning.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("versioning") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("versioning") - } - return err - } - } - return nil } diff --git a/models/multi_bucket_replication.go b/models/multi_bucket_replication.go index 44896c624a..728e66b612 100644 --- a/models/multi_bucket_replication.go +++ b/models/multi_bucket_replication.go @@ -83,7 +83,7 @@ type MultiBucketReplication struct { StorageClass string `json:"storageClass,omitempty"` // sync mode - // Enum: ["async","sync"] + // Enum: [async sync] SyncMode *string `json:"syncMode,omitempty"` // tags diff --git a/models/remote_bucket.go b/models/remote_bucket.go index fdeda43bcf..2473f2ac57 100644 --- a/models/remote_bucket.go +++ b/models/remote_bucket.go @@ -57,7 +57,7 @@ type RemoteBucket struct { SecretKey string `json:"secretKey,omitempty"` // service - // Enum: ["replication"] + // Enum: [replication] Service string `json:"service,omitempty"` // source bucket diff --git a/models/session_response.go b/models/session_response.go index 819d8aa677..ece2c13f5e 100644 --- a/models/session_response.go +++ b/models/session_response.go @@ -63,7 +63,7 @@ type SessionResponse struct { ServerEndPoint string `json:"serverEndPoint,omitempty"` // status - // Enum: ["ok"] + // Enum: [ok] Status string `json:"status,omitempty"` } diff --git a/models/set_bucket_quota.go b/models/set_bucket_quota.go index 739e7f65a3..01668ab6e5 100644 --- a/models/set_bucket_quota.go +++ b/models/set_bucket_quota.go @@ -45,7 +45,7 @@ type SetBucketQuota struct { Enabled *bool `json:"enabled"` // quota type - // Enum: ["hard"] + // Enum: [hard] QuotaType string `json:"quota_type,omitempty"` } diff --git a/swagger.yml b/swagger.yml index f19c97a312..f7e57a1d84 100644 --- a/swagger.yml +++ b/swagger.yml @@ -134,46 +134,6 @@ paths: tags: - Auth - /account/change-password: - post: - summary: Change password of currently logged in user. - operationId: AccountChangePassword - parameters: - - name: body - in: body - required: true - schema: - $ref: "#/definitions/accountChangePasswordRequest" - responses: - 204: - description: A successful login. - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Account - - /account/change-user-password: - post: - summary: Change password of currently logged in user. - operationId: ChangeUserPassword - parameters: - - name: body - in: body - required: true - schema: - $ref: "#/definitions/changeUserPasswordRequest" - responses: - 201: - description: Password successfully changed. - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Account - /buckets: get: summary: List Buckets @@ -230,66 +190,6 @@ paths: $ref: "#/definitions/ApiError" tags: - Bucket - delete: - summary: Delete Bucket - operationId: DeleteBucket - parameters: - - name: name - in: path - required: true - type: string - responses: - 204: - description: A successful response. - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Bucket - - /buckets/{bucket_name}/retention: - get: - summary: Get Bucket's retention config - operationId: GetBucketRetentionConfig - parameters: - - name: bucket_name - in: path - required: true - type: string - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/getBucketRetentionConfig" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Bucket - put: - summary: Set Bucket's retention config - operationId: SetBucketRetentionConfig - parameters: - - name: bucket_name - in: path - required: true - type: string - - name: body - in: body - required: true - schema: - $ref: "#/definitions/putBucketRetentionRequest" - responses: - 200: - description: A successful response. - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Bucket /buckets/{bucket_name}/objects: get: @@ -542,94 +442,6 @@ paths: $ref: "#/definitions/ApiError" tags: - Object - /buckets/{bucket_name}/objects/legalhold: - put: - summary: Put Object's legalhold status - operationId: PutObjectLegalHold - parameters: - - name: bucket_name - in: path - required: true - type: string - - name: prefix - in: query - required: true - type: string - - name: version_id - in: query - required: true - type: string - - name: body - in: body - required: true - schema: - $ref: "#/definitions/putObjectLegalHoldRequest" - responses: - 200: - description: A successful response. - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Object - - /buckets/{bucket_name}/objects/retention: - put: - summary: Put Object's retention status - operationId: PutObjectRetention - parameters: - - name: bucket_name - in: path - required: true - type: string - - name: prefix - in: query - required: true - type: string - - name: version_id - in: query - required: true - type: string - - name: body - in: body - required: true - schema: - $ref: "#/definitions/putObjectRetentionRequest" - responses: - 200: - description: A successful response. - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Object - delete: - summary: Delete Object retention from an object - operationId: DeleteObjectRetention - parameters: - - name: bucket_name - in: path - required: true - type: string - - name: prefix - in: query - required: true - type: string - - name: version_id - in: query - required: true - type: string - responses: - 200: - description: A successful response. - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Object /buckets/{bucket_name}/objects/tags: put: @@ -742,32 +554,6 @@ paths: tags: - Bucket - /buckets/{name}/set-policy: - put: - summary: Bucket Set Policy - operationId: BucketSetPolicy - parameters: - - name: name - in: path - required: true - type: string - - name: body - in: body - required: true - schema: - $ref: "#/definitions/setBucketPolicyRequest" - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/bucket" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Bucket - /buckets/{name}/quota: get: summary: Get Bucket Quota @@ -788,56 +574,30 @@ paths: $ref: "#/definitions/ApiError" tags: - Bucket - put: - summary: Bucket Quota - operationId: SetBucketQuota - parameters: - - name: name - in: path - required: true - type: string - - name: body - in: body - required: true - schema: - $ref: "#/definitions/setBucketQuota" - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/bucket" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Bucket - /buckets/{bucket_name}/events: + /buckets/{bucket_name}/versioning: get: - summary: List Bucket Events - operationId: ListBucketEvents + summary: Bucket Versioning + operationId: GetBucketVersioning parameters: - name: bucket_name in: path required: true type: string - - $ref: "#/parameters/offset" - - $ref: "#/parameters/limit" responses: 200: description: A successful response. schema: - $ref: "#/definitions/listBucketEventsResponse" + $ref: "#/definitions/bucketVersioningResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - Bucket - post: - summary: Create Bucket Event - operationId: CreateBucketEvent + put: + summary: Set Bucket Versioning + operationId: SetBucketVersioning parameters: - name: bucket_name in: path @@ -847,7 +607,7 @@ paths: in: body required: true schema: - $ref: "#/definitions/bucketEventRequest" + $ref: "#/definitions/setBucketVersioning" responses: 201: description: A successful response. @@ -858,27 +618,28 @@ paths: tags: - Bucket - /buckets/{bucket_name}/events/{arn}: - delete: - summary: Delete Bucket Event - operationId: DeleteBucketEvent + /buckets/{bucket_name}/rewind/{date}: + get: + summary: Get objects in a bucket for a rewind date + operationId: GetBucketRewind parameters: - name: bucket_name in: path required: true type: string - - name: arn + - name: date in: path required: true type: string - - name: body - in: body - required: true - schema: - $ref: "#/definitions/notificationDeleteRequest" + - name: prefix + in: query + required: false + type: string responses: - 204: + 200: description: A successful response. + schema: + $ref: "#/definitions/rewindResponse" default: description: Generic error response. schema: @@ -886,20 +647,15 @@ paths: tags: - Bucket - /buckets/{bucket_name}/replication: + /buckets/max-share-exp: get: - summary: Bucket Replication - operationId: GetBucketReplication - parameters: - - name: bucket_name - in: path - required: true - type: string + summary: Get max expiration time for share link in seconds + operationId: GetMaxShareLinkExp responses: 200: description: A successful response. schema: - $ref: "#/definitions/bucketReplicationResponse" + $ref: "#/definitions/maxShareLinkExpResponse" default: description: Generic error response. schema: @@ -907,1855 +663,60 @@ paths: tags: - Bucket - /buckets/{bucket_name}/replication/{rule_id}: + /users: get: - summary: Bucket Replication - operationId: GetBucketReplicationRule + summary: List Users + operationId: ListUsers parameters: - - name: bucket_name - in: path - required: true - type: string - - name: rule_id - in: path - required: true - type: string + - $ref: "#/parameters/offset" + - $ref: "#/parameters/limit" responses: 200: description: A successful response. schema: - $ref: "#/definitions/bucketReplicationRule" + $ref: "#/definitions/listUsersResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - - Bucket + - User - put: - summary: Update Replication rule - operationId: UpdateMultiBucketReplication - parameters: - - name: bucket_name - in: path - required: true - type: string - - name: rule_id - in: path - required: true - type: string - - name: body - in: body - required: true - schema: - $ref: "#/definitions/multiBucketReplicationEdit" - responses: - 201: - description: A successful response. - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Bucket - - delete: - summary: Bucket Replication Rule Delete - operationId: DeleteBucketReplicationRule - parameters: - - name: bucket_name - in: path - required: true - type: string - - name: rule_id - in: path - required: true - type: string - - responses: - 204: - description: A successful response. - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Bucket - - /buckets/{bucket_name}/delete-all-replication-rules: - delete: - summary: Deletes all replication rules from a bucket - operationId: DeleteAllReplicationRules - parameters: - - name: bucket_name - in: path - required: true - type: string - responses: - 204: - description: A successful response. - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Bucket - - /buckets/{bucket_name}/delete-selected-replication-rules: - delete: - summary: Deletes selected replication rules from a bucket - operationId: DeleteSelectedReplicationRules - parameters: - - name: bucket_name - in: path - required: true - type: string - - name: rules - in: body - required: true - schema: - $ref: "#/definitions/bucketReplicationRuleList" - responses: - 204: - description: A successful response. - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Bucket - - /buckets/{bucket_name}/versioning: - get: - summary: Bucket Versioning - operationId: GetBucketVersioning - parameters: - - name: bucket_name - in: path - required: true - type: string - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/bucketVersioningResponse" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Bucket - put: - summary: Set Bucket Versioning - operationId: SetBucketVersioning - parameters: - - name: bucket_name - in: path - required: true - type: string - - name: body - in: body - required: true - schema: - $ref: "#/definitions/setBucketVersioning" - responses: - 201: - description: A successful response. - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Bucket - - /buckets/{bucket_name}/object-locking: - get: - summary: Returns the status of object locking support on the bucket - operationId: GetBucketObjectLockingStatus - parameters: - - name: bucket_name - in: path - required: true - type: string - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/bucketObLockingResponse" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Bucket - - /buckets/{bucket_name}/encryption/enable: - post: - summary: Enable bucket encryption. - operationId: EnableBucketEncryption - parameters: - - name: bucket_name - in: path - required: true - type: string - - name: body - in: body - required: true - schema: - $ref: "#/definitions/bucketEncryptionRequest" - responses: - 200: - description: A successful response. - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Bucket - - /buckets/{bucket_name}/encryption/disable: - post: - summary: Disable bucket encryption. - operationId: DisableBucketEncryption - parameters: - - name: bucket_name - in: path - required: true - type: string - responses: - 200: - description: A successful response. - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Bucket - - /buckets/{bucket_name}/encryption/info: - get: - summary: Get bucket encryption information. - operationId: GetBucketEncryptionInfo - parameters: - - name: bucket_name - in: path - required: true - type: string - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/bucketEncryptionInfo" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Bucket - - /buckets/{bucket_name}/rewind/{date}: - get: - summary: Get objects in a bucket for a rewind date - operationId: GetBucketRewind - parameters: - - name: bucket_name - in: path - required: true - type: string - - name: date - in: path - required: true - type: string - - name: prefix - in: query - required: false - type: string - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/rewindResponse" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Bucket - - /buckets/max-share-exp: - get: - summary: Get max expiration time for share link in seconds - operationId: GetMaxShareLinkExp - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/maxShareLinkExpResponse" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Bucket - - /list-external-buckets: - post: - summary: Lists an External list of buckets using custom credentials - operationId: ListExternalBuckets - parameters: - - name: body - in: body - required: true - schema: - $ref: "#/definitions/listExternalBucketsParams" - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/listBucketsResponse" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Bucket - - /buckets-replication: - post: - summary: Sets Multi Bucket Replication in multiple Buckets - operationId: SetMultiBucketReplication - parameters: - - name: body - in: body - required: true - schema: - $ref: "#/definitions/multiBucketReplication" - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/multiBucketResponseState" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Bucket - - /service-accounts: - get: - summary: List User's Service Accounts - operationId: ListUserServiceAccounts - parameters: - - $ref: "#/parameters/offset" - - $ref: "#/parameters/limit" - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/serviceAccounts" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - ServiceAccount - post: - summary: Create Service Account - operationId: CreateServiceAccount - parameters: - - name: body - in: body - required: true - schema: - $ref: "#/definitions/serviceAccountRequest" - responses: - 201: - description: A successful response. - schema: - $ref: "#/definitions/serviceAccountCreds" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - ServiceAccount - - /service-account-credentials: - post: - summary: Create Service Account With Credentials - operationId: CreateServiceAccountCreds - parameters: - - name: body - in: body - required: true - schema: - $ref: "#/definitions/serviceAccountRequestCreds" - responses: - 201: - description: A successful response. - schema: - $ref: "#/definitions/serviceAccountCreds" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - ServiceAccount - - /service-accounts/delete-multi: - delete: - summary: Delete Multiple Service Accounts - operationId: DeleteMultipleServiceAccounts - parameters: - - name: selectedSA - in: body - required: true - schema: - $ref: "#/definitions/selectedSAs" - responses: - 204: - description: A successful response. - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - ServiceAccount - - /service-accounts/{access_key}: - get: - summary: Get Service Account - operationId: GetServiceAccount - parameters: - - name: access_key - in: path - required: true - type: string - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/serviceAccount" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - ServiceAccount - put: - summary: Set Service Account Policy - operationId: UpdateServiceAccount - parameters: - - name: access_key - in: path - required: true - type: string - - name: body - in: body - required: true - schema: - $ref: "#/definitions/updateServiceAccountRequest" - responses: - 200: - description: A successful response. - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - ServiceAccount - delete: - summary: Delete Service Account - operationId: DeleteServiceAccount - parameters: - - name: access_key - in: path - required: true - type: string - responses: - 204: - description: A successful response. - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - ServiceAccount - - /users: - get: - summary: List Users - operationId: ListUsers - parameters: - - $ref: "#/parameters/offset" - - $ref: "#/parameters/limit" - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/listUsersResponse" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - User - post: - summary: Add User - operationId: AddUser - parameters: - - name: body - in: body - required: true - schema: - $ref: "#/definitions/addUserRequest" - responses: - 201: - description: A successful response. - schema: - $ref: "#/definitions/user" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - User - - /users/service-accounts: - post: - summary: Check number of service accounts for each user specified - operationId: CheckUserServiceAccounts - parameters: - - name: selectedUsers - in: body - required: true - schema: - $ref: "#/definitions/selectedUsers" - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/userServiceAccountSummary" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - User - - /user/{name}: - get: - summary: Get User Info - operationId: GetUserInfo - parameters: - - name: name - in: path - required: true - type: string - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/user" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - User - put: - summary: Update User Info - operationId: UpdateUserInfo - parameters: - - name: name - in: path - required: true - type: string - - name: body - in: body - required: true - schema: - $ref: "#/definitions/updateUser" - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/user" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - User - delete: - summary: Remove user - operationId: RemoveUser - parameters: - - name: name - in: path - required: true - type: string - responses: - 204: - description: A successful response. - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - User - - /user/{name}/groups: - put: - summary: Update Groups for a user - operationId: UpdateUserGroups - parameters: - - name: name - in: path - required: true - type: string - - name: body - in: body - required: true - schema: - $ref: "#/definitions/updateUserGroups" - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/user" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - User - /user/policy: - get: - summary: returns policies for logged in user - operationId: GetUserPolicy - responses: - 200: - description: A successful response. - schema: - type: string - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Policy - /user/{name}/policies: - get: - summary: returns policies assigned for a specified user - operationId: GetSAUserPolicy - parameters: - - name: name - in: path - required: true - type: string - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/aUserPolicyResponse" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Policy - /user/{name}/service-accounts: - get: - summary: returns a list of service accounts for a user - operationId: ListAUserServiceAccounts - parameters: - - name: name - in: path - required: true - type: string - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/serviceAccounts" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - User - post: - summary: Create Service Account for User - operationId: CreateAUserServiceAccount - parameters: - - name: name - in: path - required: true - type: string - - name: body - in: body - required: true - schema: - $ref: "#/definitions/serviceAccountRequest" - responses: - 201: - description: A successful response. - schema: - $ref: "#/definitions/serviceAccountCreds" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - User - - /user/{name}/service-account-credentials: - post: - summary: Create Service Account for User With Credentials - operationId: CreateServiceAccountCredentials - parameters: - - name: name - in: path - required: true - type: string - - name: body - in: body - required: true - schema: - $ref: "#/definitions/serviceAccountRequestCreds" - responses: - 201: - description: A successful response. - schema: - $ref: "#/definitions/serviceAccountCreds" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - User - - /users-groups-bulk: - put: - summary: Bulk functionality to Add Users to Groups - operationId: BulkUpdateUsersGroups - parameters: - - name: body - in: body - required: true - schema: - $ref: "#/definitions/bulkUserGroups" - responses: - 200: - description: A successful response. - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - User - - /groups: - get: - summary: List Groups - operationId: ListGroups - parameters: - - $ref: "#/parameters/offset" - - $ref: "#/parameters/limit" - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/listGroupsResponse" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Group - post: - summary: Add Group - operationId: AddGroup - parameters: - - name: body - in: body - required: true - schema: - $ref: "#/definitions/addGroupRequest" - responses: - 201: - description: A successful response. - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Group - - /group/{name}: - get: - summary: Group info - operationId: GroupInfo - parameters: - - name: name - in: path - required: true - type: string - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/group" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Group - delete: - summary: Remove group - operationId: RemoveGroup - parameters: - - name: name - in: path - required: true - type: string - responses: - 204: - description: A successful response. - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Group - put: - summary: Update Group Members or Status - operationId: UpdateGroup - parameters: - - name: name - in: path - required: true - type: string - - name: body - in: body - required: true - schema: - $ref: "#/definitions/updateGroupRequest" - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/group" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Group - - /policies: - get: - summary: List Policies - operationId: ListPolicies - parameters: - - $ref: "#/parameters/offset" - - $ref: "#/parameters/limit" - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/listPoliciesResponse" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Policy - post: - summary: Add Policy - operationId: AddPolicy - parameters: - - name: body - in: body - required: true - schema: - $ref: "#/definitions/addPolicyRequest" - responses: - 201: - description: A successful response. - schema: - $ref: "#/definitions/policy" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Policy - - /policies/{policy}/users: - get: - summary: List Users for a Policy - operationId: ListUsersForPolicy - parameters: - - name: policy - in: path - required: true - type: string - responses: - 200: - description: A successful response. - schema: - type: array - items: - type: string - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Policy - - /policies/{policy}/groups: - get: - summary: List Groups for a Policy - operationId: ListGroupsForPolicy - parameters: - - name: policy - in: path - required: true - type: string - responses: - 200: - description: A successful response. - schema: - type: array - items: - type: string - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Policy - - /bucket-policy/{bucket}: - get: - summary: List Policies With Given Bucket - operationId: ListPoliciesWithBucket - parameters: - - name: bucket - in: path - required: true - type: string - - $ref: "#/parameters/offset" - - $ref: "#/parameters/limit" - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/listPoliciesResponse" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Bucket - - /bucket/{bucket}/access-rules: - put: - summary: Add Access Rule To Given Bucket - operationId: SetAccessRuleWithBucket - parameters: - - name: bucket - in: path - required: true - type: string - - name: prefixaccess - in: body - required: true - schema: - $ref: "#/definitions/prefixAccessPair" - responses: - 200: - description: A successful response. - schema: - type: boolean - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Bucket - get: - summary: List Access Rules With Given Bucket - operationId: ListAccessRulesWithBucket - parameters: - - name: bucket - in: path - required: true - type: string - - $ref: "#/parameters/offset" - - $ref: "#/parameters/limit" - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/listAccessRulesResponse" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Bucket - delete: - summary: Delete Access Rule From Given Bucket - operationId: DeleteAccessRuleWithBucket - parameters: - - name: bucket - in: path - required: true - type: string - - name: prefix - in: body - required: true - schema: - $ref: "#/definitions/prefixWrapper" - responses: - 200: - description: A successful response. - schema: - type: boolean - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Bucket - - /bucket-users/{bucket}: - get: - summary: List Users With Access to a Given Bucket - operationId: ListUsersWithAccessToBucket - parameters: - - name: bucket - in: path - required: true - type: string - - $ref: "#/parameters/offset" - - $ref: "#/parameters/limit" - responses: - 200: - description: A successful response. - schema: - type: array - items: - type: string - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Bucket - - /policy/{name}: - get: - summary: Policy info - operationId: PolicyInfo - parameters: - - name: name - in: path - required: true - type: string - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/policy" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Policy - delete: - summary: Remove policy - operationId: RemovePolicy - parameters: - - name: name - in: path - required: true - type: string - responses: - 204: - description: A successful response. - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Policy - - /configs: - get: - summary: List Configurations - operationId: ListConfig - parameters: - - $ref: "#/parameters/offset" - - $ref: "#/parameters/limit" - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/listConfigResponse" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Configuration - - /set-policy: - put: - summary: Set policy - operationId: SetPolicy - parameters: - - name: body - in: body - required: true - schema: - $ref: "#/definitions/setPolicyNameRequest" - responses: - 204: - description: A successful response. - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Policy - - /set-policy-multi: - put: - summary: Set policy to multiple users/groups - operationId: SetPolicyMultiple - parameters: - - name: body - in: body - required: true - schema: - $ref: "#/definitions/setPolicyMultipleNameRequest" - responses: - 204: - description: A successful response. - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Policy - - /configs/{name}: - get: - summary: Configuration info - operationId: ConfigInfo - parameters: - - name: name - in: path - required: true - type: string - responses: - 200: - description: A successful response. - schema: - type: array - items: - $ref: "#/definitions/configuration" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Configuration - put: - summary: Set Configuration - operationId: SetConfig - parameters: - - name: name - in: path - required: true - type: string - - name: body - in: body - required: true - schema: - $ref: "#/definitions/setConfigRequest" - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/setConfigResponse" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Configuration - - /configs/{name}/reset: - post: - summary: Configuration reset - operationId: ResetConfig - parameters: - - name: name - in: path - required: true - type: string - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/setConfigResponse" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Configuration - - /configs/export: - get: - summary: Export the current config from MinIO server - operationId: ExportConfig - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/configExportResponse" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Configuration - /configs/import: - post: - summary: Uploads a file to import MinIO server config. - consumes: - - multipart/form-data - parameters: - - name: file - in: formData - required: true - type: file - responses: - 200: - description: A successful response. - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Configuration - /service/restart: - post: - summary: Restart Service - operationId: RestartService - responses: - 204: - description: A successful response. - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Service - - /admin/info: - get: - summary: Returns information about the deployment - operationId: AdminInfo - parameters: - - name: defaultOnly - in: query - required: false - type: boolean - default: false - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/adminInfoResponse" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - System - - /admin/info/widgets/{widgetId}: - get: - summary: Returns information about the deployment - operationId: DashboardWidgetDetails - parameters: - - name: widgetId - in: path - type: integer - format: int32 - required: true - - name: start - in: query - type: integer - - name: end - in: query - type: integer - - name: step - in: query - type: integer - format: int32 - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/widgetDetails" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - System - - /admin/arns: - get: - summary: Returns a list of active ARNs in the instance - operationId: ArnList - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/arnsResponse" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - System - - /admin/notification_endpoints: - get: - summary: Returns a list of active notification endpoints - operationId: NotificationEndpointList - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/notifEndpointResponse" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Configuration - post: - summary: Allows to configure a new notification endpoint - operationId: AddNotificationEndpoint - parameters: - - name: body - in: body - required: true - schema: - $ref: "#/definitions/notificationEndpoint" - responses: - 201: - description: A successful response. - schema: - $ref: "#/definitions/setNotificationEndpointResponse" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Configuration - - /nodes: - get: - summary: Lists Nodes - operationId: ListNodes - responses: - 200: - description: A successful response. - schema: - type: array - items: - type: string - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - System - - /remote-buckets: - get: - summary: List Remote Buckets - operationId: ListRemoteBuckets - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/listRemoteBucketsResponse" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Bucket - post: - summary: Add Remote Bucket - operationId: AddRemoteBucket - parameters: - - name: body - in: body - required: true - schema: - $ref: "#/definitions/createRemoteBucket" - responses: - 201: - description: A successful response. - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Bucket - - /remote-buckets/{name}: - get: - summary: Remote Bucket Details - operationId: RemoteBucketDetails - parameters: - - name: name - in: path - required: true - type: string - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/remoteBucket" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Bucket - /remote-buckets/{source-bucket-name}/{arn}: - delete: - summary: Delete Remote Bucket - operationId: DeleteRemoteBucket - parameters: - - name: source-bucket-name - in: path - required: true - type: string - - name: arn - in: path - required: true - type: string - responses: - 204: - description: A successful response. - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Bucket - /logs/search: - get: - summary: Search the logs - operationId: LogSearch - parameters: - - name: fp - description: Filter Parameters - in: query - collectionFormat: multi - type: array - items: - type: string - - name: pageSize - in: query - type: number - format: int32 - default: 10 - - name: pageNo - in: query - type: number - format: int32 - default: 0 - - name: order - in: query - type: string - enum: [timeDesc, timeAsc] - default: timeDesc - - name: timeStart - in: query - type: string - - name: timeEnd - in: query - type: string - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/logSearchResponse" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Logging - - /kms/status: - get: - summary: KMS status - operationId: KMSStatus - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/kmsStatusResponse" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - KMS - /kms/metrics: - get: - summary: KMS metrics - operationId: KMSMetrics - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/kmsMetricsResponse" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - KMS - /kms/apis: - get: - summary: KMS apis - operationId: KMSAPIs - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/kmsAPIsResponse" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - KMS - /kms/version: - get: - summary: KMS version - operationId: KMSVersion - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/kmsVersionResponse" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - KMS - /kms/keys: - post: - summary: KMS create key - operationId: KMSCreateKey - parameters: - - name: body - in: body - required: true - schema: - $ref: "#/definitions/kmsCreateKeyRequest" - responses: - 201: - description: A successful response. - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - KMS - get: - summary: KMS list keys - operationId: KMSListKeys - parameters: - - name: pattern - description: pattern to retrieve keys - in: query - type: string - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/kmsListKeysResponse" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - KMS - /kms/keys/{name}: - get: - summary: KMS key status - operationId: KMSKeyStatus - parameters: - - name: name - description: KMS key name - in: path - required: true - type: string - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/kmsKeyStatusResponse" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - KMS - - /admin/inspect: + /admin/info: get: - summary: Inspect Files on Drive - operationId: Inspect - produces: - - application/octet-stream + summary: Returns information about the deployment + operationId: AdminInfo parameters: - - name: file - in: query - required: true - type: string - - name: volume - in: query - required: true - type: string - - name: encrypt + - name: defaultOnly in: query required: false type: boolean - - responses: - 200: - description: A successful response. - schema: - type: file - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Inspect - /idp/{type}: - post: - summary: Create IDP Configuration - operationId: CreateConfiguration - consumes: - - application/json - parameters: - - name: type - description: IDP Configuration Type - in: path - required: true - type: string - - name: body - in: body - required: true - schema: - $ref: "#/definitions/idpServerConfiguration" - responses: - 201: - description: A successful response. - schema: - $ref: "#/definitions/setIDPResponse" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - idp - get: - summary: List IDP Configurations - operationId: ListConfigurations - parameters: - - name: type - description: IDP Configuration Type - in: path - required: true - type: string - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/idpListConfigurationsResponse" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - idp - /idp/{type}/{name}: - get: - summary: Get IDP Configuration - operationId: GetConfiguration - parameters: - - name: name - description: IDP Configuration Name - in: path - required: true - type: string - - name: type - description: IDP Configuration Type - in: path - required: true - type: string - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/idpServerConfiguration" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - idp - delete: - summary: Delete IDP Configuration - operationId: DeleteConfiguration - parameters: - - name: name - description: IDP Configuration Name - in: path - required: true - type: string - - name: type - description: IDP Configuration Type - in: path - required: true - type: string - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/setIDPResponse" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - idp - put: - summary: Update IDP Configuration - operationId: UpdateConfiguration - consumes: - - application/json - parameters: - - name: body - in: body - required: true - schema: - $ref: "#/definitions/idpServerConfiguration" - - name: name - description: IDP Configuration Name - in: path - required: true - type: string - - name: type - description: IDP Configuration Type - in: path - required: true - type: string - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/setIDPResponse" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - idp - - /ldap-entities: - post: - summary: Get LDAP Entities - operationId: GetLDAPEntities - parameters: - - name: body - in: body - required: true - schema: - $ref: "#/definitions/ldapEntitiesRequest" + default: false responses: 200: description: A successful response. schema: - $ref: "#/definitions/ldapEntities" + $ref: "#/definitions/adminInfoResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - - idp + - System - /releases: + /license/acknowledge: get: - summary: Get repo releases for a given version - operationId: ListReleases - parameters: - - name: repo - description: repo name - in: query - type: string - required: true - - name: current - description: Current Release - in: query - type: string - - name: search - description: search content - in: query - type: string - - name: filter - description: filter releases - in: query - type: string + summary: Acknowledge the license + operationId: LicenseAcknowledge responses: 200: description: A successful response. - schema: - $ref: "#/definitions/releaseListResponse" default: description: Generic error response. schema: $ref: "#/definitions/ApiError" tags: - - release + - License /download-shared-object/{url}: get: @@ -2988,14 +949,6 @@ definitions: properties: name: type: string - locking: - type: boolean - versioning: - $ref: "#/definitions/setBucketVersioning" - quota: - $ref: "#/definitions/setBucketQuota" - retention: - $ref: "#/definitions/putBucketRetentionRequest" ApiError: type: object properties: diff --git a/web-app/e2e/buckets.spec.ts b/web-app/e2e/buckets.spec.ts deleted file mode 100644 index 01ec49e70f..0000000000 --- a/web-app/e2e/buckets.spec.ts +++ /dev/null @@ -1,62 +0,0 @@ -// 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 . -import { expect } from "@playwright/test"; -import { generateUUID, test } from "./fixtures/baseFixture"; -import { minioadminFile } from "./consts"; -import { BUCKET_LIST_PAGE } from "./consts"; - -test.use({ storageState: minioadminFile }); - -test.beforeEach(async ({ page }) => { - await page.goto(BUCKET_LIST_PAGE); - await page.waitForTimeout(1000); -}); - -test("create a new bucket", async ({ page }) => { - await page.getByRole("button", { name: "Buckets" }).click(); - await page.getByRole("button", { name: "Create Bucket" }).click(); - await page.getByLabel("Bucket Name*").click(); - - const bucketName = `new-bucket-${generateUUID()}`; - - await page.getByLabel("Bucket Name*").fill(bucketName); - await page.getByRole("button", { name: "Create Bucket" }).click(); - await page.waitForTimeout(2000); - await page.locator("#refresh-buckets").click(); - await page.getByPlaceholder("Search Buckets").fill(bucketName); - - await expect(page.locator(`#manageBucket-${bucketName}`)).toBeTruthy(); - const bucketLocatorEl = `#manageBucket-${bucketName}`; - await page.locator(bucketLocatorEl).click(); - await page.locator("#delete-bucket-button").click(); - //confirm modal - await page.locator("#confirm-ok").click(); - const listItemsCount = await page.locator(bucketLocatorEl).count(); - await expect(listItemsCount).toEqual(0); -}); - -test("invalid bucket name", async ({ page }) => { - await page.getByRole("button", { name: "Buckets" }).click(); - await page.getByRole("button", { name: "Create Bucket" }).click(); - await page.getByLabel("Bucket Name*").click(); - await page.getByLabel("Bucket Name*").fill("invalid name"); - await page.getByRole("button", { name: "View Bucket Naming Rules" }).click(); - await expect( - page.getByText( - "Bucket names can consist only of lowercase letters, numbers, dots (.), and hyphe", - ), - ).toBeTruthy(); -}); diff --git a/web-app/e2e/groups.spec.ts b/web-app/e2e/groups.spec.ts deleted file mode 100644 index 5059393a94..0000000000 --- a/web-app/e2e/groups.spec.ts +++ /dev/null @@ -1,38 +0,0 @@ -// 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 . - -import { expect } from "@playwright/test"; -import { generateUUID, test } from "./fixtures/baseFixture"; -import { minioadminFile } from "./consts"; -import { BUCKET_LIST_PAGE } from "./consts"; - -test.use({ storageState: minioadminFile }); - -test.beforeEach(async ({ page }) => { - await page.goto(BUCKET_LIST_PAGE); -}); - -test("Add a new group", async ({ page }) => { - await page.getByRole("button", { name: "Identity" }).click(); - await page.getByRole("button", { name: "Groups" }).click(); - await page.getByRole("button", { name: "Create Group" }).click(); - - const groupName = `new-group-${generateUUID()}`; - - await page.getByLabel("Group Name").fill(groupName); - await page.getByRole("button", { name: "Save" }).click(); - await expect(page.getByRole("gridcell", { name: groupName })).toBeTruthy(); -}); diff --git a/web-app/e2e/policies.spec.ts b/web-app/e2e/policies.spec.ts deleted file mode 100644 index 881e93f649..0000000000 --- a/web-app/e2e/policies.spec.ts +++ /dev/null @@ -1,46 +0,0 @@ -// 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 . -import { expect } from "@playwright/test"; -import { generateUUID, test } from "./fixtures/baseFixture"; -import { minioadminFile } from "./consts"; -import { BUCKET_LIST_PAGE } from "./consts"; - -test.use({ storageState: minioadminFile }); - -test.beforeEach(async ({ page }) => { - await page.goto(BUCKET_LIST_PAGE); -}); - -test("Can create a policy", async ({ page }) => { - await page.getByRole("button", { name: "Policies" }).click(); - await page.getByRole("button", { name: "Create Policy" }).click(); - await page.getByLabel("Policy Name").click(); - - const policyName = `policy-${generateUUID()}`; - - await page.getByLabel("Policy Name").fill(policyName); - await page.locator("#code_wrapper").click(); - await page.locator("#code_wrapper").click(); - await page.locator("#code_wrapper").click(); - await page.locator("#code_wrapper").press("Meta+a"); - await page - .locator("#code_wrapper") - .fill( - '{\n "Version": "2012-10-17",\n "Statement": [\n {\n "Effect": "Allow",\n "Action": [\n "s3:*"\n ],\n "Resource": [\n "arn:aws:s3:::bucket1/*",\n "arn:aws:s3:::bucket2/*",\n "arn:aws:s3:::bucket3/*",\n "arn:aws:s3:::bucket4/*"\n ]\n },\n {\n "Effect": "Deny",\n "Action": [\n "s3:DeleteBucket"\n ],\n "Resource": [\n "arn:aws:s3:::*"\n ]\n }\n ]\n}\n', - ); - await page.getByRole("button", { name: "Save" }).click(); - await expect(page.getByRole("gridcell", { name: policyName })).toBeTruthy(); -}); diff --git a/web-app/package.json b/web-app/package.json index ad4d7f8e70..7617b8257e 100644 --- a/web-app/package.json +++ b/web-app/package.json @@ -12,9 +12,8 @@ "local-storage-fallback": "^4.1.3", "lodash": "^4.17.21", "luxon": "^3.5.0", - "mds": "https://github.com/minio/mds.git#v1.0.4", + "mds": "https://github.com/minio/mds.git#v1.1.1", "react": "^18.3.1", - "react-component-export-image": "^1.0.6", "react-copy-to-clipboard": "^5.1.0", "react-dom": "^18.3.1", "react-dropzone": "^14.3.5", @@ -25,7 +24,6 @@ "react-virtualized": "^9.22.6", "react-window": "^1.8.11", "react-window-infinite-loader": "^1.0.10", - "recharts": "^2.15.1", "styled-components": "5.3.11", "superagent": "^9.0.2", "tinycolor2": "^1.6.0" diff --git a/web-app/src/api/consoleApi.ts b/web-app/src/api/consoleApi.ts index f9bb8d59b2..1a8327f59b 100644 --- a/web-app/src/api/consoleApi.ts +++ b/web-app/src/api/consoleApi.ts @@ -125,10 +125,6 @@ export interface BucketObject { export interface MakeBucketRequest { name: string; - locking?: boolean; - versioning?: SetBucketVersioning; - quota?: SetBucketQuota; - retention?: PutBucketRetentionRequest; } export interface ApiError { @@ -1532,51 +1528,6 @@ export class Api< ...params, }), }; - account = { - /** - * No description - * - * @tags Account - * @name AccountChangePassword - * @summary Change password of currently logged in user. - * @request POST:/account/change-password - * @secure - */ - accountChangePassword: ( - body: AccountChangePasswordRequest, - params: RequestParams = {}, - ) => - this.request({ - path: `/account/change-password`, - method: "POST", - body: body, - secure: true, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags Account - * @name ChangeUserPassword - * @summary Change password of currently logged in user. - * @request POST:/account/change-user-password - * @secure - */ - changeUserPassword: ( - body: ChangeUserPasswordRequest, - params: RequestParams = {}, - ) => - this.request({ - path: `/account/change-user-password`, - method: "POST", - body: body, - secure: true, - type: ContentType.Json, - ...params, - }), - }; buckets = { /** * No description @@ -1634,67 +1585,6 @@ export class Api< ...params, }), - /** - * No description - * - * @tags Bucket - * @name DeleteBucket - * @summary Delete Bucket - * @request DELETE:/buckets/{name} - * @secure - */ - deleteBucket: (name: string, params: RequestParams = {}) => - this.request({ - path: `/buckets/${encodeURIComponent(name)}`, - method: "DELETE", - secure: true, - ...params, - }), - - /** - * No description - * - * @tags Bucket - * @name GetBucketRetentionConfig - * @summary Get Bucket's retention config - * @request GET:/buckets/{bucket_name}/retention - * @secure - */ - getBucketRetentionConfig: ( - bucketName: string, - params: RequestParams = {}, - ) => - this.request({ - path: `/buckets/${encodeURIComponent(bucketName)}/retention`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Bucket - * @name SetBucketRetentionConfig - * @summary Set Bucket's retention config - * @request PUT:/buckets/{bucket_name}/retention - * @secure - */ - setBucketRetentionConfig: ( - bucketName: string, - body: PutBucketRetentionRequest, - params: RequestParams = {}, - ) => - this.request({ - path: `/buckets/${encodeURIComponent(bucketName)}/retention`, - method: "PUT", - body: body, - secure: true, - type: ContentType.Json, - ...params, - }), - /** * No description * @@ -1891,87 +1781,6 @@ export class Api< ...params, }), - /** - * No description - * - * @tags Object - * @name PutObjectLegalHold - * @summary Put Object's legalhold status - * @request PUT:/buckets/{bucket_name}/objects/legalhold - * @secure - */ - putObjectLegalHold: ( - bucketName: string, - query: { - prefix: string; - version_id: string; - }, - body: PutObjectLegalHoldRequest, - params: RequestParams = {}, - ) => - this.request({ - path: `/buckets/${encodeURIComponent(bucketName)}/objects/legalhold`, - method: "PUT", - query: query, - body: body, - secure: true, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags Object - * @name PutObjectRetention - * @summary Put Object's retention status - * @request PUT:/buckets/{bucket_name}/objects/retention - * @secure - */ - putObjectRetention: ( - bucketName: string, - query: { - prefix: string; - version_id: string; - }, - body: PutObjectRetentionRequest, - params: RequestParams = {}, - ) => - this.request({ - path: `/buckets/${encodeURIComponent(bucketName)}/objects/retention`, - method: "PUT", - query: query, - body: body, - secure: true, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags Object - * @name DeleteObjectRetention - * @summary Delete Object retention from an object - * @request DELETE:/buckets/{bucket_name}/objects/retention - * @secure - */ - deleteObjectRetention: ( - bucketName: string, - query: { - prefix: string; - version_id: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/buckets/${encodeURIComponent(bucketName)}/objects/retention`, - method: "DELETE", - query: query, - secure: true, - ...params, - }), - /** * No description * @@ -2074,30 +1883,6 @@ export class Api< ...params, }), - /** - * No description - * - * @tags Bucket - * @name BucketSetPolicy - * @summary Bucket Set Policy - * @request PUT:/buckets/{name}/set-policy - * @secure - */ - bucketSetPolicy: ( - name: string, - body: SetBucketPolicyRequest, - params: RequestParams = {}, - ) => - this.request({ - path: `/buckets/${encodeURIComponent(name)}/set-policy`, - method: "PUT", - body: body, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - /** * No description * @@ -2120,55 +1905,15 @@ export class Api< * No description * * @tags Bucket - * @name SetBucketQuota - * @summary Bucket Quota - * @request PUT:/buckets/{name}/quota - * @secure - */ - setBucketQuota: ( - name: string, - body: SetBucketQuota, - params: RequestParams = {}, - ) => - this.request({ - path: `/buckets/${encodeURIComponent(name)}/quota`, - method: "PUT", - body: body, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Bucket - * @name ListBucketEvents - * @summary List Bucket Events - * @request GET:/buckets/{bucket_name}/events + * @name GetBucketVersioning + * @summary Bucket Versioning + * @request GET:/buckets/{bucket_name}/versioning * @secure */ - listBucketEvents: ( - bucketName: string, - query?: { - /** - * @format int32 - * @default 0 - */ - offset?: number; - /** - * @format int32 - * @default 20 - */ - limit?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/buckets/${encodeURIComponent(bucketName)}/events`, + getBucketVersioning: (bucketName: string, params: RequestParams = {}) => + this.request({ + path: `/buckets/${encodeURIComponent(bucketName)}/versioning`, method: "GET", - query: query, secure: true, format: "json", ...params, @@ -2178,19 +1923,19 @@ export class Api< * No description * * @tags Bucket - * @name CreateBucketEvent - * @summary Create Bucket Event - * @request POST:/buckets/{bucket_name}/events + * @name SetBucketVersioning + * @summary Set Bucket Versioning + * @request PUT:/buckets/{bucket_name}/versioning * @secure */ - createBucketEvent: ( + setBucketVersioning: ( bucketName: string, - body: BucketEventRequest, + body: SetBucketVersioning, params: RequestParams = {}, ) => this.request({ - path: `/buckets/${encodeURIComponent(bucketName)}/events`, - method: "POST", + path: `/buckets/${encodeURIComponent(bucketName)}/versioning`, + method: "PUT", body: body, secure: true, type: ContentType.Json, @@ -2201,23 +1946,25 @@ export class Api< * No description * * @tags Bucket - * @name DeleteBucketEvent - * @summary Delete Bucket Event - * @request DELETE:/buckets/{bucket_name}/events/{arn} + * @name GetBucketRewind + * @summary Get objects in a bucket for a rewind date + * @request GET:/buckets/{bucket_name}/rewind/{date} * @secure */ - deleteBucketEvent: ( + getBucketRewind: ( bucketName: string, - arn: string, - body: NotificationDeleteRequest, + date: string, + query?: { + prefix?: string; + }, params: RequestParams = {}, ) => - this.request({ - path: `/buckets/${encodeURIComponent(bucketName)}/events/${encodeURIComponent(arn)}`, - method: "DELETE", - body: body, + this.request({ + path: `/buckets/${encodeURIComponent(bucketName)}/rewind/${encodeURIComponent(date)}`, + method: "GET", + query: query, secure: true, - type: ContentType.Json, + format: "json", ...params, }), @@ -2225,1639 +1972,73 @@ export class Api< * No description * * @tags Bucket - * @name GetBucketReplication - * @summary Bucket Replication - * @request GET:/buckets/{bucket_name}/replication + * @name GetMaxShareLinkExp + * @summary Get max expiration time for share link in seconds + * @request GET:/buckets/max-share-exp * @secure */ - getBucketReplication: (bucketName: string, params: RequestParams = {}) => - this.request({ - path: `/buckets/${encodeURIComponent(bucketName)}/replication`, + getMaxShareLinkExp: (params: RequestParams = {}) => + this.request({ + path: `/buckets/max-share-exp`, method: "GET", secure: true, format: "json", ...params, }), - + }; + users = { /** * No description * - * @tags Bucket - * @name GetBucketReplicationRule - * @summary Bucket Replication - * @request GET:/buckets/{bucket_name}/replication/{rule_id} + * @tags User + * @name ListUsers + * @summary List Users + * @request GET:/users * @secure */ - getBucketReplicationRule: ( - bucketName: string, - ruleId: string, + listUsers: ( + query?: { + /** + * @format int32 + * @default 0 + */ + offset?: number; + /** + * @format int32 + * @default 20 + */ + limit?: number; + }, params: RequestParams = {}, ) => - this.request({ - path: `/buckets/${encodeURIComponent(bucketName)}/replication/${encodeURIComponent(ruleId)}`, + this.request({ + path: `/users`, method: "GET", + query: query, secure: true, format: "json", ...params, }), - - /** - * No description - * - * @tags Bucket - * @name UpdateMultiBucketReplication - * @summary Update Replication rule - * @request PUT:/buckets/{bucket_name}/replication/{rule_id} - * @secure - */ - updateMultiBucketReplication: ( - bucketName: string, - ruleId: string, - body: MultiBucketReplicationEdit, - params: RequestParams = {}, - ) => - this.request({ - path: `/buckets/${encodeURIComponent(bucketName)}/replication/${encodeURIComponent(ruleId)}`, - method: "PUT", - body: body, - secure: true, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags Bucket - * @name DeleteBucketReplicationRule - * @summary Bucket Replication Rule Delete - * @request DELETE:/buckets/{bucket_name}/replication/{rule_id} - * @secure - */ - deleteBucketReplicationRule: ( - bucketName: string, - ruleId: string, - params: RequestParams = {}, - ) => - this.request({ - path: `/buckets/${encodeURIComponent(bucketName)}/replication/${encodeURIComponent(ruleId)}`, - method: "DELETE", - secure: true, - ...params, - }), - - /** - * No description - * - * @tags Bucket - * @name DeleteAllReplicationRules - * @summary Deletes all replication rules from a bucket - * @request DELETE:/buckets/{bucket_name}/delete-all-replication-rules - * @secure - */ - deleteAllReplicationRules: ( - bucketName: string, - params: RequestParams = {}, - ) => - this.request({ - path: `/buckets/${encodeURIComponent(bucketName)}/delete-all-replication-rules`, - method: "DELETE", - secure: true, - ...params, - }), - - /** - * No description - * - * @tags Bucket - * @name DeleteSelectedReplicationRules - * @summary Deletes selected replication rules from a bucket - * @request DELETE:/buckets/{bucket_name}/delete-selected-replication-rules - * @secure - */ - deleteSelectedReplicationRules: ( - bucketName: string, - rules: BucketReplicationRuleList, - params: RequestParams = {}, - ) => - this.request({ - path: `/buckets/${encodeURIComponent(bucketName)}/delete-selected-replication-rules`, - method: "DELETE", - body: rules, - secure: true, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags Bucket - * @name GetBucketVersioning - * @summary Bucket Versioning - * @request GET:/buckets/{bucket_name}/versioning - * @secure - */ - getBucketVersioning: (bucketName: string, params: RequestParams = {}) => - this.request({ - path: `/buckets/${encodeURIComponent(bucketName)}/versioning`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Bucket - * @name SetBucketVersioning - * @summary Set Bucket Versioning - * @request PUT:/buckets/{bucket_name}/versioning - * @secure - */ - setBucketVersioning: ( - bucketName: string, - body: SetBucketVersioning, - params: RequestParams = {}, - ) => - this.request({ - path: `/buckets/${encodeURIComponent(bucketName)}/versioning`, - method: "PUT", - body: body, - secure: true, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags Bucket - * @name GetBucketObjectLockingStatus - * @summary Returns the status of object locking support on the bucket - * @request GET:/buckets/{bucket_name}/object-locking - * @secure - */ - getBucketObjectLockingStatus: ( - bucketName: string, - params: RequestParams = {}, - ) => - this.request({ - path: `/buckets/${encodeURIComponent(bucketName)}/object-locking`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Bucket - * @name EnableBucketEncryption - * @summary Enable bucket encryption. - * @request POST:/buckets/{bucket_name}/encryption/enable - * @secure - */ - enableBucketEncryption: ( - bucketName: string, - body: BucketEncryptionRequest, - params: RequestParams = {}, - ) => - this.request({ - path: `/buckets/${encodeURIComponent(bucketName)}/encryption/enable`, - method: "POST", - body: body, - secure: true, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags Bucket - * @name DisableBucketEncryption - * @summary Disable bucket encryption. - * @request POST:/buckets/{bucket_name}/encryption/disable - * @secure - */ - disableBucketEncryption: (bucketName: string, params: RequestParams = {}) => - this.request({ - path: `/buckets/${encodeURIComponent(bucketName)}/encryption/disable`, - method: "POST", - secure: true, - ...params, - }), - - /** - * No description - * - * @tags Bucket - * @name GetBucketEncryptionInfo - * @summary Get bucket encryption information. - * @request GET:/buckets/{bucket_name}/encryption/info - * @secure - */ - getBucketEncryptionInfo: (bucketName: string, params: RequestParams = {}) => - this.request({ - path: `/buckets/${encodeURIComponent(bucketName)}/encryption/info`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Bucket - * @name GetBucketRewind - * @summary Get objects in a bucket for a rewind date - * @request GET:/buckets/{bucket_name}/rewind/{date} - * @secure - */ - getBucketRewind: ( - bucketName: string, - date: string, - query?: { - prefix?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/buckets/${encodeURIComponent(bucketName)}/rewind/${encodeURIComponent(date)}`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Bucket - * @name GetMaxShareLinkExp - * @summary Get max expiration time for share link in seconds - * @request GET:/buckets/max-share-exp - * @secure - */ - getMaxShareLinkExp: (params: RequestParams = {}) => - this.request({ - path: `/buckets/max-share-exp`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - }; - listExternalBuckets = { - /** - * No description - * - * @tags Bucket - * @name ListExternalBuckets - * @summary Lists an External list of buckets using custom credentials - * @request POST:/list-external-buckets - * @secure - */ - listExternalBuckets: ( - body: ListExternalBucketsParams, - params: RequestParams = {}, - ) => - this.request({ - path: `/list-external-buckets`, - method: "POST", - body: body, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - }; - bucketsReplication = { - /** - * No description - * - * @tags Bucket - * @name SetMultiBucketReplication - * @summary Sets Multi Bucket Replication in multiple Buckets - * @request POST:/buckets-replication - * @secure - */ - setMultiBucketReplication: ( - body: MultiBucketReplication, - params: RequestParams = {}, - ) => - this.request({ - path: `/buckets-replication`, - method: "POST", - body: body, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - }; - serviceAccounts = { - /** - * No description - * - * @tags ServiceAccount - * @name ListUserServiceAccounts - * @summary List User's Service Accounts - * @request GET:/service-accounts - * @secure - */ - listUserServiceAccounts: ( - query?: { - /** - * @format int32 - * @default 0 - */ - offset?: number; - /** - * @format int32 - * @default 20 - */ - limit?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/service-accounts`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags ServiceAccount - * @name CreateServiceAccount - * @summary Create Service Account - * @request POST:/service-accounts - * @secure - */ - createServiceAccount: ( - body: ServiceAccountRequest, - params: RequestParams = {}, - ) => - this.request({ - path: `/service-accounts`, - method: "POST", - body: body, - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags ServiceAccount - * @name DeleteMultipleServiceAccounts - * @summary Delete Multiple Service Accounts - * @request DELETE:/service-accounts/delete-multi - * @secure - */ - deleteMultipleServiceAccounts: ( - selectedSA: SelectedSAs, - params: RequestParams = {}, - ) => - this.request({ - path: `/service-accounts/delete-multi`, - method: "DELETE", - body: selectedSA, - secure: true, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags ServiceAccount - * @name GetServiceAccount - * @summary Get Service Account - * @request GET:/service-accounts/{access_key} - * @secure - */ - getServiceAccount: (accessKey: string, params: RequestParams = {}) => - this.request({ - path: `/service-accounts/${encodeURIComponent(accessKey)}`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags ServiceAccount - * @name UpdateServiceAccount - * @summary Set Service Account Policy - * @request PUT:/service-accounts/{access_key} - * @secure - */ - updateServiceAccount: ( - accessKey: string, - body: UpdateServiceAccountRequest, - params: RequestParams = {}, - ) => - this.request({ - path: `/service-accounts/${encodeURIComponent(accessKey)}`, - method: "PUT", - body: body, - secure: true, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags ServiceAccount - * @name DeleteServiceAccount - * @summary Delete Service Account - * @request DELETE:/service-accounts/{access_key} - * @secure - */ - deleteServiceAccount: (accessKey: string, params: RequestParams = {}) => - this.request({ - path: `/service-accounts/${encodeURIComponent(accessKey)}`, - method: "DELETE", - secure: true, - ...params, - }), - }; - serviceAccountCredentials = { - /** - * No description - * - * @tags ServiceAccount - * @name CreateServiceAccountCreds - * @summary Create Service Account With Credentials - * @request POST:/service-account-credentials - * @secure - */ - createServiceAccountCreds: ( - body: ServiceAccountRequestCreds, - params: RequestParams = {}, - ) => - this.request({ - path: `/service-account-credentials`, - method: "POST", - body: body, - secure: true, - format: "json", - ...params, - }), - }; - users = { - /** - * No description - * - * @tags User - * @name ListUsers - * @summary List Users - * @request GET:/users - * @secure - */ - listUsers: ( - query?: { - /** - * @format int32 - * @default 0 - */ - offset?: number; - /** - * @format int32 - * @default 20 - */ - limit?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/users`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags User - * @name AddUser - * @summary Add User - * @request POST:/users - * @secure - */ - addUser: (body: AddUserRequest, params: RequestParams = {}) => - this.request({ - path: `/users`, - method: "POST", - body: body, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags User - * @name CheckUserServiceAccounts - * @summary Check number of service accounts for each user specified - * @request POST:/users/service-accounts - * @secure - */ - checkUserServiceAccounts: ( - selectedUsers: SelectedUsers, - params: RequestParams = {}, - ) => - this.request({ - path: `/users/service-accounts`, - method: "POST", - body: selectedUsers, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - }; - user = { - /** - * No description - * - * @tags User - * @name GetUserInfo - * @summary Get User Info - * @request GET:/user/{name} - * @secure - */ - getUserInfo: (name: string, params: RequestParams = {}) => - this.request({ - path: `/user/${encodeURIComponent(name)}`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags User - * @name UpdateUserInfo - * @summary Update User Info - * @request PUT:/user/{name} - * @secure - */ - updateUserInfo: ( - name: string, - body: UpdateUser, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/${encodeURIComponent(name)}`, - method: "PUT", - body: body, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags User - * @name RemoveUser - * @summary Remove user - * @request DELETE:/user/{name} - * @secure - */ - removeUser: (name: string, params: RequestParams = {}) => - this.request({ - path: `/user/${encodeURIComponent(name)}`, - method: "DELETE", - secure: true, - ...params, - }), - - /** - * No description - * - * @tags User - * @name UpdateUserGroups - * @summary Update Groups for a user - * @request PUT:/user/{name}/groups - * @secure - */ - updateUserGroups: ( - name: string, - body: UpdateUserGroups, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/${encodeURIComponent(name)}/groups`, - method: "PUT", - body: body, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Policy - * @name GetUserPolicy - * @summary returns policies for logged in user - * @request GET:/user/policy - * @secure - */ - getUserPolicy: (params: RequestParams = {}) => - this.request({ - path: `/user/policy`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Policy - * @name GetSaUserPolicy - * @summary returns policies assigned for a specified user - * @request GET:/user/{name}/policies - * @secure - */ - getSaUserPolicy: (name: string, params: RequestParams = {}) => - this.request({ - path: `/user/${encodeURIComponent(name)}/policies`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags User - * @name ListAUserServiceAccounts - * @summary returns a list of service accounts for a user - * @request GET:/user/{name}/service-accounts - * @secure - */ - listAUserServiceAccounts: (name: string, params: RequestParams = {}) => - this.request({ - path: `/user/${encodeURIComponent(name)}/service-accounts`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags User - * @name CreateAUserServiceAccount - * @summary Create Service Account for User - * @request POST:/user/{name}/service-accounts - * @secure - */ - createAUserServiceAccount: ( - name: string, - body: ServiceAccountRequest, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/${encodeURIComponent(name)}/service-accounts`, - method: "POST", - body: body, - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags User - * @name CreateServiceAccountCredentials - * @summary Create Service Account for User With Credentials - * @request POST:/user/{name}/service-account-credentials - * @secure - */ - createServiceAccountCredentials: ( - name: string, - body: ServiceAccountRequestCreds, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/${encodeURIComponent(name)}/service-account-credentials`, - method: "POST", - body: body, - secure: true, - format: "json", - ...params, - }), - }; - usersGroupsBulk = { - /** - * No description - * - * @tags User - * @name BulkUpdateUsersGroups - * @summary Bulk functionality to Add Users to Groups - * @request PUT:/users-groups-bulk - * @secure - */ - bulkUpdateUsersGroups: (body: BulkUserGroups, params: RequestParams = {}) => - this.request({ - path: `/users-groups-bulk`, - method: "PUT", - body: body, - secure: true, - type: ContentType.Json, - ...params, - }), - }; - groups = { - /** - * No description - * - * @tags Group - * @name ListGroups - * @summary List Groups - * @request GET:/groups - * @secure - */ - listGroups: ( - query?: { - /** - * @format int32 - * @default 0 - */ - offset?: number; - /** - * @format int32 - * @default 20 - */ - limit?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/groups`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Group - * @name AddGroup - * @summary Add Group - * @request POST:/groups - * @secure - */ - addGroup: (body: AddGroupRequest, params: RequestParams = {}) => - this.request({ - path: `/groups`, - method: "POST", - body: body, - secure: true, - type: ContentType.Json, - ...params, - }), - }; - group = { - /** - * No description - * - * @tags Group - * @name GroupInfo - * @summary Group info - * @request GET:/group/{name} - * @secure - */ - groupInfo: (name: string, params: RequestParams = {}) => - this.request({ - path: `/group/${encodeURIComponent(name)}`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Group - * @name RemoveGroup - * @summary Remove group - * @request DELETE:/group/{name} - * @secure - */ - removeGroup: (name: string, params: RequestParams = {}) => - this.request({ - path: `/group/${encodeURIComponent(name)}`, - method: "DELETE", - secure: true, - ...params, - }), - - /** - * No description - * - * @tags Group - * @name UpdateGroup - * @summary Update Group Members or Status - * @request PUT:/group/{name} - * @secure - */ - updateGroup: ( - name: string, - body: UpdateGroupRequest, - params: RequestParams = {}, - ) => - this.request({ - path: `/group/${encodeURIComponent(name)}`, - method: "PUT", - body: body, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - }; - policies = { - /** - * No description - * - * @tags Policy - * @name ListPolicies - * @summary List Policies - * @request GET:/policies - * @secure - */ - listPolicies: ( - query?: { - /** - * @format int32 - * @default 0 - */ - offset?: number; - /** - * @format int32 - * @default 20 - */ - limit?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/policies`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Policy - * @name AddPolicy - * @summary Add Policy - * @request POST:/policies - * @secure - */ - addPolicy: (body: AddPolicyRequest, params: RequestParams = {}) => - this.request({ - path: `/policies`, - method: "POST", - body: body, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Policy - * @name ListUsersForPolicy - * @summary List Users for a Policy - * @request GET:/policies/{policy}/users - * @secure - */ - listUsersForPolicy: (policy: string, params: RequestParams = {}) => - this.request({ - path: `/policies/${encodeURIComponent(policy)}/users`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Policy - * @name ListGroupsForPolicy - * @summary List Groups for a Policy - * @request GET:/policies/{policy}/groups - * @secure - */ - listGroupsForPolicy: (policy: string, params: RequestParams = {}) => - this.request({ - path: `/policies/${encodeURIComponent(policy)}/groups`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - }; - bucketPolicy = { - /** - * No description - * - * @tags Bucket - * @name ListPoliciesWithBucket - * @summary List Policies With Given Bucket - * @request GET:/bucket-policy/{bucket} - * @secure - */ - listPoliciesWithBucket: ( - bucket: string, - query?: { - /** - * @format int32 - * @default 0 - */ - offset?: number; - /** - * @format int32 - * @default 20 - */ - limit?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/bucket-policy/${encodeURIComponent(bucket)}`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - }; - bucket = { - /** - * No description - * - * @tags Bucket - * @name SetAccessRuleWithBucket - * @summary Add Access Rule To Given Bucket - * @request PUT:/bucket/{bucket}/access-rules - * @secure - */ - setAccessRuleWithBucket: ( - bucket: string, - prefixaccess: PrefixAccessPair, - params: RequestParams = {}, - ) => - this.request({ - path: `/bucket/${encodeURIComponent(bucket)}/access-rules`, - method: "PUT", - body: prefixaccess, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Bucket - * @name ListAccessRulesWithBucket - * @summary List Access Rules With Given Bucket - * @request GET:/bucket/{bucket}/access-rules - * @secure - */ - listAccessRulesWithBucket: ( - bucket: string, - query?: { - /** - * @format int32 - * @default 0 - */ - offset?: number; - /** - * @format int32 - * @default 20 - */ - limit?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/bucket/${encodeURIComponent(bucket)}/access-rules`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Bucket - * @name DeleteAccessRuleWithBucket - * @summary Delete Access Rule From Given Bucket - * @request DELETE:/bucket/{bucket}/access-rules - * @secure - */ - deleteAccessRuleWithBucket: ( - bucket: string, - prefix: PrefixWrapper, - params: RequestParams = {}, - ) => - this.request({ - path: `/bucket/${encodeURIComponent(bucket)}/access-rules`, - method: "DELETE", - body: prefix, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - }; - bucketUsers = { - /** - * No description - * - * @tags Bucket - * @name ListUsersWithAccessToBucket - * @summary List Users With Access to a Given Bucket - * @request GET:/bucket-users/{bucket} - * @secure - */ - listUsersWithAccessToBucket: ( - bucket: string, - query?: { - /** - * @format int32 - * @default 0 - */ - offset?: number; - /** - * @format int32 - * @default 20 - */ - limit?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/bucket-users/${encodeURIComponent(bucket)}`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - }; - policy = { - /** - * No description - * - * @tags Policy - * @name PolicyInfo - * @summary Policy info - * @request GET:/policy/{name} - * @secure - */ - policyInfo: (name: string, params: RequestParams = {}) => - this.request({ - path: `/policy/${encodeURIComponent(name)}`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Policy - * @name RemovePolicy - * @summary Remove policy - * @request DELETE:/policy/{name} - * @secure - */ - removePolicy: (name: string, params: RequestParams = {}) => - this.request({ - path: `/policy/${encodeURIComponent(name)}`, - method: "DELETE", - secure: true, - ...params, - }), - }; - configs = { - /** - * No description - * - * @tags Configuration - * @name ListConfig - * @summary List Configurations - * @request GET:/configs - * @secure - */ - listConfig: ( - query?: { - /** - * @format int32 - * @default 0 - */ - offset?: number; - /** - * @format int32 - * @default 20 - */ - limit?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/configs`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Configuration - * @name ConfigInfo - * @summary Configuration info - * @request GET:/configs/{name} - * @secure - */ - configInfo: (name: string, params: RequestParams = {}) => - this.request({ - path: `/configs/${encodeURIComponent(name)}`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Configuration - * @name SetConfig - * @summary Set Configuration - * @request PUT:/configs/{name} - * @secure - */ - setConfig: ( - name: string, - body: SetConfigRequest, - params: RequestParams = {}, - ) => - this.request({ - path: `/configs/${encodeURIComponent(name)}`, - method: "PUT", - body: body, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Configuration - * @name ResetConfig - * @summary Configuration reset - * @request POST:/configs/{name}/reset - * @secure - */ - resetConfig: (name: string, params: RequestParams = {}) => - this.request({ - path: `/configs/${encodeURIComponent(name)}/reset`, - method: "POST", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Configuration - * @name ExportConfig - * @summary Export the current config from MinIO server - * @request GET:/configs/export - * @secure - */ - exportConfig: (params: RequestParams = {}) => - this.request({ - path: `/configs/export`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Configuration - * @name ImportCreate - * @summary Uploads a file to import MinIO server config. - * @request POST:/configs/import - * @secure - */ - importCreate: ( - data: { - /** @format binary */ - file: File; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/configs/import`, - method: "POST", - body: data, - secure: true, - type: ContentType.FormData, - ...params, - }), - }; - setPolicy = { - /** - * No description - * - * @tags Policy - * @name SetPolicy - * @summary Set policy - * @request PUT:/set-policy - * @secure - */ - setPolicy: (body: SetPolicyNameRequest, params: RequestParams = {}) => - this.request({ - path: `/set-policy`, - method: "PUT", - body: body, - secure: true, - type: ContentType.Json, - ...params, - }), - }; - setPolicyMulti = { - /** - * No description - * - * @tags Policy - * @name SetPolicyMultiple - * @summary Set policy to multiple users/groups - * @request PUT:/set-policy-multi - * @secure - */ - setPolicyMultiple: ( - body: SetPolicyMultipleNameRequest, - params: RequestParams = {}, - ) => - this.request({ - path: `/set-policy-multi`, - method: "PUT", - body: body, - secure: true, - type: ContentType.Json, - ...params, - }), - }; - service = { - /** - * No description - * - * @tags Service - * @name RestartService - * @summary Restart Service - * @request POST:/service/restart - * @secure - */ - restartService: (params: RequestParams = {}) => - this.request({ - path: `/service/restart`, - method: "POST", - secure: true, - ...params, - }), - }; - admin = { - /** - * No description - * - * @tags System - * @name AdminInfo - * @summary Returns information about the deployment - * @request GET:/admin/info - * @secure - */ - adminInfo: ( - query?: { - /** @default false */ - defaultOnly?: boolean; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/admin/info`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags System - * @name DashboardWidgetDetails - * @summary Returns information about the deployment - * @request GET:/admin/info/widgets/{widgetId} - * @secure - */ - dashboardWidgetDetails: ( - widgetId: number, - query?: { - start?: number; - end?: number; - /** @format int32 */ - step?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/admin/info/widgets/${encodeURIComponent(widgetId)}`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags System - * @name ArnList - * @summary Returns a list of active ARNs in the instance - * @request GET:/admin/arns - * @secure - */ - arnList: (params: RequestParams = {}) => - this.request({ - path: `/admin/arns`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Configuration - * @name NotificationEndpointList - * @summary Returns a list of active notification endpoints - * @request GET:/admin/notification_endpoints - * @secure - */ - notificationEndpointList: (params: RequestParams = {}) => - this.request({ - path: `/admin/notification_endpoints`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Configuration - * @name AddNotificationEndpoint - * @summary Allows to configure a new notification endpoint - * @request POST:/admin/notification_endpoints - * @secure - */ - addNotificationEndpoint: ( - body: NotificationEndpoint, - params: RequestParams = {}, - ) => - this.request({ - path: `/admin/notification_endpoints`, - method: "POST", - body: body, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Inspect - * @name Inspect - * @summary Inspect Files on Drive - * @request GET:/admin/inspect - * @secure - */ - inspect: ( - query: { - file: string; - volume: string; - encrypt?: boolean; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/admin/inspect`, - method: "GET", - query: query, - secure: true, - ...params, - }), - }; - nodes = { + }; + admin = { /** * No description * * @tags System - * @name ListNodes - * @summary Lists Nodes - * @request GET:/nodes - * @secure - */ - listNodes: (params: RequestParams = {}) => - this.request({ - path: `/nodes`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - }; - remoteBuckets = { - /** - * No description - * - * @tags Bucket - * @name ListRemoteBuckets - * @summary List Remote Buckets - * @request GET:/remote-buckets - * @secure - */ - listRemoteBuckets: (params: RequestParams = {}) => - this.request({ - path: `/remote-buckets`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Bucket - * @name AddRemoteBucket - * @summary Add Remote Bucket - * @request POST:/remote-buckets - * @secure - */ - addRemoteBucket: (body: CreateRemoteBucket, params: RequestParams = {}) => - this.request({ - path: `/remote-buckets`, - method: "POST", - body: body, - secure: true, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags Bucket - * @name RemoteBucketDetails - * @summary Remote Bucket Details - * @request GET:/remote-buckets/{name} - * @secure - */ - remoteBucketDetails: (name: string, params: RequestParams = {}) => - this.request({ - path: `/remote-buckets/${encodeURIComponent(name)}`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Bucket - * @name DeleteRemoteBucket - * @summary Delete Remote Bucket - * @request DELETE:/remote-buckets/{source-bucket-name}/{arn} - * @secure - */ - deleteRemoteBucket: ( - sourceBucketName: string, - arn: string, - params: RequestParams = {}, - ) => - this.request({ - path: `/remote-buckets/${encodeURIComponent(sourceBucketName)}/${encodeURIComponent(arn)}`, - method: "DELETE", - secure: true, - ...params, - }), - }; - logs = { - /** - * No description - * - * @tags Logging - * @name LogSearch - * @summary Search the logs - * @request GET:/logs/search + * @name AdminInfo + * @summary Returns information about the deployment + * @request GET:/admin/info * @secure */ - logSearch: ( + adminInfo: ( query?: { - /** Filter Parameters */ - fp?: string[]; - /** - * @format int32 - * @default 10 - */ - pageSize?: number; - /** - * @format int32 - * @default 0 - */ - pageNo?: number; - /** @default "timeDesc" */ - order?: "timeDesc" | "timeAsc"; - timeStart?: string; - timeEnd?: string; + /** @default false */ + defaultOnly?: boolean; }, params: RequestParams = {}, ) => - this.request({ - path: `/logs/search`, + this.request({ + path: `/admin/info`, method: "GET", query: query, secure: true, @@ -3865,303 +2046,21 @@ export class Api< ...params, }), }; - kms = { - /** - * No description - * - * @tags KMS - * @name KmsStatus - * @summary KMS status - * @request GET:/kms/status - * @secure - */ - kmsStatus: (params: RequestParams = {}) => - this.request({ - path: `/kms/status`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags KMS - * @name KmsMetrics - * @summary KMS metrics - * @request GET:/kms/metrics - * @secure - */ - kmsMetrics: (params: RequestParams = {}) => - this.request({ - path: `/kms/metrics`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags KMS - * @name KmsapIs - * @summary KMS apis - * @request GET:/kms/apis - * @secure - */ - kmsapIs: (params: RequestParams = {}) => - this.request({ - path: `/kms/apis`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags KMS - * @name KmsVersion - * @summary KMS version - * @request GET:/kms/version - * @secure - */ - kmsVersion: (params: RequestParams = {}) => - this.request({ - path: `/kms/version`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - + license = { /** * No description * - * @tags KMS - * @name KmsCreateKey - * @summary KMS create key - * @request POST:/kms/keys + * @tags License + * @name LicenseAcknowledge + * @summary Acknowledge the license + * @request GET:/license/acknowledge * @secure */ - kmsCreateKey: (body: KmsCreateKeyRequest, params: RequestParams = {}) => + licenseAcknowledge: (params: RequestParams = {}) => this.request({ - path: `/kms/keys`, - method: "POST", - body: body, - secure: true, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags KMS - * @name KmsListKeys - * @summary KMS list keys - * @request GET:/kms/keys - * @secure - */ - kmsListKeys: ( - query?: { - /** pattern to retrieve keys */ - pattern?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/kms/keys`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags KMS - * @name KmsKeyStatus - * @summary KMS key status - * @request GET:/kms/keys/{name} - * @secure - */ - kmsKeyStatus: (name: string, params: RequestParams = {}) => - this.request({ - path: `/kms/keys/${encodeURIComponent(name)}`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - }; - idp = { - /** - * No description - * - * @tags idp - * @name CreateConfiguration - * @summary Create IDP Configuration - * @request POST:/idp/{type} - * @secure - */ - createConfiguration: ( - type: string, - body: IdpServerConfiguration, - params: RequestParams = {}, - ) => - this.request({ - path: `/idp/${encodeURIComponent(type)}`, - method: "POST", - body: body, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags idp - * @name ListConfigurations - * @summary List IDP Configurations - * @request GET:/idp/{type} - * @secure - */ - listConfigurations: (type: string, params: RequestParams = {}) => - this.request({ - path: `/idp/${encodeURIComponent(type)}`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags idp - * @name GetConfiguration - * @summary Get IDP Configuration - * @request GET:/idp/{type}/{name} - * @secure - */ - getConfiguration: ( - name: string, - type: string, - params: RequestParams = {}, - ) => - this.request({ - path: `/idp/${encodeURIComponent(type)}/${encodeURIComponent(name)}`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags idp - * @name DeleteConfiguration - * @summary Delete IDP Configuration - * @request DELETE:/idp/{type}/{name} - * @secure - */ - deleteConfiguration: ( - name: string, - type: string, - params: RequestParams = {}, - ) => - this.request({ - path: `/idp/${encodeURIComponent(type)}/${encodeURIComponent(name)}`, - method: "DELETE", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags idp - * @name UpdateConfiguration - * @summary Update IDP Configuration - * @request PUT:/idp/{type}/{name} - * @secure - */ - updateConfiguration: ( - name: string, - type: string, - body: IdpServerConfiguration, - params: RequestParams = {}, - ) => - this.request({ - path: `/idp/${encodeURIComponent(type)}/${encodeURIComponent(name)}`, - method: "PUT", - body: body, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - }; - ldapEntities = { - /** - * No description - * - * @tags idp - * @name GetLdapEntities - * @summary Get LDAP Entities - * @request POST:/ldap-entities - * @secure - */ - getLdapEntities: (body: LdapEntitiesRequest, params: RequestParams = {}) => - this.request({ - path: `/ldap-entities`, - method: "POST", - body: body, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - }; - releases = { - /** - * No description - * - * @tags release - * @name ListReleases - * @summary Get repo releases for a given version - * @request GET:/releases - * @secure - */ - listReleases: ( - query: { - /** repo name */ - repo: string; - /** Current Release */ - current?: string; - /** search content */ - search?: string; - /** filter releases */ - filter?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/releases`, + path: `/license/acknowledge`, method: "GET", - query: query, secure: true, - format: "json", ...params, }), }; diff --git a/web-app/src/common/SecureComponent/__tests__/accessControl.test.ts b/web-app/src/common/SecureComponent/__tests__/accessControl.test.ts deleted file mode 100644 index 5cd0ceacf9..0000000000 --- a/web-app/src/common/SecureComponent/__tests__/accessControl.test.ts +++ /dev/null @@ -1,192 +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 "../../../utils/matchMedia"; -import hasPermission from "../accessControl"; -import { store } from "../../../store"; -import { IAM_PAGES, IAM_PAGES_PERMISSIONS, IAM_SCOPES } from "../permissions"; -import { saveSessionResponse } from "../../../screens/Console/consoleSlice"; - -const setPolicy1 = () => { - store.dispatch( - saveSessionResponse({ - distributedMode: true, - features: ["log-search"], - permissions: { - "arn:aws:s3:::testcafe": [ - "admin:CreateUser", - "s3:GetBucketLocation", - "s3:ListBucket", - "admin:CreateServiceAccount", - ], - "arn:aws:s3:::testcafe/*": [ - "admin:CreateServiceAccount", - "admin:CreateUser", - "s3:GetObject", - "s3:ListBucket", - ], - "arn:aws:s3:::testcafe/write/*": [ - "admin:CreateServiceAccount", - "admin:CreateUser", - "s3:PutObject", - "s3:DeleteObject", - "s3:GetObject", - "s3:ListBucket", - ], - "console-ui": ["admin:CreateServiceAccount", "admin:CreateUser"], - }, - status: "ok", - }), - ); -}; -const setPolicy2 = () => { - store.dispatch( - saveSessionResponse({ - distributedMode: true, - features: [], - permissions: { - "arn:aws:s3:::bucket-svc": [ - "admin:CreateServiceAccount", - "s3:GetBucketLocation", - "s3:ListBucket", - "s3:ListBucketMultipartUploads", - "s3:ListMultipartUploadParts", - "admin:CreateUser", - ], - "arn:aws:s3:::bucket-svc/prefix1/*": [ - "admin:CreateUser", - "admin:CreateServiceAccount", - "s3:GetObject", - "s3:PutObject", - ], - "arn:aws:s3:::bucket-svc/prefix1/ini*": [ - "admin:CreateServiceAccount", - "s3:*", - "admin:CreateUser", - ], - "arn:aws:s3:::bucket-svc/prefix1/jars*": [ - "admin:CreateUser", - "admin:CreateServiceAccount", - "s3:*", - ], - "arn:aws:s3:::bucket-svc/prefix1/logs*": [ - "admin:CreateUser", - "admin:CreateServiceAccount", - "s3:*", - ], - "console-ui": ["admin:CreateServiceAccount", "admin:CreateUser"], - }, - status: "ok", - }), - ); -}; -const setPolicy3 = () => { - store.dispatch( - saveSessionResponse({ - distributedMode: true, - features: [], - permissions: { - "arn:aws:s3:::testbucket-*": [ - "admin:CreateServiceAccount", - "s3:*", - "admin:CreateUser", - ], - "console-ui": ["admin:CreateServiceAccount", "admin:CreateUser"], - }, - status: "ok", - }), - ); -}; - -const setPolicy4 = () => { - store.dispatch( - saveSessionResponse({ - distributedMode: true, - features: [], - permissions: { - "arn:aws:s3:::test/*": ["s3:ListBucket"], - "arn:aws:s3:::test": ["s3:GetBucketLocation"], - "arn:aws:s3:::test/digitalinsights/xref_cust_guid_actd*": ["s3:*"], - }, - status: "ok", - }), - ); -}; - -test("Upload button disabled", () => { - setPolicy1(); - expect(hasPermission("testcafe", ["s3:PutObject"])).toBe(false); -}); - -test("Upload button enabled valid prefix", () => { - setPolicy1(); - expect(hasPermission("testcafe/write", ["s3:PutObject"], false, true)).toBe( - true, - ); -}); - -test("Can Browse Bucket", () => { - setPolicy2(); - expect( - hasPermission( - "bucket-svc", - IAM_PAGES_PERMISSIONS[IAM_PAGES.OBJECT_BROWSER_VIEW], - ), - ).toBe(true); -}); - -test("Can List Objects In Bucket", () => { - setPolicy2(); - expect(hasPermission("bucket-svc", [IAM_SCOPES.S3_LIST_BUCKET])).toBe(true); -}); - -test("Can create bucket for policy with a wildcard", () => { - setPolicy3(); - expect(hasPermission("*", [IAM_SCOPES.S3_CREATE_BUCKET])).toBe(true); -}); - -test("Can browse a bucket for a policy with a wildcard", () => { - setPolicy3(); - expect( - hasPermission( - "testbucket-0", - IAM_PAGES_PERMISSIONS[IAM_PAGES.OBJECT_BROWSER_VIEW], - ), - ).toBe(true); -}); - -test("Can delete an object inside a bucket prefix", () => { - setPolicy4(); - expect( - hasPermission( - [ - "xref_cust_guid_actd-v1.jpg", - "test/digitalinsights/xref_cust_guid_actd-v1.jpg", - ], - [IAM_SCOPES.S3_DELETE_OBJECT, IAM_SCOPES.S3_DELETE_ACTIONS], - ), - ).toBe(true); -}); - -test("Can't delete an object inside a bucket prefix", () => { - setPolicy4(); - expect( - hasPermission( - ["xref_cust_guid_actd-v1.jpg", "test/xref_cust_guid_actd-v1.jpg"], - [IAM_SCOPES.S3_DELETE_OBJECT, IAM_SCOPES.S3_DELETE_ACTIONS], - ), - ).toBe(false); -}); diff --git a/web-app/src/common/SecureComponent/permissions.ts b/web-app/src/common/SecureComponent/permissions.ts index 71d2afc1fa..09faf9ae3f 100644 --- a/web-app/src/common/SecureComponent/permissions.ts +++ b/web-app/src/common/SecureComponent/permissions.ts @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -export const IAM_ROLES = { +const IAM_ROLES = { BUCKET_OWNER: "BUCKET_OWNER", // upload/delete objects from the bucket BUCKET_VIEWER: "BUCKET_VIEWER", // only view objects on the bucket BUCKET_ADMIN: "BUCKET_ADMIN", // administrate the bucket @@ -193,7 +193,7 @@ export const IAM_PAGES = { }; // roles -export const IAM_PERMISSIONS = { +const IAM_PERMISSIONS = { [IAM_ROLES.BUCKET_OWNER]: [ IAM_SCOPES.S3_PUT_OBJECT, IAM_SCOPES.S3_PUT_ACTIONS, @@ -397,7 +397,6 @@ export const IAM_PAGES_PERMISSIONS = { ], }; -export const S3_ALL_RESOURCES = "arn:aws:s3:::*"; export const CONSOLE_UI_RESOURCE = "console-ui"; export const permissionTooltipHelper = (scopes: string[], name: string) => { @@ -415,106 +414,3 @@ export const permissionTooltipHelper = (scopes: string[], name: string) => { "." ); }; - -export const listUsersPermissions = [IAM_SCOPES.ADMIN_LIST_USERS]; - -export const addUserToGroupPermissions = [IAM_SCOPES.ADMIN_ADD_USER_TO_GROUP]; - -export const deleteUserPermissions = [IAM_SCOPES.ADMIN_DELETE_USER]; - -export const enableUserPermissions = [IAM_SCOPES.ADMIN_ENABLE_USER]; - -export const disableUserPermissions = [IAM_SCOPES.ADMIN_DISABLE_USER]; - -//note that adminUserPermissions does NOT include ADMIN_CREATE_USER to allow hiding the Users tab for users wtih only this permission as it is being applied by default -export const adminUserPermissions = [ - IAM_SCOPES.ADMIN_LIST_USER_POLICIES, - IAM_SCOPES.ADMIN_LIST_USERS, - IAM_SCOPES.ADMIN_ADD_USER_TO_GROUP, - IAM_SCOPES.ADMIN_REMOVE_USER_FROM_GROUP, - IAM_SCOPES.ADMIN_ATTACH_USER_OR_GROUP_POLICY, - IAM_SCOPES.ADMIN_LIST_USERS, - IAM_SCOPES.ADMIN_DELETE_USER, - IAM_SCOPES.ADMIN_ENABLE_USER, - IAM_SCOPES.ADMIN_DISABLE_USER, - IAM_SCOPES.ADMIN_GET_USER, - IAM_SCOPES.ADMIN_LIST_USER_POLICIES, -]; - -export const assignIAMPolicyPermissions = [ - IAM_SCOPES.ADMIN_ATTACH_USER_OR_GROUP_POLICY, - IAM_SCOPES.ADMIN_LIST_USER_POLICIES, - IAM_SCOPES.ADMIN_GET_POLICY, -]; - -export const assignGroupPermissions = [ - IAM_SCOPES.ADMIN_ADD_USER_TO_GROUP, - IAM_SCOPES.ADMIN_REMOVE_USER_FROM_GROUP, - IAM_SCOPES.ADMIN_LIST_GROUPS, - IAM_SCOPES.ADMIN_ENABLE_USER, -]; - -export const getGroupPermissions = [IAM_SCOPES.ADMIN_GET_GROUP]; - -export const enableDisableUserPermissions = [ - IAM_SCOPES.ADMIN_ENABLE_USER, - IAM_SCOPES.ADMIN_DISABLE_USER, -]; - -export const editServiceAccountPermissions = [ - IAM_SCOPES.ADMIN_LIST_SERVICEACCOUNTS, - IAM_SCOPES.ADMIN_UPDATE_SERVICEACCOUNT, - IAM_SCOPES.ADMIN_REMOVE_SERVICEACCOUNT, -]; - -export const applyPolicyPermissions = [ - IAM_SCOPES.ADMIN_ATTACH_USER_OR_GROUP_POLICY, - IAM_SCOPES.ADMIN_LIST_USER_POLICIES, -]; - -export const deleteGroupPermissions = [IAM_SCOPES.ADMIN_REMOVE_USER_FROM_GROUP]; - -export const displayGroupsPermissions = [IAM_SCOPES.ADMIN_LIST_GROUPS]; - -export const createGroupPermissions = [ - IAM_SCOPES.ADMIN_ADD_USER_TO_GROUP, - IAM_SCOPES.ADMIN_LIST_USERS, -]; - -export const viewUserPermissions = [ - IAM_SCOPES.ADMIN_GET_USER, - IAM_SCOPES.ADMIN_LIST_USERS, -]; -export const editGroupMembersPermissions = [ - IAM_SCOPES.ADMIN_ADD_USER_TO_GROUP, - IAM_SCOPES.ADMIN_LIST_USERS, -]; -export const setGroupPoliciesPermissions = [ - IAM_SCOPES.ADMIN_ATTACH_USER_OR_GROUP_POLICY, - IAM_SCOPES.ADMIN_LIST_USER_POLICIES, -]; -export const viewPolicyPermissions = [IAM_SCOPES.ADMIN_GET_POLICY]; -export const enableDisableGroupPermissions = [ - IAM_SCOPES.ADMIN_ENABLE_GROUP, - IAM_SCOPES.ADMIN_DISABLE_GROUP, -]; -export const createPolicyPermissions = [IAM_SCOPES.ADMIN_CREATE_POLICY]; - -export const deletePolicyPermissions = [IAM_SCOPES.ADMIN_DELETE_POLICY]; - -export const listPolicyPermissions = [IAM_SCOPES.ADMIN_LIST_USER_POLICIES]; - -export const listGroupPermissions = [ - IAM_SCOPES.ADMIN_LIST_GROUPS, - IAM_SCOPES.ADMIN_GET_GROUP, -]; - -export const deleteBucketPermissions = [ - IAM_SCOPES.S3_DELETE_BUCKET, - IAM_SCOPES.S3_FORCE_DELETE_BUCKET, -]; - -export const browseBucketPermissions = [ - IAM_SCOPES.S3_LIST_BUCKET, - IAM_SCOPES.S3_ALL_LIST_BUCKET, -]; diff --git a/web-app/src/common/types.ts b/web-app/src/common/types.ts index 04ea3093e4..8bbe1013fa 100644 --- a/web-app/src/common/types.ts +++ b/web-app/src/common/types.ts @@ -36,11 +36,6 @@ export interface ErrorResponseHandler { statusCode?: number; } -export interface IBytesCalc { - total: number; - unit: string; -} - interface IEmbeddedCustomButton { backgroundColor: string; textColor: string; @@ -97,8 +92,3 @@ export interface IEmbeddedCustomStyles { inputBox: IEmbeddedInputBox; switch: IEmbeddedSwitch; } - -export interface SelectorTypes { - label: any; - value: string; -} diff --git a/web-app/src/common/utils.ts b/web-app/src/common/utils.ts index 6f37551083..2ca0d629cc 100644 --- a/web-app/src/common/utils.ts +++ b/web-app/src/common/utils.ts @@ -15,23 +15,13 @@ // along with this program. If not, see . import storage from "local-storage-fallback"; -import { IBytesCalc, IErasureCodeCalc, IStorageFactors } from "./types"; +import { IErasureCodeCalc, IStorageFactors } from "./types"; import get from "lodash/get"; const minMemReq = 2147483648; // Minimal Memory required for MinIO in bytes -export const units = [ - "B", - "KiB", - "MiB", - "GiB", - "TiB", - "PiB", - "EiB", - "ZiB", - "YiB", -]; +const units = ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"]; const k8sUnits = ["Ki", "Mi", "Gi", "Ti", "Pi", "Ei"]; const k8sCalcUnits = ["B", ...k8sUnits]; @@ -53,7 +43,7 @@ export const niceBytesInt = (n: number, showK8sUnits: boolean = false) => { return n.toFixed(1) + " " + (showK8sUnits ? k8sUnitsN[l] : units[l]); }; -export const deleteCookie = (name: string) => { +const deleteCookie = (name: string) => { document.cookie = name + "=; expires=Thu, 01 Jan 1970 00:00:01 GMT;"; }; @@ -64,20 +54,6 @@ export const clearSession = () => { deleteCookie("idp-refresh-token"); }; -// units to be used in a dropdown -export const k8sScalarUnitsExcluding = (exclude?: string[]) => { - return k8sUnits - .filter((unit) => { - if (exclude && exclude.includes(unit)) { - return false; - } - return true; - }) - .map((unit) => { - return { label: unit, value: unit }; - }); -}; - //getBytes, converts from a value and a unit from units array to bytes as a string export const getBytes = ( value: string, @@ -272,13 +248,6 @@ export const niceTimeFromSeconds = (seconds: number): string => { return parts.join(" and "); }; -// seconds / minutes /hours / Days / Years calculator -export const niceDays = (secondsValue: string, timeVariant: string = "s") => { - let seconds = parseFloat(secondsValue); - - return niceDaysInt(seconds, timeVariant); -}; - // niceDaysInt returns the string in the max unit found e.g. 92400 seconds -> 1 day export const niceDaysInt = (seconds: number, timeVariant: string = "s") => { switch (timeVariant) { @@ -334,159 +303,6 @@ export const niceDaysInt = (seconds: number, timeVariant: string = "s") => { }`; }; -const twoDigitsNumberString = (value: number) => { - return `${value < 10 ? "0" : ""}${value}`; -}; - -export const getTimeFromTimestamp = ( - timestamp: string, - fullDate: boolean = false, - simplifiedDate: boolean = false, -) => { - const timestampToInt = parseInt(timestamp); - if (isNaN(timestampToInt)) { - return ""; - } - const dateObject = new Date(timestampToInt * 1000); - - if (fullDate) { - if (simplifiedDate) { - return `${twoDigitsNumberString( - dateObject.getMonth() + 1, - )}/${twoDigitsNumberString(dateObject.getDate())} ${twoDigitsNumberString( - dateObject.getHours(), - )}:${twoDigitsNumberString(dateObject.getMinutes())}`; - } else { - return dateObject.toLocaleString(); - } - } - return `${dateObject.getHours()}:${String(dateObject.getMinutes()).padStart( - 2, - "0", - )}`; -}; - -export const calculateBytes = ( - x: string | number, - showDecimals = false, - roundFloor = true, - k8sUnit = false, -): IBytesCalc => { - let bytes; - - if (typeof x === "string") { - bytes = parseInt(x, 10); - } else { - bytes = x; - } - - if (bytes === 0) { - return { total: 0, unit: units[0] }; - } - - // Gi : GiB - const k = 1024; - - // Get unit for measure - const i = Math.floor(Math.log(bytes) / Math.log(k)); - - const fractionDigits = showDecimals ? 1 : 0; - - const bytesUnit = bytes / Math.pow(k, i); - - const roundedUnit = roundFloor ? Math.floor(bytesUnit) : bytesUnit; - - // Get Unit parsed - const unitParsed = parseFloat(roundedUnit.toFixed(fractionDigits)); - const finalUnit = k8sUnit ? k8sCalcUnits[i] : units[i]; - - return { total: unitParsed, unit: finalUnit }; -}; - -export const nsToSeconds = (nanoseconds: number) => { - const conversion = nanoseconds * 0.000000001; - const round = Math.round((conversion + Number.EPSILON) * 10000) / 10000; - - return `${round} s`; -}; - -export const textToRGBColor = (text: string) => { - const splitText = text.split(""); - - const hashVl = splitText.reduce((acc, currItem) => { - return acc + currItem.charCodeAt(0) + ((acc << 5) - acc); - }, 0); - - const hashColored = ((hashVl * 100) & 0x00ffffff).toString(16).toUpperCase(); - - return `#${hashColored.padStart(6, "0")}`; -}; - -export const prettyNumber = (usage: number | undefined) => { - if (usage === undefined) { - return 0; - } - - return usage.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); -}; - -export const representationNumber = (number: number | undefined) => { - if (number === undefined) { - return "0"; - } - - let returnValue = number.toString(); - let unit = ""; - - if (number > 999 && number < 1000000) { - returnValue = (number / 1000).toFixed(1); // convert to K, numbers > 999 - unit = "K"; - } else if (number >= 1000000 && number < 1000000000) { - returnValue = (number / 1000000).toFixed(1); // convert to M, numbers >= 1 million - unit = "M"; - } else if (number >= 1000000000) { - returnValue = (number / 1000000000).toFixed(1); // convert to B, numbers >= 1 billion - unit = "B"; - } - - if (returnValue.endsWith(".0")) { - returnValue = returnValue.slice(0, -2); - } - - return `${returnValue}${unit}`; -}; - -/** Ref https://developer.mozilla.org/en-US/docs/Glossary/Base64 */ - -export const performDownload = (blob: Blob, fileName: string) => { - const link = document.createElement("a"); - link.href = window.URL.createObjectURL(blob); - link.download = fileName; - document.body.appendChild(link); - link.click(); - document.body.removeChild(link); -}; - -export const getCookieValue = (cookieName: string) => { - return ( - document.cookie - .match("(^|;)\\s*" + cookieName + "\\s*=\\s*([^;]+)") - ?.pop() || "" - ); -}; - -export const capacityColors = (usedSpace: number, maxSpace: number) => { - const percCalculate = (usedSpace * 100) / maxSpace; - - if (percCalculate >= 90) { - return "#C83B51"; - } else if (percCalculate >= 70) { - return "#FFAB0F"; - } - - return "#07193E"; -}; - export const getClientOS = (): string => { const getPlatform = get(window.navigator, "platform", "undefined"); @@ -497,18 +313,6 @@ export const getClientOS = (): string => { return getPlatform; }; -// Generates a valid access/secret key string -export const getRandomString = function (length = 16): string { - let retval = ""; - let legalcharacters = - "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; - for (let i = 0; i < length; i++) { - retval += - legalcharacters[Math.floor(Math.random() * legalcharacters.length)]; - } - return retval; -}; - // replaces bad unicode characters export const replaceUnicodeChar = (inputString: string): string => { let unicodeChar = "\u202E"; diff --git a/web-app/src/config.ts b/web-app/src/config.ts index f3ae22f2e7..11adcca145 100644 --- a/web-app/src/config.ts +++ b/web-app/src/config.ts @@ -65,8 +65,3 @@ export const getLogoApplicationVariant = return "console"; } }; - -export const registeredCluster = (): boolean => { - const plan = getLogoVar(); - return ["standard", "enterprise", "enterpriseos"].includes(plan || "AGPL"); -}; diff --git a/web-app/src/icons/SidebarMenus/EncryptionIcon.tsx b/web-app/src/icons/SidebarMenus/EncryptionIcon.tsx deleted file mode 100644 index d51a353aa3..0000000000 --- a/web-app/src/icons/SidebarMenus/EncryptionIcon.tsx +++ /dev/null @@ -1,37 +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 * as React from "react"; -import { SVGProps } from "react"; - -const EncryptionIcon = (props: SVGProps) => ( - - - -); - -export default EncryptionIcon; diff --git a/web-app/src/icons/SidebarMenus/EncryptionStatusIcon.tsx b/web-app/src/icons/SidebarMenus/EncryptionStatusIcon.tsx deleted file mode 100644 index 866c41f137..0000000000 --- a/web-app/src/icons/SidebarMenus/EncryptionStatusIcon.tsx +++ /dev/null @@ -1,38 +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 * as React from "react"; -import { SVGProps } from "react"; - -const EncryptionStatusIcon = (props: SVGProps) => ( - - - -); - -export default EncryptionStatusIcon; diff --git a/web-app/src/screens/Console/Account/Account.tsx b/web-app/src/screens/Console/Account/Account.tsx deleted file mode 100644 index b9ac00c3c8..0000000000 --- a/web-app/src/screens/Console/Account/Account.tsx +++ /dev/null @@ -1,326 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 { - AccountIcon, - AddIcon, - Box, - Button, - DataTable, - DeleteIcon, - Grid, - HelpBox, - PageLayout, - PasswordKeyIcon, -} from "mds"; -import { useSelector } from "react-redux"; -import { useNavigate } from "react-router-dom"; -import { actionsTray } from "../Common/FormComponents/common/styleLibrary"; - -import ChangePasswordModal from "./ChangePasswordModal"; -import SearchBox from "../Common/SearchBox"; -import withSuspense from "../Common/Components/withSuspense"; - -import { selectSAs } from "../Configurations/utils"; -import DeleteMultipleServiceAccounts from "../Users/DeleteMultipleServiceAccounts"; -import EditServiceAccount from "./EditServiceAccount"; - -import { selFeatures } from "../consoleSlice"; -import TooltipWrapper from "../Common/TooltipWrapper/TooltipWrapper"; -import PageHeaderWrapper from "../Common/PageHeaderWrapper/PageHeaderWrapper"; -import { api } from "api"; -import { errorToHandler } from "api/errors"; -import HelpMenu from "../HelpMenu"; -import { ACCOUNT_TABLE_COLUMNS } from "./AccountUtils"; -import { useAppDispatch } from "store"; -import { ServiceAccounts } from "api/consoleApi"; -import { - setErrorSnackMessage, - setHelpName, - setSnackBarMessage, -} from "systemSlice"; -import { usersSort } from "utils/sortFunctions"; -import { SecureComponent } from "common/SecureComponent"; -import { - CONSOLE_UI_RESOURCE, - IAM_PAGES, - IAM_SCOPES, -} from "common/SecureComponent/permissions"; - -const DeleteServiceAccount = withSuspense( - React.lazy(() => import("./DeleteServiceAccount")), -); - -const Account = () => { - const dispatch = useAppDispatch(); - const navigate = useNavigate(); - - const features = useSelector(selFeatures); - - const [records, setRecords] = useState([]); - const [loading, setLoading] = useState(false); - const [filter, setFilter] = useState(""); - const [deleteOpen, setDeleteOpen] = useState(false); - const [selectedServiceAccount, setSelectedServiceAccount] = useState< - string | null - >(null); - const [changePasswordModalOpen, setChangePasswordModalOpen] = - useState(false); - const [selectedSAs, setSelectedSAs] = useState([]); - const [deleteMultipleOpen, setDeleteMultipleOpen] = useState(false); - const [isEditOpen, setIsEditOpen] = useState(false); - - const userIDP = (features && features.includes("external-idp")) || false; - - useEffect(() => { - fetchRecords(); - }, []); - - useEffect(() => { - dispatch(setHelpName("accessKeys")); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); - - useEffect(() => { - if (loading) { - api.serviceAccounts - .listUserServiceAccounts() - .then((res) => { - setLoading(false); - const sortedRows = res.data.sort(usersSort); - setRecords(sortedRows); - }) - .catch((res) => { - dispatch( - setErrorSnackMessage( - errorToHandler(res?.error || "Error retrieving access keys"), - ), - ); - setLoading(false); - }); - } - }, [loading, setLoading, setRecords, dispatch]); - - const fetchRecords = () => { - setLoading(true); - }; - - const closeDeleteModalAndRefresh = (refresh: boolean) => { - setDeleteOpen(false); - - if (refresh) { - setSelectedSAs([]); - fetchRecords(); - } - }; - - const closeDeleteMultipleModalAndRefresh = (refresh: boolean) => { - setDeleteMultipleOpen(false); - if (refresh) { - dispatch(setSnackBarMessage(`Access keys deleted successfully.`)); - setSelectedSAs([]); - setLoading(true); - } - }; - - const editModalOpen = (selectedServiceAccount: string) => { - setSelectedServiceAccount(selectedServiceAccount); - setIsEditOpen(true); - }; - - const closePolicyModal = () => { - setIsEditOpen(false); - setLoading(true); - }; - - const confirmDeleteServiceAccount = (selectedServiceAccount: string) => { - setSelectedServiceAccount(selectedServiceAccount); - setDeleteOpen(true); - }; - - const tableActions = [ - { - type: "view", - onClick: (value: any) => { - if (value) { - editModalOpen(value.accessKey); - } - }, - }, - { - type: "delete", - onClick: (value: any) => { - if (value) { - confirmDeleteServiceAccount(value.accessKey); - } - }, - }, - { - type: "edit", - onClick: (value: any) => { - if (value) { - editModalOpen(value.accessKey); - } - }, - }, - ]; - - const filteredRecords = records.filter((elementItem) => - elementItem?.accessKey?.toLowerCase().includes(filter.toLowerCase()), - ); - - return ( - - {deleteOpen && ( - { - closeDeleteModalAndRefresh(refresh); - }} - /> - )} - {deleteMultipleOpen && ( - - )} - - {isEditOpen && ( - - )} - setChangePasswordModalOpen(false)} - /> - } /> - - - - - - - - - handleSelectedOption(value)} - hideTriggerAction={() => { - handleCloseDownload(); - }} - open={openDownloadMenu} - anchorEl={anchorEl} - anchorOrigin={"end"} - /> - - - ); -}; - -export default DownloadWidgetDataButton; diff --git a/web-app/src/screens/Console/Dashboard/Prometheus/MergedWidgets.tsx b/web-app/src/screens/Console/Dashboard/Prometheus/MergedWidgets.tsx deleted file mode 100644 index 75b280fac7..0000000000 --- a/web-app/src/screens/Console/Dashboard/Prometheus/MergedWidgets.tsx +++ /dev/null @@ -1,42 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 } from "react"; -import CommonCard from "../CommonCard"; - -interface IMergedWidgets { - title: string; - leftComponent: any; - rightComponent: any; -} - -const MergedWidgets = ({ - title, - leftComponent, - rightComponent, -}: IMergedWidgets) => { - return ( - - - - ); -}; - -export default MergedWidgets; diff --git a/web-app/src/screens/Console/Dashboard/Prometheus/PrDashboard.tsx b/web-app/src/screens/Console/Dashboard/Prometheus/PrDashboard.tsx deleted file mode 100644 index a7a6d99031..0000000000 --- a/web-app/src/screens/Console/Dashboard/Prometheus/PrDashboard.tsx +++ /dev/null @@ -1,348 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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, useState } from "react"; -import { - Box, - Button, - Grid, - HelpBox, - PageLayout, - ProgressBar, - PrometheusErrorIcon, - SyncIcon, - TabItemProps, - Tabs, -} from "mds"; -import { IDashboardPanel } from "./types"; -import { panelsConfiguration } from "./utils"; -import { componentToUse } from "./widgetUtils"; -import { useAppDispatch, useAppSelector } from "../../../../store"; -import { - DLayoutColumnProps, - DLayoutRowProps, - resourcesPanelsLayout, - resourcesPanelsLayoutAdvanced, - RowPanelLayout, - summaryPanelsLayout, - trafficPanelsLayout, -} from "./Widgets/LayoutUtil"; -import { getUsageAsync } from "../dashboardThunks"; -import { reloadWidgets } from "../dashboardSlice"; -import { selFeatures } from "../../consoleSlice"; -import { AdminInfoResponse } from "api/consoleApi"; -import ZoomWidget from "./ZoomWidget"; -import DateRangeSelector from "../../Common/FormComponents/DateRangeSelector/DateRangeSelector"; -import MergedWidgetsRenderer from "./Widgets/MergedWidgetsRenderer"; -import BasicDashboard from "../BasicDashboard/BasicDashboard"; - -interface IPrDashboard { - apiPrefix?: string; - usage: AdminInfoResponse | null; -} - -const PrDashboard = ({ apiPrefix = "admin", usage }: IPrDashboard) => { - const dispatch = useAppDispatch(); - const status = useAppSelector((state) => state.dashboard.status); - const zoomOpen = useAppSelector((state) => state.dashboard.zoom.openZoom); - const zoomWidget = useAppSelector( - (state) => state.dashboard.zoom.widgetRender, - ); - const features = useAppSelector(selFeatures); - const obOnly = !!features?.includes("object-browser-only"); - let hideMenu = false; - if (features?.includes("hide-menu")) { - hideMenu = true; - } else if (obOnly) { - hideMenu = true; - } - - const [timeStart, setTimeStart] = useState(null); - const [timeEnd, setTimeEnd] = useState(null); - const panelInformation = panelsConfiguration; - const [curTab, setCurTab] = useState("info"); - - const getPanelDetails = (id: number) => { - return panelInformation.find((panel) => panel.id === id); - }; - - const triggerLoad = () => { - dispatch(reloadWidgets()); - }; - - const renderCmpByConfig = ( - panelInfo: IDashboardPanel | undefined, - key: string, - ) => { - return ( - - {panelInfo ? ( - - - {panelInfo.mergedPanels ? ( - - ) : ( - componentToUse( - panelInfo, - timeStart, - timeEnd, - true, - apiPrefix, - zoomOpen, - ) - )} - - - ) : null} - - ); - }; - - const renderPanelItems = (layoutRows: DLayoutRowProps[]) => { - return layoutRows.reduce((prev: any[], rowItem, rIdx) => { - const { columns = [] } = rowItem; - const cellItems: any[] = columns.map( - (cellItem: DLayoutColumnProps, colIdx: number) => { - const panelInfo = getPanelDetails(cellItem.componentId); - return renderCmpByConfig(panelInfo, `${rIdx}-${colIdx}`); - }, - ); - const rowConfig = ( - - {cellItems} - - ); - return [...prev, rowConfig]; - }, []); - }; - - const renderSummaryPanels = () => { - return renderPanelItems(summaryPanelsLayout); - }; - - const renderTrafficPanels = () => { - return renderPanelItems(trafficPanelsLayout); - }; - - const renderResourcesPanels = () => { - return renderPanelItems(resourcesPanelsLayout); - }; - - const renderAdvancedResourcesPanels = () => { - return renderPanelItems(resourcesPanelsLayoutAdvanced); - }; - - const prometheusOptionsDisabled = - usage?.advancedMetricsStatus === "not configured"; - - const searchBox = ( - - {curTab === "info" ? ( - - - - Server Information - - - - - - - - ); -}; - -export default ExpandGraphLink; diff --git a/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/HealActivityRenderer.tsx b/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/HealActivityRenderer.tsx deleted file mode 100644 index 2f32bcbdda..0000000000 --- a/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/HealActivityRenderer.tsx +++ /dev/null @@ -1,70 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 from "react"; -import { Box, breakPoints } from "mds"; -import TimeStatItem from "../../TimeStatItem"; - -export type SimpleWidgetRenderProps = { - valueToRender?: any; - loading?: boolean; - title?: any; - id?: number; - iconWidget?: any; -}; -const HealActivityRenderer = ({ - valueToRender = "", - loading = false, - iconWidget = null, -}: SimpleWidgetRenderProps) => { - return ( - - - - Time since last - {" "} - Heal Activity - - } - value={valueToRender} - /> - - ); -}; - -export default HealActivityRenderer; diff --git a/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/LayoutUtil.tsx b/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/LayoutUtil.tsx deleted file mode 100644 index 24a678bcb4..0000000000 --- a/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/LayoutUtil.tsx +++ /dev/null @@ -1,261 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 { Box } from "mds"; -import { CSSObject } from "styled-components"; -import { breakPoints } from "mds"; - -export type DLayoutColumnProps = { - componentId: number; - sx?: CSSObject; -}; -export type DLayoutRowProps = { - sx?: CSSObject; - columns: DLayoutColumnProps[]; -}; - -export const summaryPanelsLayout: DLayoutRowProps[] = [ - { - sx: { - minWidth: 0, - display: "grid", - gap: "30px", - gridTemplateColumns: "1fr 1fr 1fr 1fr", - [`@media (max-width: ${breakPoints.sm}px)`]: { - gridTemplateColumns: "1fr", - }, - [`@media (max-width: ${breakPoints.md}px)`]: { - gridTemplateColumns: "1fr 1fr", - }, - }, - columns: [ - { - componentId: 66, - }, - { - componentId: 44, - }, - { - componentId: 500, - }, - { - componentId: 501, - }, - ], - }, - { - sx: { - display: "grid", - minWidth: 0, // important to avoid css grid blow out. - gap: "30px", - gridTemplateColumns: "1fr 1fr", - [`@media (max-width: ${breakPoints.md}px)`]: { - gridTemplateColumns: "1fr", - }, - }, - columns: [ - { - componentId: 50, - }, - { - componentId: 502, - }, - ], - }, - { - sx: { - display: "grid", - minWidth: 0, - gap: "30px", - gridTemplateColumns: "1fr 1fr 1fr", - [`@media (max-width: ${breakPoints.md}px)`]: { - gridTemplateColumns: "1fr", - }, - }, - columns: [ - { - componentId: 80, - }, - { - componentId: 81, - }, - { - componentId: 1, - }, - ], - }, - { - sx: { - display: "grid", - minWidth: 0, - gap: "30px", - gridTemplateColumns: "1fr 1fr", - [`@media (max-width: ${breakPoints.md}px)`]: { - gridTemplateColumns: "1fr", - }, - }, - columns: [ - { - componentId: 68, - }, - { - componentId: 52, - }, - ], - }, - { - sx: { - display: "grid", - minWidth: 0, - gap: "30px", - gridTemplateColumns: "1fr 1fr", - [`@media (max-width: ${breakPoints.md}px)`]: { - gridTemplateColumns: "1fr", - }, - }, - columns: [ - { - componentId: 63, - }, - { - componentId: 70, - }, - ], - }, -]; - -export const trafficPanelsLayout: DLayoutRowProps[] = [ - { - sx: { - display: "grid", - gridTemplateColumns: "1fr", - gap: "30px", - }, - columns: [ - { - componentId: 60, - }, - ], - }, - { - sx: { - display: "grid", - minWidth: 0, - gap: "30px", - gridTemplateColumns: "1fr 1fr", - [`@media (max-width: ${breakPoints.md}px)`]: { - gridTemplateColumns: "1fr", - }, - }, - columns: [ - { - componentId: 71, - sx: { - flex: 1, - width: "50%", - flexShrink: 0, - }, - }, - { - componentId: 17, - sx: { - flex: 1, - width: "50%", - flexShrink: 0, - }, - }, - ], - }, - { - sx: { - display: "grid", - gridTemplateColumns: "1fr", - gap: "30px", - }, - columns: [ - { - componentId: 73, - }, - ], - }, -]; - -export const resourcesPanelsLayout: DLayoutRowProps[] = [ - { - sx: { - display: "grid", - minWidth: 0, - gridTemplateColumns: "1fr 1fr", - gap: "30px", - }, - columns: [ - { - componentId: 76, - }, - { - componentId: 77, - }, - ], - }, - { - sx: { - display: "grid", - minWidth: 0, - gridTemplateColumns: "1fr 1fr", - gap: "30px", - }, - columns: [ - { - componentId: 82, - }, - { - componentId: 74, - }, - ], - }, -]; -export const resourcesPanelsLayoutAdvanced: DLayoutRowProps[] = [ - { - sx: { - display: "grid", - minWidth: 0, - gridTemplateColumns: "1fr 1fr", - gap: "30px", - }, - columns: [ - { - componentId: 11, - }, - { - componentId: 8, - }, - ], - }, -]; - -export const RowPanelLayout = ({ children }: { children: any }) => { - return ( - - {children} - - ); -}; diff --git a/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/LinearGraphWidget.tsx b/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/LinearGraphWidget.tsx deleted file mode 100644 index 34debed952..0000000000 --- a/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/LinearGraphWidget.tsx +++ /dev/null @@ -1,414 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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, useRef, useState } from "react"; -import styled from "styled-components"; -import get from "lodash/get"; -import { useSelector } from "react-redux"; -import { - Area, - AreaChart, - CartesianGrid, - ResponsiveContainer, - Tooltip, - XAxis, - YAxis, -} from "recharts"; -import { Box, breakPoints, Grid, Loader } from "mds"; -import { ILinearGraphConfiguration } from "./types"; -import { widgetCommon } from "../../../Common/FormComponents/common/styleLibrary"; -import { IDashboardPanel } from "../types"; -import { widgetDetailsToPanel } from "../utils"; -import { ErrorResponseHandler } from "../../../../../common/types"; -import { setErrorSnackMessage } from "../../../../../systemSlice"; -import { AppState, useAppDispatch } from "../../../../../store"; -import api from "../../../../../common/api"; -import LineChartTooltip from "./tooltips/LineChartTooltip"; -import ExpandGraphLink from "./ExpandGraphLink"; -import DownloadWidgetDataButton from "../../DownloadWidgetDataButton"; - -interface ILinearGraphWidget { - title: string; - panelItem: IDashboardPanel; - timeStart: any; - timeEnd: any; - apiPrefix: string; - hideYAxis?: boolean; - yAxisFormatter?: (item: string) => string; - xAxisFormatter?: (item: string, var1: boolean, var2: boolean) => string; - areaWidget?: boolean; - zoomActivated?: boolean; -} - -const LinearGraphMain = styled.div(({ theme }) => ({ - ...widgetCommon(theme), - "& .chartCont": { - position: "relative", - height: 140, - width: "100%", - }, - "& .legendChart": { - display: "flex", - flexDirection: "column", - flex: "0 1 auto", - maxHeight: 130, - margin: 0, - overflowY: "auto", - position: "relative", - textAlign: "center", - width: "100%", - justifyContent: "flex-start", - color: get(theme, "mutedText", "#87888d"), - fontWeight: "bold", - fontSize: 12, - [`@media (max-width: ${breakPoints.md}px)`]: { - display: "none", - }, - }, - "& .loadingAlign": { - width: 40, - height: 40, - textAlign: "center", - margin: "15px auto", - }, -})); - -const LinearGraphWidget = ({ - title, - timeStart, - timeEnd, - panelItem, - apiPrefix, - hideYAxis = false, - areaWidget = false, - yAxisFormatter = (item: string) => item, - xAxisFormatter = (item: string, var1: boolean, var2: boolean) => item, - zoomActivated = false, -}: ILinearGraphWidget) => { - const dispatch = useAppDispatch(); - const [loading, setLoading] = useState(false); - const [hover, setHover] = useState(false); - const [data, setData] = useState([]); - const [csvData, setCsvData] = useState([]); - const [dataMax, setDataMax] = useState(0); - const [result, setResult] = useState(null); - const widgetVersion = useSelector( - (state: AppState) => state.dashboard.widgetLoadVersion, - ); - - const componentRef = useRef(null); - - useEffect(() => { - setLoading(true); - }, [widgetVersion]); - - useEffect(() => { - if (loading) { - let stepCalc = 0; - if (timeStart !== null && timeEnd !== null) { - const secondsInPeriod = - timeEnd.toUnixInteger() - timeStart.toUnixInteger(); - const periods = Math.floor(secondsInPeriod / 60); - - stepCalc = periods < 1 ? 15 : periods; - } - - api - .invoke( - "GET", - `/api/v1/${apiPrefix}/info/widgets/${ - panelItem.id - }/?step=${stepCalc}&${ - timeStart !== null ? `&start=${timeStart.toUnixInteger()}` : "" - }${timeStart !== null && timeEnd !== null ? "&" : ""}${ - timeEnd !== null ? `end=${timeEnd.toUnixInteger()}` : "" - }`, - ) - .then((res: any) => { - const widgetsWithValue = widgetDetailsToPanel(res, panelItem); - setData(widgetsWithValue.data); - setResult(widgetsWithValue); - setLoading(false); - let maxVal = 0; - for (const dp of widgetsWithValue.data) { - for (const key in dp) { - if (key === "name") { - continue; - } - let val = parseInt(dp[key]); - - if (isNaN(val)) { - val = 0; - } - - if (maxVal < val) { - maxVal = val; - } - } - } - setDataMax(maxVal); - }) - .catch((err: ErrorResponseHandler) => { - dispatch(setErrorSnackMessage(err)); - setLoading(false); - }); - } - }, [loading, panelItem, timeEnd, timeStart, dispatch, apiPrefix]); - - let intervalCount = Math.floor(data.length / 5); - - const onHover = () => { - setHover(true); - }; - - const onStopHover = () => { - setHover(false); - }; - - useEffect(() => { - const fmtData = data.map((el: any) => { - const date = new Date(el?.name * 1000); - return { - ...el, - name: date, - }; - }); - - setCsvData(fmtData); - }, [data]); - - const linearConfiguration = result - ? (result?.widgetConfiguration as ILinearGraphConfiguration[]) - : []; - - const CustomizedDot = (prop: any) => { - const { cx, cy, index } = prop; - - if (index % 3 !== 0) { - return null; - } - return ; - }; - - let dspLongDate = false; - - if (zoomActivated) { - dspLongDate = true; - } - - return ( - - - {!zoomActivated && ( - - - {title} - - - {hover && } - - - {componentRef !== null && ( - - )} - - - )} -
- - {loading && } - {!loading && ( - - - - - {areaWidget && ( - - - - - - - - - )} - - - xAxisFormatter(value, dspLongDate, true) - } - interval={intervalCount} - tick={{ - fontSize: "68%", - fontWeight: "normal", - color: "#404143", - }} - tickCount={10} - stroke={"#082045"} - /> - yAxisFormatter(value)} - tick={{ - fontSize: "68%", - fontWeight: "normal", - color: "#404143", - }} - stroke={"#082045"} - /> - {linearConfiguration.map((section, index) => { - return ( - : false} - /> - ); - })} - - } - wrapperStyle={{ - zIndex: 5000, - }} - /> - - - - {!areaWidget && ( - - {zoomActivated && ( - - Series -
-
-
- )} - - - {linearConfiguration.map((section, index) => { - return ( - - - - {section.keyLabel} - - - ); - })} - -
- )} -
- )} -
-
-
-
- ); -}; - -export default LinearGraphWidget; diff --git a/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/MergedWidgetsRenderer.tsx b/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/MergedWidgetsRenderer.tsx deleted file mode 100644 index 32d464c1c6..0000000000 --- a/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/MergedWidgetsRenderer.tsx +++ /dev/null @@ -1,92 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 from "react"; -import { componentToUse } from "../widgetUtils"; -import { IDashboardPanel } from "../types"; -import MergedWidgets from "../MergedWidgets"; -import EntityStateItemRenderer from "./EntityStateItemRenderer"; -import NetworkItem from "./NetworkItem"; -import DashboardItemBox from "../../DashboardItemBox"; - -const MergedWidgetsRenderer = ({ - info, - timeStart, - timeEnd, - loading, - apiPrefix, -}: { - info: IDashboardPanel; - timeStart: any; - timeEnd: any; - loading: boolean; - apiPrefix: string; -}) => { - const { mergedPanels = [], title = "", id } = info; - const [leftPanel, rightPanel] = mergedPanels; - - const renderById = () => { - if ([500, 501].includes(id)) { - return ( - - - - ); - } - - if (id === 502) { - return ( - - - - ); - } - - return ( - - ); - }; - - return renderById(); -}; - -export default MergedWidgetsRenderer; diff --git a/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/NetworkGetItem.tsx b/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/NetworkGetItem.tsx deleted file mode 100644 index 83e961574b..0000000000 --- a/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/NetworkGetItem.tsx +++ /dev/null @@ -1,72 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 from "react"; -import styled from "styled-components"; -import get from "lodash/get"; -import { Loader, NetworkGetIcon, Box } from "mds"; - -const NetworkGetBase = styled.div(({ theme }) => ({ - "& .putLabel": { - display: "flex", - gap: 10, - alignItems: "center", - marginTop: "10px", - - "& .min-icon": { - height: 15, - width: 15, - fill: get(theme, "signalColors.good", "#4CCB92"), - }, - - "& .getText": { - fontSize: "18px", - color: get(theme, "mutedText", "#87888d"), - fontWeight: "bold", - }, - "& .valueText": { - fontSize: 50, - fontFamily: "Inter", - fontWeight: 600, - }, - }, -})); - -const NetworkGetItem = ({ - value, - loading, -}: { - value: any; - loading: boolean; - title?: any; - id?: number; -}) => { - return ( - - - GET - {loading ? ( - - ) : ( - - )} - - {value} - - ); -}; - -export default NetworkGetItem; diff --git a/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/NetworkItem.tsx b/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/NetworkItem.tsx deleted file mode 100644 index 2c4dfc795d..0000000000 --- a/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/NetworkItem.tsx +++ /dev/null @@ -1,176 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 from "react"; -import styled from "styled-components"; -import get from "lodash/get"; -import { Box, breakPoints, SpeedtestIcon } from "mds"; -import { IDashboardPanel } from "../types"; -import SingleValueWidget from "./SingleValueWidget"; -import NetworkGetItem from "./NetworkGetItem"; -import NetworkPutItem from "./NetworkPutItem"; - -const NetworkItemBase = styled.div(({ theme }) => ({ - flex: 1, - display: "flex", - alignItems: "center", - flexFlow: "row", - gap: "15px", - "& .unitText": { - fontSize: "14px", - color: get(theme, "mutedText", "#87888d"), - marginLeft: "5px", - }, - "& .unit": { - color: get(theme, "mutedText", "#87888d"), - fontSize: "18px", - marginLeft: "12px", - marginTop: "10px", - }, - [`@media (max-width: ${breakPoints.sm}px)`]: { - flexFlow: "column", - }, -})); - -const NetworkItem = ({ - value, - timeStart, - timeEnd, - apiPrefix, -}: { - value: IDashboardPanel; - timeStart: any; - timeEnd: any; - apiPrefix: string; -}) => { - const { mergedPanels = [] } = value; - const [leftPanel, rightPanel] = mergedPanels; - - const rightCmp = ( - { - return ( - - ); - }} - /> - ); - const leftCmp = ( - { - return ( - - ); - }} - /> - ); - - return ( - - - Network - - - - {leftCmp} - - - - - {rightCmp} - - - - - - - ); -}; - -export default NetworkItem; diff --git a/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/NetworkPutItem.tsx b/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/NetworkPutItem.tsx deleted file mode 100644 index 3cfd5e9834..0000000000 --- a/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/NetworkPutItem.tsx +++ /dev/null @@ -1,72 +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 from "react"; -import styled from "styled-components"; -import get from "lodash/get"; -import { Box, Loader, NetworkPutIcon } from "mds"; - -const NetworkPutBase = styled.div(({ theme }) => ({ - "& .putLabel": { - display: "flex", - gap: 10, - alignItems: "center", - marginTop: "10px", - - "& .min-icon": { - height: 15, - width: 15, - fill: get(theme, "signalColors.info", "#2781B0"), - }, - - "& .putText": { - fontSize: "18px", - color: get(theme, "mutedText", "#87888d"), - fontWeight: "bold", - }, - "& .valueText": { - fontSize: 50, - fontFamily: "Inter", - fontWeight: 600, - }, - }, -})); - -const NetworkPutItem = ({ - value, - loading, -}: { - value: any; - loading: boolean; - title?: any; - id?: number; -}) => { - return ( - - - PUT - {loading ? ( - - ) : ( - - )} - - {value} - - ); -}; - -export default NetworkPutItem; diff --git a/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/NumericStatCard.tsx b/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/NumericStatCard.tsx deleted file mode 100644 index eed4dcf20d..0000000000 --- a/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/NumericStatCard.tsx +++ /dev/null @@ -1,134 +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 from "react"; -import styled from "styled-components"; -import get from "lodash/get"; -import { Box, breakPoints, Loader, Tooltip } from "mds"; - -const StatCardMain = styled.div(({ theme }) => ({ - fontFamily: "Inter,sans-serif", - color: get(theme, "signalColors.main", "#07193E"), - maxWidth: "300px", - display: "flex", - marginLeft: "auto", - marginRight: "auto", - cursor: "default", - position: "relative", - width: "100%", -})); - -const NumericStatCard = ({ - value, - label = "", - icon = null, - loading = false, -}: { - value: string | number; - label?: any; - icon?: any; - loading?: boolean; -}) => { - const getContent = () => { - return ( - - - - {label} - - - - - {value} - - - - - {} - {loading ? ( - - ) : ( - icon - )} - - - ); - }; - - return {getContent()}; -}; - -export default NumericStatCard; diff --git a/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/ObjectsCountItem.tsx b/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/ObjectsCountItem.tsx deleted file mode 100644 index 0a237d0cc5..0000000000 --- a/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/ObjectsCountItem.tsx +++ /dev/null @@ -1,40 +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 from "react"; -import NumericStatCard from "./NumericStatCard"; -import { TotalObjectsIcon } from "mds"; - -const ObjectsCountItem = ({ - title, - value, - loading, -}: { - title: string; - value: string; - loading?: boolean; -}) => { - return ( - } - value={value} - loading={loading} - /> - ); -}; - -export default ObjectsCountItem; diff --git a/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/PieChartWidget.tsx b/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/PieChartWidget.tsx deleted file mode 100644 index 01e90e3dc7..0000000000 --- a/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/PieChartWidget.tsx +++ /dev/null @@ -1,237 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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, { useEffect, useState } from "react"; -import get from "lodash/get"; -import styled from "styled-components"; -import { Box, Loader } from "mds"; -import { Cell, Pie, PieChart, ResponsiveContainer } from "recharts"; -import { useSelector } from "react-redux"; -import api from "../../../../../common/api"; -import { IPieChartConfiguration } from "./types"; -import { widgetCommon } from "../../../Common/FormComponents/common/styleLibrary"; -import { IDashboardPanel } from "../types"; -import { splitSizeMetric, widgetDetailsToPanel } from "../utils"; -import { ErrorResponseHandler } from "../../../../../common/types"; -import { setErrorSnackMessage } from "../../../../../systemSlice"; -import { AppState, useAppDispatch } from "../../../../../store"; - -interface IPieChartWidget { - title: string; - panelItem: IDashboardPanel; - timeStart: any; - timeEnd: any; - apiPrefix: string; -} - -const PieChartMain = styled.div(({ theme }) => ({ - ...widgetCommon(theme), - "& .loadingAlign": { - width: "100%", - paddingTop: "15px", - textAlign: "center", - margin: "auto", - }, - "& .pieChartLabel": { - fontSize: 60, - color: get(theme, "signalColors.main", "#07193E"), - fontWeight: "bold", - width: "100%", - "& .unitText": { - color: get(theme, "mutedText", "#87888d"), - fontSize: 12, - }, - }, - "& .chartContainer": { - width: "100%", - height: 140, - }, -})); - -const PieChartWidget = ({ - title, - panelItem, - timeStart, - timeEnd, - apiPrefix, -}: IPieChartWidget) => { - const dispatch = useAppDispatch(); - const [loading, setLoading] = useState(false); - const [dataInner, setDataInner] = useState([]); - const [dataOuter, setDataOuter] = useState([]); - const [result, setResult] = useState(null); - const widgetVersion = useSelector( - (state: AppState) => state.dashboard.widgetLoadVersion, - ); - - useEffect(() => { - setLoading(true); - }, [widgetVersion]); - - useEffect(() => { - if (loading) { - let stepCalc = 0; - if (timeStart !== null && timeEnd !== null) { - const secondsInPeriod = - timeEnd.toUnixInteger() - timeStart.toUnixInteger(); - const periods = Math.floor(secondsInPeriod / 60); - - stepCalc = periods < 1 ? 15 : periods; - } - - api - .invoke( - "GET", - `/api/v1/${apiPrefix}/info/widgets/${ - panelItem.id - }/?step=${stepCalc}&${ - timeStart !== null ? `&start=${timeStart.toUnixInteger()}` : "" - }${timeStart !== null && timeEnd !== null ? "&" : ""}${ - timeEnd !== null ? `end=${timeEnd.toUnixInteger()}` : "" - }`, - ) - .then((res: any) => { - const widgetsWithValue = widgetDetailsToPanel(res, panelItem); - setDataInner(widgetsWithValue.data); - setDataOuter(widgetsWithValue.dataOuter as object[]); - setResult(widgetsWithValue); - setLoading(false); - }) - .catch((err: ErrorResponseHandler) => { - dispatch(setErrorSnackMessage(err)); - setLoading(false); - }); - } - }, [loading, panelItem, timeEnd, timeStart, dispatch, apiPrefix]); - - const pieChartConfiguration = result - ? (result.widgetConfiguration as IPieChartConfiguration) - : []; - const middleLabel = result?.innerLabel; - - const innerColors = get(pieChartConfiguration, "innerChart.colorList", []); - const outerColors = get(pieChartConfiguration, "outerChart.colorList", []); - - return ( - - - {title} - {loading && ( - - - - )} - {!loading && ( - - - {middleLabel && splitSizeMetric(middleLabel)} - - - - - {dataOuter && ( - - {dataOuter.map((entry, index) => ( - - ))} - - )} - {dataInner && ( - - {dataInner.map((entry, index) => { - return ( - - ); - })} - - )} - - - - - )} - - - ); -}; - -export default PieChartWidget; diff --git a/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/ScanActivityRenderer.tsx b/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/ScanActivityRenderer.tsx deleted file mode 100644 index ae7d94ecfa..0000000000 --- a/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/ScanActivityRenderer.tsx +++ /dev/null @@ -1,64 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 from "react"; -import { Box, breakPoints } from "mds"; -import TimeStatItem from "../../TimeStatItem"; -import { SimpleWidgetRenderProps } from "./HealActivityRenderer"; - -const ScanActivityRenderer = ({ - valueToRender = "", - loading = false, - iconWidget = null, -}: SimpleWidgetRenderProps) => { - return ( - - - - Time since last - {" "} - Scan Activity - - } - value={valueToRender} - /> - - ); -}; - -export default ScanActivityRenderer; diff --git a/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/SimpleWidget.tsx b/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/SimpleWidget.tsx deleted file mode 100644 index 6d76f31b60..0000000000 --- a/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/SimpleWidget.tsx +++ /dev/null @@ -1,140 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 styled from "styled-components"; -import get from "lodash/get"; -import { useSelector } from "react-redux"; -import { Loader } from "mds"; -import api from "../../../../../common/api"; -import { widgetDetailsToPanel } from "../utils"; -import { IDashboardPanel } from "../types"; -import { ErrorResponseHandler } from "../../../../../common/types"; -import { setErrorSnackMessage } from "../../../../../systemSlice"; -import { AppState, useAppDispatch } from "../../../../../store"; - -interface ISimpleWidget { - iconWidget: any; - title: string; - panelItem: IDashboardPanel; - timeStart: any; - timeEnd: any; - apiPrefix: string; - renderFn?: undefined | null | ((arg: Record) => any); -} - -const SimpleWidgetMain = styled.span(({ theme }) => ({ - display: "inline-flex", - color: get(theme, "signalColors.main", "#07193E"), - alignItems: "center", - "& .icon": { - color: get(theme, "signalColors.main", "#07193E"), - fill: get(theme, "signalColors.main", "#07193E"), - marginRight: 5, - marginLeft: 12, - }, - "& .widgetLabel": { - fontWeight: "bold", - textTransform: "uppercase", - marginRight: 10, - }, - "& .widgetValue": { - marginRight: 25, - }, -})); - -const SimpleWidget = ({ - iconWidget, - title, - panelItem, - timeStart, - timeEnd, - apiPrefix, - renderFn, -}: ISimpleWidget) => { - const dispatch = useAppDispatch(); - const [loading, setLoading] = useState(false); - const [data, setData] = useState(""); - const widgetVersion = useSelector( - (state: AppState) => state.dashboard.widgetLoadVersion, - ); - - useEffect(() => { - setLoading(true); - }, [widgetVersion]); - - useEffect(() => { - if (loading) { - let stepCalc = 0; - if (timeStart !== null && timeEnd !== null) { - const secondsInPeriod = - timeEnd.toUnixInteger() - timeStart.toUnixInteger(); - const periods = Math.floor(secondsInPeriod / 60); - - stepCalc = periods < 1 ? 15 : periods; - } - - api - .invoke( - "GET", - `/api/v1/${apiPrefix}/info/widgets/${ - panelItem.id - }/?step=${stepCalc}&${ - timeStart !== null ? `&start=${timeStart.toUnixInteger()}` : "" - }${timeStart !== null && timeEnd !== null ? "&" : ""}${ - timeEnd !== null ? `end=${timeEnd.toUnixInteger()}` : "" - }`, - ) - .then((res: any) => { - const widgetsWithValue = widgetDetailsToPanel(res, panelItem); - setData(widgetsWithValue.data); - setLoading(false); - }) - .catch((err: ErrorResponseHandler) => { - dispatch(setErrorSnackMessage(err)); - setLoading(false); - }); - } - }, [loading, panelItem, timeEnd, timeStart, dispatch, apiPrefix]); - - if (renderFn) { - return renderFn({ - valueToRender: data, - loading, - title, - id: panelItem.id, - iconWidget: iconWidget, - }); - } - return ( - - {loading && ( -
- -
- )} - {!loading && ( - - {iconWidget ? iconWidget : null} - {title}: - {data} - - )} -
- ); -}; - -export default SimpleWidget; diff --git a/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/SingleRepWidget.tsx b/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/SingleRepWidget.tsx deleted file mode 100644 index 6f2c2b77f9..0000000000 --- a/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/SingleRepWidget.tsx +++ /dev/null @@ -1,142 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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, { useEffect, useState } from "react"; -import { connect, useSelector } from "react-redux"; -import { IDashboardPanel } from "../types"; -import { widgetDetailsToPanel } from "../utils"; -import { ErrorResponseHandler } from "../../../../../common/types"; -import { representationNumber } from "../../../../../common/utils"; -import api from "../../../../../common/api"; -import DashboardItemBox from "../../DashboardItemBox"; -import BucketsCountItem from "./BucketsCountItem"; -import ObjectsCountItem from "./ObjectsCountItem"; -import { setErrorSnackMessage } from "../../../../../systemSlice"; -import { AppState, useAppDispatch } from "../../../../../store"; - -interface ISingleRepWidget { - title: string; - panelItem: IDashboardPanel; - timeStart: any; - timeEnd: any; - propLoading: boolean; - - color?: string; - fillColor?: string; - apiPrefix: string; -} - -const SingleRepWidget = ({ - title, - panelItem, - timeStart, - timeEnd, - propLoading, - - apiPrefix, -}: ISingleRepWidget) => { - const dispatch = useAppDispatch(); - const [loading, setLoading] = useState(false); - const [result, setResult] = useState(null); - const widgetVersion = useSelector( - (state: AppState) => state.dashboard.widgetLoadVersion, - ); - - useEffect(() => { - setLoading(true); - }, [widgetVersion]); - - useEffect(() => { - if (loading) { - let stepCalc = 0; - if (timeStart !== null && timeEnd !== null) { - const secondsInPeriod = - timeEnd.toUnixInteger() - timeStart.toUnixInteger(); - const periods = Math.floor(secondsInPeriod / 60); - - stepCalc = periods < 1 ? 15 : periods; - } - - api - .invoke( - "GET", - `/api/v1/${apiPrefix}/info/widgets/${ - panelItem.id - }/?step=${stepCalc}&${ - timeStart !== null ? `&start=${timeStart.toUnixInteger()}` : "" - }${timeStart !== null && timeEnd !== null ? "&" : ""}${ - timeEnd !== null ? `end=${timeEnd.toUnixInteger()}` : "" - }`, - ) - .then((res: any) => { - const widgetsWithValue = widgetDetailsToPanel(res, panelItem); - setResult(widgetsWithValue); - setLoading(false); - }) - .catch((err: ErrorResponseHandler) => { - dispatch(setErrorSnackMessage(err)); - setLoading(false); - }); - } - }, [loading, panelItem, timeEnd, timeStart, dispatch, apiPrefix]); - - let repNumber = ""; - - if (result) { - const resultRep = parseInt(result.innerLabel || "0"); - - if (!isNaN(resultRep)) { - repNumber = representationNumber(resultRep); - } else { - repNumber = "0"; - } - } - - const renderById = (id: number) => { - if (id === 66) { - return ( - - - - ); - } - if (id === 44) { - return ( - - - - ); - } - - return null; - }; - - return renderById(panelItem.id); -}; - -const connector = connect(null, { - setErrorSnackMessage: setErrorSnackMessage, -}); - -export default connector(SingleRepWidget); diff --git a/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/SingleValueWidget.tsx b/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/SingleValueWidget.tsx deleted file mode 100644 index 630c829fda..0000000000 --- a/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/SingleValueWidget.tsx +++ /dev/null @@ -1,143 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 { useSelector } from "react-redux"; -import { Box, Loader } from "mds"; -import styled from "styled-components"; -import get from "lodash/get"; -import { widgetCommon } from "../../../Common/FormComponents/common/styleLibrary"; -import { splitSizeMetric, widgetDetailsToPanel } from "../utils"; -import { IDashboardPanel } from "../types"; -import { ErrorResponseHandler } from "../../../../../common/types"; -import { setErrorSnackMessage } from "../../../../../systemSlice"; -import { AppState, useAppDispatch } from "../../../../../store"; -import api from "../../../../../common/api"; - -interface ISingleValueWidget { - title: string; - panelItem: IDashboardPanel; - timeStart: any; - timeEnd: any; - apiPrefix: string; - renderFn?: (arg: Record) => any; -} - -const SingleValueWidgetMain = styled.div(({ theme }) => ({ - display: "flex", - height: 140, - flexDirection: "column", - justifyContent: "center", - "& .unitText": { - color: get(theme, "mutedText", "#87888d"), - fontSize: 12, - }, - "& .loadingAlign": { - width: "100%", - textAlign: "center", - margin: "auto", - }, - "& .metric": { - fontSize: 60, - lineHeight: 1, - color: get(theme, "signalColors.main", "#07193E"), - fontWeight: 700, - }, - "& .titleElement": { - fontSize: 10, - color: get(theme, "mutedText", "#87888d"), - fontWeight: 700, - }, - ...widgetCommon(theme), -})); - -const SingleValueWidget = ({ - title, - panelItem, - timeStart, - timeEnd, - apiPrefix, - renderFn, -}: ISingleValueWidget) => { - const dispatch = useAppDispatch(); - - const [loading, setLoading] = useState(false); - const [data, setData] = useState(""); - const widgetVersion = useSelector( - (state: AppState) => state.dashboard.widgetLoadVersion, - ); - - useEffect(() => { - setLoading(true); - }, [widgetVersion]); - - useEffect(() => { - if (loading) { - let stepCalc = 0; - if (timeStart !== null && timeEnd !== null) { - const secondsInPeriod = - timeEnd.toUnixInteger() - timeStart.toUnixInteger(); - const periods = Math.floor(secondsInPeriod / 60); - - stepCalc = periods < 1 ? 15 : periods; - } - - api - .invoke( - "GET", - `/api/v1/${apiPrefix}/info/widgets/${ - panelItem.id - }/?step=${stepCalc}&${ - timeStart !== null ? `&start=${timeStart.toUnixInteger()}` : "" - }${timeStart !== null && timeEnd !== null ? "&" : ""}${ - timeEnd !== null ? `end=${timeEnd.toUnixInteger()}` : "" - }`, - ) - .then((res: any) => { - const widgetsWithValue = widgetDetailsToPanel(res, panelItem); - setData(widgetsWithValue.data); - setLoading(false); - }) - .catch((err: ErrorResponseHandler) => { - dispatch(setErrorSnackMessage(err)); - setLoading(false); - }); - } - }, [loading, panelItem, timeEnd, timeStart, dispatch, apiPrefix]); - - const valueToRender = splitSizeMetric(data); - - if (renderFn) { - return renderFn({ valueToRender, loading, title, id: panelItem.id }); - } - return ( - - {loading && ( - - - - )} - {!loading && ( - - {splitSizeMetric(data)} - {title} - - )} - - ); -}; - -export default SingleValueWidget; diff --git a/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/UptimeActivityRenderer.tsx b/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/UptimeActivityRenderer.tsx deleted file mode 100644 index fd0fa78271..0000000000 --- a/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/UptimeActivityRenderer.tsx +++ /dev/null @@ -1,56 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 from "react"; -import { Box } from "mds"; -import TimeStatItem from "../../TimeStatItem"; - -type SimpleWidgetRenderProps = { - valueToRender?: any; - loading?: boolean; - title?: any; - id?: number; - iconWidget?: any; -}; -const UptimeActivityRenderer = ({ - valueToRender = "", - loading = false, - iconWidget = null, -}: SimpleWidgetRenderProps) => { - return ( - - Uptime} - value={valueToRender} - /> - - ); -}; - -export default UptimeActivityRenderer; diff --git a/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/tooltips/BarChartTooltip.tsx b/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/tooltips/BarChartTooltip.tsx deleted file mode 100644 index 2533391d1a..0000000000 --- a/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/tooltips/BarChartTooltip.tsx +++ /dev/null @@ -1,64 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 from "react"; -import { Box } from "mds"; -import { tooltipCommon } from "../../../../Common/FormComponents/common/styleLibrary"; - -const BarChartTooltip = ({ - active, - payload, - label, - barChartConfiguration, -}: any) => { - if (active) { - return ( - - {label} - {payload && - payload.map((pl: any, index: number) => { - return ( - - - - {pl.value} - - - ); - })} - - ); - } - - return null; -}; - -export default BarChartTooltip; diff --git a/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/tooltips/LineChartTooltip.tsx b/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/tooltips/LineChartTooltip.tsx deleted file mode 100644 index c0e98123dc..0000000000 --- a/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/tooltips/LineChartTooltip.tsx +++ /dev/null @@ -1,71 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 from "react"; -import { Box } from "mds"; -import { getTimeFromTimestamp } from "../../../../../../common/utils"; -import { tooltipCommon } from "../../../../Common/FormComponents/common/styleLibrary"; - -const LineChartTooltip = ({ - active, - payload, - label, - linearConfiguration, - yAxisFormatter, -}: any) => { - if (active) { - return ( - - - {getTimeFromTimestamp(label, true)} - - {payload && - payload.map((pl: any, index: number) => { - return ( - - - - - {linearConfiguration[index].keyLabel}:{" "} - {yAxisFormatter(pl.value)} - - - - ); - })} - - ); - } - - return null; -}; - -export default LineChartTooltip; diff --git a/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/types.ts b/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/types.ts deleted file mode 100644 index fc00801fef..0000000000 --- a/web-app/src/screens/Console/Dashboard/Prometheus/Widgets/types.ts +++ /dev/null @@ -1,54 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 . - -export interface ILinearGraphConfiguration { - dataKey: string; - keyLabel: string; - lineColor: string; - fillColor: string; - strokeWidth?: number; -} - -export interface IBarChartConfiguration { - dataKey: string; - color: string; - background?: object; - greatestColor?: string; - strokeWidth?: number; -} - -export interface IPieChartConfiguration { - innerChart: ISinglePieConfiguration; - outerChart?: ISinglePieConfiguration; - strokeWidth?: number; -} - -interface ISinglePieConfiguration { - colorList: string[]; - startAngle?: number; - endAngle?: number; - innerRadius?: number | string; - outerRadius?: number | string; -} - -export interface IDataSRep { - value: number; -} - -export interface IBarChartRelation { - originTag: string; - displayTag: string; -} diff --git a/web-app/src/screens/Console/Dashboard/Prometheus/ZoomWidget.tsx b/web-app/src/screens/Console/Dashboard/Prometheus/ZoomWidget.tsx deleted file mode 100644 index 0fde64aea1..0000000000 --- a/web-app/src/screens/Console/Dashboard/Prometheus/ZoomWidget.tsx +++ /dev/null @@ -1,65 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 } from "react"; - -import ModalWrapper from "../../Common/ModalWrapper/ModalWrapper"; -import { IDashboardPanel } from "./types"; -import { componentToUse } from "./widgetUtils"; -import { closeZoomPage } from "../dashboardSlice"; -import { useAppDispatch } from "../../../../store"; - -interface IZoomWidget { - widgetRender: number; - value: IDashboardPanel | null; - modalOpen: boolean; - timeStart: any; - timeEnd: any; - apiPrefix: string; -} - -const ZoomWidget = ({ - value, - modalOpen, - timeStart, - timeEnd, - apiPrefix, -}: IZoomWidget) => { - const dispatch = useAppDispatch(); - if (!value) { - return null; - } - - return ( - { - dispatch(closeZoomPage()); - }} - modalOpen={modalOpen} - wideLimit={false} - sx={{ - padding: 0, - }} - > - - {componentToUse(value, timeStart, timeEnd, true, apiPrefix, true)} - - - ); -}; - -export default ZoomWidget; diff --git a/web-app/src/screens/Console/Dashboard/Prometheus/types.ts b/web-app/src/screens/Console/Dashboard/Prometheus/types.ts deleted file mode 100644 index 9f62a5fcdd..0000000000 --- a/web-app/src/screens/Console/Dashboard/Prometheus/types.ts +++ /dev/null @@ -1,55 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 { - IBarChartConfiguration, - IBarChartRelation, - IDataSRep, - ILinearGraphConfiguration, - IPieChartConfiguration, -} from "./Widgets/types"; - -export enum widgetType { - singleValue = "singleValue", - linearGraph = "linearGraph", - areaGraph = "areaGraph", - barChart = "barChart", - pieChart = "pieChart", - singleRep = "singleRep", - simpleWidget = "simpleWidget", -} - -export interface IDashboardPanel { - id: number; - mergedPanels?: IDashboardPanel[]; - title: string; - data?: string | object[] | IDataSRep[]; - dataOuter?: string | object[]; - type?: widgetType; - widgetIcon?: any; - widgetConfiguration?: - | ILinearGraphConfiguration[] - | IBarChartConfiguration[] - | IPieChartConfiguration; - color?: string; - fillColor?: string; - innerLabel?: string; - labelDisplayFunction?: (value: string) => any; - disableYAxis?: boolean; - xAxisFormatter?: (item: string) => string; - yAxisFormatter?: (item: string) => string; - customStructure?: IBarChartRelation[]; -} diff --git a/web-app/src/screens/Console/Dashboard/Prometheus/utils.tsx b/web-app/src/screens/Console/Dashboard/Prometheus/utils.tsx deleted file mode 100644 index bc97e45c71..0000000000 --- a/web-app/src/screens/Console/Dashboard/Prometheus/utils.tsx +++ /dev/null @@ -1,849 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 } from "react"; -import get from "lodash/get"; -import { IDashboardPanel, widgetType } from "./types"; -import { - getTimeFromTimestamp, - niceBytes, - niceDays, - representationNumber, - textToRGBColor, - units, -} from "../../../../common/utils"; -import { DiagnosticsIcon, HealIcon, UptimeIcon } from "mds"; - -const colorsMain = [ - "#C4D4E9", - "#DCD1EE", - "#D1EEE7", - "#EEDED1", - "#AAF38F", - "#F9E6C5", - "#C83B51", - "#F4CECE", - "#D6D6D6", -]; - -const niceDaysFromNS = (seconds: string) => { - return niceDays(seconds, "ns"); -}; - -const roundNumber = (value: string) => { - return parseInt(value).toString(10); -}; - -export const panelsConfiguration: IDashboardPanel[] = [ - { - id: 1, - title: "Uptime", - data: "N/A", - type: widgetType.simpleWidget, - widgetIcon: , - labelDisplayFunction: niceDays, - }, - { - id: 50, - title: "Capacity", - data: [], - dataOuter: [{ name: "outer", value: 100 }], - widgetConfiguration: { - outerChart: { - colorList: ["#9c9c9c"], - innerRadius: 0, - outerRadius: 0, - startAngle: 0, - endAngle: 0, - }, - innerChart: { - colorList: colorsMain, - innerRadius: 20, - outerRadius: 50, - startAngle: 90, - endAngle: -200, - }, - }, - type: widgetType.pieChart, - innerLabel: "N/A", - labelDisplayFunction: niceBytes, - }, - { - id: 51, - title: "Usable Capacity", - data: [], - dataOuter: [{ name: "outer", value: 100 }], - widgetConfiguration: { - outerChart: { - colorList: ["#9c9c9c"], - innerRadius: 0, - outerRadius: 0, - startAngle: 0, - endAngle: 0, - }, - innerChart: { - colorList: colorsMain, - innerRadius: 20, - outerRadius: 50, - startAngle: 90, - endAngle: -200, - }, - }, - type: widgetType.pieChart, - innerLabel: "N/A", - labelDisplayFunction: niceBytes, - }, - { - id: 68, - title: "Data Usage Growth", - data: [], - widgetConfiguration: [ - { - dataKey: "", - keyLabel: "", - lineColor: "#000", - fillColor: "#000", - }, - ], - type: widgetType.areaGraph, - yAxisFormatter: niceBytes, - xAxisFormatter: getTimeFromTimestamp, - }, - { - id: 52, - title: "Object size distribution", - data: [], - widgetConfiguration: [ - { - dataKey: "a", - color: "#2781B0", - background: { - fill: "#EEF1F4", - }, - greatestColor: "#081C42", - }, - ], - customStructure: [ - { originTag: "LESS_THAN_1024_B", displayTag: "Less than 1024B" }, - { - originTag: "BETWEEN_1024_B_AND_1_MB", - displayTag: "Between 1024B and 1MB", - }, - { - originTag: "BETWEEN_1_MB_AND_10_MB", - displayTag: "Between 1MB and 10MB", - }, - { - originTag: "BETWEEN_10_MB_AND_64_MB", - displayTag: "Between 10MB and 64MB", - }, - { - originTag: "BETWEEN_64_MB_AND_128_MB", - displayTag: "Between 64MB and 128MB", - }, - { - originTag: "BETWEEN_128_MB_AND_512_MB", - displayTag: "Between 128MB and 512MB", - }, - { - originTag: "GREATER_THAN_512_MB", - displayTag: "Greater than 512MB", - }, - ], - type: widgetType.barChart, - }, - { - id: 66, - title: "Buckets", - data: [], - innerLabel: "N/A", - type: widgetType.singleRep, - color: "#0071BC", - fillColor: "#ADD5E0", - }, - { - id: 44, - title: "Objects", - data: [], - innerLabel: "N/A", - type: widgetType.singleRep, - color: "#0071BC", - fillColor: "#ADD5E0", - }, - { - id: 63, - title: "API Data Received Rate", - data: [], - widgetConfiguration: [ - { - dataKey: "", - keyLabel: "", - lineColor: "#000", - fillColor: "#000", - strokeWidth: 3, - }, - ], - type: widgetType.linearGraph, - - xAxisFormatter: getTimeFromTimestamp, - yAxisFormatter: niceBytes, - }, - { - id: 61, - title: "Total Open FDs", - data: [], - innerLabel: "N/A", - type: widgetType.singleRep, - color: "#22B573", - fillColor: "#A6E8C4", - }, - { - id: 62, - title: "Total Goroutines", - data: [], - innerLabel: "N/A", - type: widgetType.singleRep, - color: "#F7655E", - fillColor: "#F4CECE", - }, - { - id: 77, - title: "Node CPU Usage", - data: [], - widgetConfiguration: [ - { - dataKey: "", - keyLabel: "", - lineColor: "#000", - fillColor: "#000", - }, - ], - type: widgetType.linearGraph, - - yAxisFormatter: roundNumber, - xAxisFormatter: getTimeFromTimestamp, - }, - { - id: 60, - title: "API Request Rate", - data: [], - widgetConfiguration: [ - { - dataKey: "", - keyLabel: "", - lineColor: "#000", - fillColor: "#000", - }, - ], - type: widgetType.linearGraph, - yAxisFormatter: roundNumber, - xAxisFormatter: getTimeFromTimestamp, - }, - { - id: 70, - title: "API Data Sent Rate", - data: [], - widgetConfiguration: [ - { - dataKey: "", - keyLabel: "", - lineColor: "#000", - fillColor: "#000", - }, - ], - type: widgetType.linearGraph, - - xAxisFormatter: getTimeFromTimestamp, - yAxisFormatter: niceBytes, - }, - { - id: 17, - title: "Internode Data Transfer", - data: [], - widgetConfiguration: [ - { - dataKey: "", - keyLabel: "", - lineColor: "#000", - fillColor: "#000", - }, - ], - type: widgetType.linearGraph, - - yAxisFormatter: niceBytes, - xAxisFormatter: getTimeFromTimestamp, - }, - { - id: 73, - title: "Node IO", - data: [], - widgetConfiguration: [ - { - dataKey: "", - keyLabel: "", - lineColor: "#000", - fillColor: "#000", - }, - ], - type: widgetType.linearGraph, - - yAxisFormatter: niceBytes, - xAxisFormatter: getTimeFromTimestamp, - }, - { - id: 80, - title: "Time Since Last Heal Activity", - data: "N/A", - type: widgetType.simpleWidget, - widgetIcon: , - labelDisplayFunction: niceDaysFromNS, - }, - { - id: 81, - title: "Time Since Last Scan Activity", - data: "N/A", - type: widgetType.simpleWidget, - widgetIcon: , - labelDisplayFunction: niceDaysFromNS, - }, - { - id: 71, - title: "API Request Error Rate", - data: [], - widgetConfiguration: [ - { - dataKey: "", - keyLabel: "", - lineColor: "#000", - fillColor: "#000", - }, - ], - type: widgetType.linearGraph, - - xAxisFormatter: getTimeFromTimestamp, - }, - { - id: 76, - title: "Node Memory Usage", - data: [], - widgetConfiguration: [ - { - dataKey: "", - keyLabel: "", - lineColor: "#000", - fillColor: "#000", - }, - ], - type: widgetType.linearGraph, - - xAxisFormatter: getTimeFromTimestamp, - yAxisFormatter: niceBytes, - }, - { - id: 74, - title: "Drive Used Capacity", - data: [], - widgetConfiguration: [ - { - dataKey: "", - keyLabel: "", - lineColor: "#000", - fillColor: "#000", - }, - ], - type: widgetType.linearGraph, - - xAxisFormatter: getTimeFromTimestamp, - yAxisFormatter: niceBytes, - }, - { - id: 82, - title: "Drives Free Inodes", - data: [], - widgetConfiguration: [ - { - dataKey: "", - keyLabel: "", - lineColor: "#000", - fillColor: "#000", - }, - ], - type: widgetType.linearGraph, - - disableYAxis: true, - xAxisFormatter: getTimeFromTimestamp, - }, - { - id: 11, - title: "Node Syscalls", - data: [], - widgetConfiguration: [ - { - dataKey: "", - keyLabel: "", - lineColor: "#000", - fillColor: "#000", - }, - ], - type: widgetType.linearGraph, - yAxisFormatter: roundNumber, - xAxisFormatter: getTimeFromTimestamp, - }, - { - id: 8, - title: "Node File Descriptors", - data: [], - widgetConfiguration: [ - { - dataKey: "", - keyLabel: "", - lineColor: "#000", - fillColor: "#000", - }, - ], - type: widgetType.linearGraph, - yAxisFormatter: roundNumber, - xAxisFormatter: getTimeFromTimestamp, - }, - { - id: 500, - mergedPanels: [ - { - id: 53, - title: "Online", - data: "N/A", - type: widgetType.singleValue, - }, - { - id: 69, - title: "Offline", - data: "N/A", - type: widgetType.singleValue, - }, - ], - title: "Servers", - }, - { - id: 501, - mergedPanels: [ - { - id: 9, - title: "Online", - data: "N/A", - type: widgetType.singleValue, - }, - { - id: 78, - title: "Offline", - data: "N/A", - type: widgetType.singleValue, - }, - ], - title: "Drives", - }, - { - id: 502, - mergedPanels: [ - { - id: 65, - title: "Upload", - data: "N/A", - type: widgetType.singleValue, - - labelDisplayFunction: niceBytes, - }, - { - id: 64, - title: "Download", - data: "N/A", - type: widgetType.singleValue, - - labelDisplayFunction: niceBytes, - }, - ], - title: "Network", - }, -]; - -const calculateMainValue = (elements: any[], metricCalc: string) => { - if (elements.length === 0) { - return ["", "0"]; - } - - switch (metricCalc) { - case "mean": - const sumValues = elements.reduce((accumulator, currValue) => { - return accumulator + parseFloat(currValue[1]); - }, 0); - - const mean = Math.floor(sumValues / elements.length); - - return ["", mean.toString()]; - default: - const sortResult = elements.sort( - (value1: any[], value2: any[]) => value1[0] - value2[0], - ); - - return sortResult[sortResult.length - 1]; - } -}; - -const constructLabelNames = (metrics: any, legendFormat: string) => { - const keysToReplace = Object.keys(metrics); - const expToReplace = new RegExp(`{{(${keysToReplace.join("|")})}}`, "g"); - - let replacedLegend = legendFormat.replace(expToReplace, (matchItem) => { - const nwMatchItem = matchItem.replace(/({{|}})/g, ""); - return metrics[nwMatchItem]; - }); - - const countVarsOpen = (replacedLegend.match(/{{/g) || []).length; - const countVarsClose = (replacedLegend.match(/}}/g) || []).length; - - let cleanLegend = replacedLegend.replace(/{{(.*?)}}/g, ""); - - if ( - countVarsOpen === countVarsClose && - countVarsOpen !== 0 && - countVarsClose !== 0 - ) { - keysToReplace.forEach((element) => { - replacedLegend = replacedLegend.replace(element, metrics[element]); - }); - - cleanLegend = replacedLegend; - } - - // In case not all the legends were replaced, we remove the placeholders. - return cleanLegend; -}; - -export const widgetDetailsToPanel = ( - payloadData: any, - panelItem: IDashboardPanel, -) => { - if (!payloadData) { - return panelItem; - } - - const typeOfPayload = payloadData.type; - - switch (panelItem.type) { - case widgetType.singleValue: - case widgetType.simpleWidget: - if (typeOfPayload === "stat" || typeOfPayload === "singlestat") { - // We sort values & get the last value - let elements = get(payloadData, "targets[0].result[0].values", []); - - if (elements === null) { - elements = []; - } - - const metricCalc = get( - payloadData, - "options.reduceOptions.calcs[0]", - "lastNotNull", - ); - - const valueDisplay = calculateMainValue(elements, metricCalc); - - const data = panelItem.labelDisplayFunction - ? panelItem.labelDisplayFunction(valueDisplay[1]) - : valueDisplay[1]; - - return { - ...panelItem, - data, - }; - } - break; - case widgetType.pieChart: - if (typeOfPayload === "gauge") { - const metricCalc = get( - payloadData, - "options.reduceOptions.calcs[0]", - "lastNotNull", - ); - - let chartSeries = get(payloadData, "targets", []).filter( - (seriesItem: any) => seriesItem !== null, - ); - - const values = chartSeries.map((chartTarget: any) => { - const resultMap = - chartTarget.result && Array.isArray(chartTarget.result) - ? chartTarget.result - : []; - - const values = resultMap.map((elementValue: any) => { - const values = get(elementValue, "values", []); - const metricKeyItem = Object.keys(elementValue.metric); - const sortResult = values.sort( - (value1: any[], value2: any[]) => - parseInt(value1[0][1]) - parseInt(value2[0][1]), - ); - - const metricName = elementValue.metric[metricKeyItem[0]]; - const value = sortResult[sortResult.length - 1]; - return { - name: metricName, - value: parseInt(value[1]), - legend: chartTarget.legendFormat, - }; - }); - - return values; - }); - - const firstTarget = - chartSeries[0].result && chartSeries[0].result.length > 0 - ? chartSeries[0].result[0].values - : []; - - const totalValues = calculateMainValue(firstTarget, metricCalc); - - const innerLabel = panelItem.labelDisplayFunction - ? panelItem.labelDisplayFunction(totalValues[1]) - : totalValues[1]; - - return { - ...panelItem, - data: values, - innerLabel, - }; - } - break; - case widgetType.linearGraph: - case widgetType.areaGraph: - if (typeOfPayload === "graph") { - let targets = get(payloadData, "targets", []); - if (targets === null) { - targets = []; - } - - const series: any[] = []; - const plotValues: any[] = []; - - targets.forEach( - ( - targetMaster: { legendFormat: string; result: any[] }, - index: number, - ) => { - // Add a new serie to plot variables in case it is not from multiple values - let results = get(targetMaster, "result", []); - const legendFormat = targetMaster.legendFormat; - if (results === null) { - results = []; - } - - results.forEach((itemVals: { metric: object; values: any[] }) => { - // Label Creation - const labelName = constructLabelNames( - itemVals.metric, - legendFormat, - ); - const keyName = `key_${index}${labelName}`; - - // series creation with recently created label - series.push({ - dataKey: keyName, - keyLabel: labelName, - lineColor: "", - fillColor: "", - }); - - // we iterate over values and create elements - let values = get(itemVals, "values", []); - if (values === null) { - values = []; - } - - values.forEach((valInfo: any[]) => { - const itemIndex = plotValues.findIndex( - (element) => element.name === valInfo[0], - ); - - // Element not exists yet - if (itemIndex === -1) { - let itemToPush: any = { name: valInfo[0] }; - itemToPush[keyName] = valInfo[1]; - - plotValues.push(itemToPush); - } else { - plotValues[itemIndex][keyName] = valInfo[1]; - } - }); - }); - }, - ); - - const sortedSeries = series.sort((series1: any, series2: any) => { - if (series1.keyLabel < series2.keyLabel) { - return -1; - } - if (series1.keyLabel > series2.keyLabel) { - return 1; - } - return 0; - }); - - const seriesWithColors = sortedSeries.map( - (serialC: any, index: number) => { - return { - ...serialC, - lineColor: colorsMain[index] || textToRGBColor(serialC.keyLabel), - fillColor: colorsMain[index] || textToRGBColor(serialC.keyLabel), - }; - }, - ); - - const sortedVals = plotValues.sort( - (value1: any, value2: any) => value1.name - value2.name, - ); - - return { - ...panelItem, - widgetConfiguration: seriesWithColors, - data: sortedVals, - }; - } - break; - case widgetType.barChart: - if (typeOfPayload === "bargauge") { - let chartBars = get(payloadData, "targets[0].result", []); - - if (chartBars === null) { - chartBars = []; - } - - const sortFunction = (value1: any[], value2: any[]) => - value1[0] - value2[0]; - - let values = []; - if (panelItem.customStructure) { - values = panelItem.customStructure.map((structureItem) => { - const metricTake = chartBars.find((element: any) => { - return element.metric.range === structureItem.originTag; - }); - - const elements = get(metricTake, "values", []); - - const sortResult = elements.sort(sortFunction); - const lastValue = sortResult[sortResult.length - 1] || ["", "0"]; - - return { - name: structureItem.displayTag, - a: parseInt(lastValue[1]), - }; - }); - } else { - // If no configuration is set, we construct the series for bar chart and return the element - values = chartBars.map((elementValue: any) => { - const metricKeyItem = Object.keys(elementValue.metric); - - const metricName = elementValue.metric[metricKeyItem[0]]; - - const elements = get(elementValue, "values", []); - - const sortResult = elements.sort(sortFunction); - const lastValue = sortResult[sortResult.length - 1] || ["", "0"]; - return { name: metricName, a: parseInt(lastValue[1]) }; - }); - } - - return { - ...panelItem, - data: values, - }; - } - break; - case widgetType.singleRep: - if (typeOfPayload === "stat") { - // We sort values & get the last value - let elements = get(payloadData, "targets[0].result[0].values", []); - if (elements === null) { - elements = []; - } - const metricCalc = get( - payloadData, - "options.reduceOptions.calcs[0]", - "lastNotNull", - ); - - const valueDisplay = calculateMainValue(elements, metricCalc); - - const sortResult = elements.sort( - (value1: any[], value2: any[]) => value1[0] - value2[0], - ); - - let valuesForBackground = []; - - if (sortResult.length === 1) { - valuesForBackground.push({ value: 0 }); - } - - sortResult.forEach((eachVal: any) => { - valuesForBackground.push({ value: parseInt(eachVal[1]) }); - }); - - const innerLabel = panelItem.labelDisplayFunction - ? panelItem.labelDisplayFunction(valueDisplay[1]) - : valueDisplay[1]; - - return { - ...panelItem, - data: valuesForBackground, - innerLabel, - }; - } - break; - } - - return panelItem; -}; - -const verifyNumeric = (item: string) => { - return !isNaN(parseFloat(item)); -}; - -export const splitSizeMetric = (val: string) => { - const splittedText = val.split(" "); - // Value is not a size metric, we return as common string - - const singleValue = () => { - let vl = val; - - if (verifyNumeric(val)) { - vl = representationNumber(parseFloat(val)); - } - return {vl}; - }; - - if (splittedText.length !== 2) { - return singleValue(); - } - - if (!units.includes(splittedText[1])) { - return singleValue(); - } - - return ( - - {splittedText[0]} - {splittedText[1]} - - ); -}; diff --git a/web-app/src/screens/Console/Dashboard/Prometheus/widgetUtils.tsx b/web-app/src/screens/Console/Dashboard/Prometheus/widgetUtils.tsx deleted file mode 100644 index a8574b332e..0000000000 --- a/web-app/src/screens/Console/Dashboard/Prometheus/widgetUtils.tsx +++ /dev/null @@ -1,159 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 from "react"; -import { IDashboardPanel, widgetType } from "./types"; -import BarChartWidget from "./Widgets/BarChartWidget"; -import LinearGraphWidget from "./Widgets/LinearGraphWidget"; -import PieChartWidget from "./Widgets/PieChartWidget"; -import SimpleWidget from "./Widgets/SimpleWidget"; -import SingleRepWidget from "./Widgets/SingleRepWidget"; -import SingleValueWidget from "./Widgets/SingleValueWidget"; -import CapacityItem from "./Widgets/CapacityItem"; -import DashboardItemBox from "../DashboardItemBox"; -import HealActivityRenderer, { - SimpleWidgetRenderProps, -} from "./Widgets/HealActivityRenderer"; -import ScanActivityRenderer from "./Widgets/ScanActivityRenderer"; -import UptimeActivityRenderer from "./Widgets/UptimeActivityRenderer"; - -export const componentToUse = ( - value: IDashboardPanel, - timeStart: any, - timeEnd: any, - loading: boolean, - apiPrefix: string, - zoomActivated: boolean = false, -) => { - switch (value.type) { - case widgetType.singleValue: - return ( - - ); - case widgetType.simpleWidget: - let renderFn; - let CmpToRender: any = null; - if (value.id === 80) { - CmpToRender = HealActivityRenderer; - } else if (value.id === 81) { - CmpToRender = ScanActivityRenderer; - } else if (value.id === 1) { - CmpToRender = UptimeActivityRenderer; - } - - if ([80, 81, 1].includes(value.id)) { - renderFn = ({ - valueToRender, - loading, - title, - id, - iconWidget, - }: SimpleWidgetRenderProps) => { - return ( - - ); - }; - } - return ( - - ); - case widgetType.pieChart: - if (value.id === 50) { - return ( - - - - ); - } - return ( - - ); - case widgetType.linearGraph: - case widgetType.areaGraph: - return ( - - ); - case widgetType.barChart: - return ( - - ); - case widgetType.singleRep: - const fillColor = value.fillColor ? value.fillColor : value.color; - return ( - - ); - default: - return null; - } -}; diff --git a/web-app/src/screens/Console/Dashboard/TimeStatItem.tsx b/web-app/src/screens/Console/Dashboard/TimeStatItem.tsx deleted file mode 100644 index d768b18cd9..0000000000 --- a/web-app/src/screens/Console/Dashboard/TimeStatItem.tsx +++ /dev/null @@ -1,73 +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 from "react"; -import styled from "styled-components"; -import get from "lodash/get"; -import { Box, Loader, SuccessIcon } from "mds"; - -const TimeStatBase = styled.div(({ theme }) => ({ - display: "grid", - alignItems: "center", - gap: 8, - height: 33, - paddingLeft: 15, - gridTemplateColumns: "20px 1.5fr .5fr 20px", - background: get(theme, "boxBackground", "#FBFAFA"), // #EBF9EE - "& .min-icon": { - height: "12px", - width: "12px", - fill: get(theme, "signalColors.good", "#4CCB92"), - }, - "& .ok-icon": { - height: "8px", - width: "8px", - fill: get(theme, "signalColors.good", "#4CCB92"), - color: get(theme, "signalColors.good", "#4CCB92"), - }, - "& .timeStatLabel": { - fontSize: "12px", - color: get(theme, "signalColors.good", "#4CCB92"), - fontWeight: 600, - }, - "& .timeStatValue": { - fontSize: "12px", - color: get(theme, "signalColors.good", "#4CCB92"), - }, -})); - -const TimeStatItem = ({ - icon, - label, - value, - loading = false, -}: { - icon: any; - label: any; - value: string; - loading?: boolean; -}) => { - return ( - - {loading ? : icon} - {label} - {value} - {value !== "n/a" ? : null} - - ); -}; - -export default TimeStatItem; diff --git a/web-app/src/screens/Console/Dashboard/dashboardSlice.ts b/web-app/src/screens/Console/Dashboard/dashboardSlice.ts deleted file mode 100644 index fab1c4c5db..0000000000 --- a/web-app/src/screens/Console/Dashboard/dashboardSlice.ts +++ /dev/null @@ -1,72 +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 { createSlice, PayloadAction } from "@reduxjs/toolkit"; -import { zoomState } from "./types"; -import { IDashboardPanel } from "./Prometheus/types"; -import { getUsageAsync } from "./dashboardThunks"; -import { AdminInfoResponse } from "api/consoleApi"; - -interface DashboardState { - zoom: zoomState; - usage: AdminInfoResponse | null; - status: "idle" | "loading" | "failed"; - widgetLoadVersion: number; -} - -const initialState: DashboardState = { - status: "idle", - zoom: { - openZoom: false, - widgetRender: null, - }, - usage: null, - widgetLoadVersion: 0, -}; -const dashboardSlice = createSlice({ - name: "dashboard", - initialState, - reducers: { - openZoomPage: (state, action: PayloadAction) => { - state.zoom.openZoom = true; - state.zoom.widgetRender = action.payload; - }, - closeZoomPage: (state) => { - state.zoom.openZoom = false; - state.zoom.widgetRender = null; - }, - reloadWidgets: (state) => { - state.widgetLoadVersion++; - }, - }, - extraReducers: (builder) => { - builder - .addCase(getUsageAsync.pending, (state) => { - state.status = "loading"; - }) - .addCase(getUsageAsync.rejected, (state) => { - state.status = "failed"; - }) - .addCase(getUsageAsync.fulfilled, (state, action) => { - state.status = "idle"; - state.usage = action.payload; - }); - }, -}); -export const { openZoomPage, closeZoomPage, reloadWidgets } = - dashboardSlice.actions; - -export default dashboardSlice.reducer; diff --git a/web-app/src/screens/Console/Dashboard/dashboardThunks.ts b/web-app/src/screens/Console/Dashboard/dashboardThunks.ts deleted file mode 100644 index cff2a7d84b..0000000000 --- a/web-app/src/screens/Console/Dashboard/dashboardThunks.ts +++ /dev/null @@ -1,35 +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 { createAsyncThunk } from "@reduxjs/toolkit"; -import { setErrorSnackMessage } from "../../../systemSlice"; -import { api } from "api"; -import { errorToHandler } from "api/errors"; - -export const getUsageAsync = createAsyncThunk( - "dashboard/getUsageAsync", - async (_, { getState, rejectWithValue, dispatch }) => { - return api.admin - .adminInfo() - .then((res) => { - return res.data; - }) - .catch((err) => { - dispatch(setErrorSnackMessage(errorToHandler(err.error))); - return rejectWithValue(err); - }); - }, -); diff --git a/web-app/src/screens/Console/Dashboard/types.ts b/web-app/src/screens/Console/Dashboard/types.ts deleted file mode 100644 index 37bbcc456a..0000000000 --- a/web-app/src/screens/Console/Dashboard/types.ts +++ /dev/null @@ -1,22 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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 { IDashboardPanel } from "./Prometheus/types"; - -export interface zoomState { - openZoom: boolean; - widgetRender: null | IDashboardPanel; -} diff --git a/web-app/src/screens/Console/EventDestinations/AddEventDestination.tsx b/web-app/src/screens/Console/EventDestinations/AddEventDestination.tsx deleted file mode 100644 index 4c8b35cb44..0000000000 --- a/web-app/src/screens/Console/EventDestinations/AddEventDestination.tsx +++ /dev/null @@ -1,209 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2021 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, useCallback, useEffect, useState } from "react"; -import get from "lodash/get"; -import { BackLink, Button, FormLayout, Grid, InputBox, PageLayout } from "mds"; -import { useNavigate, useParams } from "react-router-dom"; -import { api } from "api"; -import { errorToHandler } from "api/errors"; -import { - destinationList, - notificationEndpointsFields, - notifyMysql, - notifyPostgres, - removeEmptyFields, -} from "./utils"; -import { IElementValue } from "../Configurations/types"; -import { IAM_PAGES } from "../../../common/SecureComponent/permissions"; -import { - setErrorSnackMessage, - setHelpName, - setServerNeedsRestart, -} from "../../../systemSlice"; -import { useAppDispatch } from "../../../store"; -import { setDestinationLoading } from "./destinationsSlice"; -import withSuspense from "../Common/Components/withSuspense"; -import PageHeaderWrapper from "../Common/PageHeaderWrapper/PageHeaderWrapper"; -import TargetTitle from "./TargetTitle"; -import HelpMenu from "../HelpMenu"; - -const ConfMySql = withSuspense( - React.lazy(() => import("./CustomForms/ConfMySql")), -); - -const ConfTargetGeneric = withSuspense( - React.lazy(() => import("./ConfTargetGeneric")), -); - -const ConfPostgres = withSuspense( - React.lazy(() => import("./CustomForms/ConfPostgres")), -); - -interface IAddNotificationEndpointProps { - saveAndRefresh: any; -} - -const AddEventDestination = ({ - saveAndRefresh, -}: IAddNotificationEndpointProps) => { - const dispatch = useAppDispatch(); - const navigate = useNavigate(); - const params = useParams(); - - //Local States - const [valuesArr, setValueArr] = useState([]); - const [identifier, setIdentifier] = useState(""); - const [saving, setSaving] = useState(false); - const service = params.service || ""; - - //Effects - useEffect(() => { - if (saving) { - const payload = { - key_values: removeEmptyFields(valuesArr), - }; - api.configs - .setConfig(`${service}:${identifier}`, payload) - .then(() => { - setSaving(false); - dispatch(setServerNeedsRestart(true)); - dispatch(setDestinationLoading(true)); - navigate(IAM_PAGES.EVENT_DESTINATIONS); - }) - .catch((err) => { - setSaving(false); - dispatch(setErrorSnackMessage(errorToHandler(err.error))); - }); - } - }, [ - saving, - service, - valuesArr, - saveAndRefresh, - dispatch, - navigate, - identifier, - ]); - - //Fetch Actions - const submitForm = (event: React.FormEvent) => { - event.preventDefault(); - setSaving(true); - }; - - const onValueChange = useCallback( - (newValue: IElementValue[]) => { - setValueArr(newValue); - }, - [setValueArr], - ); - - let srvComponent; - switch (service) { - case notifyPostgres: { - srvComponent = ; - break; - } - case notifyMysql: { - srvComponent = ; - break; - } - default: { - const fields = get(notificationEndpointsFields, service, []); - - srvComponent = ( - - ); - } - } - - const targetElement = destinationList.find( - (element) => element.actionTrigger === service, - ); - - useEffect(() => { - dispatch(setHelpName("add_notification_endpoint")); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); - - return ( - - - navigate(IAM_PAGES.EVENT_DESTINATIONS_ADD)} - /> - - } - actions={} - /> - - - - {service !== "" && ( - - - {targetElement && ( - - )} - - - setIdentifier(e.target.value)} - tooltip={"Unique descriptive string for this destination"} - placeholder="Enter Destination Identifier" - required - /> - - {srvComponent} - - - - )} - - -