diff --git a/api/admin_tiers.go b/api/admin_tiers.go deleted file mode 100644 index b662d2b35f..0000000000 --- a/api/admin_tiers.go +++ /dev/null @@ -1,488 +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" - "strconv" - - "github.com/dustin/go-humanize" - "github.com/go-openapi/runtime/middleware" - "github.com/minio/console/api/operations" - "github.com/minio/console/api/operations/tiering" - tieringApi "github.com/minio/console/api/operations/tiering" - "github.com/minio/console/models" - "github.com/minio/madmin-go/v3" -) - -func registerAdminTiersHandlers(api *operations.ConsoleAPI) { - // return a list of notification endpoints - api.TieringTiersListHandler = tieringApi.TiersListHandlerFunc(func(params tieringApi.TiersListParams, session *models.Principal) middleware.Responder { - tierList, err := getTiersResponse(session, params) - if err != nil { - return tieringApi.NewTiersListDefault(err.Code).WithPayload(err.APIError) - } - return tieringApi.NewTiersListOK().WithPayload(tierList) - }) - api.TieringTiersListNamesHandler = tiering.TiersListNamesHandlerFunc(func(params tiering.TiersListNamesParams, session *models.Principal) middleware.Responder { - tierList, err := getTiersNameResponse(session, params) - if err != nil { - return tieringApi.NewTiersListDefault(err.Code).WithPayload(err.APIError) - } - return tieringApi.NewTiersListNamesOK().WithPayload(tierList) - }) - // add a new tiers - api.TieringAddTierHandler = tieringApi.AddTierHandlerFunc(func(params tieringApi.AddTierParams, session *models.Principal) middleware.Responder { - err := getAddTierResponse(session, params) - if err != nil { - return tieringApi.NewAddTierDefault(err.Code).WithPayload(err.APIError) - } - return tieringApi.NewAddTierCreated() - }) - // get a tier - api.TieringGetTierHandler = tieringApi.GetTierHandlerFunc(func(params tieringApi.GetTierParams, session *models.Principal) middleware.Responder { - notifEndpoints, err := getGetTierResponse(session, params) - if err != nil { - return tieringApi.NewGetTierDefault(err.Code).WithPayload(err.APIError) - } - return tieringApi.NewGetTierOK().WithPayload(notifEndpoints) - }) - // edit credentials for a tier - api.TieringEditTierCredentialsHandler = tieringApi.EditTierCredentialsHandlerFunc(func(params tieringApi.EditTierCredentialsParams, session *models.Principal) middleware.Responder { - err := getEditTierCredentialsResponse(session, params) - if err != nil { - return tieringApi.NewEditTierCredentialsDefault(err.Code).WithPayload(err.APIError) - } - return tieringApi.NewEditTierCredentialsOK() - }) - // remove an empty tier - api.TieringRemoveTierHandler = tieringApi.RemoveTierHandlerFunc(func(params tieringApi.RemoveTierParams, session *models.Principal) middleware.Responder { - err := getRemoveTierResponse(session, params) - if err != nil { - return tieringApi.NewRemoveTierDefault(err.Code).WithPayload(err.APIError) - } - return tieringApi.NewRemoveTierNoContent() - }) -} - -// getTiers returns a list of tiers with their stats -func getTiers(ctx context.Context, client MinioAdmin) (*models.TierListResponse, error) { - tiers, err := client.listTiers(ctx) - if err != nil { - return nil, err - } - - tierStatsInfo, err := client.tierStats(ctx) - if err != nil { - return nil, err - } - tiersStatsMap := make(map[string]madmin.TierStats, len(tierStatsInfo)) - for _, stat := range tierStatsInfo { - tiersStatsMap[stat.Name] = stat.Stats - } - - var tiersList []*models.Tier - for _, tierData := range tiers { - // Default Tier Stats - tierStats := madmin.TierStats{ - NumObjects: 0, - NumVersions: 0, - TotalSize: 0, - } - if stats, ok := tiersStatsMap[tierData.Name]; ok { - tierStats = stats - } - - status := client.verifyTierStatus(ctx, tierData.Name) == nil - - switch tierData.Type { - case madmin.S3: - tiersList = append(tiersList, &models.Tier{ - Type: models.TierTypeS3, - S3: &models.TierS3{ - Accesskey: tierData.S3.AccessKey, - Bucket: tierData.S3.Bucket, - Endpoint: tierData.S3.Endpoint, - Name: tierData.Name, - Prefix: tierData.S3.Prefix, - Region: tierData.S3.Region, - Secretkey: tierData.S3.SecretKey, - Storageclass: tierData.S3.StorageClass, - Usage: humanize.IBytes(tierStats.TotalSize), - Objects: strconv.Itoa(tierStats.NumObjects), - Versions: strconv.Itoa(tierStats.NumVersions), - }, - Status: status, - }) - case madmin.MinIO: - tiersList = append(tiersList, &models.Tier{ - Type: models.TierTypeMinio, - Minio: &models.TierMinio{ - Accesskey: tierData.MinIO.AccessKey, - Bucket: tierData.MinIO.Bucket, - Endpoint: tierData.MinIO.Endpoint, - Name: tierData.Name, - Prefix: tierData.MinIO.Prefix, - Region: tierData.MinIO.Region, - Secretkey: tierData.MinIO.SecretKey, - Usage: humanize.IBytes(tierStats.TotalSize), - Objects: strconv.Itoa(tierStats.NumObjects), - Versions: strconv.Itoa(tierStats.NumVersions), - }, - Status: status, - }) - case madmin.GCS: - tiersList = append(tiersList, &models.Tier{ - Type: models.TierTypeGcs, - Gcs: &models.TierGcs{ - Bucket: tierData.GCS.Bucket, - Creds: tierData.GCS.Creds, - Endpoint: tierData.GCS.Endpoint, - Name: tierData.Name, - Prefix: tierData.GCS.Prefix, - Region: tierData.GCS.Region, - Usage: humanize.IBytes(tierStats.TotalSize), - Objects: strconv.Itoa(tierStats.NumObjects), - Versions: strconv.Itoa(tierStats.NumVersions), - }, - Status: status, - }) - case madmin.Azure: - tiersList = append(tiersList, &models.Tier{ - Type: models.TierTypeAzure, - Azure: &models.TierAzure{ - Accountkey: tierData.Azure.AccountKey, - Accountname: tierData.Azure.AccountName, - Bucket: tierData.Azure.Bucket, - Endpoint: tierData.Azure.Endpoint, - Name: tierData.Name, - Prefix: tierData.Azure.Prefix, - Region: tierData.Azure.Region, - Usage: humanize.IBytes(tierStats.TotalSize), - Objects: strconv.Itoa(tierStats.NumObjects), - Versions: strconv.Itoa(tierStats.NumVersions), - }, - Status: status, - }) - case madmin.Unsupported: - tiersList = append(tiersList, &models.Tier{ - Type: models.TierTypeUnsupported, - Status: status, - }) - } - } - // build response - return &models.TierListResponse{ - Items: tiersList, - }, nil -} - -// getTiersResponse returns a response with a list of tiers -func getTiersResponse(session *models.Principal, params tieringApi.TiersListParams) (*models.TierListResponse, *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 - tiersResp, err := getTiers(ctx, adminClient) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return tiersResp, nil -} - -// getTiersNameResponse returns a response with a list of tiers' names -func getTiersNameResponse(session *models.Principal, params tieringApi.TiersListNamesParams) (*models.TiersNameListResponse, *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 - tiersResp, err := getTiersName(ctx, adminClient) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return tiersResp, nil -} - -// getTiersName fetches listTiers and returns a list of the tiers' names -func getTiersName(ctx context.Context, client MinioAdmin) (*models.TiersNameListResponse, error) { - tiers, err := client.listTiers(ctx) - if err != nil { - return nil, err - } - - tiersNameList := make([]string, len(tiers)) - for i, tierData := range tiers { - tiersNameList[i] = tierData.Name - } - - return &models.TiersNameListResponse{ - Items: tiersNameList, - }, nil -} - -func addTier(ctx context.Context, client MinioAdmin, params *tieringApi.AddTierParams) error { - var cfg *madmin.TierConfig - var err error - - switch params.Body.Type { - - case models.TierTypeS3: - cfg, err = madmin.NewTierS3( - params.Body.S3.Name, - params.Body.S3.Accesskey, - params.Body.S3.Secretkey, - params.Body.S3.Bucket, - madmin.S3Region(params.Body.S3.Region), - madmin.S3Prefix(params.Body.S3.Prefix), - madmin.S3Endpoint(params.Body.S3.Endpoint), - madmin.S3StorageClass(params.Body.S3.Storageclass), - ) - if err != nil { - return err - } - case models.TierTypeMinio: - cfg, err = madmin.NewTierMinIO( - params.Body.Minio.Name, - params.Body.Minio.Endpoint, - params.Body.Minio.Accesskey, - params.Body.Minio.Secretkey, - params.Body.Minio.Bucket, - madmin.MinIORegion(params.Body.Minio.Region), - madmin.MinIOPrefix(params.Body.Minio.Prefix), - ) - if err != nil { - return err - } - case models.TierTypeGcs: - gcsOpts := []madmin.GCSOptions{} - prefix := params.Body.Gcs.Prefix - if prefix != "" { - gcsOpts = append(gcsOpts, madmin.GCSPrefix(prefix)) - } - - region := params.Body.Gcs.Region - if region != "" { - gcsOpts = append(gcsOpts, madmin.GCSRegion(region)) - } - base64Text := make([]byte, base64.StdEncoding.EncodedLen(len(params.Body.Gcs.Creds))) - l, _ := base64.StdEncoding.Decode(base64Text, []byte(params.Body.Gcs.Creds)) - - cfg, err = madmin.NewTierGCS( - params.Body.Gcs.Name, - base64Text[:l], - params.Body.Gcs.Bucket, - gcsOpts..., - ) - if err != nil { - return err - } - case models.TierTypeAzure: - cfg, err = madmin.NewTierAzure( - params.Body.Azure.Name, - params.Body.Azure.Accountname, - params.Body.Azure.Accountkey, - params.Body.Azure.Bucket, - madmin.AzurePrefix(params.Body.Azure.Prefix), - madmin.AzureEndpoint(params.Body.Azure.Endpoint), - madmin.AzureRegion(params.Body.Azure.Region), - ) - if err != nil { - return err - } - case models.TierTypeUnsupported: - cfg = &madmin.TierConfig{ - Type: madmin.Unsupported, - } - - } - - err = client.addTier(ctx, cfg) - if err != nil { - return err - } - return nil -} - -// getAddTierResponse returns the response of admin tier -func getAddTierResponse(session *models.Principal, params tieringApi.AddTierParams) *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} - - // serialize output - errTier := addTier(ctx, adminClient, ¶ms) - if errTier != nil { - return ErrorWithContext(ctx, errTier) - } - return nil -} - -func getTier(ctx context.Context, client MinioAdmin, params *tieringApi.GetTierParams) (*models.Tier, error) { - tiers, err := client.listTiers(ctx) - if err != nil { - return nil, err - } - for i := range tiers { - switch tiers[i].Type { - case madmin.S3: - if params.Type != models.TierTypeS3 || tiers[i].Name != params.Name { - continue - } - return &models.Tier{ - Type: models.TierTypeS3, - S3: &models.TierS3{ - Accesskey: tiers[i].S3.AccessKey, - Bucket: tiers[i].S3.Bucket, - Endpoint: tiers[i].S3.Endpoint, - Name: tiers[i].Name, - Prefix: tiers[i].S3.Prefix, - Region: tiers[i].S3.Region, - Secretkey: tiers[i].S3.SecretKey, - Storageclass: tiers[i].S3.StorageClass, - }, - }, err - case madmin.GCS: - if params.Type != models.TierTypeGcs || tiers[i].Name != params.Name { - continue - } - return &models.Tier{ - Type: models.TierTypeGcs, - Gcs: &models.TierGcs{ - Bucket: tiers[i].GCS.Bucket, - Creds: tiers[i].GCS.Creds, - Endpoint: tiers[i].GCS.Endpoint, - Name: tiers[i].Name, - Prefix: tiers[i].GCS.Prefix, - Region: tiers[i].GCS.Region, - }, - }, nil - case madmin.Azure: - if params.Type != models.TierTypeAzure || tiers[i].Name != params.Name { - continue - } - return &models.Tier{ - Type: models.TierTypeAzure, - Azure: &models.TierAzure{ - Accountkey: tiers[i].Azure.AccountKey, - Accountname: tiers[i].Azure.AccountName, - Bucket: tiers[i].Azure.Bucket, - Endpoint: tiers[i].Azure.Endpoint, - Name: tiers[i].Name, - Prefix: tiers[i].Azure.Prefix, - Region: tiers[i].Azure.Region, - }, - }, nil - } - } - - // build response - return nil, ErrNotFound -} - -// getGetTierResponse returns a tier -func getGetTierResponse(session *models.Principal, params tieringApi.GetTierParams) (*models.Tier, *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 - addTierResp, err := getTier(ctx, adminClient, ¶ms) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return addTierResp, nil -} - -func editTierCredentials(ctx context.Context, client MinioAdmin, params *tieringApi.EditTierCredentialsParams) error { - base64Text := make([]byte, base64.StdEncoding.EncodedLen(len(params.Body.Creds))) - l, err := base64.StdEncoding.Decode(base64Text, []byte(params.Body.Creds)) - if err != nil { - return err - } - - creds := madmin.TierCreds{ - AccessKey: params.Body.AccessKey, - SecretKey: params.Body.SecretKey, - CredsJSON: base64Text[:l], - } - return client.editTierCreds(ctx, params.Name, creds) -} - -// getEditTierCredentialsResponse returns the result of editing credentials for a tier -func getEditTierCredentialsResponse(session *models.Principal, params tieringApi.EditTierCredentialsParams) *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} - // serialize output - err = editTierCredentials(ctx, adminClient, ¶ms) - if err != nil { - return ErrorWithContext(ctx, err) - } - return nil -} - -func removeTier(ctx context.Context, client MinioAdmin, params *tieringApi.RemoveTierParams) error { - return client.removeTier(ctx, params.Name) -} - -func getRemoveTierResponse(session *models.Principal, params tieringApi.RemoveTierParams) *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} - // serialize output - err = removeTier(ctx, adminClient, ¶ms) - if err != nil { - return ErrorWithContext(ctx, err) - } - return nil -} diff --git a/api/admin_tiers_test.go b/api/admin_tiers_test.go deleted file mode 100644 index 791a4e35dd..0000000000 --- a/api/admin_tiers_test.go +++ /dev/null @@ -1,310 +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" - - tieringApi "github.com/minio/console/api/operations/tiering" - "github.com/minio/console/models" - "github.com/minio/madmin-go/v3" - "github.com/stretchr/testify/assert" -) - -func TestGetTiers(t *testing.T) { - assert := assert.New(t) - // mock minIO client - adminClient := AdminClientMock{} - - function := "getTiers()" - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - // Test-1 : getTiers() get list of tiers - // mock lifecycle response from MinIO - returnListMock := []*madmin.TierConfig{ - { - Version: "V1", - Type: madmin.S3, - Name: "S3 Tier", - S3: &madmin.TierS3{ - Endpoint: "https://s3tier.test.com/", - AccessKey: "Access Key", - SecretKey: "Secret Key", - Bucket: "buckets3", - Prefix: "pref1", - Region: "us-west-1", - StorageClass: "TT1", - }, - }, - { - Version: "V1", - Type: madmin.MinIO, - Name: "MinIO Tier", - MinIO: &madmin.TierMinIO{ - Endpoint: "https://minio-endpoint.test.com/", - AccessKey: "access", - SecretKey: "secret", - Bucket: "somebucket", - Prefix: "p1", - Region: "us-east-2", - }, - }, - } - - returnStatsMock := []madmin.TierInfo{ - { - Name: "STANDARD", - Type: "internal", - Stats: madmin.TierStats{NumObjects: 2, NumVersions: 2, TotalSize: 228915}, - }, - { - Name: "MinIO Tier", - Type: "internal", - Stats: madmin.TierStats{NumObjects: 10, NumVersions: 3, TotalSize: 132788}, - }, - { - Name: "S3 Tier", - Type: "s3", - Stats: madmin.TierStats{NumObjects: 0, NumVersions: 0, TotalSize: 0}, - }, - } - - expectedOutput := &models.TierListResponse{ - Items: []*models.Tier{ - { - Type: models.TierTypeS3, - S3: &models.TierS3{ - Accesskey: "Access Key", - Secretkey: "Secret Key", - Bucket: "buckets3", - Endpoint: "https://s3tier.test.com/", - Name: "S3 Tier", - Prefix: "pref1", - Region: "us-west-1", - Storageclass: "TT1", - Usage: "0 B", - Objects: "0", - Versions: "0", - }, - Status: false, - }, - { - Type: models.TierTypeMinio, - Minio: &models.TierMinio{ - Accesskey: "access", - Secretkey: "secret", - Bucket: "somebucket", - Endpoint: "https://minio-endpoint.test.com/", - Name: "MinIO Tier", - Prefix: "p1", - Region: "us-east-2", - Usage: "130 KiB", - Objects: "10", - Versions: "3", - }, - Status: false, - }, - }, - } - - minioListTiersMock = func(_ context.Context) ([]*madmin.TierConfig, error) { - return returnListMock, nil - } - - minioTierStatsMock = func(_ context.Context) ([]madmin.TierInfo, error) { - return returnStatsMock, nil - } - - minioVerifyTierStatusMock = func(_ context.Context, _ string) error { - return fmt.Errorf("someerror") - } - - tiersList, err := getTiers(ctx, adminClient) - if err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - // verify length of tiers list is correct - assert.Equal(len(tiersList.Items), len(returnListMock), fmt.Sprintf("Failed on %s: length of lists is not the same", function)) - assert.Equal(expectedOutput, tiersList) - - // Test-2 : getTiers() list is empty - returnListMockT2 := []*madmin.TierConfig{} - minioListTiersMock = func(_ context.Context) ([]*madmin.TierConfig, error) { - return returnListMockT2, nil - } - - tiersListT2, err := getTiers(ctx, adminClient) - if err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - - if len(tiersListT2.Items) != 0 { - t.Errorf("Failed on %s:, returned list was not empty", function) - } -} - -func TestGetTiersName(t *testing.T) { - assert := assert.New(t) - // mock minIO client - adminClient := AdminClientMock{} - - function := "getTiersName()" - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - // Test-1 : getTiersName() get list tiers' names - // mock lifecycle response from MinIO - returnListMock := []*madmin.TierConfig{ - { - Version: "V1", - Type: madmin.S3, - Name: "S3 Tier", - S3: &madmin.TierS3{ - Endpoint: "https://s3tier.test.com/", - AccessKey: "Access Key", - SecretKey: "Secret Key", - Bucket: "buckets3", - Prefix: "pref1", - Region: "us-west-1", - StorageClass: "TT1", - }, - }, - { - Version: "V1", - Type: madmin.MinIO, - Name: "MinIO Tier", - MinIO: &madmin.TierMinIO{ - Endpoint: "https://minio-endpoint.test.com/", - AccessKey: "access", - SecretKey: "secret", - Bucket: "somebucket", - Prefix: "p1", - Region: "us-east-2", - }, - }, - } - - expectedOutput := &models.TiersNameListResponse{ - Items: []string{"S3 Tier", "MinIO Tier"}, - } - - minioListTiersMock = func(_ context.Context) ([]*madmin.TierConfig, error) { - return returnListMock, nil - } - - tiersList, err := getTiersName(ctx, adminClient) - if err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - // verify length of tiers list is correct - assert.Equal(len(tiersList.Items), len(returnListMock), fmt.Sprintf("Failed on %s: length of lists is not the same", function)) - assert.Equal(expectedOutput, tiersList) - - // Test-2 : getTiersName() list is empty - returnListMockT2 := []*madmin.TierConfig{} - minioListTiersMock = func(_ context.Context) ([]*madmin.TierConfig, error) { - return returnListMockT2, nil - } - - emptyTierList, err := getTiersName(ctx, adminClient) - if err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - - if len(emptyTierList.Items) != 0 { - t.Errorf("Failed on %s:, returned list was not empty", function) - } -} - -func TestAddTier(t *testing.T) { - assert := assert.New(t) - // mock minIO client - adminClient := AdminClientMock{} - - function := "addTier()" - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - // Test-1: addTier() add new Tier - minioAddTiersMock = func(_ context.Context, _ *madmin.TierConfig) error { - return nil - } - - paramsToAdd := tieringApi.AddTierParams{ - Body: &models.Tier{ - Type: "S3", - S3: &models.TierS3{ - Accesskey: "TestAK", - Bucket: "bucket1", - Endpoint: "https://test.com/", - Name: "TIERS3", - Prefix: "Pr1", - Region: "us-west-1", - Secretkey: "SecretK", - Storageclass: "STCLASS", - }, - }, - } - - err := addTier(ctx, adminClient, ¶msToAdd) - assert.Equal(nil, err, fmt.Sprintf("Failed on %s: Error returned", function)) - - // Test-2: addTier() error adding Tier - minioAddTiersMock = func(_ context.Context, _ *madmin.TierConfig) error { - return errors.New("error setting new tier") - } - - err2 := addTier(ctx, adminClient, ¶msToAdd) - - assert.Equal(errors.New("error setting new tier"), err2, fmt.Sprintf("Failed on %s: Error returned", function)) -} - -func TestUpdateTierCreds(t *testing.T) { - assert := assert.New(t) - // mock minIO client - adminClient := AdminClientMock{} - - function := "editTierCredentials()" - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - // Test-1: editTierCredentials() update Tier configuration - minioEditTiersMock = func(_ context.Context, _ string, _ madmin.TierCreds) error { - return nil - } - - params := &tieringApi.EditTierCredentialsParams{ - Name: "TESTTIER", - Body: &models.TierCredentialsRequest{ - AccessKey: "New Key", - SecretKey: "Secret Key", - }, - } - - err := editTierCredentials(ctx, adminClient, params) - - assert.Equal(nil, err, fmt.Sprintf("Failed on %s: Error returned", function)) - - // Test-2: editTierCredentials() update Tier configuration failure - minioEditTiersMock = func(_ context.Context, _ string, _ madmin.TierCreds) error { - return errors.New("error message") - } - - errT2 := editTierCredentials(ctx, adminClient, params) - - assert.Equal(errors.New("error message"), errT2, fmt.Sprintf("Failed on %s: Error returned", function)) -} diff --git a/api/configure_console.go b/api/configure_console.go index 1566bf3d89..4e5eb9aa66 100644 --- a/api/configure_console.go +++ b/api/configure_console.go @@ -125,8 +125,6 @@ func configureAPI(api *operations.ConsoleAPI) http.Handler { registerConfigHandlers(api) // Register bucket events handlers registerBucketEventsHandlers(api) - // Register bucket lifecycle handlers - registerBucketsLifecycleHandlers(api) // Register service handlers registerServiceHandlers(api) // Register session handlers @@ -147,8 +145,6 @@ func configureAPI(api *operations.ConsoleAPI) http.Handler { registerKMSHandlers(api) // Register admin IDP handlers registerIDPHandlers(api) - // Register Account handlers - registerAdminTiersHandlers(api) // Register Inspect Handler registerInspectHandler(api) // Register nodes handlers diff --git a/api/embedded_spec.go b/api/embedded_spec.go index 4686766346..cfb4ec9cbb 100644 --- a/api/embedded_spec.go +++ b/api/embedded_spec.go @@ -313,199 +313,6 @@ func init() { } } }, - "/admin/tiers": { - "get": { - "tags": [ - "Tiering" - ], - "summary": "Returns a list of tiers for ilm", - "operationId": "TiersList", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/tierListResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - }, - "post": { - "tags": [ - "Tiering" - ], - "summary": "Allows to configure a new tier", - "operationId": "AddTier", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/tier" - } - } - ], - "responses": { - "201": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/admin/tiers/names": { - "get": { - "tags": [ - "Tiering" - ], - "summary": "Returns a list of tiers' names for ilm", - "operationId": "TiersListNames", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/tiersNameListResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/admin/tiers/{name}/remove": { - "delete": { - "tags": [ - "Tiering" - ], - "summary": "Remove Tier", - "operationId": "RemoveTier", - "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "204": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/admin/tiers/{type}/{name}": { - "get": { - "tags": [ - "Tiering" - ], - "summary": "Get Tier", - "operationId": "GetTier", - "parameters": [ - { - "enum": [ - "s3", - "gcs", - "azure", - "minio" - ], - "type": "string", - "name": "type", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/tier" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/admin/tiers/{type}/{name}/credentials": { - "put": { - "tags": [ - "Tiering" - ], - "summary": "Edit Tier Credentials", - "operationId": "EditTierCredentials", - "parameters": [ - { - "enum": [ - "s3", - "gcs", - "azure", - "minio" - ], - "type": "string", - "name": "type", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "name", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/tierCredentialsRequest" - } - } - ], - "responses": { - "200": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, "/bucket-policy/{bucket}": { "get": { "tags": [ @@ -804,39 +611,6 @@ func init() { } } }, - "/buckets/multi-lifecycle": { - "post": { - "tags": [ - "Bucket" - ], - "summary": "Add Multi Bucket Lifecycle", - "operationId": "AddMultiBucketLifecycle", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/addMultiBucketLifecycle" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/multiLifecycleResult" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, "/buckets/{bucket_name}/delete-all-replication-rules": { "delete": { "tags": [ @@ -1158,13 +932,13 @@ func init() { } } }, - "/buckets/{bucket_name}/lifecycle": { + "/buckets/{bucket_name}/object-locking": { "get": { "tags": [ "Bucket" ], - "summary": "Bucket Lifecycle", - "operationId": "GetBucketLifecycle", + "summary": "Returns the status of object locking support on the bucket", + "operationId": "GetBucketObjectLockingStatus", "parameters": [ { "type": "string", @@ -1177,7 +951,7 @@ func init() { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/bucketLifecycleResponse" + "$ref": "#/definitions/bucketObLockingResponse" } }, "default": { @@ -1187,13 +961,23 @@ func init() { } } } - }, - "post": { + } + }, + "/buckets/{bucket_name}/objects": { + "get": { + "security": [ + { + "key": [] + }, + { + "anonymous": [] + } + ], "tags": [ - "Bucket" + "Object" ], - "summary": "Add Bucket Lifecycle", - "operationId": "AddBucketLifecycle", + "summary": "List Objects", + "operationId": "ListObjects", "parameters": [ { "type": "string", @@ -1202,17 +986,35 @@ func init() { "required": true }, { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/addBucketLifecycle" - } + "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/limit" } ], "responses": { - "201": { - "description": "A successful response." + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/listObjectsResponse" + } }, "default": { "description": "Generic error response.", @@ -1221,15 +1023,13 @@ func init() { } } } - } - }, - "/buckets/{bucket_name}/lifecycle/{lifecycle_id}": { - "put": { + }, + "delete": { "tags": [ - "Bucket" + "Object" ], - "summary": "Update Lifecycle rule", - "operationId": "UpdateBucketLifecycle", + "summary": "Delete Object", + "operationId": "DeleteObject", "parameters": [ { "type": "string", @@ -1239,173 +1039,8 @@ func init() { }, { "type": "string", - "name": "lifecycle_id", - "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/updateBucketLifecycle" - } - } - ], - "responses": { - "200": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - }, - "delete": { - "tags": [ - "Bucket" - ], - "summary": "Delete Lifecycle rule", - "operationId": "DeleteBucketLifecycleRule", - "parameters": [ - { - "type": "string", - "name": "bucket_name", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "lifecycle_id", - "in": "path", - "required": true - } - ], - "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" - }, - { - "$ref": "#/parameters/limit" - } - ], - "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", + "name": "prefix", + "in": "query", "required": true }, { @@ -4619,77 +4254,6 @@ func init() { } } }, - "addBucketLifecycle": { - "type": "object", - "properties": { - "disable": { - "description": "Non required, toggle to disable or enable rule", - "type": "boolean" - }, - "expired_object_delete_all": { - "description": "Non required, toggle to disable or enable rule", - "type": "boolean" - }, - "expired_object_delete_marker": { - "description": "Non required, toggle to disable or enable rule", - "type": "boolean" - }, - "expiry_days": { - "description": "Required in case of expiry_date or transition fields are not set. it defines an expiry days for ILM", - "type": "integer", - "format": "int32", - "default": 0 - }, - "newer_noncurrentversion_expiration_versions": { - "description": "Non required, can be set in case of expiration is enabled", - "type": "integer", - "format": "int32", - "default": 0 - }, - "noncurrentversion_expiration_days": { - "description": "Non required, can be set in case of expiration is enabled", - "type": "integer", - "format": "int32", - "default": 0 - }, - "noncurrentversion_transition_days": { - "description": "Non required, can be set in case of transition is enabled", - "type": "integer", - "format": "int32", - "default": 0 - }, - "noncurrentversion_transition_storage_class": { - "description": "Non required, can be set in case of transition is enabled", - "type": "string" - }, - "prefix": { - "description": "Non required field, it matches a prefix to perform ILM operations on it", - "type": "string" - }, - "storage_class": { - "description": "Required only in case of transition is set. it refers to a tier", - "type": "string" - }, - "tags": { - "description": "Non required field, tags to match ILM files", - "type": "string" - }, - "transition_days": { - "description": "Required in case of transition_date or expiry fields are not set. it defines a transition days for ILM", - "type": "integer", - "format": "int32", - "default": 0 - }, - "type": { - "description": "ILM Rule type (Expiry or transition)", - "type": "string", - "enum": [ - "expiry", - "transition" - ] - } - } - }, "addBucketReplication": { "type": "object", "properties": { @@ -4719,77 +4283,6 @@ func init() { } } }, - "addMultiBucketLifecycle": { - "type": "object", - "required": [ - "buckets", - "type" - ], - "properties": { - "buckets": { - "type": "array", - "items": { - "type": "string" - } - }, - "expired_object_delete_all": { - "description": "Non required, toggle to disable or enable rule", - "type": "boolean" - }, - "expired_object_delete_marker": { - "description": "Non required, toggle to disable or enable rule", - "type": "boolean" - }, - "expiry_days": { - "description": "Required in case of expiry_date or transition fields are not set. it defines an expiry days for ILM", - "type": "integer", - "format": "int32", - "default": 0 - }, - "noncurrentversion_expiration_days": { - "description": "Non required, can be set in case of expiration is enabled", - "type": "integer", - "format": "int32", - "default": 0 - }, - "noncurrentversion_transition_days": { - "description": "Non required, can be set in case of transition is enabled", - "type": "integer", - "format": "int32", - "default": 0 - }, - "noncurrentversion_transition_storage_class": { - "description": "Non required, can be set in case of transition is enabled", - "type": "string" - }, - "prefix": { - "description": "Non required field, it matches a prefix to perform ILM operations on it", - "type": "string" - }, - "storage_class": { - "description": "Required only in case of transition is set. it refers to a tier", - "type": "string" - }, - "tags": { - "description": "Non required field, tags to match ILM files", - "type": "string" - }, - "transition_days": { - "description": "Required in case of transition_date or expiry fields are not set. it defines a transition days for ILM", - "type": "integer", - "format": "int32", - "default": 0 - }, - "type": { - "description": "ILM Rule type (Expiry or transition)", - "type": "string", - "enum": [ - "expiry", - "transition" - ] - } - } - }, "addPolicyRequest": { "type": "object", "required": [ @@ -5021,22 +4514,11 @@ func init() { } } }, - "bucketLifecycleResponse": { + "bucketObLockingResponse": { "type": "object", "properties": { - "lifecycle": { - "type": "array", - "items": { - "$ref": "#/definitions/objectBucketLifecycle" - } - } - } - }, - "bucketObLockingResponse": { - "type": "object", - "properties": { - "object_locking_enabled": { - "type": "boolean" + "object_locking_enabled": { + "type": "boolean" } } }, @@ -5431,32 +4913,6 @@ func init() { } } }, - "expirationResponse": { - "type": "object", - "properties": { - "date": { - "type": "string" - }, - "days": { - "type": "integer", - "format": "int64" - }, - "delete_all": { - "type": "boolean" - }, - "delete_marker": { - "type": "boolean" - }, - "newer_noncurrent_expiration_versions": { - "type": "integer", - "format": "int64" - }, - "noncurrent_expiration_days": { - "type": "integer", - "format": "int64" - } - } - }, "getBucketRetentionConfig": { "type": "object", "properties": { @@ -5896,17 +5352,6 @@ func init() { } } }, - "lifecycleTag": { - "type": "object", - "properties": { - "key": { - "type": "string" - }, - "value": { - "type": "string" - } - } - }, "listAccessRulesResponse": { "type": "object", "properties": { @@ -6371,27 +5816,6 @@ func init() { } } }, - "multiLifecycleResult": { - "properties": { - "results": { - "type": "array", - "items": { - "$ref": "#/definitions/multicycleResultItem" - } - } - } - }, - "multicycleResultItem": { - "type": "object", - "properties": { - "bucketName": { - "type": "string" - }, - "error": { - "type": "string" - } - } - }, "nofiticationService": { "type": "string", "enum": [ @@ -6520,32 +5944,6 @@ func init() { "scanner" ] }, - "objectBucketLifecycle": { - "type": "object", - "properties": { - "expiration": { - "$ref": "#/definitions/expirationResponse" - }, - "id": { - "type": "string" - }, - "prefix": { - "type": "string" - }, - "status": { - "type": "string" - }, - "tags": { - "type": "array", - "items": { - "$ref": "#/definitions/lifecycleTag" - } - }, - "transition": { - "$ref": "#/definitions/transitionResponse" - } - } - }, "objectLegalHoldStatus": { "type": "string", "enum": [ @@ -7603,439 +7001,135 @@ func init() { } } }, - "tier": { + "updateGroupRequest": { "type": "object", + "required": [ + "members", + "status" + ], "properties": { - "azure": { - "type": "object", - "$ref": "#/definitions/tier_azure" - }, - "gcs": { - "type": "object", - "$ref": "#/definitions/tier_gcs" - }, - "minio": { - "type": "object", - "$ref": "#/definitions/tier_minio" - }, - "s3": { - "type": "object", - "$ref": "#/definitions/tier_s3" + "members": { + "type": "array", + "items": { + "type": "string" + } }, "status": { - "type": "boolean" - }, - "type": { - "type": "string", - "enum": [ - "s3", - "gcs", - "azure", - "minio", - "unsupported" - ] + "type": "string" } } }, - "tierCredentialsRequest": { + "updateServiceAccountRequest": { "type": "object", + "required": [ + "policy" + ], "properties": { - "access_key": { + "description": { + "type": "string" + }, + "expiry": { + "type": "string" + }, + "name": { + "type": "string" + }, + "policy": { "type": "string" }, - "creds": { - "description": "a base64 encoded value", + "secretKey": { "type": "string" }, - "secret_key": { + "status": { "type": "string" } } }, - "tierListResponse": { + "updateUser": { "type": "object", + "required": [ + "status", + "groups" + ], "properties": { - "items": { + "groups": { "type": "array", "items": { - "$ref": "#/definitions/tier" + "type": "string" } + }, + "status": { + "type": "string" } } }, - "tier_azure": { + "updateUserGroups": { "type": "object", + "required": [ + "groups" + ], "properties": { - "accountkey": { - "type": "string" - }, - "accountname": { - "type": "string" - }, - "bucket": { - "type": "string" - }, - "endpoint": { - "type": "string" - }, - "name": { - "type": "string" - }, - "objects": { - "type": "string" - }, - "prefix": { - "type": "string" - }, - "region": { - "type": "string" - }, - "usage": { - "type": "string" - }, - "versions": { - "type": "string" + "groups": { + "type": "array", + "items": { + "type": "string" + } } } }, - "tier_gcs": { + "user": { "type": "object", "properties": { - "bucket": { - "type": "string" - }, - "creds": { - "type": "string" - }, - "endpoint": { - "type": "string" - }, - "name": { - "type": "string" - }, - "objects": { + "accessKey": { "type": "string" }, - "prefix": { - "type": "string" + "hasPolicy": { + "type": "boolean" }, - "region": { - "type": "string" + "memberOf": { + "type": "array", + "items": { + "type": "string" + } }, - "usage": { - "type": "string" + "policy": { + "type": "array", + "items": { + "type": "string" + } }, - "versions": { + "status": { "type": "string" } } }, - "tier_minio": { + "userSAs": { "type": "object", "properties": { - "accesskey": { - "type": "string" - }, - "bucket": { - "type": "string" - }, - "endpoint": { - "type": "string" - }, - "name": { - "type": "string" - }, - "objects": { - "type": "string" - }, - "prefix": { - "type": "string" - }, - "region": { - "type": "string" - }, - "secretkey": { - "type": "string" - }, - "storageclass": { + "path": { "type": "string" }, - "usage": { - "type": "string" + "recursive": { + "type": "boolean" }, - "versions": { + "versionID": { "type": "string" } } }, - "tier_s3": { + "userServiceAccountItem": { "type": "object", "properties": { - "accesskey": { - "type": "string" - }, - "bucket": { - "type": "string" - }, - "endpoint": { - "type": "string" - }, - "name": { - "type": "string" - }, - "objects": { - "type": "string" - }, - "prefix": { - "type": "string" - }, - "region": { - "type": "string" - }, - "secretkey": { - "type": "string" - }, - "storageclass": { - "type": "string" - }, - "usage": { - "type": "string" + "numSAs": { + "type": "integer", + "format": "int64" }, - "versions": { + "userName": { "type": "string" } } }, - "tiersNameListResponse": { - "type": "object", - "properties": { - "items": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "transitionResponse": { - "type": "object", - "properties": { - "date": { - "type": "string" - }, - "days": { - "type": "integer", - "format": "int64" - }, - "noncurrent_storage_class": { - "type": "string" - }, - "noncurrent_transition_days": { - "type": "integer", - "format": "int64" - }, - "storage_class": { - "type": "string" - } - } - }, - "updateBucketLifecycle": { - "type": "object", - "required": [ - "type" - ], - "properties": { - "disable": { - "description": "Non required, toggle to disable or enable rule", - "type": "boolean" - }, - "expired_object_delete_all": { - "description": "Non required, toggle to disable or enable rule", - "type": "boolean" - }, - "expired_object_delete_marker": { - "description": "Non required, toggle to disable or enable rule", - "type": "boolean" - }, - "expiry_days": { - "description": "Required in case of expiry_date or transition fields are not set. it defines an expiry days for ILM", - "type": "integer", - "format": "int32", - "default": 0 - }, - "noncurrentversion_expiration_days": { - "description": "Non required, can be set in case of expiration is enabled", - "type": "integer", - "format": "int32", - "default": 0 - }, - "noncurrentversion_transition_days": { - "description": "Non required, can be set in case of transition is enabled", - "type": "integer", - "format": "int32", - "default": 0 - }, - "noncurrentversion_transition_storage_class": { - "description": "Non required, can be set in case of transition is enabled", - "type": "string" - }, - "prefix": { - "description": "Non required field, it matches a prefix to perform ILM operations on it", - "type": "string" - }, - "storage_class": { - "description": "Required only in case of transition is set. it refers to a tier", - "type": "string" - }, - "tags": { - "description": "Non required field, tags to match ILM files", - "type": "string" - }, - "transition_days": { - "description": "Required in case of transition_date or expiry fields are not set. it defines a transition days for ILM", - "type": "integer", - "format": "int32", - "default": 0 - }, - "type": { - "description": "ILM Rule type (Expiry or transition)", - "type": "string", - "enum": [ - "expiry", - "transition" - ] - } - } - }, - "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": { + "userServiceAccountSummary": { "type": "object", "properties": { "hasSA": { @@ -8355,197 +7449,41 @@ func init() { } } }, - "/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" - } - } - } - } - }, - "/admin/tiers": { - "get": { - "tags": [ - "Tiering" - ], - "summary": "Returns a list of tiers for ilm", - "operationId": "TiersList", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/tierListResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - }, - "post": { - "tags": [ - "Tiering" - ], - "summary": "Allows to configure a new tier", - "operationId": "AddTier", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/tier" - } - } - ], - "responses": { - "201": { - "description": "A successful response." - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/admin/tiers/names": { - "get": { - "tags": [ - "Tiering" - ], - "summary": "Returns a list of tiers' names for ilm", - "operationId": "TiersListNames", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/tiersNameListResponse" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, - "/admin/tiers/{name}/remove": { - "delete": { + "/admin/inspect": { + "get": { + "produces": [ + "application/octet-stream" + ], "tags": [ - "Tiering" + "Inspect" ], - "summary": "Remove Tier", - "operationId": "RemoveTier", + "summary": "Inspect Files on Drive", + "operationId": "Inspect", "parameters": [ { "type": "string", - "name": "name", - "in": "path", + "name": "file", + "in": "query", + "required": true + }, + { + "type": "string", + "name": "volume", + "in": "query", "required": true + }, + { + "type": "boolean", + "name": "encrypt", + "in": "query" } ], "responses": { - "204": { - "description": "A successful response." + "200": { + "description": "A successful response.", + "schema": { + "type": "file" + } }, "default": { "description": "Generic error response.", @@ -8556,38 +7494,18 @@ func init() { } } }, - "/admin/tiers/{type}/{name}": { + "/admin/notification_endpoints": { "get": { "tags": [ - "Tiering" - ], - "summary": "Get Tier", - "operationId": "GetTier", - "parameters": [ - { - "enum": [ - "s3", - "gcs", - "azure", - "minio" - ], - "type": "string", - "name": "type", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "name", - "in": "path", - "required": true - } + "Configuration" ], + "summary": "Returns a list of active notification endpoints", + "operationId": "NotificationEndpointList", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/tier" + "$ref": "#/definitions/notifEndpointResponse" } }, "default": { @@ -8597,46 +7515,29 @@ func init() { } } } - } - }, - "/admin/tiers/{type}/{name}/credentials": { - "put": { + }, + "post": { "tags": [ - "Tiering" + "Configuration" ], - "summary": "Edit Tier Credentials", - "operationId": "EditTierCredentials", + "summary": "Allows to configure a new notification endpoint", + "operationId": "AddNotificationEndpoint", "parameters": [ - { - "enum": [ - "s3", - "gcs", - "azure", - "minio" - ], - "type": "string", - "name": "type", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "name", - "in": "path", - "required": true - }, { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/tierCredentialsRequest" + "$ref": "#/definitions/notificationEndpoint" } } ], "responses": { - "200": { - "description": "A successful response." + "201": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/setNotificationEndpointResponse" + } }, "default": { "description": "Generic error response.", @@ -8969,39 +7870,6 @@ func init() { } } }, - "/buckets/multi-lifecycle": { - "post": { - "tags": [ - "Bucket" - ], - "summary": "Add Multi Bucket Lifecycle", - "operationId": "AddMultiBucketLifecycle", - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/addMultiBucketLifecycle" - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/multiLifecycleResult" - } - }, - "default": { - "description": "Generic error response.", - "schema": { - "$ref": "#/definitions/ApiError" - } - } - } - } - }, "/buckets/{bucket_name}/delete-all-replication-rules": { "delete": { "tags": [ @@ -9098,153 +7966,13 @@ func init() { "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" + "$ref": "#/definitions/bucketReplicationRuleList" } + } + ], + "responses": { + "204": { + "description": "A successful response." }, "default": { "description": "Generic error response.", @@ -9253,31 +7981,25 @@ func init() { } } } - }, + } + }, + "/buckets/{bucket_name}/encryption/disable": { "post": { "tags": [ "Bucket" ], - "summary": "Create Bucket Event", - "operationId": "CreateBucketEvent", + "summary": "Disable bucket encryption.", + "operationId": "DisableBucketEncryption", "parameters": [ { "type": "string", "name": "bucket_name", "in": "path", "required": true - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/bucketEventRequest" - } } ], "responses": { - "201": { + "200": { "description": "A successful response." }, "default": { @@ -9289,13 +8011,13 @@ func init() { } } }, - "/buckets/{bucket_name}/events/{arn}": { - "delete": { + "/buckets/{bucket_name}/encryption/enable": { + "post": { "tags": [ "Bucket" ], - "summary": "Delete Bucket Event", - "operationId": "DeleteBucketEvent", + "summary": "Enable bucket encryption.", + "operationId": "EnableBucketEncryption", "parameters": [ { "type": "string", @@ -9303,23 +8025,17 @@ func init() { "in": "path", "required": true }, - { - "type": "string", - "name": "arn", - "in": "path", - "required": true - }, { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/notificationDeleteRequest" + "$ref": "#/definitions/bucketEncryptionRequest" } } ], "responses": { - "204": { + "200": { "description": "A successful response." }, "default": { @@ -9331,13 +8047,13 @@ func init() { } } }, - "/buckets/{bucket_name}/lifecycle": { + "/buckets/{bucket_name}/encryption/info": { "get": { "tags": [ "Bucket" ], - "summary": "Bucket Lifecycle", - "operationId": "GetBucketLifecycle", + "summary": "Get bucket encryption information.", + "operationId": "GetBucketEncryptionInfo", "parameters": [ { "type": "string", @@ -9350,7 +8066,7 @@ func init() { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/bucketLifecycleResponse" + "$ref": "#/definitions/bucketEncryptionInfo" } }, "default": { @@ -9360,13 +8076,15 @@ func init() { } } } - }, - "post": { + } + }, + "/buckets/{bucket_name}/events": { + "get": { "tags": [ "Bucket" ], - "summary": "Add Bucket Lifecycle", - "operationId": "AddBucketLifecycle", + "summary": "List Bucket Events", + "operationId": "ListBucketEvents", "parameters": [ { "type": "string", @@ -9375,17 +8093,26 @@ func init() { "required": true }, { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/addBucketLifecycle" - } + "type": "number", + "format": "int32", + "default": 0, + "name": "offset", + "in": "query" + }, + { + "type": "number", + "format": "int32", + "default": 20, + "name": "limit", + "in": "query" } ], "responses": { - "201": { - "description": "A successful response." + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/listBucketEventsResponse" + } }, "default": { "description": "Generic error response.", @@ -9394,15 +8121,13 @@ func init() { } } } - } - }, - "/buckets/{bucket_name}/lifecycle/{lifecycle_id}": { - "put": { + }, + "post": { "tags": [ "Bucket" ], - "summary": "Update Lifecycle rule", - "operationId": "UpdateBucketLifecycle", + "summary": "Create Bucket Event", + "operationId": "CreateBucketEvent", "parameters": [ { "type": "string", @@ -9410,23 +8135,17 @@ func init() { "in": "path", "required": true }, - { - "type": "string", - "name": "lifecycle_id", - "in": "path", - "required": true - }, { "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/updateBucketLifecycle" + "$ref": "#/definitions/bucketEventRequest" } } ], "responses": { - "200": { + "201": { "description": "A successful response." }, "default": { @@ -9436,13 +8155,15 @@ func init() { } } } - }, + } + }, + "/buckets/{bucket_name}/events/{arn}": { "delete": { "tags": [ "Bucket" ], - "summary": "Delete Lifecycle rule", - "operationId": "DeleteBucketLifecycleRule", + "summary": "Delete Bucket Event", + "operationId": "DeleteBucketEvent", "parameters": [ { "type": "string", @@ -9452,9 +8173,17 @@ func init() { }, { "type": "string", - "name": "lifecycle_id", + "name": "arn", "in": "path", "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/notificationDeleteRequest" + } } ], "responses": { @@ -12990,77 +11719,6 @@ func init() { } } }, - "addBucketLifecycle": { - "type": "object", - "properties": { - "disable": { - "description": "Non required, toggle to disable or enable rule", - "type": "boolean" - }, - "expired_object_delete_all": { - "description": "Non required, toggle to disable or enable rule", - "type": "boolean" - }, - "expired_object_delete_marker": { - "description": "Non required, toggle to disable or enable rule", - "type": "boolean" - }, - "expiry_days": { - "description": "Required in case of expiry_date or transition fields are not set. it defines an expiry days for ILM", - "type": "integer", - "format": "int32", - "default": 0 - }, - "newer_noncurrentversion_expiration_versions": { - "description": "Non required, can be set in case of expiration is enabled", - "type": "integer", - "format": "int32", - "default": 0 - }, - "noncurrentversion_expiration_days": { - "description": "Non required, can be set in case of expiration is enabled", - "type": "integer", - "format": "int32", - "default": 0 - }, - "noncurrentversion_transition_days": { - "description": "Non required, can be set in case of transition is enabled", - "type": "integer", - "format": "int32", - "default": 0 - }, - "noncurrentversion_transition_storage_class": { - "description": "Non required, can be set in case of transition is enabled", - "type": "string" - }, - "prefix": { - "description": "Non required field, it matches a prefix to perform ILM operations on it", - "type": "string" - }, - "storage_class": { - "description": "Required only in case of transition is set. it refers to a tier", - "type": "string" - }, - "tags": { - "description": "Non required field, tags to match ILM files", - "type": "string" - }, - "transition_days": { - "description": "Required in case of transition_date or expiry fields are not set. it defines a transition days for ILM", - "type": "integer", - "format": "int32", - "default": 0 - }, - "type": { - "description": "ILM Rule type (Expiry or transition)", - "type": "string", - "enum": [ - "expiry", - "transition" - ] - } - } - }, "addBucketReplication": { "type": "object", "properties": { @@ -13090,77 +11748,6 @@ func init() { } } }, - "addMultiBucketLifecycle": { - "type": "object", - "required": [ - "buckets", - "type" - ], - "properties": { - "buckets": { - "type": "array", - "items": { - "type": "string" - } - }, - "expired_object_delete_all": { - "description": "Non required, toggle to disable or enable rule", - "type": "boolean" - }, - "expired_object_delete_marker": { - "description": "Non required, toggle to disable or enable rule", - "type": "boolean" - }, - "expiry_days": { - "description": "Required in case of expiry_date or transition fields are not set. it defines an expiry days for ILM", - "type": "integer", - "format": "int32", - "default": 0 - }, - "noncurrentversion_expiration_days": { - "description": "Non required, can be set in case of expiration is enabled", - "type": "integer", - "format": "int32", - "default": 0 - }, - "noncurrentversion_transition_days": { - "description": "Non required, can be set in case of transition is enabled", - "type": "integer", - "format": "int32", - "default": 0 - }, - "noncurrentversion_transition_storage_class": { - "description": "Non required, can be set in case of transition is enabled", - "type": "string" - }, - "prefix": { - "description": "Non required field, it matches a prefix to perform ILM operations on it", - "type": "string" - }, - "storage_class": { - "description": "Required only in case of transition is set. it refers to a tier", - "type": "string" - }, - "tags": { - "description": "Non required field, tags to match ILM files", - "type": "string" - }, - "transition_days": { - "description": "Required in case of transition_date or expiry fields are not set. it defines a transition days for ILM", - "type": "integer", - "format": "int32", - "default": 0 - }, - "type": { - "description": "ILM Rule type (Expiry or transition)", - "type": "string", - "enum": [ - "expiry", - "transition" - ] - } - } - }, "addPolicyRequest": { "type": "object", "required": [ @@ -13392,17 +11979,6 @@ func init() { } } }, - "bucketLifecycleResponse": { - "type": "object", - "properties": { - "lifecycle": { - "type": "array", - "items": { - "$ref": "#/definitions/objectBucketLifecycle" - } - } - } - }, "bucketObLockingResponse": { "type": "object", "properties": { @@ -13797,32 +12373,6 @@ func init() { } } }, - "expirationResponse": { - "type": "object", - "properties": { - "date": { - "type": "string" - }, - "days": { - "type": "integer", - "format": "int64" - }, - "delete_all": { - "type": "boolean" - }, - "delete_marker": { - "type": "boolean" - }, - "newer_noncurrent_expiration_versions": { - "type": "integer", - "format": "int64" - }, - "noncurrent_expiration_days": { - "type": "integer", - "format": "int64" - } - } - }, "getBucketRetentionConfig": { "type": "object", "properties": { @@ -14262,17 +12812,6 @@ func init() { } } }, - "lifecycleTag": { - "type": "object", - "properties": { - "key": { - "type": "string" - }, - "value": { - "type": "string" - } - } - }, "listAccessRulesResponse": { "type": "object", "properties": { @@ -14732,28 +13271,7 @@ func init() { "destinationBucket": { "type": "string" }, - "originBucket": { - "type": "string" - } - } - }, - "multiLifecycleResult": { - "properties": { - "results": { - "type": "array", - "items": { - "$ref": "#/definitions/multicycleResultItem" - } - } - } - }, - "multicycleResultItem": { - "type": "object", - "properties": { - "bucketName": { - "type": "string" - }, - "error": { + "originBucket": { "type": "string" } } @@ -14886,32 +13404,6 @@ func init() { "scanner" ] }, - "objectBucketLifecycle": { - "type": "object", - "properties": { - "expiration": { - "$ref": "#/definitions/expirationResponse" - }, - "id": { - "type": "string" - }, - "prefix": { - "type": "string" - }, - "status": { - "type": "string" - }, - "tags": { - "type": "array", - "items": { - "$ref": "#/definitions/lifecycleTag" - } - }, - "transition": { - "$ref": "#/definitions/transitionResponse" - } - } - }, "objectLegalHoldStatus": { "type": "string", "enum": [ @@ -15952,310 +14444,6 @@ func init() { } } }, - "tier": { - "type": "object", - "properties": { - "azure": { - "type": "object", - "$ref": "#/definitions/tier_azure" - }, - "gcs": { - "type": "object", - "$ref": "#/definitions/tier_gcs" - }, - "minio": { - "type": "object", - "$ref": "#/definitions/tier_minio" - }, - "s3": { - "type": "object", - "$ref": "#/definitions/tier_s3" - }, - "status": { - "type": "boolean" - }, - "type": { - "type": "string", - "enum": [ - "s3", - "gcs", - "azure", - "minio", - "unsupported" - ] - } - } - }, - "tierCredentialsRequest": { - "type": "object", - "properties": { - "access_key": { - "type": "string" - }, - "creds": { - "description": "a base64 encoded value", - "type": "string" - }, - "secret_key": { - "type": "string" - } - } - }, - "tierListResponse": { - "type": "object", - "properties": { - "items": { - "type": "array", - "items": { - "$ref": "#/definitions/tier" - } - } - } - }, - "tier_azure": { - "type": "object", - "properties": { - "accountkey": { - "type": "string" - }, - "accountname": { - "type": "string" - }, - "bucket": { - "type": "string" - }, - "endpoint": { - "type": "string" - }, - "name": { - "type": "string" - }, - "objects": { - "type": "string" - }, - "prefix": { - "type": "string" - }, - "region": { - "type": "string" - }, - "usage": { - "type": "string" - }, - "versions": { - "type": "string" - } - } - }, - "tier_gcs": { - "type": "object", - "properties": { - "bucket": { - "type": "string" - }, - "creds": { - "type": "string" - }, - "endpoint": { - "type": "string" - }, - "name": { - "type": "string" - }, - "objects": { - "type": "string" - }, - "prefix": { - "type": "string" - }, - "region": { - "type": "string" - }, - "usage": { - "type": "string" - }, - "versions": { - "type": "string" - } - } - }, - "tier_minio": { - "type": "object", - "properties": { - "accesskey": { - "type": "string" - }, - "bucket": { - "type": "string" - }, - "endpoint": { - "type": "string" - }, - "name": { - "type": "string" - }, - "objects": { - "type": "string" - }, - "prefix": { - "type": "string" - }, - "region": { - "type": "string" - }, - "secretkey": { - "type": "string" - }, - "storageclass": { - "type": "string" - }, - "usage": { - "type": "string" - }, - "versions": { - "type": "string" - } - } - }, - "tier_s3": { - "type": "object", - "properties": { - "accesskey": { - "type": "string" - }, - "bucket": { - "type": "string" - }, - "endpoint": { - "type": "string" - }, - "name": { - "type": "string" - }, - "objects": { - "type": "string" - }, - "prefix": { - "type": "string" - }, - "region": { - "type": "string" - }, - "secretkey": { - "type": "string" - }, - "storageclass": { - "type": "string" - }, - "usage": { - "type": "string" - }, - "versions": { - "type": "string" - } - } - }, - "tiersNameListResponse": { - "type": "object", - "properties": { - "items": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "transitionResponse": { - "type": "object", - "properties": { - "date": { - "type": "string" - }, - "days": { - "type": "integer", - "format": "int64" - }, - "noncurrent_storage_class": { - "type": "string" - }, - "noncurrent_transition_days": { - "type": "integer", - "format": "int64" - }, - "storage_class": { - "type": "string" - } - } - }, - "updateBucketLifecycle": { - "type": "object", - "required": [ - "type" - ], - "properties": { - "disable": { - "description": "Non required, toggle to disable or enable rule", - "type": "boolean" - }, - "expired_object_delete_all": { - "description": "Non required, toggle to disable or enable rule", - "type": "boolean" - }, - "expired_object_delete_marker": { - "description": "Non required, toggle to disable or enable rule", - "type": "boolean" - }, - "expiry_days": { - "description": "Required in case of expiry_date or transition fields are not set. it defines an expiry days for ILM", - "type": "integer", - "format": "int32", - "default": 0 - }, - "noncurrentversion_expiration_days": { - "description": "Non required, can be set in case of expiration is enabled", - "type": "integer", - "format": "int32", - "default": 0 - }, - "noncurrentversion_transition_days": { - "description": "Non required, can be set in case of transition is enabled", - "type": "integer", - "format": "int32", - "default": 0 - }, - "noncurrentversion_transition_storage_class": { - "description": "Non required, can be set in case of transition is enabled", - "type": "string" - }, - "prefix": { - "description": "Non required field, it matches a prefix to perform ILM operations on it", - "type": "string" - }, - "storage_class": { - "description": "Required only in case of transition is set. it refers to a tier", - "type": "string" - }, - "tags": { - "description": "Non required field, tags to match ILM files", - "type": "string" - }, - "transition_days": { - "description": "Required in case of transition_date or expiry fields are not set. it defines a transition days for ILM", - "type": "integer", - "format": "int32", - "default": 0 - }, - "type": { - "description": "ILM Rule type (Expiry or transition)", - "type": "string", - "enum": [ - "expiry", - "transition" - ] - } - } - }, "updateGroupRequest": { "type": "object", "required": [ diff --git a/api/operations/bucket/add_bucket_lifecycle.go b/api/operations/bucket/add_bucket_lifecycle.go deleted file mode 100644 index f6f89fec78..0000000000 --- a/api/operations/bucket/add_bucket_lifecycle.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" -) - -// AddBucketLifecycleHandlerFunc turns a function with the right signature into a add bucket lifecycle handler -type AddBucketLifecycleHandlerFunc func(AddBucketLifecycleParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn AddBucketLifecycleHandlerFunc) Handle(params AddBucketLifecycleParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// AddBucketLifecycleHandler interface for that can handle valid add bucket lifecycle params -type AddBucketLifecycleHandler interface { - Handle(AddBucketLifecycleParams, *models.Principal) middleware.Responder -} - -// NewAddBucketLifecycle creates a new http.Handler for the add bucket lifecycle operation -func NewAddBucketLifecycle(ctx *middleware.Context, handler AddBucketLifecycleHandler) *AddBucketLifecycle { - return &AddBucketLifecycle{Context: ctx, Handler: handler} -} - -/* - AddBucketLifecycle swagger:route POST /buckets/{bucket_name}/lifecycle Bucket addBucketLifecycle - -Add Bucket Lifecycle -*/ -type AddBucketLifecycle struct { - Context *middleware.Context - Handler AddBucketLifecycleHandler -} - -func (o *AddBucketLifecycle) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewAddBucketLifecycleParams() - 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_bucket_lifecycle_parameters.go b/api/operations/bucket/add_bucket_lifecycle_parameters.go deleted file mode 100644 index 8f56467e64..0000000000 --- a/api/operations/bucket/add_bucket_lifecycle_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" -) - -// NewAddBucketLifecycleParams creates a new AddBucketLifecycleParams object -// -// There are no default values defined in the spec. -func NewAddBucketLifecycleParams() AddBucketLifecycleParams { - - return AddBucketLifecycleParams{} -} - -// AddBucketLifecycleParams contains all the bound params for the add bucket lifecycle operation -// typically these are obtained from a http.Request -// -// swagger:parameters AddBucketLifecycle -type AddBucketLifecycleParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.AddBucketLifecycle - /* - 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 NewAddBucketLifecycleParams() beforehand. -func (o *AddBucketLifecycleParams) 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.AddBucketLifecycle - 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 *AddBucketLifecycleParams) 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/add_bucket_lifecycle_responses.go b/api/operations/bucket/add_bucket_lifecycle_responses.go deleted file mode 100644 index 764266c943..0000000000 --- a/api/operations/bucket/add_bucket_lifecycle_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" -) - -// AddBucketLifecycleCreatedCode is the HTTP code returned for type AddBucketLifecycleCreated -const AddBucketLifecycleCreatedCode int = 201 - -/* -AddBucketLifecycleCreated A successful response. - -swagger:response addBucketLifecycleCreated -*/ -type AddBucketLifecycleCreated struct { -} - -// NewAddBucketLifecycleCreated creates AddBucketLifecycleCreated with default headers values -func NewAddBucketLifecycleCreated() *AddBucketLifecycleCreated { - - return &AddBucketLifecycleCreated{} -} - -// WriteResponse to the client -func (o *AddBucketLifecycleCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(201) -} - -/* -AddBucketLifecycleDefault Generic error response. - -swagger:response addBucketLifecycleDefault -*/ -type AddBucketLifecycleDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewAddBucketLifecycleDefault creates AddBucketLifecycleDefault with default headers values -func NewAddBucketLifecycleDefault(code int) *AddBucketLifecycleDefault { - if code <= 0 { - code = 500 - } - - return &AddBucketLifecycleDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the add bucket lifecycle default response -func (o *AddBucketLifecycleDefault) WithStatusCode(code int) *AddBucketLifecycleDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the add bucket lifecycle default response -func (o *AddBucketLifecycleDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the add bucket lifecycle default response -func (o *AddBucketLifecycleDefault) WithPayload(payload *models.APIError) *AddBucketLifecycleDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the add bucket lifecycle default response -func (o *AddBucketLifecycleDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *AddBucketLifecycleDefault) 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_bucket_lifecycle_urlbuilder.go b/api/operations/bucket/add_bucket_lifecycle_urlbuilder.go deleted file mode 100644 index 3f1621e4cd..0000000000 --- a/api/operations/bucket/add_bucket_lifecycle_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" -) - -// AddBucketLifecycleURL generates an URL for the add bucket lifecycle operation -type AddBucketLifecycleURL 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 *AddBucketLifecycleURL) WithBasePath(bp string) *AddBucketLifecycleURL { - 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 *AddBucketLifecycleURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *AddBucketLifecycleURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/buckets/{bucket_name}/lifecycle" - - bucketName := o.BucketName - if bucketName != "" { - _path = strings.Replace(_path, "{bucket_name}", bucketName, -1) - } else { - return nil, errors.New("bucketName is required on AddBucketLifecycleURL") - } - - _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 *AddBucketLifecycleURL) 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 *AddBucketLifecycleURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *AddBucketLifecycleURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on AddBucketLifecycleURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on AddBucketLifecycleURL") - } - - 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 *AddBucketLifecycleURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/bucket/add_multi_bucket_lifecycle.go b/api/operations/bucket/add_multi_bucket_lifecycle.go deleted file mode 100644 index 24bfea3c89..0000000000 --- a/api/operations/bucket/add_multi_bucket_lifecycle.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" -) - -// AddMultiBucketLifecycleHandlerFunc turns a function with the right signature into a add multi bucket lifecycle handler -type AddMultiBucketLifecycleHandlerFunc func(AddMultiBucketLifecycleParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn AddMultiBucketLifecycleHandlerFunc) Handle(params AddMultiBucketLifecycleParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// AddMultiBucketLifecycleHandler interface for that can handle valid add multi bucket lifecycle params -type AddMultiBucketLifecycleHandler interface { - Handle(AddMultiBucketLifecycleParams, *models.Principal) middleware.Responder -} - -// NewAddMultiBucketLifecycle creates a new http.Handler for the add multi bucket lifecycle operation -func NewAddMultiBucketLifecycle(ctx *middleware.Context, handler AddMultiBucketLifecycleHandler) *AddMultiBucketLifecycle { - return &AddMultiBucketLifecycle{Context: ctx, Handler: handler} -} - -/* - AddMultiBucketLifecycle swagger:route POST /buckets/multi-lifecycle Bucket addMultiBucketLifecycle - -Add Multi Bucket Lifecycle -*/ -type AddMultiBucketLifecycle struct { - Context *middleware.Context - Handler AddMultiBucketLifecycleHandler -} - -func (o *AddMultiBucketLifecycle) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewAddMultiBucketLifecycleParams() - 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_multi_bucket_lifecycle_parameters.go b/api/operations/bucket/add_multi_bucket_lifecycle_parameters.go deleted file mode 100644 index 89e20108e6..0000000000 --- a/api/operations/bucket/add_multi_bucket_lifecycle_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" -) - -// NewAddMultiBucketLifecycleParams creates a new AddMultiBucketLifecycleParams object -// -// There are no default values defined in the spec. -func NewAddMultiBucketLifecycleParams() AddMultiBucketLifecycleParams { - - return AddMultiBucketLifecycleParams{} -} - -// AddMultiBucketLifecycleParams contains all the bound params for the add multi bucket lifecycle operation -// typically these are obtained from a http.Request -// -// swagger:parameters AddMultiBucketLifecycle -type AddMultiBucketLifecycleParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.AddMultiBucketLifecycle -} - -// 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 NewAddMultiBucketLifecycleParams() beforehand. -func (o *AddMultiBucketLifecycleParams) 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.AddMultiBucketLifecycle - 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_multi_bucket_lifecycle_responses.go b/api/operations/bucket/add_multi_bucket_lifecycle_responses.go deleted file mode 100644 index 9bde2518d6..0000000000 --- a/api/operations/bucket/add_multi_bucket_lifecycle_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" -) - -// AddMultiBucketLifecycleOKCode is the HTTP code returned for type AddMultiBucketLifecycleOK -const AddMultiBucketLifecycleOKCode int = 200 - -/* -AddMultiBucketLifecycleOK A successful response. - -swagger:response addMultiBucketLifecycleOK -*/ -type AddMultiBucketLifecycleOK struct { - - /* - In: Body - */ - Payload *models.MultiLifecycleResult `json:"body,omitempty"` -} - -// NewAddMultiBucketLifecycleOK creates AddMultiBucketLifecycleOK with default headers values -func NewAddMultiBucketLifecycleOK() *AddMultiBucketLifecycleOK { - - return &AddMultiBucketLifecycleOK{} -} - -// WithPayload adds the payload to the add multi bucket lifecycle o k response -func (o *AddMultiBucketLifecycleOK) WithPayload(payload *models.MultiLifecycleResult) *AddMultiBucketLifecycleOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the add multi bucket lifecycle o k response -func (o *AddMultiBucketLifecycleOK) SetPayload(payload *models.MultiLifecycleResult) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *AddMultiBucketLifecycleOK) 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 - } - } -} - -/* -AddMultiBucketLifecycleDefault Generic error response. - -swagger:response addMultiBucketLifecycleDefault -*/ -type AddMultiBucketLifecycleDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewAddMultiBucketLifecycleDefault creates AddMultiBucketLifecycleDefault with default headers values -func NewAddMultiBucketLifecycleDefault(code int) *AddMultiBucketLifecycleDefault { - if code <= 0 { - code = 500 - } - - return &AddMultiBucketLifecycleDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the add multi bucket lifecycle default response -func (o *AddMultiBucketLifecycleDefault) WithStatusCode(code int) *AddMultiBucketLifecycleDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the add multi bucket lifecycle default response -func (o *AddMultiBucketLifecycleDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the add multi bucket lifecycle default response -func (o *AddMultiBucketLifecycleDefault) WithPayload(payload *models.APIError) *AddMultiBucketLifecycleDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the add multi bucket lifecycle default response -func (o *AddMultiBucketLifecycleDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *AddMultiBucketLifecycleDefault) 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_multi_bucket_lifecycle_urlbuilder.go b/api/operations/bucket/add_multi_bucket_lifecycle_urlbuilder.go deleted file mode 100644 index 74e550d95f..0000000000 --- a/api/operations/bucket/add_multi_bucket_lifecycle_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" -) - -// AddMultiBucketLifecycleURL generates an URL for the add multi bucket lifecycle operation -type AddMultiBucketLifecycleURL 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 *AddMultiBucketLifecycleURL) WithBasePath(bp string) *AddMultiBucketLifecycleURL { - 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 *AddMultiBucketLifecycleURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *AddMultiBucketLifecycleURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/buckets/multi-lifecycle" - - _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 *AddMultiBucketLifecycleURL) 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 *AddMultiBucketLifecycleURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *AddMultiBucketLifecycleURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on AddMultiBucketLifecycleURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on AddMultiBucketLifecycleURL") - } - - 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 *AddMultiBucketLifecycleURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/bucket/delete_bucket_lifecycle_rule.go b/api/operations/bucket/delete_bucket_lifecycle_rule.go deleted file mode 100644 index daa38a1cba..0000000000 --- a/api/operations/bucket/delete_bucket_lifecycle_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" -) - -// DeleteBucketLifecycleRuleHandlerFunc turns a function with the right signature into a delete bucket lifecycle rule handler -type DeleteBucketLifecycleRuleHandlerFunc func(DeleteBucketLifecycleRuleParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn DeleteBucketLifecycleRuleHandlerFunc) Handle(params DeleteBucketLifecycleRuleParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// DeleteBucketLifecycleRuleHandler interface for that can handle valid delete bucket lifecycle rule params -type DeleteBucketLifecycleRuleHandler interface { - Handle(DeleteBucketLifecycleRuleParams, *models.Principal) middleware.Responder -} - -// NewDeleteBucketLifecycleRule creates a new http.Handler for the delete bucket lifecycle rule operation -func NewDeleteBucketLifecycleRule(ctx *middleware.Context, handler DeleteBucketLifecycleRuleHandler) *DeleteBucketLifecycleRule { - return &DeleteBucketLifecycleRule{Context: ctx, Handler: handler} -} - -/* - DeleteBucketLifecycleRule swagger:route DELETE /buckets/{bucket_name}/lifecycle/{lifecycle_id} Bucket deleteBucketLifecycleRule - -Delete Lifecycle rule -*/ -type DeleteBucketLifecycleRule struct { - Context *middleware.Context - Handler DeleteBucketLifecycleRuleHandler -} - -func (o *DeleteBucketLifecycleRule) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewDeleteBucketLifecycleRuleParams() - 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_lifecycle_rule_parameters.go b/api/operations/bucket/delete_bucket_lifecycle_rule_parameters.go deleted file mode 100644 index 1d6dd3431c..0000000000 --- a/api/operations/bucket/delete_bucket_lifecycle_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" -) - -// NewDeleteBucketLifecycleRuleParams creates a new DeleteBucketLifecycleRuleParams object -// -// There are no default values defined in the spec. -func NewDeleteBucketLifecycleRuleParams() DeleteBucketLifecycleRuleParams { - - return DeleteBucketLifecycleRuleParams{} -} - -// DeleteBucketLifecycleRuleParams contains all the bound params for the delete bucket lifecycle rule operation -// typically these are obtained from a http.Request -// -// swagger:parameters DeleteBucketLifecycleRule -type DeleteBucketLifecycleRuleParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - BucketName string - /* - Required: true - In: path - */ - LifecycleID 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 NewDeleteBucketLifecycleRuleParams() beforehand. -func (o *DeleteBucketLifecycleRuleParams) 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) - } - - rLifecycleID, rhkLifecycleID, _ := route.Params.GetOK("lifecycle_id") - if err := o.bindLifecycleID(rLifecycleID, rhkLifecycleID, 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 *DeleteBucketLifecycleRuleParams) 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 -} - -// bindLifecycleID binds and validates parameter LifecycleID from path. -func (o *DeleteBucketLifecycleRuleParams) bindLifecycleID(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.LifecycleID = raw - - return nil -} diff --git a/api/operations/bucket/delete_bucket_lifecycle_rule_responses.go b/api/operations/bucket/delete_bucket_lifecycle_rule_responses.go deleted file mode 100644 index b289f77391..0000000000 --- a/api/operations/bucket/delete_bucket_lifecycle_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" -) - -// DeleteBucketLifecycleRuleNoContentCode is the HTTP code returned for type DeleteBucketLifecycleRuleNoContent -const DeleteBucketLifecycleRuleNoContentCode int = 204 - -/* -DeleteBucketLifecycleRuleNoContent A successful response. - -swagger:response deleteBucketLifecycleRuleNoContent -*/ -type DeleteBucketLifecycleRuleNoContent struct { -} - -// NewDeleteBucketLifecycleRuleNoContent creates DeleteBucketLifecycleRuleNoContent with default headers values -func NewDeleteBucketLifecycleRuleNoContent() *DeleteBucketLifecycleRuleNoContent { - - return &DeleteBucketLifecycleRuleNoContent{} -} - -// WriteResponse to the client -func (o *DeleteBucketLifecycleRuleNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -/* -DeleteBucketLifecycleRuleDefault Generic error response. - -swagger:response deleteBucketLifecycleRuleDefault -*/ -type DeleteBucketLifecycleRuleDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewDeleteBucketLifecycleRuleDefault creates DeleteBucketLifecycleRuleDefault with default headers values -func NewDeleteBucketLifecycleRuleDefault(code int) *DeleteBucketLifecycleRuleDefault { - if code <= 0 { - code = 500 - } - - return &DeleteBucketLifecycleRuleDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the delete bucket lifecycle rule default response -func (o *DeleteBucketLifecycleRuleDefault) WithStatusCode(code int) *DeleteBucketLifecycleRuleDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the delete bucket lifecycle rule default response -func (o *DeleteBucketLifecycleRuleDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the delete bucket lifecycle rule default response -func (o *DeleteBucketLifecycleRuleDefault) WithPayload(payload *models.APIError) *DeleteBucketLifecycleRuleDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the delete bucket lifecycle rule default response -func (o *DeleteBucketLifecycleRuleDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *DeleteBucketLifecycleRuleDefault) 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_lifecycle_rule_urlbuilder.go b/api/operations/bucket/delete_bucket_lifecycle_rule_urlbuilder.go deleted file mode 100644 index 2e30aef494..0000000000 --- a/api/operations/bucket/delete_bucket_lifecycle_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" -) - -// DeleteBucketLifecycleRuleURL generates an URL for the delete bucket lifecycle rule operation -type DeleteBucketLifecycleRuleURL struct { - BucketName string - LifecycleID 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 *DeleteBucketLifecycleRuleURL) WithBasePath(bp string) *DeleteBucketLifecycleRuleURL { - 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 *DeleteBucketLifecycleRuleURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *DeleteBucketLifecycleRuleURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/buckets/{bucket_name}/lifecycle/{lifecycle_id}" - - bucketName := o.BucketName - if bucketName != "" { - _path = strings.Replace(_path, "{bucket_name}", bucketName, -1) - } else { - return nil, errors.New("bucketName is required on DeleteBucketLifecycleRuleURL") - } - - lifecycleID := o.LifecycleID - if lifecycleID != "" { - _path = strings.Replace(_path, "{lifecycle_id}", lifecycleID, -1) - } else { - return nil, errors.New("lifecycleId is required on DeleteBucketLifecycleRuleURL") - } - - _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 *DeleteBucketLifecycleRuleURL) 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 *DeleteBucketLifecycleRuleURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *DeleteBucketLifecycleRuleURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on DeleteBucketLifecycleRuleURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on DeleteBucketLifecycleRuleURL") - } - - 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 *DeleteBucketLifecycleRuleURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/bucket/get_bucket_lifecycle.go b/api/operations/bucket/get_bucket_lifecycle.go deleted file mode 100644 index 9d499f73d9..0000000000 --- a/api/operations/bucket/get_bucket_lifecycle.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" -) - -// GetBucketLifecycleHandlerFunc turns a function with the right signature into a get bucket lifecycle handler -type GetBucketLifecycleHandlerFunc func(GetBucketLifecycleParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetBucketLifecycleHandlerFunc) Handle(params GetBucketLifecycleParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// GetBucketLifecycleHandler interface for that can handle valid get bucket lifecycle params -type GetBucketLifecycleHandler interface { - Handle(GetBucketLifecycleParams, *models.Principal) middleware.Responder -} - -// NewGetBucketLifecycle creates a new http.Handler for the get bucket lifecycle operation -func NewGetBucketLifecycle(ctx *middleware.Context, handler GetBucketLifecycleHandler) *GetBucketLifecycle { - return &GetBucketLifecycle{Context: ctx, Handler: handler} -} - -/* - GetBucketLifecycle swagger:route GET /buckets/{bucket_name}/lifecycle Bucket getBucketLifecycle - -Bucket Lifecycle -*/ -type GetBucketLifecycle struct { - Context *middleware.Context - Handler GetBucketLifecycleHandler -} - -func (o *GetBucketLifecycle) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetBucketLifecycleParams() - 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_lifecycle_parameters.go b/api/operations/bucket/get_bucket_lifecycle_parameters.go deleted file mode 100644 index 6395bebcb8..0000000000 --- a/api/operations/bucket/get_bucket_lifecycle_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" -) - -// NewGetBucketLifecycleParams creates a new GetBucketLifecycleParams object -// -// There are no default values defined in the spec. -func NewGetBucketLifecycleParams() GetBucketLifecycleParams { - - return GetBucketLifecycleParams{} -} - -// GetBucketLifecycleParams contains all the bound params for the get bucket lifecycle operation -// typically these are obtained from a http.Request -// -// swagger:parameters GetBucketLifecycle -type GetBucketLifecycleParams 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 NewGetBucketLifecycleParams() beforehand. -func (o *GetBucketLifecycleParams) 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 *GetBucketLifecycleParams) 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_lifecycle_responses.go b/api/operations/bucket/get_bucket_lifecycle_responses.go deleted file mode 100644 index dea7d5effc..0000000000 --- a/api/operations/bucket/get_bucket_lifecycle_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" -) - -// GetBucketLifecycleOKCode is the HTTP code returned for type GetBucketLifecycleOK -const GetBucketLifecycleOKCode int = 200 - -/* -GetBucketLifecycleOK A successful response. - -swagger:response getBucketLifecycleOK -*/ -type GetBucketLifecycleOK struct { - - /* - In: Body - */ - Payload *models.BucketLifecycleResponse `json:"body,omitempty"` -} - -// NewGetBucketLifecycleOK creates GetBucketLifecycleOK with default headers values -func NewGetBucketLifecycleOK() *GetBucketLifecycleOK { - - return &GetBucketLifecycleOK{} -} - -// WithPayload adds the payload to the get bucket lifecycle o k response -func (o *GetBucketLifecycleOK) WithPayload(payload *models.BucketLifecycleResponse) *GetBucketLifecycleOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get bucket lifecycle o k response -func (o *GetBucketLifecycleOK) SetPayload(payload *models.BucketLifecycleResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetBucketLifecycleOK) 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 - } - } -} - -/* -GetBucketLifecycleDefault Generic error response. - -swagger:response getBucketLifecycleDefault -*/ -type GetBucketLifecycleDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewGetBucketLifecycleDefault creates GetBucketLifecycleDefault with default headers values -func NewGetBucketLifecycleDefault(code int) *GetBucketLifecycleDefault { - if code <= 0 { - code = 500 - } - - return &GetBucketLifecycleDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get bucket lifecycle default response -func (o *GetBucketLifecycleDefault) WithStatusCode(code int) *GetBucketLifecycleDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get bucket lifecycle default response -func (o *GetBucketLifecycleDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the get bucket lifecycle default response -func (o *GetBucketLifecycleDefault) WithPayload(payload *models.APIError) *GetBucketLifecycleDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get bucket lifecycle default response -func (o *GetBucketLifecycleDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetBucketLifecycleDefault) 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_lifecycle_urlbuilder.go b/api/operations/bucket/get_bucket_lifecycle_urlbuilder.go deleted file mode 100644 index e623c553a0..0000000000 --- a/api/operations/bucket/get_bucket_lifecycle_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" -) - -// GetBucketLifecycleURL generates an URL for the get bucket lifecycle operation -type GetBucketLifecycleURL 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 *GetBucketLifecycleURL) WithBasePath(bp string) *GetBucketLifecycleURL { - 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 *GetBucketLifecycleURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetBucketLifecycleURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/buckets/{bucket_name}/lifecycle" - - bucketName := o.BucketName - if bucketName != "" { - _path = strings.Replace(_path, "{bucket_name}", bucketName, -1) - } else { - return nil, errors.New("bucketName is required on GetBucketLifecycleURL") - } - - _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 *GetBucketLifecycleURL) 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 *GetBucketLifecycleURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetBucketLifecycleURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetBucketLifecycleURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetBucketLifecycleURL") - } - - 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 *GetBucketLifecycleURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/bucket/update_bucket_lifecycle.go b/api/operations/bucket/update_bucket_lifecycle.go deleted file mode 100644 index 7bdb76190e..0000000000 --- a/api/operations/bucket/update_bucket_lifecycle.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" -) - -// UpdateBucketLifecycleHandlerFunc turns a function with the right signature into a update bucket lifecycle handler -type UpdateBucketLifecycleHandlerFunc func(UpdateBucketLifecycleParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn UpdateBucketLifecycleHandlerFunc) Handle(params UpdateBucketLifecycleParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// UpdateBucketLifecycleHandler interface for that can handle valid update bucket lifecycle params -type UpdateBucketLifecycleHandler interface { - Handle(UpdateBucketLifecycleParams, *models.Principal) middleware.Responder -} - -// NewUpdateBucketLifecycle creates a new http.Handler for the update bucket lifecycle operation -func NewUpdateBucketLifecycle(ctx *middleware.Context, handler UpdateBucketLifecycleHandler) *UpdateBucketLifecycle { - return &UpdateBucketLifecycle{Context: ctx, Handler: handler} -} - -/* - UpdateBucketLifecycle swagger:route PUT /buckets/{bucket_name}/lifecycle/{lifecycle_id} Bucket updateBucketLifecycle - -Update Lifecycle rule -*/ -type UpdateBucketLifecycle struct { - Context *middleware.Context - Handler UpdateBucketLifecycleHandler -} - -func (o *UpdateBucketLifecycle) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewUpdateBucketLifecycleParams() - 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_bucket_lifecycle_parameters.go b/api/operations/bucket/update_bucket_lifecycle_parameters.go deleted file mode 100644 index 27907ab2c9..0000000000 --- a/api/operations/bucket/update_bucket_lifecycle_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" -) - -// NewUpdateBucketLifecycleParams creates a new UpdateBucketLifecycleParams object -// -// There are no default values defined in the spec. -func NewUpdateBucketLifecycleParams() UpdateBucketLifecycleParams { - - return UpdateBucketLifecycleParams{} -} - -// UpdateBucketLifecycleParams contains all the bound params for the update bucket lifecycle operation -// typically these are obtained from a http.Request -// -// swagger:parameters UpdateBucketLifecycle -type UpdateBucketLifecycleParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.UpdateBucketLifecycle - /* - Required: true - In: path - */ - BucketName string - /* - Required: true - In: path - */ - LifecycleID 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 NewUpdateBucketLifecycleParams() beforehand. -func (o *UpdateBucketLifecycleParams) 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.UpdateBucketLifecycle - 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) - } - - rLifecycleID, rhkLifecycleID, _ := route.Params.GetOK("lifecycle_id") - if err := o.bindLifecycleID(rLifecycleID, rhkLifecycleID, 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 *UpdateBucketLifecycleParams) 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 -} - -// bindLifecycleID binds and validates parameter LifecycleID from path. -func (o *UpdateBucketLifecycleParams) bindLifecycleID(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.LifecycleID = raw - - return nil -} diff --git a/api/operations/bucket/update_bucket_lifecycle_responses.go b/api/operations/bucket/update_bucket_lifecycle_responses.go deleted file mode 100644 index 8cf05dfe37..0000000000 --- a/api/operations/bucket/update_bucket_lifecycle_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" -) - -// UpdateBucketLifecycleOKCode is the HTTP code returned for type UpdateBucketLifecycleOK -const UpdateBucketLifecycleOKCode int = 200 - -/* -UpdateBucketLifecycleOK A successful response. - -swagger:response updateBucketLifecycleOK -*/ -type UpdateBucketLifecycleOK struct { -} - -// NewUpdateBucketLifecycleOK creates UpdateBucketLifecycleOK with default headers values -func NewUpdateBucketLifecycleOK() *UpdateBucketLifecycleOK { - - return &UpdateBucketLifecycleOK{} -} - -// WriteResponse to the client -func (o *UpdateBucketLifecycleOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(200) -} - -/* -UpdateBucketLifecycleDefault Generic error response. - -swagger:response updateBucketLifecycleDefault -*/ -type UpdateBucketLifecycleDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewUpdateBucketLifecycleDefault creates UpdateBucketLifecycleDefault with default headers values -func NewUpdateBucketLifecycleDefault(code int) *UpdateBucketLifecycleDefault { - if code <= 0 { - code = 500 - } - - return &UpdateBucketLifecycleDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the update bucket lifecycle default response -func (o *UpdateBucketLifecycleDefault) WithStatusCode(code int) *UpdateBucketLifecycleDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the update bucket lifecycle default response -func (o *UpdateBucketLifecycleDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the update bucket lifecycle default response -func (o *UpdateBucketLifecycleDefault) WithPayload(payload *models.APIError) *UpdateBucketLifecycleDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the update bucket lifecycle default response -func (o *UpdateBucketLifecycleDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *UpdateBucketLifecycleDefault) 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_bucket_lifecycle_urlbuilder.go b/api/operations/bucket/update_bucket_lifecycle_urlbuilder.go deleted file mode 100644 index 07542b7c09..0000000000 --- a/api/operations/bucket/update_bucket_lifecycle_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" -) - -// UpdateBucketLifecycleURL generates an URL for the update bucket lifecycle operation -type UpdateBucketLifecycleURL struct { - BucketName string - LifecycleID 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 *UpdateBucketLifecycleURL) WithBasePath(bp string) *UpdateBucketLifecycleURL { - 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 *UpdateBucketLifecycleURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *UpdateBucketLifecycleURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/buckets/{bucket_name}/lifecycle/{lifecycle_id}" - - bucketName := o.BucketName - if bucketName != "" { - _path = strings.Replace(_path, "{bucket_name}", bucketName, -1) - } else { - return nil, errors.New("bucketName is required on UpdateBucketLifecycleURL") - } - - lifecycleID := o.LifecycleID - if lifecycleID != "" { - _path = strings.Replace(_path, "{lifecycle_id}", lifecycleID, -1) - } else { - return nil, errors.New("lifecycleId is required on UpdateBucketLifecycleURL") - } - - _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 *UpdateBucketLifecycleURL) 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 *UpdateBucketLifecycleURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *UpdateBucketLifecycleURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on UpdateBucketLifecycleURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on UpdateBucketLifecycleURL") - } - - 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 *UpdateBucketLifecycleURL) 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 33e2d81e6a..a4c3129e21 100644 --- a/api/operations/console_api.go +++ b/api/operations/console_api.go @@ -52,7 +52,6 @@ import ( "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/tiering" "github.com/minio/console/api/operations/user" "github.com/minio/console/models" ) @@ -84,15 +83,9 @@ func NewConsoleAPI(spec *loads.Document) *ConsoleAPI { AccountAccountChangePasswordHandler: account.AccountChangePasswordHandlerFunc(func(params account.AccountChangePasswordParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation account.AccountChangePassword has not yet been implemented") }), - BucketAddBucketLifecycleHandler: bucket.AddBucketLifecycleHandlerFunc(func(params bucket.AddBucketLifecycleParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation bucket.AddBucketLifecycle 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") }), - BucketAddMultiBucketLifecycleHandler: bucket.AddMultiBucketLifecycleHandlerFunc(func(params bucket.AddMultiBucketLifecycleParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation bucket.AddMultiBucketLifecycle 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") }), @@ -102,9 +95,6 @@ func NewConsoleAPI(spec *loads.Document) *ConsoleAPI { BucketAddRemoteBucketHandler: bucket.AddRemoteBucketHandlerFunc(func(params bucket.AddRemoteBucketParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation bucket.AddRemoteBucket has not yet been implemented") }), - TieringAddTierHandler: tiering.AddTierHandlerFunc(func(params tiering.AddTierParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation tiering.AddTier 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") }), @@ -165,9 +155,6 @@ func NewConsoleAPI(spec *loads.Document) *ConsoleAPI { BucketDeleteBucketEventHandler: bucket.DeleteBucketEventHandlerFunc(func(params bucket.DeleteBucketEventParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation bucket.DeleteBucketEvent has not yet been implemented") }), - BucketDeleteBucketLifecycleRuleHandler: bucket.DeleteBucketLifecycleRuleHandlerFunc(func(params bucket.DeleteBucketLifecycleRuleParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation bucket.DeleteBucketLifecycleRule 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") }), @@ -207,9 +194,6 @@ 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") }), - TieringEditTierCredentialsHandler: tiering.EditTierCredentialsHandlerFunc(func(params tiering.EditTierCredentialsParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation tiering.EditTierCredentials 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") }), @@ -219,9 +203,6 @@ func NewConsoleAPI(spec *loads.Document) *ConsoleAPI { BucketGetBucketEncryptionInfoHandler: bucket.GetBucketEncryptionInfoHandlerFunc(func(params bucket.GetBucketEncryptionInfoParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation bucket.GetBucketEncryptionInfo has not yet been implemented") }), - BucketGetBucketLifecycleHandler: bucket.GetBucketLifecycleHandlerFunc(func(params bucket.GetBucketLifecycleParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation bucket.GetBucketLifecycle 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") }), @@ -261,9 +242,6 @@ func NewConsoleAPI(spec *loads.Document) *ConsoleAPI { 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") }), - TieringGetTierHandler: tiering.GetTierHandlerFunc(func(params tiering.GetTierParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation tiering.GetTier 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") }), @@ -408,9 +386,6 @@ func NewConsoleAPI(spec *loads.Document) *ConsoleAPI { PolicyRemovePolicyHandler: policy.RemovePolicyHandlerFunc(func(params policy.RemovePolicyParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation policy.RemovePolicy has not yet been implemented") }), - TieringRemoveTierHandler: tiering.RemoveTierHandlerFunc(func(params tiering.RemoveTierParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation tiering.RemoveTier 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") }), @@ -450,15 +425,6 @@ func NewConsoleAPI(spec *loads.Document) *ConsoleAPI { ObjectShareObjectHandler: object.ShareObjectHandlerFunc(func(params object.ShareObjectParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation object.ShareObject has not yet been implemented") }), - TieringTiersListHandler: tiering.TiersListHandlerFunc(func(params tiering.TiersListParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation tiering.TiersList has not yet been implemented") - }), - TieringTiersListNamesHandler: tiering.TiersListNamesHandlerFunc(func(params tiering.TiersListNamesParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation tiering.TiersListNames has not yet been implemented") - }), - BucketUpdateBucketLifecycleHandler: bucket.UpdateBucketLifecycleHandlerFunc(func(params bucket.UpdateBucketLifecycleParams, principal *models.Principal) middleware.Responder { - return middleware.NotImplemented("operation bucket.UpdateBucketLifecycle 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") }), @@ -542,20 +508,14 @@ type ConsoleAPI struct { // AccountAccountChangePasswordHandler sets the operation handler for the account change password operation AccountAccountChangePasswordHandler account.AccountChangePasswordHandler - // BucketAddBucketLifecycleHandler sets the operation handler for the add bucket lifecycle operation - BucketAddBucketLifecycleHandler bucket.AddBucketLifecycleHandler // GroupAddGroupHandler sets the operation handler for the add group operation GroupAddGroupHandler group.AddGroupHandler - // BucketAddMultiBucketLifecycleHandler sets the operation handler for the add multi bucket lifecycle operation - BucketAddMultiBucketLifecycleHandler bucket.AddMultiBucketLifecycleHandler // 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 - // TieringAddTierHandler sets the operation handler for the add tier operation - TieringAddTierHandler tiering.AddTierHandler // UserAddUserHandler sets the operation handler for the add user operation UserAddUserHandler user.AddUserHandler // SystemAdminInfoHandler sets the operation handler for the admin info operation @@ -596,8 +556,6 @@ type ConsoleAPI struct { BucketDeleteBucketHandler bucket.DeleteBucketHandler // BucketDeleteBucketEventHandler sets the operation handler for the delete bucket event operation BucketDeleteBucketEventHandler bucket.DeleteBucketEventHandler - // BucketDeleteBucketLifecycleRuleHandler sets the operation handler for the delete bucket lifecycle rule operation - BucketDeleteBucketLifecycleRuleHandler bucket.DeleteBucketLifecycleRuleHandler // 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 @@ -624,16 +582,12 @@ type ConsoleAPI struct { ObjectDownloadMultipleObjectsHandler object.DownloadMultipleObjectsHandler // PublicDownloadSharedObjectHandler sets the operation handler for the download shared object operation PublicDownloadSharedObjectHandler public.DownloadSharedObjectHandler - // TieringEditTierCredentialsHandler sets the operation handler for the edit tier credentials operation - TieringEditTierCredentialsHandler tiering.EditTierCredentialsHandler // 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 - // BucketGetBucketLifecycleHandler sets the operation handler for the get bucket lifecycle operation - BucketGetBucketLifecycleHandler bucket.GetBucketLifecycleHandler // 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 @@ -660,8 +614,6 @@ type ConsoleAPI struct { PolicyGetSAUserPolicyHandler policy.GetSAUserPolicyHandler // ServiceAccountGetServiceAccountHandler sets the operation handler for the get service account operation ServiceAccountGetServiceAccountHandler service_account.GetServiceAccountHandler - // TieringGetTierHandler sets the operation handler for the get tier operation - TieringGetTierHandler tiering.GetTierHandler // 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 @@ -758,8 +710,6 @@ type ConsoleAPI struct { GroupRemoveGroupHandler group.RemoveGroupHandler // PolicyRemovePolicyHandler sets the operation handler for the remove policy operation PolicyRemovePolicyHandler policy.RemovePolicyHandler - // TieringRemoveTierHandler sets the operation handler for the remove tier operation - TieringRemoveTierHandler tiering.RemoveTierHandler // UserRemoveUserHandler sets the operation handler for the remove user operation UserRemoveUserHandler user.RemoveUserHandler // ConfigurationResetConfigHandler sets the operation handler for the reset config operation @@ -786,12 +736,6 @@ type ConsoleAPI struct { PolicySetPolicyMultipleHandler policy.SetPolicyMultipleHandler // ObjectShareObjectHandler sets the operation handler for the share object operation ObjectShareObjectHandler object.ShareObjectHandler - // TieringTiersListHandler sets the operation handler for the tiers list operation - TieringTiersListHandler tiering.TiersListHandler - // TieringTiersListNamesHandler sets the operation handler for the tiers list names operation - TieringTiersListNamesHandler tiering.TiersListNamesHandler - // BucketUpdateBucketLifecycleHandler sets the operation handler for the update bucket lifecycle operation - BucketUpdateBucketLifecycleHandler bucket.UpdateBucketLifecycleHandler // IdpUpdateConfigurationHandler sets the operation handler for the update configuration operation IdpUpdateConfigurationHandler idp.UpdateConfigurationHandler // GroupUpdateGroupHandler sets the operation handler for the update group operation @@ -897,15 +841,9 @@ func (o *ConsoleAPI) Validate() error { if o.AccountAccountChangePasswordHandler == nil { unregistered = append(unregistered, "account.AccountChangePasswordHandler") } - if o.BucketAddBucketLifecycleHandler == nil { - unregistered = append(unregistered, "bucket.AddBucketLifecycleHandler") - } if o.GroupAddGroupHandler == nil { unregistered = append(unregistered, "group.AddGroupHandler") } - if o.BucketAddMultiBucketLifecycleHandler == nil { - unregistered = append(unregistered, "bucket.AddMultiBucketLifecycleHandler") - } if o.ConfigurationAddNotificationEndpointHandler == nil { unregistered = append(unregistered, "configuration.AddNotificationEndpointHandler") } @@ -915,9 +853,6 @@ func (o *ConsoleAPI) Validate() error { if o.BucketAddRemoteBucketHandler == nil { unregistered = append(unregistered, "bucket.AddRemoteBucketHandler") } - if o.TieringAddTierHandler == nil { - unregistered = append(unregistered, "tiering.AddTierHandler") - } if o.UserAddUserHandler == nil { unregistered = append(unregistered, "user.AddUserHandler") } @@ -978,9 +913,6 @@ func (o *ConsoleAPI) Validate() error { if o.BucketDeleteBucketEventHandler == nil { unregistered = append(unregistered, "bucket.DeleteBucketEventHandler") } - if o.BucketDeleteBucketLifecycleRuleHandler == nil { - unregistered = append(unregistered, "bucket.DeleteBucketLifecycleRuleHandler") - } if o.BucketDeleteBucketReplicationRuleHandler == nil { unregistered = append(unregistered, "bucket.DeleteBucketReplicationRuleHandler") } @@ -1020,9 +952,6 @@ func (o *ConsoleAPI) Validate() error { if o.PublicDownloadSharedObjectHandler == nil { unregistered = append(unregistered, "public.DownloadSharedObjectHandler") } - if o.TieringEditTierCredentialsHandler == nil { - unregistered = append(unregistered, "tiering.EditTierCredentialsHandler") - } if o.BucketEnableBucketEncryptionHandler == nil { unregistered = append(unregistered, "bucket.EnableBucketEncryptionHandler") } @@ -1032,9 +961,6 @@ func (o *ConsoleAPI) Validate() error { if o.BucketGetBucketEncryptionInfoHandler == nil { unregistered = append(unregistered, "bucket.GetBucketEncryptionInfoHandler") } - if o.BucketGetBucketLifecycleHandler == nil { - unregistered = append(unregistered, "bucket.GetBucketLifecycleHandler") - } if o.BucketGetBucketObjectLockingStatusHandler == nil { unregistered = append(unregistered, "bucket.GetBucketObjectLockingStatusHandler") } @@ -1074,9 +1000,6 @@ func (o *ConsoleAPI) Validate() error { if o.ServiceAccountGetServiceAccountHandler == nil { unregistered = append(unregistered, "service_account.GetServiceAccountHandler") } - if o.TieringGetTierHandler == nil { - unregistered = append(unregistered, "tiering.GetTierHandler") - } if o.UserGetUserInfoHandler == nil { unregistered = append(unregistered, "user.GetUserInfoHandler") } @@ -1221,9 +1144,6 @@ func (o *ConsoleAPI) Validate() error { if o.PolicyRemovePolicyHandler == nil { unregistered = append(unregistered, "policy.RemovePolicyHandler") } - if o.TieringRemoveTierHandler == nil { - unregistered = append(unregistered, "tiering.RemoveTierHandler") - } if o.UserRemoveUserHandler == nil { unregistered = append(unregistered, "user.RemoveUserHandler") } @@ -1263,15 +1183,6 @@ func (o *ConsoleAPI) Validate() error { if o.ObjectShareObjectHandler == nil { unregistered = append(unregistered, "object.ShareObjectHandler") } - if o.TieringTiersListHandler == nil { - unregistered = append(unregistered, "tiering.TiersListHandler") - } - if o.TieringTiersListNamesHandler == nil { - unregistered = append(unregistered, "tiering.TiersListNamesHandler") - } - if o.BucketUpdateBucketLifecycleHandler == nil { - unregistered = append(unregistered, "bucket.UpdateBucketLifecycleHandler") - } if o.IdpUpdateConfigurationHandler == nil { unregistered = append(unregistered, "idp.UpdateConfigurationHandler") } @@ -1405,18 +1316,10 @@ func (o *ConsoleAPI) initHandlerCache() { if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } - o.handlers["POST"]["/buckets/{bucket_name}/lifecycle"] = bucket.NewAddBucketLifecycle(o.context, o.BucketAddBucketLifecycleHandler) - 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"]["/buckets/multi-lifecycle"] = bucket.NewAddMultiBucketLifecycle(o.context, o.BucketAddMultiBucketLifecycleHandler) - 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) @@ -1429,10 +1332,6 @@ func (o *ConsoleAPI) initHandlerCache() { if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } - o.handlers["POST"]["/admin/tiers"] = tiering.NewAddTier(o.context, o.TieringAddTierHandler) - 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) @@ -1513,10 +1412,6 @@ func (o *ConsoleAPI) initHandlerCache() { if o.handlers["DELETE"] == nil { o.handlers["DELETE"] = make(map[string]http.Handler) } - o.handlers["DELETE"]["/buckets/{bucket_name}/lifecycle/{lifecycle_id}"] = bucket.NewDeleteBucketLifecycleRule(o.context, o.BucketDeleteBucketLifecycleRuleHandler) - 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) @@ -1566,10 +1461,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["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/admin/tiers/{type}/{name}/credentials"] = tiering.NewEditTierCredentials(o.context, o.TieringEditTierCredentialsHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } @@ -1585,10 +1476,6 @@ func (o *ConsoleAPI) initHandlerCache() { if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } - o.handlers["GET"]["/buckets/{bucket_name}/lifecycle"] = bucket.NewGetBucketLifecycle(o.context, o.BucketGetBucketLifecycleHandler) - 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) @@ -1641,10 +1528,6 @@ func (o *ConsoleAPI) initHandlerCache() { if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } - o.handlers["GET"]["/admin/tiers/{type}/{name}"] = tiering.NewGetTier(o.context, o.TieringGetTierHandler) - 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) @@ -1837,10 +1720,6 @@ func (o *ConsoleAPI) initHandlerCache() { if o.handlers["DELETE"] == nil { o.handlers["DELETE"] = make(map[string]http.Handler) } - o.handlers["DELETE"]["/admin/tiers/{name}/remove"] = tiering.NewRemoveTier(o.context, o.TieringRemoveTierHandler) - 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) @@ -1890,18 +1769,6 @@ func (o *ConsoleAPI) initHandlerCache() { 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["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/admin/tiers"] = tiering.NewTiersList(o.context, o.TieringTiersListHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/admin/tiers/names"] = tiering.NewTiersListNames(o.context, o.TieringTiersListNamesHandler) - if o.handlers["PUT"] == nil { - o.handlers["PUT"] = make(map[string]http.Handler) - } - o.handlers["PUT"]["/buckets/{bucket_name}/lifecycle/{lifecycle_id}"] = bucket.NewUpdateBucketLifecycle(o.context, o.BucketUpdateBucketLifecycleHandler) if o.handlers["PUT"] == nil { o.handlers["PUT"] = make(map[string]http.Handler) } diff --git a/api/operations/tiering/add_tier.go b/api/operations/tiering/add_tier.go deleted file mode 100644 index 25650a4e42..0000000000 --- a/api/operations/tiering/add_tier.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 tiering - -// 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" -) - -// AddTierHandlerFunc turns a function with the right signature into a add tier handler -type AddTierHandlerFunc func(AddTierParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn AddTierHandlerFunc) Handle(params AddTierParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// AddTierHandler interface for that can handle valid add tier params -type AddTierHandler interface { - Handle(AddTierParams, *models.Principal) middleware.Responder -} - -// NewAddTier creates a new http.Handler for the add tier operation -func NewAddTier(ctx *middleware.Context, handler AddTierHandler) *AddTier { - return &AddTier{Context: ctx, Handler: handler} -} - -/* - AddTier swagger:route POST /admin/tiers Tiering addTier - -Allows to configure a new tier -*/ -type AddTier struct { - Context *middleware.Context - Handler AddTierHandler -} - -func (o *AddTier) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewAddTierParams() - 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/tiering/add_tier_parameters.go b/api/operations/tiering/add_tier_parameters.go deleted file mode 100644 index 3011a6b4a4..0000000000 --- a/api/operations/tiering/add_tier_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 tiering - -// 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" -) - -// NewAddTierParams creates a new AddTierParams object -// -// There are no default values defined in the spec. -func NewAddTierParams() AddTierParams { - - return AddTierParams{} -} - -// AddTierParams contains all the bound params for the add tier operation -// typically these are obtained from a http.Request -// -// swagger:parameters AddTier -type AddTierParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.Tier -} - -// 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 NewAddTierParams() beforehand. -func (o *AddTierParams) 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.Tier - 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/tiering/add_tier_responses.go b/api/operations/tiering/add_tier_responses.go deleted file mode 100644 index 56ba3107f7..0000000000 --- a/api/operations/tiering/add_tier_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 tiering - -// 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" -) - -// AddTierCreatedCode is the HTTP code returned for type AddTierCreated -const AddTierCreatedCode int = 201 - -/* -AddTierCreated A successful response. - -swagger:response addTierCreated -*/ -type AddTierCreated struct { -} - -// NewAddTierCreated creates AddTierCreated with default headers values -func NewAddTierCreated() *AddTierCreated { - - return &AddTierCreated{} -} - -// WriteResponse to the client -func (o *AddTierCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(201) -} - -/* -AddTierDefault Generic error response. - -swagger:response addTierDefault -*/ -type AddTierDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewAddTierDefault creates AddTierDefault with default headers values -func NewAddTierDefault(code int) *AddTierDefault { - if code <= 0 { - code = 500 - } - - return &AddTierDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the add tier default response -func (o *AddTierDefault) WithStatusCode(code int) *AddTierDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the add tier default response -func (o *AddTierDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the add tier default response -func (o *AddTierDefault) WithPayload(payload *models.APIError) *AddTierDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the add tier default response -func (o *AddTierDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *AddTierDefault) 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/tiering/add_tier_urlbuilder.go b/api/operations/tiering/add_tier_urlbuilder.go deleted file mode 100644 index 4576dfd25a..0000000000 --- a/api/operations/tiering/add_tier_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 tiering - -// 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" -) - -// AddTierURL generates an URL for the add tier operation -type AddTierURL 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 *AddTierURL) WithBasePath(bp string) *AddTierURL { - 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 *AddTierURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *AddTierURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/admin/tiers" - - _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 *AddTierURL) 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 *AddTierURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *AddTierURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on AddTierURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on AddTierURL") - } - - 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 *AddTierURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/tiering/edit_tier_credentials.go b/api/operations/tiering/edit_tier_credentials.go deleted file mode 100644 index b925626c3d..0000000000 --- a/api/operations/tiering/edit_tier_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 tiering - -// 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" -) - -// EditTierCredentialsHandlerFunc turns a function with the right signature into a edit tier credentials handler -type EditTierCredentialsHandlerFunc func(EditTierCredentialsParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn EditTierCredentialsHandlerFunc) Handle(params EditTierCredentialsParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// EditTierCredentialsHandler interface for that can handle valid edit tier credentials params -type EditTierCredentialsHandler interface { - Handle(EditTierCredentialsParams, *models.Principal) middleware.Responder -} - -// NewEditTierCredentials creates a new http.Handler for the edit tier credentials operation -func NewEditTierCredentials(ctx *middleware.Context, handler EditTierCredentialsHandler) *EditTierCredentials { - return &EditTierCredentials{Context: ctx, Handler: handler} -} - -/* - EditTierCredentials swagger:route PUT /admin/tiers/{type}/{name}/credentials Tiering editTierCredentials - -Edit Tier Credentials -*/ -type EditTierCredentials struct { - Context *middleware.Context - Handler EditTierCredentialsHandler -} - -func (o *EditTierCredentials) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewEditTierCredentialsParams() - 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/tiering/edit_tier_credentials_parameters.go b/api/operations/tiering/edit_tier_credentials_parameters.go deleted file mode 100644 index 50f5c7c332..0000000000 --- a/api/operations/tiering/edit_tier_credentials_parameters.go +++ /dev/null @@ -1,164 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package tiering - -// 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" -) - -// NewEditTierCredentialsParams creates a new EditTierCredentialsParams object -// -// There are no default values defined in the spec. -func NewEditTierCredentialsParams() EditTierCredentialsParams { - - return EditTierCredentialsParams{} -} - -// EditTierCredentialsParams contains all the bound params for the edit tier credentials operation -// typically these are obtained from a http.Request -// -// swagger:parameters EditTierCredentials -type EditTierCredentialsParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: body - */ - Body *models.TierCredentialsRequest - /* - Required: true - In: path - */ - Name string - /* - 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 NewEditTierCredentialsParams() beforehand. -func (o *EditTierCredentialsParams) 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.TierCredentialsRequest - 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 *EditTierCredentialsParams) 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 *EditTierCredentialsParams) 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 - - if err := o.validateType(formats); err != nil { - return err - } - - return nil -} - -// validateType carries on validations for parameter Type -func (o *EditTierCredentialsParams) validateType(formats strfmt.Registry) error { - - if err := validate.EnumCase("type", "path", o.Type, []interface{}{"s3", "gcs", "azure", "minio"}, true); err != nil { - return err - } - - return nil -} diff --git a/api/operations/tiering/edit_tier_credentials_responses.go b/api/operations/tiering/edit_tier_credentials_responses.go deleted file mode 100644 index 36d0543dfb..0000000000 --- a/api/operations/tiering/edit_tier_credentials_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 tiering - -// 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" -) - -// EditTierCredentialsOKCode is the HTTP code returned for type EditTierCredentialsOK -const EditTierCredentialsOKCode int = 200 - -/* -EditTierCredentialsOK A successful response. - -swagger:response editTierCredentialsOK -*/ -type EditTierCredentialsOK struct { -} - -// NewEditTierCredentialsOK creates EditTierCredentialsOK with default headers values -func NewEditTierCredentialsOK() *EditTierCredentialsOK { - - return &EditTierCredentialsOK{} -} - -// WriteResponse to the client -func (o *EditTierCredentialsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(200) -} - -/* -EditTierCredentialsDefault Generic error response. - -swagger:response editTierCredentialsDefault -*/ -type EditTierCredentialsDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewEditTierCredentialsDefault creates EditTierCredentialsDefault with default headers values -func NewEditTierCredentialsDefault(code int) *EditTierCredentialsDefault { - if code <= 0 { - code = 500 - } - - return &EditTierCredentialsDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the edit tier credentials default response -func (o *EditTierCredentialsDefault) WithStatusCode(code int) *EditTierCredentialsDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the edit tier credentials default response -func (o *EditTierCredentialsDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the edit tier credentials default response -func (o *EditTierCredentialsDefault) WithPayload(payload *models.APIError) *EditTierCredentialsDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the edit tier credentials default response -func (o *EditTierCredentialsDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *EditTierCredentialsDefault) 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/tiering/edit_tier_credentials_urlbuilder.go b/api/operations/tiering/edit_tier_credentials_urlbuilder.go deleted file mode 100644 index f081a0d3f3..0000000000 --- a/api/operations/tiering/edit_tier_credentials_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 tiering - -// 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" -) - -// EditTierCredentialsURL generates an URL for the edit tier credentials operation -type EditTierCredentialsURL 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 *EditTierCredentialsURL) WithBasePath(bp string) *EditTierCredentialsURL { - 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 *EditTierCredentialsURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *EditTierCredentialsURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/admin/tiers/{type}/{name}/credentials" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on EditTierCredentialsURL") - } - - typeVar := o.Type - if typeVar != "" { - _path = strings.Replace(_path, "{type}", typeVar, -1) - } else { - return nil, errors.New("type is required on EditTierCredentialsURL") - } - - _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 *EditTierCredentialsURL) 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 *EditTierCredentialsURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *EditTierCredentialsURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on EditTierCredentialsURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on EditTierCredentialsURL") - } - - 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 *EditTierCredentialsURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/tiering/get_tier.go b/api/operations/tiering/get_tier.go deleted file mode 100644 index 8df531d616..0000000000 --- a/api/operations/tiering/get_tier.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 tiering - -// 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" -) - -// GetTierHandlerFunc turns a function with the right signature into a get tier handler -type GetTierHandlerFunc func(GetTierParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn GetTierHandlerFunc) Handle(params GetTierParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// GetTierHandler interface for that can handle valid get tier params -type GetTierHandler interface { - Handle(GetTierParams, *models.Principal) middleware.Responder -} - -// NewGetTier creates a new http.Handler for the get tier operation -func NewGetTier(ctx *middleware.Context, handler GetTierHandler) *GetTier { - return &GetTier{Context: ctx, Handler: handler} -} - -/* - GetTier swagger:route GET /admin/tiers/{type}/{name} Tiering getTier - -Get Tier -*/ -type GetTier struct { - Context *middleware.Context - Handler GetTierHandler -} - -func (o *GetTier) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewGetTierParams() - 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/tiering/get_tier_parameters.go b/api/operations/tiering/get_tier_parameters.go deleted file mode 100644 index 0aeeafc9dc..0000000000 --- a/api/operations/tiering/get_tier_parameters.go +++ /dev/null @@ -1,127 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package tiering - -// 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" - "github.com/go-openapi/validate" -) - -// NewGetTierParams creates a new GetTierParams object -// -// There are no default values defined in the spec. -func NewGetTierParams() GetTierParams { - - return GetTierParams{} -} - -// GetTierParams contains all the bound params for the get tier operation -// typically these are obtained from a http.Request -// -// swagger:parameters GetTier -type GetTierParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: path - */ - Name string - /* - 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 NewGetTierParams() beforehand. -func (o *GetTierParams) 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 *GetTierParams) 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 *GetTierParams) 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 - - if err := o.validateType(formats); err != nil { - return err - } - - return nil -} - -// validateType carries on validations for parameter Type -func (o *GetTierParams) validateType(formats strfmt.Registry) error { - - if err := validate.EnumCase("type", "path", o.Type, []interface{}{"s3", "gcs", "azure", "minio"}, true); err != nil { - return err - } - - return nil -} diff --git a/api/operations/tiering/get_tier_responses.go b/api/operations/tiering/get_tier_responses.go deleted file mode 100644 index 821bcd82c1..0000000000 --- a/api/operations/tiering/get_tier_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 tiering - -// 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" -) - -// GetTierOKCode is the HTTP code returned for type GetTierOK -const GetTierOKCode int = 200 - -/* -GetTierOK A successful response. - -swagger:response getTierOK -*/ -type GetTierOK struct { - - /* - In: Body - */ - Payload *models.Tier `json:"body,omitempty"` -} - -// NewGetTierOK creates GetTierOK with default headers values -func NewGetTierOK() *GetTierOK { - - return &GetTierOK{} -} - -// WithPayload adds the payload to the get tier o k response -func (o *GetTierOK) WithPayload(payload *models.Tier) *GetTierOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get tier o k response -func (o *GetTierOK) SetPayload(payload *models.Tier) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTierOK) 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 - } - } -} - -/* -GetTierDefault Generic error response. - -swagger:response getTierDefault -*/ -type GetTierDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewGetTierDefault creates GetTierDefault with default headers values -func NewGetTierDefault(code int) *GetTierDefault { - if code <= 0 { - code = 500 - } - - return &GetTierDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the get tier default response -func (o *GetTierDefault) WithStatusCode(code int) *GetTierDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the get tier default response -func (o *GetTierDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the get tier default response -func (o *GetTierDefault) WithPayload(payload *models.APIError) *GetTierDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the get tier default response -func (o *GetTierDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *GetTierDefault) 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/tiering/get_tier_urlbuilder.go b/api/operations/tiering/get_tier_urlbuilder.go deleted file mode 100644 index 7dc759f1d5..0000000000 --- a/api/operations/tiering/get_tier_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 tiering - -// 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" -) - -// GetTierURL generates an URL for the get tier operation -type GetTierURL 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 *GetTierURL) WithBasePath(bp string) *GetTierURL { - 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 *GetTierURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *GetTierURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/admin/tiers/{type}/{name}" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on GetTierURL") - } - - typeVar := o.Type - if typeVar != "" { - _path = strings.Replace(_path, "{type}", typeVar, -1) - } else { - return nil, errors.New("type is required on GetTierURL") - } - - _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 *GetTierURL) 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 *GetTierURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *GetTierURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on GetTierURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on GetTierURL") - } - - 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 *GetTierURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/tiering/remove_tier.go b/api/operations/tiering/remove_tier.go deleted file mode 100644 index 7dbbe12d06..0000000000 --- a/api/operations/tiering/remove_tier.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 tiering - -// 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" -) - -// RemoveTierHandlerFunc turns a function with the right signature into a remove tier handler -type RemoveTierHandlerFunc func(RemoveTierParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn RemoveTierHandlerFunc) Handle(params RemoveTierParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// RemoveTierHandler interface for that can handle valid remove tier params -type RemoveTierHandler interface { - Handle(RemoveTierParams, *models.Principal) middleware.Responder -} - -// NewRemoveTier creates a new http.Handler for the remove tier operation -func NewRemoveTier(ctx *middleware.Context, handler RemoveTierHandler) *RemoveTier { - return &RemoveTier{Context: ctx, Handler: handler} -} - -/* - RemoveTier swagger:route DELETE /admin/tiers/{name}/remove Tiering removeTier - -Remove Tier -*/ -type RemoveTier struct { - Context *middleware.Context - Handler RemoveTierHandler -} - -func (o *RemoveTier) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewRemoveTierParams() - 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/tiering/remove_tier_parameters.go b/api/operations/tiering/remove_tier_parameters.go deleted file mode 100644 index 6eeb31770a..0000000000 --- a/api/operations/tiering/remove_tier_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 tiering - -// 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" -) - -// NewRemoveTierParams creates a new RemoveTierParams object -// -// There are no default values defined in the spec. -func NewRemoveTierParams() RemoveTierParams { - - return RemoveTierParams{} -} - -// RemoveTierParams contains all the bound params for the remove tier operation -// typically these are obtained from a http.Request -// -// swagger:parameters RemoveTier -type RemoveTierParams 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 NewRemoveTierParams() beforehand. -func (o *RemoveTierParams) 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 *RemoveTierParams) 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/tiering/remove_tier_responses.go b/api/operations/tiering/remove_tier_responses.go deleted file mode 100644 index a594274f4d..0000000000 --- a/api/operations/tiering/remove_tier_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 tiering - -// 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" -) - -// RemoveTierNoContentCode is the HTTP code returned for type RemoveTierNoContent -const RemoveTierNoContentCode int = 204 - -/* -RemoveTierNoContent A successful response. - -swagger:response removeTierNoContent -*/ -type RemoveTierNoContent struct { -} - -// NewRemoveTierNoContent creates RemoveTierNoContent with default headers values -func NewRemoveTierNoContent() *RemoveTierNoContent { - - return &RemoveTierNoContent{} -} - -// WriteResponse to the client -func (o *RemoveTierNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(204) -} - -/* -RemoveTierDefault Generic error response. - -swagger:response removeTierDefault -*/ -type RemoveTierDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewRemoveTierDefault creates RemoveTierDefault with default headers values -func NewRemoveTierDefault(code int) *RemoveTierDefault { - if code <= 0 { - code = 500 - } - - return &RemoveTierDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the remove tier default response -func (o *RemoveTierDefault) WithStatusCode(code int) *RemoveTierDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the remove tier default response -func (o *RemoveTierDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the remove tier default response -func (o *RemoveTierDefault) WithPayload(payload *models.APIError) *RemoveTierDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the remove tier default response -func (o *RemoveTierDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *RemoveTierDefault) 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/tiering/remove_tier_urlbuilder.go b/api/operations/tiering/remove_tier_urlbuilder.go deleted file mode 100644 index cabe36758e..0000000000 --- a/api/operations/tiering/remove_tier_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 tiering - -// 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" -) - -// RemoveTierURL generates an URL for the remove tier operation -type RemoveTierURL 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 *RemoveTierURL) WithBasePath(bp string) *RemoveTierURL { - 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 *RemoveTierURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *RemoveTierURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/admin/tiers/{name}/remove" - - name := o.Name - if name != "" { - _path = strings.Replace(_path, "{name}", name, -1) - } else { - return nil, errors.New("name is required on RemoveTierURL") - } - - _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 *RemoveTierURL) 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 *RemoveTierURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *RemoveTierURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on RemoveTierURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on RemoveTierURL") - } - - 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 *RemoveTierURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/tiering/tiers_list.go b/api/operations/tiering/tiers_list.go deleted file mode 100644 index 65a97783be..0000000000 --- a/api/operations/tiering/tiers_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 tiering - -// 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" -) - -// TiersListHandlerFunc turns a function with the right signature into a tiers list handler -type TiersListHandlerFunc func(TiersListParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn TiersListHandlerFunc) Handle(params TiersListParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// TiersListHandler interface for that can handle valid tiers list params -type TiersListHandler interface { - Handle(TiersListParams, *models.Principal) middleware.Responder -} - -// NewTiersList creates a new http.Handler for the tiers list operation -func NewTiersList(ctx *middleware.Context, handler TiersListHandler) *TiersList { - return &TiersList{Context: ctx, Handler: handler} -} - -/* - TiersList swagger:route GET /admin/tiers Tiering tiersList - -Returns a list of tiers for ilm -*/ -type TiersList struct { - Context *middleware.Context - Handler TiersListHandler -} - -func (o *TiersList) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewTiersListParams() - 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/tiering/tiers_list_names.go b/api/operations/tiering/tiers_list_names.go deleted file mode 100644 index 2e4203949d..0000000000 --- a/api/operations/tiering/tiers_list_names.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 tiering - -// 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" -) - -// TiersListNamesHandlerFunc turns a function with the right signature into a tiers list names handler -type TiersListNamesHandlerFunc func(TiersListNamesParams, *models.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn TiersListNamesHandlerFunc) Handle(params TiersListNamesParams, principal *models.Principal) middleware.Responder { - return fn(params, principal) -} - -// TiersListNamesHandler interface for that can handle valid tiers list names params -type TiersListNamesHandler interface { - Handle(TiersListNamesParams, *models.Principal) middleware.Responder -} - -// NewTiersListNames creates a new http.Handler for the tiers list names operation -func NewTiersListNames(ctx *middleware.Context, handler TiersListNamesHandler) *TiersListNames { - return &TiersListNames{Context: ctx, Handler: handler} -} - -/* - TiersListNames swagger:route GET /admin/tiers/names Tiering tiersListNames - -Returns a list of tiers' names for ilm -*/ -type TiersListNames struct { - Context *middleware.Context - Handler TiersListNamesHandler -} - -func (o *TiersListNames) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewTiersListNamesParams() - 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/tiering/tiers_list_names_parameters.go b/api/operations/tiering/tiers_list_names_parameters.go deleted file mode 100644 index 7ab9445b85..0000000000 --- a/api/operations/tiering/tiers_list_names_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 tiering - -// 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" -) - -// NewTiersListNamesParams creates a new TiersListNamesParams object -// -// There are no default values defined in the spec. -func NewTiersListNamesParams() TiersListNamesParams { - - return TiersListNamesParams{} -} - -// TiersListNamesParams contains all the bound params for the tiers list names operation -// typically these are obtained from a http.Request -// -// swagger:parameters TiersListNames -type TiersListNamesParams 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 NewTiersListNamesParams() beforehand. -func (o *TiersListNamesParams) 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/tiering/tiers_list_names_responses.go b/api/operations/tiering/tiers_list_names_responses.go deleted file mode 100644 index 0f30b084c1..0000000000 --- a/api/operations/tiering/tiers_list_names_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 tiering - -// 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" -) - -// TiersListNamesOKCode is the HTTP code returned for type TiersListNamesOK -const TiersListNamesOKCode int = 200 - -/* -TiersListNamesOK A successful response. - -swagger:response tiersListNamesOK -*/ -type TiersListNamesOK struct { - - /* - In: Body - */ - Payload *models.TiersNameListResponse `json:"body,omitempty"` -} - -// NewTiersListNamesOK creates TiersListNamesOK with default headers values -func NewTiersListNamesOK() *TiersListNamesOK { - - return &TiersListNamesOK{} -} - -// WithPayload adds the payload to the tiers list names o k response -func (o *TiersListNamesOK) WithPayload(payload *models.TiersNameListResponse) *TiersListNamesOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the tiers list names o k response -func (o *TiersListNamesOK) SetPayload(payload *models.TiersNameListResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *TiersListNamesOK) 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 - } - } -} - -/* -TiersListNamesDefault Generic error response. - -swagger:response tiersListNamesDefault -*/ -type TiersListNamesDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewTiersListNamesDefault creates TiersListNamesDefault with default headers values -func NewTiersListNamesDefault(code int) *TiersListNamesDefault { - if code <= 0 { - code = 500 - } - - return &TiersListNamesDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the tiers list names default response -func (o *TiersListNamesDefault) WithStatusCode(code int) *TiersListNamesDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the tiers list names default response -func (o *TiersListNamesDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the tiers list names default response -func (o *TiersListNamesDefault) WithPayload(payload *models.APIError) *TiersListNamesDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the tiers list names default response -func (o *TiersListNamesDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *TiersListNamesDefault) 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/tiering/tiers_list_names_urlbuilder.go b/api/operations/tiering/tiers_list_names_urlbuilder.go deleted file mode 100644 index 287badaf75..0000000000 --- a/api/operations/tiering/tiers_list_names_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 tiering - -// 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" -) - -// TiersListNamesURL generates an URL for the tiers list names operation -type TiersListNamesURL 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 *TiersListNamesURL) WithBasePath(bp string) *TiersListNamesURL { - 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 *TiersListNamesURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *TiersListNamesURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/admin/tiers/names" - - _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 *TiersListNamesURL) 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 *TiersListNamesURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *TiersListNamesURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on TiersListNamesURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on TiersListNamesURL") - } - - 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 *TiersListNamesURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/operations/tiering/tiers_list_parameters.go b/api/operations/tiering/tiers_list_parameters.go deleted file mode 100644 index 947d557fab..0000000000 --- a/api/operations/tiering/tiers_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 tiering - -// 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" -) - -// NewTiersListParams creates a new TiersListParams object -// -// There are no default values defined in the spec. -func NewTiersListParams() TiersListParams { - - return TiersListParams{} -} - -// TiersListParams contains all the bound params for the tiers list operation -// typically these are obtained from a http.Request -// -// swagger:parameters TiersList -type TiersListParams 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 NewTiersListParams() beforehand. -func (o *TiersListParams) 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/tiering/tiers_list_responses.go b/api/operations/tiering/tiers_list_responses.go deleted file mode 100644 index c9af04737b..0000000000 --- a/api/operations/tiering/tiers_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 tiering - -// 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" -) - -// TiersListOKCode is the HTTP code returned for type TiersListOK -const TiersListOKCode int = 200 - -/* -TiersListOK A successful response. - -swagger:response tiersListOK -*/ -type TiersListOK struct { - - /* - In: Body - */ - Payload *models.TierListResponse `json:"body,omitempty"` -} - -// NewTiersListOK creates TiersListOK with default headers values -func NewTiersListOK() *TiersListOK { - - return &TiersListOK{} -} - -// WithPayload adds the payload to the tiers list o k response -func (o *TiersListOK) WithPayload(payload *models.TierListResponse) *TiersListOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the tiers list o k response -func (o *TiersListOK) SetPayload(payload *models.TierListResponse) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *TiersListOK) 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 - } - } -} - -/* -TiersListDefault Generic error response. - -swagger:response tiersListDefault -*/ -type TiersListDefault struct { - _statusCode int - - /* - In: Body - */ - Payload *models.APIError `json:"body,omitempty"` -} - -// NewTiersListDefault creates TiersListDefault with default headers values -func NewTiersListDefault(code int) *TiersListDefault { - if code <= 0 { - code = 500 - } - - return &TiersListDefault{ - _statusCode: code, - } -} - -// WithStatusCode adds the status to the tiers list default response -func (o *TiersListDefault) WithStatusCode(code int) *TiersListDefault { - o._statusCode = code - return o -} - -// SetStatusCode sets the status to the tiers list default response -func (o *TiersListDefault) SetStatusCode(code int) { - o._statusCode = code -} - -// WithPayload adds the payload to the tiers list default response -func (o *TiersListDefault) WithPayload(payload *models.APIError) *TiersListDefault { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the tiers list default response -func (o *TiersListDefault) SetPayload(payload *models.APIError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *TiersListDefault) 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/tiering/tiers_list_urlbuilder.go b/api/operations/tiering/tiers_list_urlbuilder.go deleted file mode 100644 index 9727802c93..0000000000 --- a/api/operations/tiering/tiers_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 tiering - -// 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" -) - -// TiersListURL generates an URL for the tiers list operation -type TiersListURL 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 *TiersListURL) WithBasePath(bp string) *TiersListURL { - 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 *TiersListURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *TiersListURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/admin/tiers" - - _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 *TiersListURL) 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 *TiersListURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *TiersListURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on TiersListURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on TiersListURL") - } - - 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 *TiersListURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/api/user_buckets_lifecycle.go b/api/user_buckets_lifecycle.go deleted file mode 100644 index e2c1600a65..0000000000 --- a/api/user_buckets_lifecycle.go +++ /dev/null @@ -1,543 +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" - "strconv" - "strings" - "time" - - "github.com/minio/minio-go/v7" - - "github.com/rs/xid" - - "github.com/minio/mc/cmd/ilm" - - "github.com/minio/minio-go/v7/pkg/lifecycle" - - "github.com/go-openapi/runtime/middleware" - "github.com/minio/console/api/operations" - bucketApi "github.com/minio/console/api/operations/bucket" - "github.com/minio/console/models" -) - -type MultiLifecycleResult struct { - BucketName string - Error string -} - -func registerBucketsLifecycleHandlers(api *operations.ConsoleAPI) { - api.BucketGetBucketLifecycleHandler = bucketApi.GetBucketLifecycleHandlerFunc(func(params bucketApi.GetBucketLifecycleParams, session *models.Principal) middleware.Responder { - listBucketLifecycleResponse, err := getBucketLifecycleResponse(session, params) - if err != nil { - return bucketApi.NewGetBucketLifecycleDefault(err.Code).WithPayload(err.APIError) - } - return bucketApi.NewGetBucketLifecycleOK().WithPayload(listBucketLifecycleResponse) - }) - api.BucketAddBucketLifecycleHandler = bucketApi.AddBucketLifecycleHandlerFunc(func(params bucketApi.AddBucketLifecycleParams, session *models.Principal) middleware.Responder { - err := getAddBucketLifecycleResponse(session, params) - if err != nil { - return bucketApi.NewAddBucketLifecycleDefault(err.Code).WithPayload(err.APIError) - } - return bucketApi.NewAddBucketLifecycleCreated() - }) - api.BucketUpdateBucketLifecycleHandler = bucketApi.UpdateBucketLifecycleHandlerFunc(func(params bucketApi.UpdateBucketLifecycleParams, session *models.Principal) middleware.Responder { - err := getEditBucketLifecycleRule(session, params) - if err != nil { - return bucketApi.NewUpdateBucketLifecycleDefault(err.Code).WithPayload(err.APIError) - } - - return bucketApi.NewUpdateBucketLifecycleOK() - }) - api.BucketDeleteBucketLifecycleRuleHandler = bucketApi.DeleteBucketLifecycleRuleHandlerFunc(func(params bucketApi.DeleteBucketLifecycleRuleParams, session *models.Principal) middleware.Responder { - err := getDeleteBucketLifecycleRule(session, params) - if err != nil { - return bucketApi.NewDeleteBucketLifecycleRuleDefault(err.Code).WithPayload(err.APIError) - } - - return bucketApi.NewDeleteBucketLifecycleRuleNoContent() - }) - api.BucketAddMultiBucketLifecycleHandler = bucketApi.AddMultiBucketLifecycleHandlerFunc(func(params bucketApi.AddMultiBucketLifecycleParams, session *models.Principal) middleware.Responder { - multiBucketResponse, err := getAddMultiBucketLifecycleResponse(session, params) - if err != nil { - bucketApi.NewAddMultiBucketLifecycleDefault(err.Code).WithPayload(err.APIError) - } - - return bucketApi.NewAddMultiBucketLifecycleOK().WithPayload(multiBucketResponse) - }) -} - -// getBucketLifecycle() gets lifecycle lists for a bucket from MinIO API and returns their implementations -func getBucketLifecycle(ctx context.Context, client MinioClient, bucketName string) (*models.BucketLifecycleResponse, error) { - lifecycleList, err := client.getLifecycleRules(ctx, bucketName) - if err != nil { - return nil, err - } - var rules []*models.ObjectBucketLifecycle - - for _, rule := range lifecycleList.Rules { - - var tags []*models.LifecycleTag - - for _, tagData := range rule.RuleFilter.And.Tags { - tags = append(tags, &models.LifecycleTag{ - Key: tagData.Key, - Value: tagData.Value, - }) - } - if rule.RuleFilter.Tag.Key != "" { - tags = append(tags, &models.LifecycleTag{ - Key: rule.RuleFilter.Tag.Key, - Value: rule.RuleFilter.Tag.Value, - }) - } - rulePrefix := rule.RuleFilter.And.Prefix - - if rulePrefix == "" { - rulePrefix = rule.RuleFilter.Prefix - } - - rules = append(rules, &models.ObjectBucketLifecycle{ - ID: rule.ID, - Status: rule.Status, - Prefix: rulePrefix, - Expiration: &models.ExpirationResponse{ - Date: rule.Expiration.Date.Format(time.RFC3339), - Days: int64(rule.Expiration.Days), - DeleteMarker: rule.Expiration.DeleteMarker.IsEnabled(), - DeleteAll: bool(rule.Expiration.DeleteAll), - NoncurrentExpirationDays: int64(rule.NoncurrentVersionExpiration.NoncurrentDays), - NewerNoncurrentExpirationVersions: int64(rule.NoncurrentVersionExpiration.NewerNoncurrentVersions), - }, - Transition: &models.TransitionResponse{ - Date: rule.Transition.Date.Format(time.RFC3339), - Days: int64(rule.Transition.Days), - StorageClass: rule.Transition.StorageClass, - NoncurrentStorageClass: rule.NoncurrentVersionTransition.StorageClass, - NoncurrentTransitionDays: int64(rule.NoncurrentVersionTransition.NoncurrentDays), - }, - Tags: tags, - }) - } - - // serialize output - lifecycleBucketsResponse := &models.BucketLifecycleResponse{ - Lifecycle: rules, - } - - return lifecycleBucketsResponse, nil -} - -// getBucketLifecycleResponse performs getBucketLifecycle() and serializes it to the handler's output -func getBucketLifecycleResponse(session *models.Principal, params bucketApi.GetBucketLifecycleParams) (*models.BucketLifecycleResponse, *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 := getBucketLifecycle(ctx, minioClient, params.BucketName) - if err != nil { - return nil, ErrorWithContext(ctx, ErrBucketLifeCycleNotConfigured, err) - } - return bucketEvents, nil -} - -// addBucketLifecycle gets lifecycle lists for a bucket from MinIO API and returns their implementations -func addBucketLifecycle(ctx context.Context, client MinioClient, params bucketApi.AddBucketLifecycleParams) error { - // Configuration that is already set. - lfcCfg, err := client.getLifecycleRules(ctx, params.BucketName) - if err != nil { - if e := err; minio.ToErrorResponse(e).Code == "NoSuchLifecycleConfiguration" { - lfcCfg = lifecycle.NewConfiguration() - } else { - return err - } - } - - id := xid.New().String() - - opts := ilm.LifecycleOptions{} - - // Verify if transition rule is requested - switch params.Body.Type { - case models.AddBucketLifecycleTypeTransition: - if params.Body.TransitionDays == 0 && params.Body.NoncurrentversionTransitionDays == 0 { - return errors.New("you must provide a value for transition days or date") - } - - status := !params.Body.Disable - opts = ilm.LifecycleOptions{ - ID: id, - Prefix: ¶ms.Body.Prefix, - Status: &status, - Tags: ¶ms.Body.Tags, - ExpiredObjectDeleteMarker: ¶ms.Body.ExpiredObjectDeleteMarker, - ExpiredObjectAllversions: ¶ms.Body.ExpiredObjectDeleteAll, - } - - if params.Body.NoncurrentversionTransitionDays > 0 { - noncurrentVersionTransitionDays := int(params.Body.NoncurrentversionTransitionDays) - noncurrentVersionTransitionStorageClass := strings.ToUpper(params.Body.NoncurrentversionTransitionStorageClass) - opts.NoncurrentVersionTransitionDays = &noncurrentVersionTransitionDays - opts.NoncurrentVersionTransitionStorageClass = &noncurrentVersionTransitionStorageClass - } else if params.Body.TransitionDays > 0 { - tdays := strconv.Itoa(int(params.Body.TransitionDays)) - sclass := strings.ToUpper(params.Body.StorageClass) - opts.TransitionDays = &tdays - opts.StorageClass = &sclass - } - - case models.AddBucketLifecycleTypeExpiry: - // Verify if expiry items are set - if params.Body.NoncurrentversionTransitionDays != 0 { - return errors.New("non current version Transition Days cannot be set when expiry is being configured") - } - - if params.Body.NoncurrentversionTransitionStorageClass != "" { - return errors.New("non current version Transition Storage Class cannot be set when expiry is being configured") - } - - status := !params.Body.Disable - opts = ilm.LifecycleOptions{ - ID: id, - Prefix: ¶ms.Body.Prefix, - Status: &status, - Tags: ¶ms.Body.Tags, - ExpiredObjectDeleteMarker: ¶ms.Body.ExpiredObjectDeleteMarker, - ExpiredObjectAllversions: ¶ms.Body.ExpiredObjectDeleteAll, - } - - if params.Body.NewerNoncurrentversionExpirationVersions > 0 { - versions := int(params.Body.NewerNoncurrentversionExpirationVersions) - opts.NewerNoncurrentExpirationVersions = &versions - } - switch { - case params.Body.NoncurrentversionExpirationDays > 0: - days := int(params.Body.NoncurrentversionExpirationDays) - opts.NoncurrentVersionExpirationDays = &days - case params.Body.ExpiryDays > 0: - days := strconv.Itoa(int(params.Body.ExpiryDays)) - opts.ExpiryDays = &days - } - default: - // Non set, we return errors - return errors.New("no valid lifecycle configuration requested") - } - - newRule, merr := opts.ToILMRule() - if merr != nil { - return merr.ToGoError() - } - - lfcCfg.Rules = append(lfcCfg.Rules, newRule) - - return client.setBucketLifecycle(ctx, params.BucketName, lfcCfg) -} - -// getAddBucketLifecycleResponse returns the response of adding a bucket lifecycle response -func getAddBucketLifecycleResponse(session *models.Principal, params bucketApi.AddBucketLifecycleParams) *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 = addBucketLifecycle(ctx, minioClient, params) - if err != nil { - return ErrorWithContext(ctx, err) - } - - return nil -} - -// editBucketLifecycle gets lifecycle lists for a bucket from MinIO API and updates the selected lifecycle rule -func editBucketLifecycle(ctx context.Context, client MinioClient, params bucketApi.UpdateBucketLifecycleParams) error { - // Configuration that is already set. - lfcCfg, err := client.getLifecycleRules(ctx, params.BucketName) - if err != nil { - if e := err; minio.ToErrorResponse(e).Code == "NoSuchLifecycleConfiguration" { - lfcCfg = lifecycle.NewConfiguration() - } else { - return err - } - } - - id := params.LifecycleID - - opts := ilm.LifecycleOptions{} - - // Verify if transition items are set - switch *params.Body.Type { - case models.UpdateBucketLifecycleTypeTransition: - if params.Body.TransitionDays == 0 && params.Body.NoncurrentversionTransitionDays == 0 { - return errors.New("you must select transition days or non-current transition days configuration") - } - - status := !params.Body.Disable - opts = ilm.LifecycleOptions{ - ID: id, - Prefix: ¶ms.Body.Prefix, - Status: &status, - Tags: ¶ms.Body.Tags, - ExpiredObjectDeleteMarker: ¶ms.Body.ExpiredObjectDeleteMarker, - ExpiredObjectAllversions: ¶ms.Body.ExpiredObjectDeleteAll, - } - - if params.Body.NoncurrentversionTransitionDays > 0 { - noncurrentVersionTransitionDays := int(params.Body.NoncurrentversionTransitionDays) - noncurrentVersionTransitionStorageClass := strings.ToUpper(params.Body.NoncurrentversionTransitionStorageClass) - opts.NoncurrentVersionTransitionDays = &noncurrentVersionTransitionDays - opts.NoncurrentVersionTransitionStorageClass = &noncurrentVersionTransitionStorageClass - - } else { - tdays := strconv.Itoa(int(params.Body.TransitionDays)) - sclass := strings.ToUpper(params.Body.StorageClass) - opts.TransitionDays = &tdays - opts.StorageClass = &sclass - } - case models.UpdateBucketLifecycleTypeExpiry: // Verify if expiry configuration is set - if params.Body.NoncurrentversionTransitionDays != 0 { - return errors.New("non current version Transition Days cannot be set when expiry is being configured") - } - - if params.Body.NoncurrentversionTransitionStorageClass != "" { - return errors.New("non current version Transition Storage Class cannot be set when expiry is being configured") - } - - status := !params.Body.Disable - opts = ilm.LifecycleOptions{ - ID: id, - Prefix: ¶ms.Body.Prefix, - Status: &status, - Tags: ¶ms.Body.Tags, - ExpiredObjectDeleteMarker: ¶ms.Body.ExpiredObjectDeleteMarker, - ExpiredObjectAllversions: ¶ms.Body.ExpiredObjectDeleteAll, - } - - if params.Body.NoncurrentversionExpirationDays > 0 { - days := int(params.Body.NoncurrentversionExpirationDays) - opts.NoncurrentVersionExpirationDays = &days - } else { - days := strconv.Itoa(int(params.Body.ExpiryDays)) - opts.ExpiryDays = &days - } - default: - // Non set, we return errors - return errors.New("no valid configuration requested") - } - - var rule *lifecycle.Rule - for i := range lfcCfg.Rules { - if lfcCfg.Rules[i].ID == opts.ID { - rule = &lfcCfg.Rules[i] - break - } - } - if rule == nil { - return errors.New("unable to find the matching rule to update") - } - - err2 := ilm.ApplyRuleFields(rule, opts) - if err2.ToGoError() != nil { - return fmt.Errorf("Unable to generate new lifecycle rule: %v", err2.ToGoError()) - } - - return client.setBucketLifecycle(ctx, params.BucketName, lfcCfg) -} - -// getEditBucketLifecycleRule returns the response of bucket lifecycle tier edit -func getEditBucketLifecycleRule(session *models.Principal, params bucketApi.UpdateBucketLifecycleParams) *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 = editBucketLifecycle(ctx, minioClient, params) - if err != nil { - return ErrorWithContext(ctx, err) - } - - return nil -} - -// deleteBucketLifecycle deletes lifecycle rule by passing an empty rule to a selected ID -func deleteBucketLifecycle(ctx context.Context, client MinioClient, params bucketApi.DeleteBucketLifecycleRuleParams) error { - // Configuration that is already set. - lfcCfg, err := client.getLifecycleRules(ctx, params.BucketName) - if err != nil { - if e := err; minio.ToErrorResponse(e).Code == "NoSuchLifecycleConfiguration" { - lfcCfg = lifecycle.NewConfiguration() - } else { - return err - } - } - - if len(lfcCfg.Rules) == 0 { - return errors.New("no rules available to delete") - } - - var newRules []lifecycle.Rule - - for _, rule := range lfcCfg.Rules { - if rule.ID != params.LifecycleID { - newRules = append(newRules, rule) - } - } - - if len(newRules) == len(lfcCfg.Rules) && len(lfcCfg.Rules) > 0 { - // rule doesn't exist - return fmt.Errorf("lifecycle rule for id '%s' doesn't exist", params.LifecycleID) - } - - lfcCfg.Rules = newRules - - return client.setBucketLifecycle(ctx, params.BucketName, lfcCfg) -} - -// getDeleteBucketLifecycleRule returns the response of bucket lifecycle tier delete -func getDeleteBucketLifecycleRule(session *models.Principal, params bucketApi.DeleteBucketLifecycleRuleParams) *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 = deleteBucketLifecycle(ctx, minioClient, params) - if err != nil { - return ErrorWithContext(ctx, err) - } - - return nil -} - -// addMultiBucketLifecycle creates multibuckets lifecycle assignments -func addMultiBucketLifecycle(ctx context.Context, client MinioClient, params bucketApi.AddMultiBucketLifecycleParams) []MultiLifecycleResult { - bucketsRelation := params.Body.Buckets - - // Parallel Lifecycle rules set - - parallelLifecycleBucket := func(bucketName string) chan MultiLifecycleResult { - remoteProc := make(chan MultiLifecycleResult) - - lifecycleParams := models.AddBucketLifecycle{ - Type: *params.Body.Type, - StorageClass: params.Body.StorageClass, - TransitionDays: params.Body.TransitionDays, - Prefix: params.Body.Prefix, - NoncurrentversionTransitionDays: params.Body.NoncurrentversionTransitionDays, - NoncurrentversionTransitionStorageClass: params.Body.NoncurrentversionTransitionStorageClass, - NoncurrentversionExpirationDays: params.Body.NoncurrentversionExpirationDays, - Tags: params.Body.Tags, - ExpiryDays: params.Body.ExpiryDays, - Disable: false, - ExpiredObjectDeleteMarker: params.Body.ExpiredObjectDeleteMarker, - ExpiredObjectDeleteAll: params.Body.ExpiredObjectDeleteMarker, - } - - go func() { - defer close(remoteProc) - - lifecycleParams := bucketApi.AddBucketLifecycleParams{ - BucketName: bucketName, - Body: &lifecycleParams, - } - - // We add lifecycle rule & expect a response - err := addBucketLifecycle(ctx, client, lifecycleParams) - - errorReturn := "" - - if err != nil { - errorReturn = err.Error() - } - - retParams := MultiLifecycleResult{ - BucketName: bucketName, - Error: errorReturn, - } - - remoteProc <- retParams - }() - return remoteProc - } - - var lifecycleManagement []chan MultiLifecycleResult - - for _, bucketName := range bucketsRelation { - rBucket := parallelLifecycleBucket(bucketName) - lifecycleManagement = append(lifecycleManagement, rBucket) - } - - var resultsList []MultiLifecycleResult - for _, result := range lifecycleManagement { - res := <-result - resultsList = append(resultsList, res) - } - - return resultsList -} - -// getAddMultiBucketLifecycleResponse returns the response of multibucket lifecycle assignment -func getAddMultiBucketLifecycleResponse(session *models.Principal, params bucketApi.AddMultiBucketLifecycleParams) (*models.MultiLifecycleResult, *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} - - multiCycleResult := addMultiBucketLifecycle(ctx, minioClient, params) - - var returnList []*models.MulticycleResultItem - - for _, resultItem := range multiCycleResult { - multicycleRS := models.MulticycleResultItem{ - BucketName: resultItem.BucketName, - Error: resultItem.Error, - } - - returnList = append(returnList, &multicycleRS) - } - - finalResult := models.MultiLifecycleResult{Results: returnList} - - return &finalResult, nil -} diff --git a/api/user_buckets_lifecycle_test.go b/api/user_buckets_lifecycle_test.go deleted file mode 100644 index 4bdf281d2f..0000000000 --- a/api/user_buckets_lifecycle_test.go +++ /dev/null @@ -1,370 +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/minio/console/models" - "github.com/stretchr/testify/assert" - - bucketApi "github.com/minio/console/api/operations/bucket" - "github.com/minio/minio-go/v7/pkg/lifecycle" -) - -// assigning mock at runtime instead of compile time -var minioGetLifecycleRulesMock func(ctx context.Context, bucketName string) (lifecycle *lifecycle.Configuration, err error) - -// mock function of getLifecycleRules() -func (ac minioClientMock) getLifecycleRules(ctx context.Context, bucketName string) (lifecycle *lifecycle.Configuration, err error) { - return minioGetLifecycleRulesMock(ctx, bucketName) -} - -// assign mock for set Bucket Lifecycle -var minioSetBucketLifecycleMock func(ctx context.Context, bucketName string, config *lifecycle.Configuration) error - -// mock function of setBucketLifecycle() -func (ac minioClientMock) setBucketLifecycle(ctx context.Context, bucketName string, config *lifecycle.Configuration) error { - return minioSetBucketLifecycleMock(ctx, bucketName, config) -} - -func TestGetLifecycleRules(t *testing.T) { - assert := assert.New(t) - // mock minIO client - minClient := minioClientMock{} - - function := "getBucketLifecycle()" - bucketName := "testBucket" - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - // Test-1 : getBucketLifecycle() get list of events for a particular bucket only one config - // mock lifecycle response from MinIO - mockLifecycle := lifecycle.Configuration{ - Rules: []lifecycle.Rule{ - { - ID: "TESTRULE", - Expiration: lifecycle.Expiration{Days: 15}, - Status: "Enabled", - RuleFilter: lifecycle.Filter{Tag: lifecycle.Tag{Key: "tag1", Value: "val1"}, And: lifecycle.And{Prefix: "prefix1"}}, - }, - }, - } - - expectedOutput := models.BucketLifecycleResponse{ - Lifecycle: []*models.ObjectBucketLifecycle{ - { - ID: "TESTRULE", - Status: "Enabled", - Prefix: "prefix1", - Expiration: &models.ExpirationResponse{Days: int64(15)}, - Transition: &models.TransitionResponse{}, - Tags: []*models.LifecycleTag{{Key: "tag1", Value: "val1"}}, - }, - }, - } - - minioGetLifecycleRulesMock = func(_ context.Context, _ string) (lifecycle *lifecycle.Configuration, err error) { - return &mockLifecycle, nil - } - - lifeCycleConfigs, err := getBucketLifecycle(ctx, minClient, bucketName) - if err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - // verify length of buckets is correct - assert.Equal(len(expectedOutput.Lifecycle), len(lifeCycleConfigs.Lifecycle), fmt.Sprintf("Failed on %s: length of lists is not the same", function)) - for i, conf := range lifeCycleConfigs.Lifecycle { - assert.Equal(expectedOutput.Lifecycle[i].ID, conf.ID) - assert.Equal(expectedOutput.Lifecycle[i].Status, conf.Status) - assert.Equal(expectedOutput.Lifecycle[i].Prefix, conf.Prefix) - assert.Equal(expectedOutput.Lifecycle[i].Expiration.Days, conf.Expiration.Days) - for j, event := range conf.Tags { - assert.Equal(expectedOutput.Lifecycle[i].Tags[j], event) - } - } - - // Test-2 : getBucketLifecycle() get list of events is empty - mockLifecycleT2 := lifecycle.Configuration{ - Rules: []lifecycle.Rule{}, - } - - expectedOutputT2 := models.BucketLifecycleResponse{ - Lifecycle: []*models.ObjectBucketLifecycle{}, - } - - minioGetLifecycleRulesMock = func(_ context.Context, _ string) (lifecycle *lifecycle.Configuration, err error) { - return &mockLifecycleT2, nil - } - - lifeCycleConfigsT2, err := getBucketLifecycle(ctx, minClient, bucketName) - if err != nil { - t.Errorf("Failed on %s:, error occurred: %s", function, err.Error()) - } - // verify length of buckets is correct - assert.Equal(len(expectedOutputT2.Lifecycle), len(lifeCycleConfigsT2.Lifecycle), fmt.Sprintf("Failed on %s: length of lists is not the same", function)) - - // Test-3 : getBucketLifecycle() get list of events returns an error - - minioGetLifecycleRulesMock = func(_ context.Context, _ string) (lifecycle *lifecycle.Configuration, err error) { - return nil, errors.New("error returned") - } - - _, errT3 := getBucketLifecycle(ctx, minClient, bucketName) - - errorCompare := errors.New("error returned") - - assert.Equal(errorCompare, errT3, fmt.Sprintf("Failed on %s: Invalid error message", function)) - - // verify length of buckets is correct - assert.Equal(len(expectedOutputT2.Lifecycle), len(lifeCycleConfigsT2.Lifecycle), fmt.Sprintf("Failed on %s: length of lists is not the same", function)) -} - -func TestSetLifecycleRule(t *testing.T) { - assert := assert.New(t) - // mock minIO client - minClient := minioClientMock{} - - function := "addBucketLifecycle()" - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - // Test-1 : addBucketLifecycle() get list of events for a particular bucket only one config - // mock create request - mockLifecycle := lifecycle.Configuration{ - Rules: []lifecycle.Rule{ - { - ID: "TESTRULE", - Expiration: lifecycle.Expiration{Days: 15}, - Status: "Enabled", - RuleFilter: lifecycle.Filter{Tag: lifecycle.Tag{Key: "tag1", Value: "val1"}, And: lifecycle.And{Prefix: "prefix1"}}, - }, - }, - } - - minioGetLifecycleRulesMock = func(_ context.Context, _ string) (lifecycle *lifecycle.Configuration, err error) { - return &mockLifecycle, nil - } - - expiryRule := "expiry" - - insertMock := bucketApi.AddBucketLifecycleParams{ - BucketName: "testBucket", - Body: &models.AddBucketLifecycle{ - Type: expiryRule, - Disable: false, - ExpiredObjectDeleteMarker: false, - ExpiryDays: int32(16), - NoncurrentversionExpirationDays: 0, - NoncurrentversionTransitionDays: 0, - NoncurrentversionTransitionStorageClass: "", - Prefix: "pref1", - StorageClass: "", - Tags: "", - TransitionDays: 0, - }, - } - - minioSetBucketLifecycleMock = func(_ context.Context, _ string, _ *lifecycle.Configuration) error { - return nil - } - - err := addBucketLifecycle(ctx, minClient, insertMock) - - assert.Equal(nil, err, fmt.Sprintf("Failed on %s: Error returned", function)) - - // Test-2 : addBucketLifecycle() returns error - - minioSetBucketLifecycleMock = func(_ context.Context, _ string, _ *lifecycle.Configuration) error { - return errors.New("error setting lifecycle") - } - - err2 := addBucketLifecycle(ctx, minClient, insertMock) - - assert.Equal(errors.New("error setting lifecycle"), err2, fmt.Sprintf("Failed on %s: Error returned", function)) -} - -func TestUpdateLifecycleRule(t *testing.T) { - assert := assert.New(t) - // mock minIO client - minClient := minioClientMock{} - - function := "editBucketLifecycle()" - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - // Test-1 : editBucketLifecycle() get list of events for a particular bucket only one config (get lifecycle mock) - // mock create request - mockLifecycle := lifecycle.Configuration{ - Rules: []lifecycle.Rule{ - { - ID: "TESTRULE", - Expiration: lifecycle.Expiration{Days: 15}, - Status: "Enabled", - RuleFilter: lifecycle.Filter{Tag: lifecycle.Tag{Key: "tag1", Value: "val1"}, And: lifecycle.And{Prefix: "prefix1"}}, - }, - }, - } - - minioGetLifecycleRulesMock = func(_ context.Context, _ string) (lifecycle *lifecycle.Configuration, err error) { - return &mockLifecycle, nil - } - - // Test-2 : editBucketLifecycle() Update lifecycle rule - - expiryRule := "expiry" - - editMock := bucketApi.UpdateBucketLifecycleParams{ - BucketName: "testBucket", - Body: &models.UpdateBucketLifecycle{ - Type: &expiryRule, - Disable: false, - ExpiredObjectDeleteMarker: false, - ExpiryDays: int32(16), - NoncurrentversionExpirationDays: 0, - NoncurrentversionTransitionDays: 0, - NoncurrentversionTransitionStorageClass: "", - Prefix: "pref1", - StorageClass: "", - Tags: "", - TransitionDays: 0, - }, - LifecycleID: "TESTRULE", - } - - minioSetBucketLifecycleMock = func(_ context.Context, _ string, _ *lifecycle.Configuration) error { - return nil - } - - err := editBucketLifecycle(ctx, minClient, editMock) - - assert.Equal(nil, err, fmt.Sprintf("Failed on %s: Error returned", function)) - - // Test-2a : editBucketLifecycle() Update lifecycle rule - - transitionRule := "transition" - - editMock = bucketApi.UpdateBucketLifecycleParams{ - BucketName: "testBucket", - Body: &models.UpdateBucketLifecycle{ - Type: &transitionRule, - Disable: false, - ExpiredObjectDeleteMarker: false, - NoncurrentversionTransitionDays: 5, - Prefix: "pref1", - StorageClass: "TEST", - NoncurrentversionTransitionStorageClass: "TESTNC", - Tags: "", - TransitionDays: int32(16), - }, - LifecycleID: "TESTRULE", - } - - minioSetBucketLifecycleMock = func(_ context.Context, _ string, _ *lifecycle.Configuration) error { - return nil - } - - err = editBucketLifecycle(ctx, minClient, editMock) - - assert.Equal(nil, err, fmt.Sprintf("Failed on %s: Error returned", function)) - - // Test-3 : editBucketLifecycle() returns error - - minioSetBucketLifecycleMock = func(_ context.Context, _ string, _ *lifecycle.Configuration) error { - return errors.New("error setting lifecycle") - } - - err2 := editBucketLifecycle(ctx, minClient, editMock) - - assert.Equal(errors.New("error setting lifecycle"), err2, fmt.Sprintf("Failed on %s: Error returned", function)) -} - -func TestDeleteLifecycleRule(t *testing.T) { - assert := assert.New(t) - // mock minIO client - minClient := minioClientMock{} - - function := "deleteBucketLifecycle()" - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - minioSetBucketLifecycleMock = func(_ context.Context, _ string, _ *lifecycle.Configuration) error { - return nil - } - - // Test-1 : deleteBucketLifecycle() get list of events for a particular bucket only one config (get lifecycle mock) - // mock create request - mockLifecycle := lifecycle.Configuration{ - Rules: []lifecycle.Rule{ - { - ID: "TESTRULE", - Expiration: lifecycle.Expiration{Days: 15}, - Status: "Enabled", - RuleFilter: lifecycle.Filter{Tag: lifecycle.Tag{Key: "tag1", Value: "val1"}, And: lifecycle.And{Prefix: "prefix1"}}, - }, - { - ID: "TESTRULE2", - Transition: lifecycle.Transition{Days: 10, StorageClass: "TESTSTCLASS"}, - Status: "Enabled", - RuleFilter: lifecycle.Filter{Tag: lifecycle.Tag{Key: "tag1", Value: "val1"}, And: lifecycle.And{Prefix: "prefix1"}}, - }, - }, - } - - minioGetLifecycleRulesMock = func(_ context.Context, _ string) (lifecycle *lifecycle.Configuration, err error) { - return &mockLifecycle, nil - } - - // Test-2 : deleteBucketLifecycle() try to delete an available rule - - availableParams := bucketApi.DeleteBucketLifecycleRuleParams{ - LifecycleID: "TESTRULE2", - BucketName: "testBucket", - } - - err := deleteBucketLifecycle(ctx, minClient, availableParams) - - assert.Equal(nil, err, fmt.Sprintf("Failed on %s: Error returned", function)) - - // Test-3 : deleteBucketLifecycle() returns error trying to delete a non available rule - - nonAvailableParams := bucketApi.DeleteBucketLifecycleRuleParams{ - LifecycleID: "INVALIDTESTRULE", - BucketName: "testBucket", - } - - err2 := deleteBucketLifecycle(ctx, minClient, nonAvailableParams) - - assert.Equal(fmt.Errorf("lifecycle rule for id '%s' doesn't exist", nonAvailableParams.LifecycleID), err2, fmt.Sprintf("Failed on %s: Error returned", function)) - - // Test-4 : deleteBucketLifecycle() returns error trying to delete a rule when no rules are available - - mockLifecycle2 := lifecycle.Configuration{ - Rules: []lifecycle.Rule{}, - } - - minioGetLifecycleRulesMock = func(_ context.Context, _ string) (lifecycle *lifecycle.Configuration, err error) { - return &mockLifecycle2, nil - } - - err3 := deleteBucketLifecycle(ctx, minClient, nonAvailableParams) - - assert.Equal(errors.New("no rules available to delete"), err3, fmt.Sprintf("Failed on %s: Error returned", function)) -} diff --git a/models/add_bucket_lifecycle.go b/models/add_bucket_lifecycle.go deleted file mode 100644 index 6aacadd790..0000000000 --- a/models/add_bucket_lifecycle.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "encoding/json" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// AddBucketLifecycle add bucket lifecycle -// -// swagger:model addBucketLifecycle -type AddBucketLifecycle struct { - - // Non required, toggle to disable or enable rule - Disable bool `json:"disable,omitempty"` - - // Non required, toggle to disable or enable rule - ExpiredObjectDeleteAll bool `json:"expired_object_delete_all,omitempty"` - - // Non required, toggle to disable or enable rule - ExpiredObjectDeleteMarker bool `json:"expired_object_delete_marker,omitempty"` - - // Required in case of expiry_date or transition fields are not set. it defines an expiry days for ILM - ExpiryDays int32 `json:"expiry_days,omitempty"` - - // Non required, can be set in case of expiration is enabled - NewerNoncurrentversionExpirationVersions int32 `json:"newer_noncurrentversion_expiration_versions,omitempty"` - - // Non required, can be set in case of expiration is enabled - NoncurrentversionExpirationDays int32 `json:"noncurrentversion_expiration_days,omitempty"` - - // Non required, can be set in case of transition is enabled - NoncurrentversionTransitionDays int32 `json:"noncurrentversion_transition_days,omitempty"` - - // Non required, can be set in case of transition is enabled - NoncurrentversionTransitionStorageClass string `json:"noncurrentversion_transition_storage_class,omitempty"` - - // Non required field, it matches a prefix to perform ILM operations on it - Prefix string `json:"prefix,omitempty"` - - // Required only in case of transition is set. it refers to a tier - StorageClass string `json:"storage_class,omitempty"` - - // Non required field, tags to match ILM files - Tags string `json:"tags,omitempty"` - - // Required in case of transition_date or expiry fields are not set. it defines a transition days for ILM - TransitionDays int32 `json:"transition_days,omitempty"` - - // ILM Rule type (Expiry or transition) - // Enum: [expiry transition] - Type string `json:"type,omitempty"` -} - -// Validate validates this add bucket lifecycle -func (m *AddBucketLifecycle) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateType(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -var addBucketLifecycleTypeTypePropEnum []interface{} - -func init() { - var res []string - if err := json.Unmarshal([]byte(`["expiry","transition"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - addBucketLifecycleTypeTypePropEnum = append(addBucketLifecycleTypeTypePropEnum, v) - } -} - -const ( - - // AddBucketLifecycleTypeExpiry captures enum value "expiry" - AddBucketLifecycleTypeExpiry string = "expiry" - - // AddBucketLifecycleTypeTransition captures enum value "transition" - AddBucketLifecycleTypeTransition string = "transition" -) - -// prop value enum -func (m *AddBucketLifecycle) validateTypeEnum(path, location string, value string) error { - if err := validate.EnumCase(path, location, value, addBucketLifecycleTypeTypePropEnum, true); err != nil { - return err - } - return nil -} - -func (m *AddBucketLifecycle) validateType(formats strfmt.Registry) error { - if swag.IsZero(m.Type) { // not required - return nil - } - - // value enum - if err := m.validateTypeEnum("type", "body", m.Type); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this add bucket lifecycle based on context it is used -func (m *AddBucketLifecycle) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *AddBucketLifecycle) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *AddBucketLifecycle) UnmarshalBinary(b []byte) error { - var res AddBucketLifecycle - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/add_multi_bucket_lifecycle.go b/models/add_multi_bucket_lifecycle.go deleted file mode 100644 index a51ff48cb4..0000000000 --- a/models/add_multi_bucket_lifecycle.go +++ /dev/null @@ -1,171 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "encoding/json" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// AddMultiBucketLifecycle add multi bucket lifecycle -// -// swagger:model addMultiBucketLifecycle -type AddMultiBucketLifecycle struct { - - // buckets - // Required: true - Buckets []string `json:"buckets"` - - // Non required, toggle to disable or enable rule - ExpiredObjectDeleteAll bool `json:"expired_object_delete_all,omitempty"` - - // Non required, toggle to disable or enable rule - ExpiredObjectDeleteMarker bool `json:"expired_object_delete_marker,omitempty"` - - // Required in case of expiry_date or transition fields are not set. it defines an expiry days for ILM - ExpiryDays int32 `json:"expiry_days,omitempty"` - - // Non required, can be set in case of expiration is enabled - NoncurrentversionExpirationDays int32 `json:"noncurrentversion_expiration_days,omitempty"` - - // Non required, can be set in case of transition is enabled - NoncurrentversionTransitionDays int32 `json:"noncurrentversion_transition_days,omitempty"` - - // Non required, can be set in case of transition is enabled - NoncurrentversionTransitionStorageClass string `json:"noncurrentversion_transition_storage_class,omitempty"` - - // Non required field, it matches a prefix to perform ILM operations on it - Prefix string `json:"prefix,omitempty"` - - // Required only in case of transition is set. it refers to a tier - StorageClass string `json:"storage_class,omitempty"` - - // Non required field, tags to match ILM files - Tags string `json:"tags,omitempty"` - - // Required in case of transition_date or expiry fields are not set. it defines a transition days for ILM - TransitionDays int32 `json:"transition_days,omitempty"` - - // ILM Rule type (Expiry or transition) - // Required: true - // Enum: [expiry transition] - Type *string `json:"type"` -} - -// Validate validates this add multi bucket lifecycle -func (m *AddMultiBucketLifecycle) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateBuckets(formats); err != nil { - res = append(res, err) - } - - if err := m.validateType(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *AddMultiBucketLifecycle) validateBuckets(formats strfmt.Registry) error { - - if err := validate.Required("buckets", "body", m.Buckets); err != nil { - return err - } - - return nil -} - -var addMultiBucketLifecycleTypeTypePropEnum []interface{} - -func init() { - var res []string - if err := json.Unmarshal([]byte(`["expiry","transition"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - addMultiBucketLifecycleTypeTypePropEnum = append(addMultiBucketLifecycleTypeTypePropEnum, v) - } -} - -const ( - - // AddMultiBucketLifecycleTypeExpiry captures enum value "expiry" - AddMultiBucketLifecycleTypeExpiry string = "expiry" - - // AddMultiBucketLifecycleTypeTransition captures enum value "transition" - AddMultiBucketLifecycleTypeTransition string = "transition" -) - -// prop value enum -func (m *AddMultiBucketLifecycle) validateTypeEnum(path, location string, value string) error { - if err := validate.EnumCase(path, location, value, addMultiBucketLifecycleTypeTypePropEnum, true); err != nil { - return err - } - return nil -} - -func (m *AddMultiBucketLifecycle) validateType(formats strfmt.Registry) error { - - if err := validate.Required("type", "body", m.Type); err != nil { - return err - } - - // value enum - if err := m.validateTypeEnum("type", "body", *m.Type); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this add multi bucket lifecycle based on context it is used -func (m *AddMultiBucketLifecycle) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *AddMultiBucketLifecycle) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *AddMultiBucketLifecycle) UnmarshalBinary(b []byte) error { - var res AddMultiBucketLifecycle - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/bucket_lifecycle_response.go b/models/bucket_lifecycle_response.go deleted file mode 100644 index c8b922cc4c..0000000000 --- a/models/bucket_lifecycle_response.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// BucketLifecycleResponse bucket lifecycle response -// -// swagger:model bucketLifecycleResponse -type BucketLifecycleResponse struct { - - // lifecycle - Lifecycle []*ObjectBucketLifecycle `json:"lifecycle"` -} - -// Validate validates this bucket lifecycle response -func (m *BucketLifecycleResponse) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateLifecycle(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *BucketLifecycleResponse) validateLifecycle(formats strfmt.Registry) error { - if swag.IsZero(m.Lifecycle) { // not required - return nil - } - - for i := 0; i < len(m.Lifecycle); i++ { - if swag.IsZero(m.Lifecycle[i]) { // not required - continue - } - - if m.Lifecycle[i] != nil { - if err := m.Lifecycle[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("lifecycle" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("lifecycle" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this bucket lifecycle response based on the context it is used -func (m *BucketLifecycleResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateLifecycle(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *BucketLifecycleResponse) contextValidateLifecycle(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Lifecycle); i++ { - - if m.Lifecycle[i] != nil { - - if swag.IsZero(m.Lifecycle[i]) { // not required - return nil - } - - if err := m.Lifecycle[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("lifecycle" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("lifecycle" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *BucketLifecycleResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *BucketLifecycleResponse) UnmarshalBinary(b []byte) error { - var res BucketLifecycleResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/expiration_response.go b/models/expiration_response.go deleted file mode 100644 index ce371c2a83..0000000000 --- a/models/expiration_response.go +++ /dev/null @@ -1,82 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// ExpirationResponse expiration response -// -// swagger:model expirationResponse -type ExpirationResponse struct { - - // date - Date string `json:"date,omitempty"` - - // days - Days int64 `json:"days,omitempty"` - - // delete all - DeleteAll bool `json:"delete_all,omitempty"` - - // delete marker - DeleteMarker bool `json:"delete_marker,omitempty"` - - // newer noncurrent expiration versions - NewerNoncurrentExpirationVersions int64 `json:"newer_noncurrent_expiration_versions,omitempty"` - - // noncurrent expiration days - NoncurrentExpirationDays int64 `json:"noncurrent_expiration_days,omitempty"` -} - -// Validate validates this expiration response -func (m *ExpirationResponse) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this expiration response based on context it is used -func (m *ExpirationResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *ExpirationResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *ExpirationResponse) UnmarshalBinary(b []byte) error { - var res ExpirationResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/lifecycle_tag.go b/models/lifecycle_tag.go deleted file mode 100644 index 84e9525d9d..0000000000 --- a/models/lifecycle_tag.go +++ /dev/null @@ -1,70 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// LifecycleTag lifecycle tag -// -// swagger:model lifecycleTag -type LifecycleTag struct { - - // key - Key string `json:"key,omitempty"` - - // value - Value string `json:"value,omitempty"` -} - -// Validate validates this lifecycle tag -func (m *LifecycleTag) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this lifecycle tag based on context it is used -func (m *LifecycleTag) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *LifecycleTag) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *LifecycleTag) UnmarshalBinary(b []byte) error { - var res LifecycleTag - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/multi_lifecycle_result.go b/models/multi_lifecycle_result.go deleted file mode 100644 index 25889c2e99..0000000000 --- a/models/multi_lifecycle_result.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// MultiLifecycleResult multi lifecycle result -// -// swagger:model multiLifecycleResult -type MultiLifecycleResult struct { - - // results - Results []*MulticycleResultItem `json:"results"` -} - -// Validate validates this multi lifecycle result -func (m *MultiLifecycleResult) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateResults(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *MultiLifecycleResult) validateResults(formats strfmt.Registry) error { - if swag.IsZero(m.Results) { // not required - return nil - } - - for i := 0; i < len(m.Results); i++ { - if swag.IsZero(m.Results[i]) { // not required - continue - } - - if m.Results[i] != nil { - if err := m.Results[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("results" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("results" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this multi lifecycle result based on the context it is used -func (m *MultiLifecycleResult) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateResults(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *MultiLifecycleResult) contextValidateResults(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Results); i++ { - - if m.Results[i] != nil { - - if swag.IsZero(m.Results[i]) { // not required - return nil - } - - if err := m.Results[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("results" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("results" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *MultiLifecycleResult) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *MultiLifecycleResult) UnmarshalBinary(b []byte) error { - var res MultiLifecycleResult - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/multicycle_result_item.go b/models/multicycle_result_item.go deleted file mode 100644 index aafdb5ac79..0000000000 --- a/models/multicycle_result_item.go +++ /dev/null @@ -1,70 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// MulticycleResultItem multicycle result item -// -// swagger:model multicycleResultItem -type MulticycleResultItem struct { - - // bucket name - BucketName string `json:"bucketName,omitempty"` - - // error - Error string `json:"error,omitempty"` -} - -// Validate validates this multicycle result item -func (m *MulticycleResultItem) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this multicycle result item based on context it is used -func (m *MulticycleResultItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *MulticycleResultItem) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *MulticycleResultItem) UnmarshalBinary(b []byte) error { - var res MulticycleResultItem - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/object_bucket_lifecycle.go b/models/object_bucket_lifecycle.go deleted file mode 100644 index 09d7ab7995..0000000000 --- a/models/object_bucket_lifecycle.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// ObjectBucketLifecycle object bucket lifecycle -// -// swagger:model objectBucketLifecycle -type ObjectBucketLifecycle struct { - - // expiration - Expiration *ExpirationResponse `json:"expiration,omitempty"` - - // id - ID string `json:"id,omitempty"` - - // prefix - Prefix string `json:"prefix,omitempty"` - - // status - Status string `json:"status,omitempty"` - - // tags - Tags []*LifecycleTag `json:"tags"` - - // transition - Transition *TransitionResponse `json:"transition,omitempty"` -} - -// Validate validates this object bucket lifecycle -func (m *ObjectBucketLifecycle) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateExpiration(formats); err != nil { - res = append(res, err) - } - - if err := m.validateTags(formats); err != nil { - res = append(res, err) - } - - if err := m.validateTransition(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *ObjectBucketLifecycle) validateExpiration(formats strfmt.Registry) error { - if swag.IsZero(m.Expiration) { // not required - return nil - } - - if m.Expiration != nil { - if err := m.Expiration.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("expiration") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("expiration") - } - return err - } - } - - return nil -} - -func (m *ObjectBucketLifecycle) validateTags(formats strfmt.Registry) error { - if swag.IsZero(m.Tags) { // not required - return nil - } - - for i := 0; i < len(m.Tags); i++ { - if swag.IsZero(m.Tags[i]) { // not required - continue - } - - if m.Tags[i] != nil { - if err := m.Tags[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("tags" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("tags" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *ObjectBucketLifecycle) validateTransition(formats strfmt.Registry) error { - if swag.IsZero(m.Transition) { // not required - return nil - } - - if m.Transition != nil { - if err := m.Transition.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("transition") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("transition") - } - return err - } - } - - return nil -} - -// ContextValidate validate this object bucket lifecycle based on the context it is used -func (m *ObjectBucketLifecycle) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateExpiration(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateTags(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateTransition(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *ObjectBucketLifecycle) contextValidateExpiration(ctx context.Context, formats strfmt.Registry) error { - - if m.Expiration != nil { - - if swag.IsZero(m.Expiration) { // not required - return nil - } - - if err := m.Expiration.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("expiration") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("expiration") - } - return err - } - } - - return nil -} - -func (m *ObjectBucketLifecycle) contextValidateTags(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Tags); i++ { - - if m.Tags[i] != nil { - - if swag.IsZero(m.Tags[i]) { // not required - return nil - } - - if err := m.Tags[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("tags" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("tags" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *ObjectBucketLifecycle) contextValidateTransition(ctx context.Context, formats strfmt.Registry) error { - - if m.Transition != nil { - - if swag.IsZero(m.Transition) { // not required - return nil - } - - if err := m.Transition.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("transition") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("transition") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *ObjectBucketLifecycle) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *ObjectBucketLifecycle) UnmarshalBinary(b []byte) error { - var res ObjectBucketLifecycle - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/tier.go b/models/tier.go deleted file mode 100644 index 0034ca1955..0000000000 --- a/models/tier.go +++ /dev/null @@ -1,343 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "encoding/json" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// Tier tier -// -// swagger:model tier -type Tier struct { - - // azure - Azure *TierAzure `json:"azure,omitempty"` - - // gcs - Gcs *TierGcs `json:"gcs,omitempty"` - - // minio - Minio *TierMinio `json:"minio,omitempty"` - - // s3 - S3 *TierS3 `json:"s3,omitempty"` - - // status - Status bool `json:"status,omitempty"` - - // type - // Enum: [s3 gcs azure minio unsupported] - Type string `json:"type,omitempty"` -} - -// Validate validates this tier -func (m *Tier) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateAzure(formats); err != nil { - res = append(res, err) - } - - if err := m.validateGcs(formats); err != nil { - res = append(res, err) - } - - if err := m.validateMinio(formats); err != nil { - res = append(res, err) - } - - if err := m.validateS3(formats); err != nil { - res = append(res, err) - } - - if err := m.validateType(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *Tier) validateAzure(formats strfmt.Registry) error { - if swag.IsZero(m.Azure) { // not required - return nil - } - - if m.Azure != nil { - if err := m.Azure.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("azure") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("azure") - } - return err - } - } - - return nil -} - -func (m *Tier) validateGcs(formats strfmt.Registry) error { - if swag.IsZero(m.Gcs) { // not required - return nil - } - - if m.Gcs != nil { - if err := m.Gcs.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("gcs") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("gcs") - } - return err - } - } - - return nil -} - -func (m *Tier) validateMinio(formats strfmt.Registry) error { - if swag.IsZero(m.Minio) { // not required - return nil - } - - if m.Minio != nil { - if err := m.Minio.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("minio") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("minio") - } - return err - } - } - - return nil -} - -func (m *Tier) validateS3(formats strfmt.Registry) error { - if swag.IsZero(m.S3) { // not required - return nil - } - - if m.S3 != nil { - if err := m.S3.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("s3") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("s3") - } - return err - } - } - - return nil -} - -var tierTypeTypePropEnum []interface{} - -func init() { - var res []string - if err := json.Unmarshal([]byte(`["s3","gcs","azure","minio","unsupported"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - tierTypeTypePropEnum = append(tierTypeTypePropEnum, v) - } -} - -const ( - - // TierTypeS3 captures enum value "s3" - TierTypeS3 string = "s3" - - // TierTypeGcs captures enum value "gcs" - TierTypeGcs string = "gcs" - - // TierTypeAzure captures enum value "azure" - TierTypeAzure string = "azure" - - // TierTypeMinio captures enum value "minio" - TierTypeMinio string = "minio" - - // TierTypeUnsupported captures enum value "unsupported" - TierTypeUnsupported string = "unsupported" -) - -// prop value enum -func (m *Tier) validateTypeEnum(path, location string, value string) error { - if err := validate.EnumCase(path, location, value, tierTypeTypePropEnum, true); err != nil { - return err - } - return nil -} - -func (m *Tier) validateType(formats strfmt.Registry) error { - if swag.IsZero(m.Type) { // not required - return nil - } - - // value enum - if err := m.validateTypeEnum("type", "body", m.Type); err != nil { - return err - } - - return nil -} - -// ContextValidate validate this tier based on the context it is used -func (m *Tier) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateAzure(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateGcs(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateMinio(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateS3(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *Tier) contextValidateAzure(ctx context.Context, formats strfmt.Registry) error { - - if m.Azure != nil { - - if swag.IsZero(m.Azure) { // not required - return nil - } - - if err := m.Azure.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("azure") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("azure") - } - return err - } - } - - return nil -} - -func (m *Tier) contextValidateGcs(ctx context.Context, formats strfmt.Registry) error { - - if m.Gcs != nil { - - if swag.IsZero(m.Gcs) { // not required - return nil - } - - if err := m.Gcs.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("gcs") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("gcs") - } - return err - } - } - - return nil -} - -func (m *Tier) contextValidateMinio(ctx context.Context, formats strfmt.Registry) error { - - if m.Minio != nil { - - if swag.IsZero(m.Minio) { // not required - return nil - } - - if err := m.Minio.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("minio") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("minio") - } - return err - } - } - - return nil -} - -func (m *Tier) contextValidateS3(ctx context.Context, formats strfmt.Registry) error { - - if m.S3 != nil { - - if swag.IsZero(m.S3) { // not required - return nil - } - - if err := m.S3.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("s3") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("s3") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *Tier) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *Tier) UnmarshalBinary(b []byte) error { - var res Tier - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/tier_azure.go b/models/tier_azure.go deleted file mode 100644 index 08f7216c1e..0000000000 --- a/models/tier_azure.go +++ /dev/null @@ -1,94 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// TierAzure tier azure -// -// swagger:model tier_azure -type TierAzure struct { - - // accountkey - Accountkey string `json:"accountkey,omitempty"` - - // accountname - Accountname string `json:"accountname,omitempty"` - - // bucket - Bucket string `json:"bucket,omitempty"` - - // endpoint - Endpoint string `json:"endpoint,omitempty"` - - // name - Name string `json:"name,omitempty"` - - // objects - Objects string `json:"objects,omitempty"` - - // prefix - Prefix string `json:"prefix,omitempty"` - - // region - Region string `json:"region,omitempty"` - - // usage - Usage string `json:"usage,omitempty"` - - // versions - Versions string `json:"versions,omitempty"` -} - -// Validate validates this tier azure -func (m *TierAzure) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this tier azure based on context it is used -func (m *TierAzure) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *TierAzure) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *TierAzure) UnmarshalBinary(b []byte) error { - var res TierAzure - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/tier_credentials_request.go b/models/tier_credentials_request.go deleted file mode 100644 index a2a359851e..0000000000 --- a/models/tier_credentials_request.go +++ /dev/null @@ -1,73 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// TierCredentialsRequest tier credentials request -// -// swagger:model tierCredentialsRequest -type TierCredentialsRequest struct { - - // access key - AccessKey string `json:"access_key,omitempty"` - - // a base64 encoded value - Creds string `json:"creds,omitempty"` - - // secret key - SecretKey string `json:"secret_key,omitempty"` -} - -// Validate validates this tier credentials request -func (m *TierCredentialsRequest) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this tier credentials request based on context it is used -func (m *TierCredentialsRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *TierCredentialsRequest) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *TierCredentialsRequest) UnmarshalBinary(b []byte) error { - var res TierCredentialsRequest - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/tier_gcs.go b/models/tier_gcs.go deleted file mode 100644 index 8ba5b7cab3..0000000000 --- a/models/tier_gcs.go +++ /dev/null @@ -1,91 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// TierGcs tier gcs -// -// swagger:model tier_gcs -type TierGcs struct { - - // bucket - Bucket string `json:"bucket,omitempty"` - - // creds - Creds string `json:"creds,omitempty"` - - // endpoint - Endpoint string `json:"endpoint,omitempty"` - - // name - Name string `json:"name,omitempty"` - - // objects - Objects string `json:"objects,omitempty"` - - // prefix - Prefix string `json:"prefix,omitempty"` - - // region - Region string `json:"region,omitempty"` - - // usage - Usage string `json:"usage,omitempty"` - - // versions - Versions string `json:"versions,omitempty"` -} - -// Validate validates this tier gcs -func (m *TierGcs) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this tier gcs based on context it is used -func (m *TierGcs) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *TierGcs) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *TierGcs) UnmarshalBinary(b []byte) error { - var res TierGcs - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/tier_list_response.go b/models/tier_list_response.go deleted file mode 100644 index 15fd15af64..0000000000 --- a/models/tier_list_response.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// TierListResponse tier list response -// -// swagger:model tierListResponse -type TierListResponse struct { - - // items - Items []*Tier `json:"items"` -} - -// Validate validates this tier list response -func (m *TierListResponse) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateItems(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *TierListResponse) validateItems(formats strfmt.Registry) error { - if swag.IsZero(m.Items) { // not required - return nil - } - - for i := 0; i < len(m.Items); i++ { - if swag.IsZero(m.Items[i]) { // not required - continue - } - - if m.Items[i] != nil { - if err := m.Items[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("items" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("items" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this tier list response based on the context it is used -func (m *TierListResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateItems(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *TierListResponse) contextValidateItems(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Items); i++ { - - if m.Items[i] != nil { - - if swag.IsZero(m.Items[i]) { // not required - return nil - } - - if err := m.Items[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("items" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("items" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *TierListResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *TierListResponse) UnmarshalBinary(b []byte) error { - var res TierListResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/tier_minio.go b/models/tier_minio.go deleted file mode 100644 index 8b31814106..0000000000 --- a/models/tier_minio.go +++ /dev/null @@ -1,97 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// TierMinio tier minio -// -// swagger:model tier_minio -type TierMinio struct { - - // accesskey - Accesskey string `json:"accesskey,omitempty"` - - // bucket - Bucket string `json:"bucket,omitempty"` - - // endpoint - Endpoint string `json:"endpoint,omitempty"` - - // name - Name string `json:"name,omitempty"` - - // objects - Objects string `json:"objects,omitempty"` - - // prefix - Prefix string `json:"prefix,omitempty"` - - // region - Region string `json:"region,omitempty"` - - // secretkey - Secretkey string `json:"secretkey,omitempty"` - - // storageclass - Storageclass string `json:"storageclass,omitempty"` - - // usage - Usage string `json:"usage,omitempty"` - - // versions - Versions string `json:"versions,omitempty"` -} - -// Validate validates this tier minio -func (m *TierMinio) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this tier minio based on context it is used -func (m *TierMinio) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *TierMinio) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *TierMinio) UnmarshalBinary(b []byte) error { - var res TierMinio - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/tier_s3.go b/models/tier_s3.go deleted file mode 100644 index 165f7ef125..0000000000 --- a/models/tier_s3.go +++ /dev/null @@ -1,97 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// TierS3 tier s3 -// -// swagger:model tier_s3 -type TierS3 struct { - - // accesskey - Accesskey string `json:"accesskey,omitempty"` - - // bucket - Bucket string `json:"bucket,omitempty"` - - // endpoint - Endpoint string `json:"endpoint,omitempty"` - - // name - Name string `json:"name,omitempty"` - - // objects - Objects string `json:"objects,omitempty"` - - // prefix - Prefix string `json:"prefix,omitempty"` - - // region - Region string `json:"region,omitempty"` - - // secretkey - Secretkey string `json:"secretkey,omitempty"` - - // storageclass - Storageclass string `json:"storageclass,omitempty"` - - // usage - Usage string `json:"usage,omitempty"` - - // versions - Versions string `json:"versions,omitempty"` -} - -// Validate validates this tier s3 -func (m *TierS3) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this tier s3 based on context it is used -func (m *TierS3) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *TierS3) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *TierS3) UnmarshalBinary(b []byte) error { - var res TierS3 - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/tiers_name_list_response.go b/models/tiers_name_list_response.go deleted file mode 100644 index 8ff1359a07..0000000000 --- a/models/tiers_name_list_response.go +++ /dev/null @@ -1,67 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// TiersNameListResponse tiers name list response -// -// swagger:model tiersNameListResponse -type TiersNameListResponse struct { - - // items - Items []string `json:"items"` -} - -// Validate validates this tiers name list response -func (m *TiersNameListResponse) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this tiers name list response based on context it is used -func (m *TiersNameListResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *TiersNameListResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *TiersNameListResponse) UnmarshalBinary(b []byte) error { - var res TiersNameListResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/transition_response.go b/models/transition_response.go deleted file mode 100644 index 2ce805f180..0000000000 --- a/models/transition_response.go +++ /dev/null @@ -1,79 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// TransitionResponse transition response -// -// swagger:model transitionResponse -type TransitionResponse struct { - - // date - Date string `json:"date,omitempty"` - - // days - Days int64 `json:"days,omitempty"` - - // noncurrent storage class - NoncurrentStorageClass string `json:"noncurrent_storage_class,omitempty"` - - // noncurrent transition days - NoncurrentTransitionDays int64 `json:"noncurrent_transition_days,omitempty"` - - // storage class - StorageClass string `json:"storage_class,omitempty"` -} - -// Validate validates this transition response -func (m *TransitionResponse) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this transition response based on context it is used -func (m *TransitionResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *TransitionResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *TransitionResponse) UnmarshalBinary(b []byte) error { - var res TransitionResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/update_bucket_lifecycle.go b/models/update_bucket_lifecycle.go deleted file mode 100644 index 0e862998a2..0000000000 --- a/models/update_bucket_lifecycle.go +++ /dev/null @@ -1,157 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "encoding/json" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// UpdateBucketLifecycle update bucket lifecycle -// -// swagger:model updateBucketLifecycle -type UpdateBucketLifecycle struct { - - // Non required, toggle to disable or enable rule - Disable bool `json:"disable,omitempty"` - - // Non required, toggle to disable or enable rule - ExpiredObjectDeleteAll bool `json:"expired_object_delete_all,omitempty"` - - // Non required, toggle to disable or enable rule - ExpiredObjectDeleteMarker bool `json:"expired_object_delete_marker,omitempty"` - - // Required in case of expiry_date or transition fields are not set. it defines an expiry days for ILM - ExpiryDays int32 `json:"expiry_days,omitempty"` - - // Non required, can be set in case of expiration is enabled - NoncurrentversionExpirationDays int32 `json:"noncurrentversion_expiration_days,omitempty"` - - // Non required, can be set in case of transition is enabled - NoncurrentversionTransitionDays int32 `json:"noncurrentversion_transition_days,omitempty"` - - // Non required, can be set in case of transition is enabled - NoncurrentversionTransitionStorageClass string `json:"noncurrentversion_transition_storage_class,omitempty"` - - // Non required field, it matches a prefix to perform ILM operations on it - Prefix string `json:"prefix,omitempty"` - - // Required only in case of transition is set. it refers to a tier - StorageClass string `json:"storage_class,omitempty"` - - // Non required field, tags to match ILM files - Tags string `json:"tags,omitempty"` - - // Required in case of transition_date or expiry fields are not set. it defines a transition days for ILM - TransitionDays int32 `json:"transition_days,omitempty"` - - // ILM Rule type (Expiry or transition) - // Required: true - // Enum: [expiry transition] - Type *string `json:"type"` -} - -// Validate validates this update bucket lifecycle -func (m *UpdateBucketLifecycle) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateType(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -var updateBucketLifecycleTypeTypePropEnum []interface{} - -func init() { - var res []string - if err := json.Unmarshal([]byte(`["expiry","transition"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - updateBucketLifecycleTypeTypePropEnum = append(updateBucketLifecycleTypeTypePropEnum, v) - } -} - -const ( - - // UpdateBucketLifecycleTypeExpiry captures enum value "expiry" - UpdateBucketLifecycleTypeExpiry string = "expiry" - - // UpdateBucketLifecycleTypeTransition captures enum value "transition" - UpdateBucketLifecycleTypeTransition string = "transition" -) - -// prop value enum -func (m *UpdateBucketLifecycle) validateTypeEnum(path, location string, value string) error { - if err := validate.EnumCase(path, location, value, updateBucketLifecycleTypeTypePropEnum, true); err != nil { - return err - } - return nil -} - -func (m *UpdateBucketLifecycle) validateType(formats strfmt.Registry) error { - - if err := validate.Required("type", "body", m.Type); err != nil { - return err - } - - // value enum - if err := m.validateTypeEnum("type", "body", *m.Type); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this update bucket lifecycle based on context it is used -func (m *UpdateBucketLifecycle) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *UpdateBucketLifecycle) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *UpdateBucketLifecycle) UnmarshalBinary(b []byte) error { - var res UpdateBucketLifecycle - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/swagger.yml b/swagger.yml index af3f4188fd..f19c97a312 100644 --- a/swagger.yml +++ b/swagger.yml @@ -1153,121 +1153,6 @@ paths: tags: - Bucket - /buckets/{bucket_name}/lifecycle: - get: - summary: Bucket Lifecycle - operationId: GetBucketLifecycle - parameters: - - name: bucket_name - in: path - required: true - type: string - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/bucketLifecycleResponse" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Bucket - post: - summary: Add Bucket Lifecycle - operationId: AddBucketLifecycle - parameters: - - name: bucket_name - in: path - required: true - type: string - - name: body - in: body - required: true - schema: - $ref: "#/definitions/addBucketLifecycle" - responses: - 201: - description: A successful response. - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Bucket - - /buckets/multi-lifecycle: - post: - summary: Add Multi Bucket Lifecycle - operationId: AddMultiBucketLifecycle - parameters: - - name: body - in: body - required: true - schema: - $ref: "#/definitions/addMultiBucketLifecycle" - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/multiLifecycleResult" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Bucket - - /buckets/{bucket_name}/lifecycle/{lifecycle_id}: - put: - summary: Update Lifecycle rule - operationId: UpdateBucketLifecycle - parameters: - - name: bucket_name - in: path - required: true - type: string - - name: lifecycle_id - in: path - required: true - type: string - - name: body - in: body - required: true - schema: - $ref: "#/definitions/updateBucketLifecycle" - responses: - 200: - description: A successful response. - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Bucket - - delete: - summary: Delete Lifecycle rule - operationId: DeleteBucketLifecycleRule - parameters: - - name: bucket_name - in: path - required: true - type: string - - name: lifecycle_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}/rewind/{date}: get: summary: Get objects in a bucket for a rewind date @@ -2394,137 +2279,6 @@ paths: tags: - Configuration - /admin/tiers: - get: - summary: Returns a list of tiers for ilm - operationId: TiersList - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/tierListResponse" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Tiering - post: - summary: Allows to configure a new tier - operationId: AddTier - parameters: - - name: body - in: body - required: true - schema: - $ref: "#/definitions/tier" - responses: - 201: - description: A successful response. - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Tiering - - /admin/tiers/names: - get: - summary: Returns a list of tiers' names for ilm - operationId: TiersListNames - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/tiersNameListResponse" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Tiering - - /admin/tiers/{type}/{name}: - get: - summary: Get Tier - operationId: GetTier - parameters: - - name: type - in: path - required: true - type: string - enum: - - s3 - - gcs - - azure - - minio - - name: name - in: path - required: true - type: string - responses: - 200: - description: A successful response. - schema: - $ref: "#/definitions/tier" - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Tiering - - /admin/tiers/{type}/{name}/credentials: - put: - summary: Edit Tier Credentials - operationId: EditTierCredentials - parameters: - - name: type - in: path - required: true - type: string - enum: - - s3 - - gcs - - azure - - minio - - name: name - in: path - required: true - type: string - - name: body - in: body - required: true - schema: - $ref: "#/definitions/tierCredentialsRequest" - responses: - 200: - description: A successful response. - default: - description: Generic error response. - schema: - $ref: "#/definitions/ApiError" - tags: - - Tiering - /admin/tiers/{name}/remove: - delete: - summary: Remove Tier - operationId: RemoveTier - 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: - - Tiering - /nodes: get: summary: Lists Nodes @@ -4601,254 +4355,6 @@ definitions: type: integer format: int32 - bucketLifecycleResponse: - type: object - properties: - lifecycle: - type: array - items: - $ref: "#/definitions/objectBucketLifecycle" - - expirationResponse: - type: object - properties: - date: - type: string - days: - type: integer - format: int64 - delete_marker: - type: boolean - delete_all: - type: boolean - noncurrent_expiration_days: - type: integer - format: int64 - newer_noncurrent_expiration_versions: - type: integer - format: int64 - - transitionResponse: - type: object - properties: - date: - type: string - storage_class: - type: string - days: - type: integer - format: int64 - noncurrent_transition_days: - type: integer - format: int64 - noncurrent_storage_class: - type: string - - lifecycleTag: - type: object - properties: - key: - type: string - value: - type: string - - objectBucketLifecycle: - type: object - properties: - id: - type: string - prefix: - type: string - status: - type: string - expiration: - $ref: "#/definitions/expirationResponse" - transition: - $ref: "#/definitions/transitionResponse" - tags: - type: array - items: - $ref: "#/definitions/lifecycleTag" - - addBucketLifecycle: - type: object - properties: - type: - description: ILM Rule type (Expiry or transition) - type: string - enum: - - expiry - - transition - prefix: - description: Non required field, it matches a prefix to perform ILM operations on it - type: string - tags: - description: Non required field, tags to match ILM files - type: string - expiry_days: - description: Required in case of expiry_date or transition fields are not set. it defines an expiry days for ILM - type: integer - format: int32 - default: 0 - transition_days: - description: Required in case of transition_date or expiry fields are not set. it defines a transition days for ILM - type: integer - format: int32 - default: 0 - storage_class: - description: Required only in case of transition is set. it refers to a tier - type: string - disable: - description: Non required, toggle to disable or enable rule - type: boolean - expired_object_delete_marker: - description: Non required, toggle to disable or enable rule - type: boolean - expired_object_delete_all: - description: Non required, toggle to disable or enable rule - type: boolean - noncurrentversion_expiration_days: - description: Non required, can be set in case of expiration is enabled - type: integer - format: int32 - default: 0 - noncurrentversion_transition_days: - description: Non required, can be set in case of transition is enabled - type: integer - format: int32 - default: 0 - newer_noncurrentversion_expiration_versions: - description: Non required, can be set in case of expiration is enabled - type: integer - format: int32 - default: 0 - noncurrentversion_transition_storage_class: - description: Non required, can be set in case of transition is enabled - type: string - - updateBucketLifecycle: - type: object - required: - - type - properties: - type: - description: ILM Rule type (Expiry or transition) - type: string - enum: - - expiry - - transition - prefix: - description: Non required field, it matches a prefix to perform ILM operations on it - type: string - tags: - description: Non required field, tags to match ILM files - type: string - expiry_days: - description: Required in case of expiry_date or transition fields are not set. it defines an expiry days for ILM - type: integer - format: int32 - default: 0 - transition_days: - description: Required in case of transition_date or expiry fields are not set. it defines a transition days for ILM - type: integer - format: int32 - default: 0 - storage_class: - description: Required only in case of transition is set. it refers to a tier - type: string - disable: - description: Non required, toggle to disable or enable rule - type: boolean - expired_object_delete_marker: - description: Non required, toggle to disable or enable rule - type: boolean - expired_object_delete_all: - description: Non required, toggle to disable or enable rule - type: boolean - noncurrentversion_expiration_days: - description: Non required, can be set in case of expiration is enabled - type: integer - format: int32 - default: 0 - noncurrentversion_transition_days: - description: Non required, can be set in case of transition is enabled - type: integer - format: int32 - default: 0 - noncurrentversion_transition_storage_class: - description: Non required, can be set in case of transition is enabled - type: string - - addMultiBucketLifecycle: - type: object - required: - - buckets - - type - properties: - buckets: - type: array - items: - type: string - type: - description: ILM Rule type (Expiry or transition) - type: string - enum: - - expiry - - transition - prefix: - description: Non required field, it matches a prefix to perform ILM operations on it - type: string - tags: - description: Non required field, tags to match ILM files - type: string - expiry_days: - description: Required in case of expiry_date or transition fields are not set. it defines an expiry days for ILM - type: integer - format: int32 - default: 0 - transition_days: - description: Required in case of transition_date or expiry fields are not set. it defines a transition days for ILM - type: integer - format: int32 - default: 0 - storage_class: - description: Required only in case of transition is set. it refers to a tier - type: string - expired_object_delete_marker: - description: Non required, toggle to disable or enable rule - type: boolean - expired_object_delete_all: - description: Non required, toggle to disable or enable rule - type: boolean - noncurrentversion_expiration_days: - description: Non required, can be set in case of expiration is enabled - type: integer - format: int32 - default: 0 - noncurrentversion_transition_days: - description: Non required, can be set in case of transition is enabled - type: integer - format: int32 - default: 0 - noncurrentversion_transition_storage_class: - description: Non required, can be set in case of transition is enabled - type: string - - multicycleResultItem: - type: object - properties: - bucketName: - type: string - error: - type: string - - multiLifecycleResult: - properties: - results: - type: array - items: - $ref: "#/definitions/multicycleResultItem" - prefixAccessPair: type: object properties: @@ -4910,104 +4416,6 @@ definitions: bucket_name: type: string - tier_s3: - type: object - properties: - name: - type: string - endpoint: - type: string - accesskey: - type: string - secretkey: - type: string - bucket: - type: string - prefix: - type: string - region: - type: string - storageclass: - type: string - usage: - type: string - objects: - type: string - versions: - type: string - - tier_minio: - type: object - properties: - name: - type: string - endpoint: - type: string - accesskey: - type: string - secretkey: - type: string - bucket: - type: string - prefix: - type: string - region: - type: string - storageclass: - type: string - usage: - type: string - objects: - type: string - versions: - type: string - - tier_azure: - type: object - properties: - name: - type: string - endpoint: - type: string - accountname: - type: string - accountkey: - type: string - bucket: - type: string - prefix: - type: string - region: - type: string - usage: - type: string - objects: - type: string - versions: - type: string - - tier_gcs: - type: object - properties: - name: - type: string - endpoint: - type: string - creds: - type: string - bucket: - type: string - prefix: - type: string - region: - type: string - usage: - type: string - objects: - type: string - versions: - type: string - deleteFile: type: object properties: @@ -5028,59 +4436,6 @@ definitions: recursive: type: boolean - tier: - type: object - properties: - status: - type: boolean - type: - type: string - enum: - - s3 - - gcs - - azure - - minio - - unsupported - s3: - type: object - $ref: "#/definitions/tier_s3" - gcs: - type: object - $ref: "#/definitions/tier_gcs" - azure: - type: object - $ref: "#/definitions/tier_azure" - minio: - type: object - $ref: "#/definitions/tier_minio" - - tierListResponse: - type: object - properties: - items: - type: array - items: - $ref: "#/definitions/tier" - - tiersNameListResponse: - type: object - properties: - items: - type: array - items: - type: string - - tierCredentialsRequest: - type: object - properties: - access_key: - type: string - secret_key: - type: string - creds: - type: string - description: a base64 encoded value - rewindItem: type: object properties: diff --git a/web-app/src/api/consoleApi.ts b/web-app/src/api/consoleApi.ts index e780cd271c..7dbc7fde16 100644 --- a/web-app/src/api/consoleApi.ts +++ b/web-app/src/api/consoleApi.ts @@ -468,11 +468,7 @@ export interface SetBucketQuota { } export interface LoginDetails { - loginStrategy?: - | "form" - | "redirect" - | "service-account" - | "redirect-service-account"; + loginStrategy?: "form" | "redirect" | "service-account" | "redirect-service-account"; redirectRules?: RedirectRule[]; isK8S?: boolean; animatedLogin?: boolean; @@ -894,189 +890,6 @@ export interface GetBucketRetentionConfig { validity?: number; } -export interface BucketLifecycleResponse { - lifecycle?: ObjectBucketLifecycle[]; -} - -export interface ExpirationResponse { - date?: string; - /** @format int64 */ - days?: number; - delete_marker?: boolean; - delete_all?: boolean; - /** @format int64 */ - noncurrent_expiration_days?: number; - /** @format int64 */ - newer_noncurrent_expiration_versions?: number; -} - -export interface TransitionResponse { - date?: string; - storage_class?: string; - /** @format int64 */ - days?: number; - /** @format int64 */ - noncurrent_transition_days?: number; - noncurrent_storage_class?: string; -} - -export interface LifecycleTag { - key?: string; - value?: string; -} - -export interface ObjectBucketLifecycle { - id?: string; - prefix?: string; - status?: string; - expiration?: ExpirationResponse; - transition?: TransitionResponse; - tags?: LifecycleTag[]; -} - -export interface AddBucketLifecycle { - /** ILM Rule type (Expiry or transition) */ - type?: "expiry" | "transition"; - /** Non required field, it matches a prefix to perform ILM operations on it */ - prefix?: string; - /** Non required field, tags to match ILM files */ - tags?: string; - /** - * Required in case of expiry_date or transition fields are not set. it defines an expiry days for ILM - * @format int32 - * @default 0 - */ - expiry_days?: number; - /** - * Required in case of transition_date or expiry fields are not set. it defines a transition days for ILM - * @format int32 - * @default 0 - */ - transition_days?: number; - /** Required only in case of transition is set. it refers to a tier */ - storage_class?: string; - /** Non required, toggle to disable or enable rule */ - disable?: boolean; - /** Non required, toggle to disable or enable rule */ - expired_object_delete_marker?: boolean; - /** Non required, toggle to disable or enable rule */ - expired_object_delete_all?: boolean; - /** - * Non required, can be set in case of expiration is enabled - * @format int32 - * @default 0 - */ - noncurrentversion_expiration_days?: number; - /** - * Non required, can be set in case of transition is enabled - * @format int32 - * @default 0 - */ - noncurrentversion_transition_days?: number; - /** - * Non required, can be set in case of expiration is enabled - * @format int32 - * @default 0 - */ - newer_noncurrentversion_expiration_versions?: number; - /** Non required, can be set in case of transition is enabled */ - noncurrentversion_transition_storage_class?: string; -} - -export interface UpdateBucketLifecycle { - /** ILM Rule type (Expiry or transition) */ - type: "expiry" | "transition"; - /** Non required field, it matches a prefix to perform ILM operations on it */ - prefix?: string; - /** Non required field, tags to match ILM files */ - tags?: string; - /** - * Required in case of expiry_date or transition fields are not set. it defines an expiry days for ILM - * @format int32 - * @default 0 - */ - expiry_days?: number; - /** - * Required in case of transition_date or expiry fields are not set. it defines a transition days for ILM - * @format int32 - * @default 0 - */ - transition_days?: number; - /** Required only in case of transition is set. it refers to a tier */ - storage_class?: string; - /** Non required, toggle to disable or enable rule */ - disable?: boolean; - /** Non required, toggle to disable or enable rule */ - expired_object_delete_marker?: boolean; - /** Non required, toggle to disable or enable rule */ - expired_object_delete_all?: boolean; - /** - * Non required, can be set in case of expiration is enabled - * @format int32 - * @default 0 - */ - noncurrentversion_expiration_days?: number; - /** - * Non required, can be set in case of transition is enabled - * @format int32 - * @default 0 - */ - noncurrentversion_transition_days?: number; - /** Non required, can be set in case of transition is enabled */ - noncurrentversion_transition_storage_class?: string; -} - -export interface AddMultiBucketLifecycle { - buckets: string[]; - /** ILM Rule type (Expiry or transition) */ - type: "expiry" | "transition"; - /** Non required field, it matches a prefix to perform ILM operations on it */ - prefix?: string; - /** Non required field, tags to match ILM files */ - tags?: string; - /** - * Required in case of expiry_date or transition fields are not set. it defines an expiry days for ILM - * @format int32 - * @default 0 - */ - expiry_days?: number; - /** - * Required in case of transition_date or expiry fields are not set. it defines a transition days for ILM - * @format int32 - * @default 0 - */ - transition_days?: number; - /** Required only in case of transition is set. it refers to a tier */ - storage_class?: string; - /** Non required, toggle to disable or enable rule */ - expired_object_delete_marker?: boolean; - /** Non required, toggle to disable or enable rule */ - expired_object_delete_all?: boolean; - /** - * Non required, can be set in case of expiration is enabled - * @format int32 - * @default 0 - */ - noncurrentversion_expiration_days?: number; - /** - * Non required, can be set in case of transition is enabled - * @format int32 - * @default 0 - */ - noncurrentversion_transition_days?: number; - /** Non required, can be set in case of transition is enabled */ - noncurrentversion_transition_storage_class?: string; -} - -export interface MulticycleResultItem { - bucketName?: string; - error?: string; -} - -export interface MultiLifecycleResult { - results?: MulticycleResultItem[]; -} - export interface PrefixAccessPair { prefix?: string; access?: string; @@ -1116,59 +929,6 @@ export interface PolicyArgs { bucket_name?: string; } -export interface TierS3 { - name?: string; - endpoint?: string; - accesskey?: string; - secretkey?: string; - bucket?: string; - prefix?: string; - region?: string; - storageclass?: string; - usage?: string; - objects?: string; - versions?: string; -} - -export interface TierMinio { - name?: string; - endpoint?: string; - accesskey?: string; - secretkey?: string; - bucket?: string; - prefix?: string; - region?: string; - storageclass?: string; - usage?: string; - objects?: string; - versions?: string; -} - -export interface TierAzure { - name?: string; - endpoint?: string; - accountname?: string; - accountkey?: string; - bucket?: string; - prefix?: string; - region?: string; - usage?: string; - objects?: string; - versions?: string; -} - -export interface TierGcs { - name?: string; - endpoint?: string; - creds?: string; - bucket?: string; - prefix?: string; - region?: string; - usage?: string; - objects?: string; - versions?: string; -} - export interface DeleteFile { path?: string; versionID?: string; @@ -1181,30 +941,6 @@ export interface UserSAs { recursive?: boolean; } -export interface Tier { - status?: boolean; - type?: "s3" | "gcs" | "azure" | "minio" | "unsupported"; - s3?: TierS3; - gcs?: TierGcs; - azure?: TierAzure; - minio?: TierMinio; -} - -export interface TierListResponse { - items?: Tier[]; -} - -export interface TiersNameListResponse { - items?: string[]; -} - -export interface TierCredentialsRequest { - access_key?: string; - secret_key?: string; - /** a base64 encoded value */ - creds?: string; -} - export interface RewindItem { last_modified?: string; /** @format int64 */ @@ -1469,22 +1205,16 @@ export interface FullRequestParams extends Omit { cancelToken?: CancelToken; } -export type RequestParams = Omit< - FullRequestParams, - "body" | "method" | "query" | "path" ->; +export type RequestParams = Omit; export interface ApiConfig { baseUrl?: string; baseApiParams?: Omit; - securityWorker?: ( - securityData: SecurityDataType | null, - ) => Promise | RequestParams | void; + securityWorker?: (securityData: SecurityDataType | null) => Promise | RequestParams | void; customFetch?: typeof fetch; } -export interface HttpResponse - extends Response { +export interface HttpResponse extends Response { data: D; error: E; } @@ -1503,8 +1233,7 @@ export class HttpClient { private securityData: SecurityDataType | null = null; private securityWorker?: ApiConfig["securityWorker"]; private abortControllers = new Map(); - private customFetch = (...fetchParams: Parameters) => - fetch(...fetchParams); + private customFetch = (...fetchParams: Parameters) => fetch(...fetchParams); private baseApiParams: RequestParams = { credentials: "same-origin", @@ -1537,15 +1266,9 @@ export class HttpClient { protected toQueryString(rawQuery?: QueryParamsType): string { const query = rawQuery || {}; - const keys = Object.keys(query).filter( - (key) => "undefined" !== typeof query[key], - ); + const keys = Object.keys(query).filter((key) => "undefined" !== typeof query[key]); return keys - .map((key) => - Array.isArray(query[key]) - ? this.addArrayQueryParam(query, key) - : this.addQueryParam(query, key), - ) + .map((key) => (Array.isArray(query[key]) ? this.addArrayQueryParam(query, key) : this.addQueryParam(query, key))) .join("&"); } @@ -1556,13 +1279,8 @@ export class HttpClient { private contentFormatters: Record any> = { [ContentType.Json]: (input: any) => - input !== null && (typeof input === "object" || typeof input === "string") - ? JSON.stringify(input) - : input, - [ContentType.Text]: (input: any) => - input !== null && typeof input !== "string" - ? JSON.stringify(input) - : input, + input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, + [ContentType.Text]: (input: any) => (input !== null && typeof input !== "string" ? JSON.stringify(input) : input), [ContentType.FormData]: (input: any) => Object.keys(input || {}).reduce((formData, key) => { const property = input[key]; @@ -1579,10 +1297,7 @@ export class HttpClient { [ContentType.UrlEncoded]: (input: any) => this.toQueryString(input), }; - protected mergeRequestParams( - params1: RequestParams, - params2?: RequestParams, - ): RequestParams { + protected mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams { return { ...this.baseApiParams, ...params1, @@ -1595,9 +1310,7 @@ export class HttpClient { }; } - protected createAbortSignal = ( - cancelToken: CancelToken, - ): AbortSignal | undefined => { + protected createAbortSignal = (cancelToken: CancelToken): AbortSignal | undefined => { if (this.abortControllers.has(cancelToken)) { const abortController = this.abortControllers.get(cancelToken); if (abortController) { @@ -1641,26 +1354,15 @@ export class HttpClient { const payloadFormatter = this.contentFormatters[type || ContentType.Json]; const responseFormat = format || requestParams.format; - return this.customFetch( - `${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, - { - ...requestParams, - headers: { - ...(requestParams.headers || {}), - ...(type && type !== ContentType.FormData - ? { "Content-Type": type } - : {}), - }, - signal: - (cancelToken - ? this.createAbortSignal(cancelToken) - : requestParams.signal) || null, - body: - typeof body === "undefined" || body === null - ? null - : payloadFormatter(body), + return this.customFetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, { + ...requestParams, + headers: { + ...(requestParams.headers || {}), + ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - ).then(async (response) => { + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, + body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), + }).then(async (response) => { const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; @@ -1696,9 +1398,7 @@ export class HttpClient { * @version 0.1.0 * @baseUrl /api/v1 */ -export class Api< - SecurityDataType extends unknown, -> extends HttpClient { +export class Api extends HttpClient { login = { /** * No description @@ -1741,10 +1441,7 @@ export class Api< * @summary Identity Provider oauth2 callback endpoint. * @request POST:/login/oauth2/auth */ - loginOauth2Auth: ( - body: LoginOauth2AuthRequest, - params: RequestParams = {}, - ) => + loginOauth2Auth: (body: LoginOauth2AuthRequest, params: RequestParams = {}) => this.request({ path: `/login/oauth2/auth`, method: "POST", @@ -1802,10 +1499,7 @@ export class Api< * @request POST:/account/change-password * @secure */ - accountChangePassword: ( - body: AccountChangePasswordRequest, - params: RequestParams = {}, - ) => + accountChangePassword: (body: AccountChangePasswordRequest, params: RequestParams = {}) => this.request({ path: `/account/change-password`, method: "POST", @@ -1824,10 +1518,7 @@ export class Api< * @request POST:/account/change-user-password * @secure */ - changeUserPassword: ( - body: ChangeUserPasswordRequest, - params: RequestParams = {}, - ) => + changeUserPassword: (body: ChangeUserPasswordRequest, params: RequestParams = {}) => this.request({ path: `/account/change-user-password`, method: "POST", @@ -1920,10 +1611,7 @@ export class Api< * @request GET:/buckets/{bucket_name}/retention * @secure */ - getBucketRetentionConfig: ( - bucketName: string, - params: RequestParams = {}, - ) => + getBucketRetentionConfig: (bucketName: string, params: RequestParams = {}) => this.request({ path: `/buckets/${encodeURIComponent(bucketName)}/retention`, method: "GET", @@ -1941,11 +1629,7 @@ export class Api< * @request PUT:/buckets/{bucket_name}/retention * @secure */ - setBucketRetentionConfig: ( - bucketName: string, - body: PutBucketRetentionRequest, - params: RequestParams = {}, - ) => + setBucketRetentionConfig: (bucketName: string, body: PutBucketRetentionRequest, params: RequestParams = {}) => this.request({ path: `/buckets/${encodeURIComponent(bucketName)}/retention`, method: "PUT", @@ -2081,11 +1765,7 @@ export class Api< * @request POST:/buckets/{bucket_name}/objects/download-multiple * @secure */ - downloadMultipleObjects: ( - bucketName: string, - objectList: SelectedUsers, - params: RequestParams = {}, - ) => + downloadMultipleObjects: (bucketName: string, objectList: SelectedUsers, params: RequestParams = {}) => this.request({ path: `/buckets/${encodeURIComponent(bucketName)}/objects/download-multiple`, method: "POST", @@ -2320,11 +2000,7 @@ export class Api< * @request PUT:/buckets/{bucket_name}/tags * @secure */ - putBucketTags: ( - bucketName: string, - body: PutBucketTagsRequest, - params: RequestParams = {}, - ) => + putBucketTags: (bucketName: string, body: PutBucketTagsRequest, params: RequestParams = {}) => this.request({ path: `/buckets/${encodeURIComponent(bucketName)}/tags`, method: "PUT", @@ -2343,11 +2019,7 @@ export class Api< * @request PUT:/buckets/{name}/set-policy * @secure */ - bucketSetPolicy: ( - name: string, - body: SetBucketPolicyRequest, - params: RequestParams = {}, - ) => + bucketSetPolicy: (name: string, body: SetBucketPolicyRequest, params: RequestParams = {}) => this.request({ path: `/buckets/${encodeURIComponent(name)}/set-policy`, method: "PUT", @@ -2385,11 +2057,7 @@ export class Api< * @request PUT:/buckets/{name}/quota * @secure */ - setBucketQuota: ( - name: string, - body: SetBucketQuota, - params: RequestParams = {}, - ) => + setBucketQuota: (name: string, body: SetBucketQuota, params: RequestParams = {}) => this.request({ path: `/buckets/${encodeURIComponent(name)}/quota`, method: "PUT", @@ -2443,11 +2111,7 @@ export class Api< * @request POST:/buckets/{bucket_name}/events * @secure */ - createBucketEvent: ( - bucketName: string, - body: BucketEventRequest, - params: RequestParams = {}, - ) => + createBucketEvent: (bucketName: string, body: BucketEventRequest, params: RequestParams = {}) => this.request({ path: `/buckets/${encodeURIComponent(bucketName)}/events`, method: "POST", @@ -2466,12 +2130,7 @@ export class Api< * @request DELETE:/buckets/{bucket_name}/events/{arn} * @secure */ - deleteBucketEvent: ( - bucketName: string, - arn: string, - body: NotificationDeleteRequest, - params: RequestParams = {}, - ) => + deleteBucketEvent: (bucketName: string, arn: string, body: NotificationDeleteRequest, params: RequestParams = {}) => this.request({ path: `/buckets/${encodeURIComponent(bucketName)}/events/${encodeURIComponent(arn)}`, method: "DELETE", @@ -2508,11 +2167,7 @@ export class Api< * @request GET:/buckets/{bucket_name}/replication/{rule_id} * @secure */ - getBucketReplicationRule: ( - bucketName: string, - ruleId: string, - params: RequestParams = {}, - ) => + getBucketReplicationRule: (bucketName: string, ruleId: string, params: RequestParams = {}) => this.request({ path: `/buckets/${encodeURIComponent(bucketName)}/replication/${encodeURIComponent(ruleId)}`, method: "GET", @@ -2554,11 +2209,7 @@ export class Api< * @request DELETE:/buckets/{bucket_name}/replication/{rule_id} * @secure */ - deleteBucketReplicationRule: ( - bucketName: string, - ruleId: string, - params: RequestParams = {}, - ) => + deleteBucketReplicationRule: (bucketName: string, ruleId: string, params: RequestParams = {}) => this.request({ path: `/buckets/${encodeURIComponent(bucketName)}/replication/${encodeURIComponent(ruleId)}`, method: "DELETE", @@ -2575,10 +2226,7 @@ export class Api< * @request DELETE:/buckets/{bucket_name}/delete-all-replication-rules * @secure */ - deleteAllReplicationRules: ( - bucketName: string, - params: RequestParams = {}, - ) => + deleteAllReplicationRules: (bucketName: string, params: RequestParams = {}) => this.request({ path: `/buckets/${encodeURIComponent(bucketName)}/delete-all-replication-rules`, method: "DELETE", @@ -2636,11 +2284,7 @@ export class Api< * @request PUT:/buckets/{bucket_name}/versioning * @secure */ - setBucketVersioning: ( - bucketName: string, - body: SetBucketVersioning, - params: RequestParams = {}, - ) => + setBucketVersioning: (bucketName: string, body: SetBucketVersioning, params: RequestParams = {}) => this.request({ path: `/buckets/${encodeURIComponent(bucketName)}/versioning`, method: "PUT", @@ -2659,10 +2303,7 @@ export class Api< * @request GET:/buckets/{bucket_name}/object-locking * @secure */ - getBucketObjectLockingStatus: ( - bucketName: string, - params: RequestParams = {}, - ) => + getBucketObjectLockingStatus: (bucketName: string, params: RequestParams = {}) => this.request({ path: `/buckets/${encodeURIComponent(bucketName)}/object-locking`, method: "GET", @@ -2680,11 +2321,7 @@ export class Api< * @request POST:/buckets/{bucket_name}/encryption/enable * @secure */ - enableBucketEncryption: ( - bucketName: string, - body: BucketEncryptionRequest, - params: RequestParams = {}, - ) => + enableBucketEncryption: (bucketName: string, body: BucketEncryptionRequest, params: RequestParams = {}) => this.request({ path: `/buckets/${encodeURIComponent(bucketName)}/encryption/enable`, method: "POST", @@ -2729,115 +2366,6 @@ export class Api< ...params, }), - /** - * No description - * - * @tags Bucket - * @name GetBucketLifecycle - * @summary Bucket Lifecycle - * @request GET:/buckets/{bucket_name}/lifecycle - * @secure - */ - getBucketLifecycle: (bucketName: string, params: RequestParams = {}) => - this.request({ - path: `/buckets/${encodeURIComponent(bucketName)}/lifecycle`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Bucket - * @name AddBucketLifecycle - * @summary Add Bucket Lifecycle - * @request POST:/buckets/{bucket_name}/lifecycle - * @secure - */ - addBucketLifecycle: ( - bucketName: string, - body: AddBucketLifecycle, - params: RequestParams = {}, - ) => - this.request({ - path: `/buckets/${encodeURIComponent(bucketName)}/lifecycle`, - method: "POST", - body: body, - secure: true, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags Bucket - * @name AddMultiBucketLifecycle - * @summary Add Multi Bucket Lifecycle - * @request POST:/buckets/multi-lifecycle - * @secure - */ - addMultiBucketLifecycle: ( - body: AddMultiBucketLifecycle, - params: RequestParams = {}, - ) => - this.request({ - path: `/buckets/multi-lifecycle`, - method: "POST", - body: body, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Bucket - * @name UpdateBucketLifecycle - * @summary Update Lifecycle rule - * @request PUT:/buckets/{bucket_name}/lifecycle/{lifecycle_id} - * @secure - */ - updateBucketLifecycle: ( - bucketName: string, - lifecycleId: string, - body: UpdateBucketLifecycle, - params: RequestParams = {}, - ) => - this.request({ - path: `/buckets/${encodeURIComponent(bucketName)}/lifecycle/${encodeURIComponent(lifecycleId)}`, - method: "PUT", - body: body, - secure: true, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags Bucket - * @name DeleteBucketLifecycleRule - * @summary Delete Lifecycle rule - * @request DELETE:/buckets/{bucket_name}/lifecycle/{lifecycle_id} - * @secure - */ - deleteBucketLifecycleRule: ( - bucketName: string, - lifecycleId: string, - params: RequestParams = {}, - ) => - this.request({ - path: `/buckets/${encodeURIComponent(bucketName)}/lifecycle/${encodeURIComponent(lifecycleId)}`, - method: "DELETE", - secure: true, - ...params, - }), - /** * No description * @@ -2892,10 +2420,7 @@ export class Api< * @request POST:/list-external-buckets * @secure */ - listExternalBuckets: ( - body: ListExternalBucketsParams, - params: RequestParams = {}, - ) => + listExternalBuckets: (body: ListExternalBucketsParams, params: RequestParams = {}) => this.request({ path: `/list-external-buckets`, method: "POST", @@ -2916,10 +2441,7 @@ export class Api< * @request POST:/buckets-replication * @secure */ - setMultiBucketReplication: ( - body: MultiBucketReplication, - params: RequestParams = {}, - ) => + setMultiBucketReplication: (body: MultiBucketReplication, params: RequestParams = {}) => this.request({ path: `/buckets-replication`, method: "POST", @@ -2973,10 +2495,7 @@ export class Api< * @request POST:/service-accounts * @secure */ - createServiceAccount: ( - body: ServiceAccountRequest, - params: RequestParams = {}, - ) => + createServiceAccount: (body: ServiceAccountRequest, params: RequestParams = {}) => this.request({ path: `/service-accounts`, method: "POST", @@ -2995,10 +2514,7 @@ export class Api< * @request DELETE:/service-accounts/delete-multi * @secure */ - deleteMultipleServiceAccounts: ( - selectedSA: SelectedSAs, - params: RequestParams = {}, - ) => + deleteMultipleServiceAccounts: (selectedSA: SelectedSAs, params: RequestParams = {}) => this.request({ path: `/service-accounts/delete-multi`, method: "DELETE", @@ -3035,11 +2551,7 @@ export class Api< * @request PUT:/service-accounts/{access_key} * @secure */ - updateServiceAccount: ( - accessKey: string, - body: UpdateServiceAccountRequest, - params: RequestParams = {}, - ) => + updateServiceAccount: (accessKey: string, body: UpdateServiceAccountRequest, params: RequestParams = {}) => this.request({ path: `/service-accounts/${encodeURIComponent(accessKey)}`, method: "PUT", @@ -3076,10 +2588,7 @@ export class Api< * @request POST:/service-account-credentials * @secure */ - createServiceAccountCreds: ( - body: ServiceAccountRequestCreds, - params: RequestParams = {}, - ) => + createServiceAccountCreds: (body: ServiceAccountRequestCreds, params: RequestParams = {}) => this.request({ path: `/service-account-credentials`, method: "POST", @@ -3152,10 +2661,7 @@ export class Api< * @request POST:/users/service-accounts * @secure */ - checkUserServiceAccounts: ( - selectedUsers: SelectedUsers, - params: RequestParams = {}, - ) => + checkUserServiceAccounts: (selectedUsers: SelectedUsers, params: RequestParams = {}) => this.request({ path: `/users/service-accounts`, method: "POST", @@ -3194,11 +2700,7 @@ export class Api< * @request PUT:/user/{name} * @secure */ - updateUserInfo: ( - name: string, - body: UpdateUser, - params: RequestParams = {}, - ) => + updateUserInfo: (name: string, body: UpdateUser, params: RequestParams = {}) => this.request({ path: `/user/${encodeURIComponent(name)}`, method: "PUT", @@ -3235,11 +2737,7 @@ export class Api< * @request PUT:/user/{name}/groups * @secure */ - updateUserGroups: ( - name: string, - body: UpdateUserGroups, - params: RequestParams = {}, - ) => + updateUserGroups: (name: string, body: UpdateUserGroups, params: RequestParams = {}) => this.request({ path: `/user/${encodeURIComponent(name)}/groups`, method: "PUT", @@ -3313,11 +2811,7 @@ export class Api< * @request POST:/user/{name}/service-accounts * @secure */ - createAUserServiceAccount: ( - name: string, - body: ServiceAccountRequest, - params: RequestParams = {}, - ) => + createAUserServiceAccount: (name: string, body: ServiceAccountRequest, params: RequestParams = {}) => this.request({ path: `/user/${encodeURIComponent(name)}/service-accounts`, method: "POST", @@ -3336,11 +2830,7 @@ export class Api< * @request POST:/user/{name}/service-account-credentials * @secure */ - createServiceAccountCredentials: ( - name: string, - body: ServiceAccountRequestCreds, - params: RequestParams = {}, - ) => + createServiceAccountCredentials: (name: string, body: ServiceAccountRequestCreds, params: RequestParams = {}) => this.request({ path: `/user/${encodeURIComponent(name)}/service-account-credentials`, method: "POST", @@ -3468,11 +2958,7 @@ export class Api< * @request PUT:/group/{name} * @secure */ - updateGroup: ( - name: string, - body: UpdateGroupRequest, - params: RequestParams = {}, - ) => + updateGroup: (name: string, body: UpdateGroupRequest, params: RequestParams = {}) => this.request({ path: `/group/${encodeURIComponent(name)}`, method: "PUT", @@ -3618,11 +3104,7 @@ export class Api< * @request PUT:/bucket/{bucket}/access-rules * @secure */ - setAccessRuleWithBucket: ( - bucket: string, - prefixaccess: PrefixAccessPair, - params: RequestParams = {}, - ) => + setAccessRuleWithBucket: (bucket: string, prefixaccess: PrefixAccessPair, params: RequestParams = {}) => this.request({ path: `/bucket/${encodeURIComponent(bucket)}/access-rules`, method: "PUT", @@ -3676,11 +3158,7 @@ export class Api< * @request DELETE:/bucket/{bucket}/access-rules * @secure */ - deleteAccessRuleWithBucket: ( - bucket: string, - prefix: PrefixWrapper, - params: RequestParams = {}, - ) => + deleteAccessRuleWithBucket: (bucket: string, prefix: PrefixWrapper, params: RequestParams = {}) => this.request({ path: `/bucket/${encodeURIComponent(bucket)}/access-rules`, method: "DELETE", @@ -3823,11 +3301,7 @@ export class Api< * @request PUT:/configs/{name} * @secure */ - setConfig: ( - name: string, - body: SetConfigRequest, - params: RequestParams = {}, - ) => + setConfig: (name: string, body: SetConfigRequest, params: RequestParams = {}) => this.request({ path: `/configs/${encodeURIComponent(name)}`, method: "PUT", @@ -3929,10 +3403,7 @@ export class Api< * @request PUT:/set-policy-multi * @secure */ - setPolicyMultiple: ( - body: SetPolicyMultipleNameRequest, - params: RequestParams = {}, - ) => + setPolicyMultiple: (body: SetPolicyMultipleNameRequest, params: RequestParams = {}) => this.request({ path: `/set-policy-multi`, method: "PUT", @@ -4059,10 +3530,7 @@ export class Api< * @request POST:/admin/notification_endpoints * @secure */ - addNotificationEndpoint: ( - body: NotificationEndpoint, - params: RequestParams = {}, - ) => + addNotificationEndpoint: (body: NotificationEndpoint, params: RequestParams = {}) => this.request({ path: `/admin/notification_endpoints`, method: "POST", @@ -4073,124 +3541,6 @@ export class Api< ...params, }), - /** - * No description - * - * @tags Tiering - * @name TiersList - * @summary Returns a list of tiers for ilm - * @request GET:/admin/tiers - * @secure - */ - tiersList: (params: RequestParams = {}) => - this.request({ - path: `/admin/tiers`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Tiering - * @name AddTier - * @summary Allows to configure a new tier - * @request POST:/admin/tiers - * @secure - */ - addTier: (body: Tier, params: RequestParams = {}) => - this.request({ - path: `/admin/tiers`, - method: "POST", - body: body, - secure: true, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags Tiering - * @name TiersListNames - * @summary Returns a list of tiers' names for ilm - * @request GET:/admin/tiers/names - * @secure - */ - tiersListNames: (params: RequestParams = {}) => - this.request({ - path: `/admin/tiers/names`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Tiering - * @name GetTier - * @summary Get Tier - * @request GET:/admin/tiers/{type}/{name} - * @secure - */ - getTier: ( - type: "s3" | "gcs" | "azure" | "minio", - name: string, - params: RequestParams = {}, - ) => - this.request({ - path: `/admin/tiers/${encodeURIComponent(type)}/${encodeURIComponent(name)}`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Tiering - * @name EditTierCredentials - * @summary Edit Tier Credentials - * @request PUT:/admin/tiers/{type}/{name}/credentials - * @secure - */ - editTierCredentials: ( - type: "s3" | "gcs" | "azure" | "minio", - name: string, - body: TierCredentialsRequest, - params: RequestParams = {}, - ) => - this.request({ - path: `/admin/tiers/${encodeURIComponent(type)}/${encodeURIComponent(name)}/credentials`, - method: "PUT", - body: body, - secure: true, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags Tiering - * @name RemoveTier - * @summary Remove Tier - * @request DELETE:/admin/tiers/{name}/remove - * @secure - */ - removeTier: (name: string, params: RequestParams = {}) => - this.request({ - path: `/admin/tiers/${encodeURIComponent(name)}/remove`, - method: "DELETE", - secure: true, - ...params, - }), - /** * No description * @@ -4300,11 +3650,7 @@ export class Api< * @request DELETE:/remote-buckets/{source-bucket-name}/{arn} * @secure */ - deleteRemoteBucket: ( - sourceBucketName: string, - arn: string, - params: RequestParams = {}, - ) => + deleteRemoteBucket: (sourceBucketName: string, arn: string, params: RequestParams = {}) => this.request({ path: `/remote-buckets/${encodeURIComponent(sourceBucketName)}/${encodeURIComponent(arn)}`, method: "DELETE", @@ -4497,11 +3843,7 @@ export class Api< * @request POST:/idp/{type} * @secure */ - createConfiguration: ( - type: string, - body: IdpServerConfiguration, - params: RequestParams = {}, - ) => + createConfiguration: (type: string, body: IdpServerConfiguration, params: RequestParams = {}) => this.request({ path: `/idp/${encodeURIComponent(type)}`, method: "POST", @@ -4539,11 +3881,7 @@ export class Api< * @request GET:/idp/{type}/{name} * @secure */ - getConfiguration: ( - name: string, - type: string, - params: RequestParams = {}, - ) => + getConfiguration: (name: string, type: string, params: RequestParams = {}) => this.request({ path: `/idp/${encodeURIComponent(type)}/${encodeURIComponent(name)}`, method: "GET", @@ -4561,11 +3899,7 @@ export class Api< * @request DELETE:/idp/{type}/{name} * @secure */ - deleteConfiguration: ( - name: string, - type: string, - params: RequestParams = {}, - ) => + deleteConfiguration: (name: string, type: string, params: RequestParams = {}) => this.request({ path: `/idp/${encodeURIComponent(type)}/${encodeURIComponent(name)}`, method: "DELETE", @@ -4583,12 +3917,7 @@ export class Api< * @request PUT:/idp/{type}/{name} * @secure */ - updateConfiguration: ( - name: string, - type: string, - body: IdpServerConfiguration, - params: RequestParams = {}, - ) => + updateConfiguration: (name: string, type: string, body: IdpServerConfiguration, params: RequestParams = {}) => this.request({ path: `/idp/${encodeURIComponent(type)}/${encodeURIComponent(name)}`, method: "PUT", diff --git a/web-app/src/common/SecureComponent/permissions.ts b/web-app/src/common/SecureComponent/permissions.ts index 55fb5c6472..481b93f9d6 100644 --- a/web-app/src/common/SecureComponent/permissions.ts +++ b/web-app/src/common/SecureComponent/permissions.ts @@ -18,7 +18,6 @@ export 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 - BUCKET_LIFECYCLE: "BUCKET_LIFECYCLE", // can manage bucket lifecycle }; export const IAM_SCOPES = { @@ -51,8 +50,6 @@ export const IAM_SCOPES = { S3_PUT_BUCKET_NOTIFICATIONS: "s3:PutBucketNotification", S3_GET_REPLICATION_CONFIGURATION: "s3:GetReplicationConfiguration", S3_PUT_REPLICATION_CONFIGURATION: "s3:PutReplicationConfiguration", - S3_GET_LIFECYCLE_CONFIGURATION: "s3:GetLifecycleConfiguration", - S3_PUT_LIFECYCLE_CONFIGURATION: "s3:PutLifecycleConfiguration", S3_GET_BUCKET_OBJECT_LOCK_CONFIGURATION: "s3:GetBucketObjectLockConfiguration", S3_PUT_BUCKET_OBJECT_LOCK_CONFIGURATION: @@ -68,8 +65,6 @@ export const IAM_SCOPES = { ADMIN_SERVER_INFO: "admin:ServerInfo", ADMIN_GET_BUCKET_QUOTA: "admin:GetBucketQuota", ADMIN_SET_BUCKET_QUOTA: "admin:SetBucketQuota", - ADMIN_LIST_TIERS: "admin:ListTier", - ADMIN_SET_TIER: "admin:SetTier", ADMIN_LIST_GROUPS: "admin:ListGroups", S3_GET_OBJECT_VERSION_FOR_REPLICATION: "s3:GetObjectVersionForReplication", S3_REPLICATE_TAGS: "s3:ReplicateTags", @@ -194,9 +189,6 @@ export const IAM_PAGES = { EVENT_DESTINATIONS: "/settings/event-destinations", EVENT_DESTINATIONS_ADD: "/settings/event-destinations/add", EVENT_DESTINATIONS_ADD_SERVICE: "/settings/event-destinations/add/:service", - TIERS: "/settings/tiers", - TIERS_ADD: "/settings/tiers/add", - TIERS_ADD_SERVICE: "/settings/tiers/add/:service", }; // roles @@ -242,8 +234,6 @@ export const IAM_PERMISSIONS = { IAM_SCOPES.S3_BYPASS_GOVERNANCE_RETENTION, IAM_SCOPES.S3_PUT_BUCKET_POLICY, IAM_SCOPES.S3_PUT_BUCKET_NOTIFICATIONS, - IAM_SCOPES.S3_GET_LIFECYCLE_CONFIGURATION, - IAM_SCOPES.S3_PUT_LIFECYCLE_CONFIGURATION, IAM_SCOPES.S3_LIST_MULTIPART_UPLOAD_PARTS, IAM_SCOPES.S3_LISTEN_BUCKET_NOTIFICATIONS, IAM_SCOPES.S3_LISTEN_NOTIFICATIONS, @@ -267,14 +257,6 @@ export const IAM_PERMISSIONS = { IAM_SCOPES.S3_GET_ACTIONS, IAM_SCOPES.S3_PUT_ACTIONS, ], - [IAM_ROLES.BUCKET_LIFECYCLE]: [ - IAM_SCOPES.S3_GET_LIFECYCLE_CONFIGURATION, - IAM_SCOPES.S3_PUT_LIFECYCLE_CONFIGURATION, - IAM_SCOPES.S3_GET_ACTIONS, - IAM_SCOPES.S3_PUT_ACTIONS, - IAM_SCOPES.ADMIN_LIST_TIERS, - IAM_SCOPES.ADMIN_SET_TIER, - ], }; // application pages/routes and required scopes/roles @@ -366,17 +348,6 @@ export const IAM_PAGES_PERMISSIONS = { IAM_SCOPES.ADMIN_SERVER_INFO, // displays notifications endpoints IAM_SCOPES.ADMIN_CONFIG_UPDATE, // displays create notification button ], - [IAM_PAGES.TIERS]: [ - IAM_SCOPES.ADMIN_LIST_TIERS, // display tiers list - ], - [IAM_PAGES.TIERS_ADD]: [ - IAM_SCOPES.ADMIN_SET_TIER, // display "add tier" button / shows add service tier page - IAM_SCOPES.ADMIN_LIST_TIERS, // display tiers list - ], - [IAM_PAGES.TIERS_ADD_SERVICE]: [ - IAM_SCOPES.ADMIN_SET_TIER, // display "add tier" button / shows add service tier page - IAM_SCOPES.ADMIN_LIST_TIERS, // display tiers list - ], [IAM_PAGES.TOOLS_LOGS]: [IAM_SCOPES.ADMIN_GET_CONSOLE_LOG], [IAM_PAGES.TOOLS_AUDITLOGS]: [IAM_SCOPES.ADMIN_HEALTH_INFO], [IAM_PAGES.TOOLS_WATCH]: [ diff --git a/web-app/src/screens/Console/Buckets/BucketDetails/AddLifecycleModal.tsx b/web-app/src/screens/Console/Buckets/BucketDetails/AddLifecycleModal.tsx deleted file mode 100644 index b4c17b8d12..0000000000 --- a/web-app/src/screens/Console/Buckets/BucketDetails/AddLifecycleModal.tsx +++ /dev/null @@ -1,493 +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 get from "lodash/get"; -import { - Accordion, - AlertIcon, - Button, - FormLayout, - Grid, - HelpTip, - InputBox, - LifecycleConfigIcon, - ProgressBar, - RadioGroup, - Select, - Switch, -} from "mds"; -import { useSelector } from "react-redux"; -import { api } from "api"; -import { BucketVersioningResponse } from "api/consoleApi"; -import { errorToHandler } from "api/errors"; -import { modalStyleUtils } from "../../Common/FormComponents/common/styleLibrary"; -import { selDistSet, setModalErrorSnackMessage } from "../../../../systemSlice"; -import { useAppDispatch } from "../../../../store"; -import { ITiersDropDown } from "../types"; -import ModalWrapper from "../../Common/ModalWrapper/ModalWrapper"; -import QueryMultiSelector from "../../Common/FormComponents/QueryMultiSelector/QueryMultiSelector"; -import InputUnitMenu from "../../Common/FormComponents/InputUnitMenu/InputUnitMenu"; -import { IAM_PAGES } from "common/SecureComponent/permissions"; - -interface IReplicationModal { - open: boolean; - closeModalAndRefresh: (refresh: boolean) => any; - bucketName: string; -} - -const AddLifecycleModal = ({ - open, - closeModalAndRefresh, - bucketName, -}: IReplicationModal) => { - const dispatch = useAppDispatch(); - const distributedSetup = useSelector(selDistSet); - const [loadingTiers, setLoadingTiers] = useState(true); - const [tiersList, setTiersList] = useState([]); - const [addLoading, setAddLoading] = useState(false); - const [versioningInfo, setVersioningInfo] = - useState(null); - const [prefix, setPrefix] = useState(""); - const [tags, setTags] = useState(""); - const [storageClass, setStorageClass] = useState(""); - - const [ilmType, setIlmType] = useState<"expiry" | "transition">("expiry"); - const [targetVersion, setTargetVersion] = useState<"current" | "noncurrent">( - "current", - ); - const [lifecycleDays, setLifecycleDays] = useState(""); - const [isFormValid, setIsFormValid] = useState(false); - const [expiredObjectDM, setExpiredObjectDM] = useState(false); - const [expiredAllVersionsDM, setExpiredAllVersionsDM] = - useState(false); - const [loadingVersioning, setLoadingVersioning] = useState(true); - const [expandedAdv, setExpandedAdv] = useState(false); - const [expanded, setExpanded] = useState(false); - const [expiryUnit, setExpiryUnit] = useState("days"); - - /*To be removed on component replacement*/ - const formFieldRowFilter = { - "& .MuiPaper-root": { padding: 0 }, - }; - - useEffect(() => { - if (loadingTiers) { - api.admin - .tiersListNames() - .then((res) => { - const tiersList: string[] | null = get(res.data, "items", []); - - if (tiersList !== null && tiersList.length >= 1) { - const objList = tiersList.map((tierName: string) => { - return { label: tierName, value: tierName }; - }); - - setTiersList(objList); - if (objList.length > 0) { - setStorageClass(objList[0].value); - } - } - setLoadingTiers(false); - }) - .catch((err) => { - setLoadingTiers(false); - dispatch(setModalErrorSnackMessage(errorToHandler(err.error))); - }); - } - }, [dispatch, loadingTiers]); - - useEffect(() => { - let valid = true; - - if (ilmType !== "expiry") { - if (storageClass === "") { - valid = false; - } - } - if (!lifecycleDays || parseInt(lifecycleDays) === 0) { - valid = false; - } - if (parseInt(lifecycleDays) > 2147483647) { - //values over int32 cannot be parsed - valid = false; - } - setIsFormValid(valid); - }, [ilmType, lifecycleDays, storageClass]); - - useEffect(() => { - if (loadingVersioning && distributedSetup) { - api.buckets - .getBucketVersioning(bucketName) - .then((res) => { - setVersioningInfo(res.data); - setLoadingVersioning(false); - }) - .catch((err) => { - dispatch(setModalErrorSnackMessage(errorToHandler(err))); - setLoadingVersioning(false); - }); - } - }, [loadingVersioning, dispatch, bucketName, distributedSetup]); - - const addRecord = () => { - let rules = {}; - - if (ilmType === "expiry") { - let expiry: { [key: string]: number } = {}; - - if (targetVersion === "current") { - expiry["expiry_days"] = parseInt(lifecycleDays); - } else if (expiryUnit === "days") { - expiry["noncurrentversion_expiration_days"] = parseInt(lifecycleDays); - } else { - expiry["newer_noncurrentversion_expiration_versions"] = - parseInt(lifecycleDays); - } - - rules = { - ...expiry, - }; - } else { - let transition: { [key: string]: number | string } = {}; - if (targetVersion === "current") { - transition["transition_days"] = parseInt(lifecycleDays); - transition["storage_class"] = storageClass; - } else if (expiryUnit === "days") { - transition["noncurrentversion_transition_days"] = - parseInt(lifecycleDays); - transition["noncurrentversion_transition_storage_class"] = storageClass; - } - - rules = { - ...transition, - }; - } - - const lifecycleInsert = { - type: ilmType, - prefix, - tags, - expired_object_delete_marker: expiredObjectDM, - expired_object_delete_all: expiredAllVersionsDM, - ...rules, - }; - - api.buckets - .addBucketLifecycle(bucketName, lifecycleInsert) - .then(() => { - setAddLoading(false); - closeModalAndRefresh(true); - }) - .catch((err) => { - setAddLoading(false); - dispatch(setModalErrorSnackMessage(errorToHandler(err))); - }); - }; - return ( - { - closeModalAndRefresh(false); - }} - title="Add Lifecycle Rule" - titleIcon={} - > - {loadingTiers && ( - - - - - - )} - - {!loadingTiers && ( -
) => { - e.preventDefault(); - setAddLoading(true); - addRecord(); - }} - > - - { - setIlmType(e.target.value as "expiry" | "transition"); - }} - selectorOptions={[ - { value: "expiry", label: "Expiry" }, - { value: "transition", label: "Transition" }, - ]} - helpTip={ - - Select{" "} - - Expiry - {" "} - to delete Objects per this rule. Select{" "} - - Transition - {" "} - to move Objects to a remote storage{" "} - - Tier - {" "} - per this rule. - - } - helpTipPlacement="right" - /> - {versioningInfo?.status === "Enabled" && ( - { - setStorageClass(value as string); - }} - options={tiersList} - helpTip={ - - Configure a{" "} - - remote tier - {" "} - to receive transitioned Objects - - } - helpTipPlacement="right" - /> - )} - - setExpanded(!expanded)} - > - - ) => { - setPrefix(e.target.value); - }} - label="Prefix" - value={prefix} - /> - - - { - setTags(vl); - }} - keyPlaceholder="Tag Key" - valuePlaceholder="Tag Value" - withBorder - /> - - - - {ilmType === "expiry" && targetVersion === "noncurrent" && ( - - setExpandedAdv(!expandedAdv)} - sx={{ marginTop: 15 }} - > - - , - ) => { - setExpiredObjectDM(event.target.checked); - }} - label={"Expire Delete Marker"} - description={ - "Remove the reference to the object if no versions are left" - } - /> - , - ) => { - setExpiredAllVersionsDM(event.target.checked); - }} - label={"Expire All Versions"} - description={ - "Removes all the versions of the object already expired" - } - /> - - - - )} - - -