mirror of
https://github.com/OpenMaxIO/openmaxio-object-browser
synced 2026-07-01 07:41:18 -07:00
Changed response type for Add bucket (#2721)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
This commit is contained in:
@@ -752,7 +752,7 @@ func TestPutObjectsLegalholdStatus(t *testing.T) {
|
|||||||
status := "enabled"
|
status := "enabled"
|
||||||
|
|
||||||
// 1. Create bucket
|
// 1. Create bucket
|
||||||
if !setupBucket(bucketName, true, true, nil, nil, assert, 201) {
|
if !setupBucket(bucketName, true, true, nil, nil, assert, 200) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -839,7 +839,7 @@ func TestGetBucketQuota(t *testing.T) {
|
|||||||
validBucket := "testgetbucketquota"
|
validBucket := "testgetbucketquota"
|
||||||
|
|
||||||
// 1. Create bucket
|
// 1. Create bucket
|
||||||
if !setupBucket(validBucket, true, true, nil, nil, assert, 201) {
|
if !setupBucket(validBucket, true, true, nil, nil, assert, 200) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -916,7 +916,7 @@ func TestPutBucketQuota(t *testing.T) {
|
|||||||
validBucket := "testputbucketquota"
|
validBucket := "testputbucketquota"
|
||||||
|
|
||||||
// 1. Create bucket
|
// 1. Create bucket
|
||||||
if !setupBucket(validBucket, true, true, nil, nil, assert, 201) {
|
if !setupBucket(validBucket, true, true, nil, nil, assert, 200) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -975,7 +975,7 @@ func TestListBucketEvents(t *testing.T) {
|
|||||||
validBucket := "testlistbucketevents"
|
validBucket := "testlistbucketevents"
|
||||||
|
|
||||||
// 1. Create bucket
|
// 1. Create bucket
|
||||||
if !setupBucket(validBucket, true, true, nil, nil, assert, 201) {
|
if !setupBucket(validBucket, true, true, nil, nil, assert, 200) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1033,7 +1033,7 @@ func TestDeleteObjectsRetentionStatus(t *testing.T) {
|
|||||||
validPrefix := encodeBase64(fileName)
|
validPrefix := encodeBase64(fileName)
|
||||||
|
|
||||||
// 1. Create bucket
|
// 1. Create bucket
|
||||||
if !setupBucket(bucketName, true, true, nil, nil, assert, 201) {
|
if !setupBucket(bucketName, true, true, nil, nil, assert, 200) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1140,7 +1140,7 @@ func TestBucketSetPolicy(t *testing.T) {
|
|||||||
validBucketName := "testbucketsetpolicy"
|
validBucketName := "testbucketsetpolicy"
|
||||||
|
|
||||||
// 1. Create bucket
|
// 1. Create bucket
|
||||||
if !setupBucket(validBucketName, true, true, nil, nil, assert, 201) {
|
if !setupBucket(validBucketName, true, true, nil, nil, assert, 200) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1201,7 +1201,7 @@ func TestRestoreObjectToASelectedVersion(t *testing.T) {
|
|||||||
validPrefix := encodeBase64(fileName)
|
validPrefix := encodeBase64(fileName)
|
||||||
|
|
||||||
// 1. Create bucket
|
// 1. Create bucket
|
||||||
if !setupBucket(bucketName, true, true, nil, nil, assert, 201) {
|
if !setupBucket(bucketName, true, true, nil, nil, assert, 200) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1289,7 +1289,7 @@ func TestPutBucketsTags(t *testing.T) {
|
|||||||
// 1. Create the bucket
|
// 1. Create the bucket
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
validBucketName := "testputbuckettags1"
|
validBucketName := "testputbuckettags1"
|
||||||
if !setupBucket(validBucketName, false, false, nil, nil, assert, 201) {
|
if !setupBucket(validBucketName, false, false, nil, nil, assert, 200) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1347,7 +1347,7 @@ func TestGetsTheMetadataOfAnObject(t *testing.T) {
|
|||||||
tags["tag"] = "testputobjecttagbucketonetagone"
|
tags["tag"] = "testputobjecttagbucketonetagone"
|
||||||
|
|
||||||
// 1. Create the bucket
|
// 1. Create the bucket
|
||||||
if !setupBucket(bucketName, false, false, nil, nil, assert, 201) {
|
if !setupBucket(bucketName, false, false, nil, nil, assert, 200) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1418,7 +1418,7 @@ func TestPutObjectsRetentionStatus(t *testing.T) {
|
|||||||
prefix := encodeBase64(fileName)
|
prefix := encodeBase64(fileName)
|
||||||
|
|
||||||
// 1. Create bucket
|
// 1. Create bucket
|
||||||
if !setupBucket(bucketName, true, true, nil, nil, assert, 201) {
|
if !setupBucket(bucketName, true, true, nil, nil, assert, 200) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1516,7 +1516,7 @@ func TestShareObjectOnURL(t *testing.T) {
|
|||||||
versionID := "null"
|
versionID := "null"
|
||||||
|
|
||||||
// 1. Create the bucket
|
// 1. Create the bucket
|
||||||
if !setupBucket(bucketName, false, false, nil, nil, assert, 201) {
|
if !setupBucket(bucketName, false, false, nil, nil, assert, 200) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1590,7 +1590,7 @@ func TestListObjects(t *testing.T) {
|
|||||||
fileName := "testlistobjecttobucket1.txt"
|
fileName := "testlistobjecttobucket1.txt"
|
||||||
|
|
||||||
// 1. Create the bucket
|
// 1. Create the bucket
|
||||||
if !setupBucket(bucketName, false, false, nil, nil, assert, 201) {
|
if !setupBucket(bucketName, false, false, nil, nil, assert, 200) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1638,7 +1638,7 @@ func TestDeleteObject(t *testing.T) {
|
|||||||
numberOfFiles := 2
|
numberOfFiles := 2
|
||||||
|
|
||||||
// 1. Create bucket
|
// 1. Create bucket
|
||||||
if !setupBucket(bucketName, true, true, nil, nil, assert, 201) {
|
if !setupBucket(bucketName, true, true, nil, nil, assert, 200) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1704,7 +1704,7 @@ func TestUploadObjectToBucket(t *testing.T) {
|
|||||||
fileName := "sample.txt"
|
fileName := "sample.txt"
|
||||||
|
|
||||||
// 1. Create the bucket
|
// 1. Create the bucket
|
||||||
if !setupBucket(bucketName, false, false, nil, nil, assert, 201) {
|
if !setupBucket(bucketName, false, false, nil, nil, assert, 200) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1739,7 +1739,7 @@ func TestDownloadObject(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 1. Create the bucket
|
// 1. Create the bucket
|
||||||
if !setupBucket(bucketName, true, true, nil, nil, assert, 201) {
|
if !setupBucket(bucketName, true, true, nil, nil, assert, 200) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1801,7 +1801,7 @@ func TestDeleteMultipleObjects(t *testing.T) {
|
|||||||
fileName := "testdeletemultipleobjs"
|
fileName := "testdeletemultipleobjs"
|
||||||
|
|
||||||
// 1. Create a bucket for this particular test
|
// 1. Create a bucket for this particular test
|
||||||
if !setupBucket(bucketName, false, false, nil, nil, assert, 201) {
|
if !setupBucket(bucketName, false, false, nil, nil, assert, 200) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1878,7 +1878,7 @@ func TestPutObjectTag(t *testing.T) {
|
|||||||
versionID := "null"
|
versionID := "null"
|
||||||
|
|
||||||
// 1. Create the bucket
|
// 1. Create the bucket
|
||||||
if !setupBucket(bucketName, false, false, nil, nil, assert, 201) {
|
if !setupBucket(bucketName, false, false, nil, nil, assert, 200) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1952,7 +1952,7 @@ func TestBucketRetention(t *testing.T) {
|
|||||||
retention["mode"] = "compliance"
|
retention["mode"] = "compliance"
|
||||||
retention["unit"] = "years"
|
retention["unit"] = "years"
|
||||||
retention["validity"] = 2
|
retention["validity"] = 2
|
||||||
if !setupBucket("setbucketretention1", true, true, nil, retention, assert, 201) {
|
if !setupBucket("setbucketretention1", true, true, nil, retention, assert, 200) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2003,7 +2003,7 @@ func TestBucketInformationGenericErrorResponse(t *testing.T) {
|
|||||||
|
|
||||||
// 1. Create the bucket
|
// 1. Create the bucket
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
if !setupBucket("bucketinformation2", false, false, nil, nil, assert, 201) {
|
if !setupBucket("bucketinformation2", false, false, nil, nil, assert, 200) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2048,7 +2048,7 @@ func TestBucketInformationSuccessfulResponse(t *testing.T) {
|
|||||||
|
|
||||||
// 1. Create the bucket
|
// 1. Create the bucket
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
if !setupBucket("bucketinformation1", false, false, nil, nil, assert, 201) {
|
if !setupBucket("bucketinformation1", false, false, nil, nil, assert, 200) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2161,7 +2161,7 @@ func TestListBuckets(t *testing.T) {
|
|||||||
// 1. Create buckets
|
// 1. Create buckets
|
||||||
numberOfBuckets := 3
|
numberOfBuckets := 3
|
||||||
for i := 1; i <= numberOfBuckets; i++ {
|
for i := 1; i <= numberOfBuckets; i++ {
|
||||||
if !setupBucket("testlistbuckets"+strconv.Itoa(i), false, false, nil, nil, assert, 201) {
|
if !setupBucket("testlistbuckets"+strconv.Itoa(i), false, false, nil, nil, assert, 200) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2277,7 +2277,7 @@ func TestBucketVersioning(t *testing.T) {
|
|||||||
|
|
||||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||||
|
|
||||||
if !setupBucket("test2", true, false, nil, nil, assert, 201) {
|
if !setupBucket("test2", true, false, nil, nil, assert, 200) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2314,7 +2314,7 @@ func TestBucketVersioning(t *testing.T) {
|
|||||||
if distributedSystem {
|
if distributedSystem {
|
||||||
assert.Equal(200, response.StatusCode, "Versioning test Status Code is incorrect - bucket failed to create")
|
assert.Equal(200, response.StatusCode, "Versioning test Status Code is incorrect - bucket failed to create")
|
||||||
} else {
|
} else {
|
||||||
assert.NotEqual(201, response.StatusCode, "Versioning test Status Code is incorrect - versioned bucket created on non-distributed system")
|
assert.NotEqual(200, response.StatusCode, "Versioning test Status Code is incorrect - versioned bucket created on non-distributed system")
|
||||||
}
|
}
|
||||||
|
|
||||||
request, error := http.NewRequest("DELETE", "http://localhost:9090/api/v1/buckets/test2", requestDataBody)
|
request, error := http.NewRequest("DELETE", "http://localhost:9090/api/v1/buckets/test2", requestDataBody)
|
||||||
@@ -2345,7 +2345,7 @@ func TestSetBucketTags(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// put bucket
|
// put bucket
|
||||||
if !setupBucket("test4", false, false, nil, nil, assert, 201) {
|
if !setupBucket("test4", false, false, nil, nil, assert, 200) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2412,7 +2412,7 @@ func TestGetBucket(t *testing.T) {
|
|||||||
Timeout: 2 * time.Second,
|
Timeout: 2 * time.Second,
|
||||||
}
|
}
|
||||||
|
|
||||||
if !setupBucket("test3", false, false, nil, nil, assert, 201) {
|
if !setupBucket("test3", false, false, nil, nil, assert, 200) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2450,7 +2450,7 @@ func TestAddBucket(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "Add Bucket with valid name",
|
name: "Add Bucket with valid name",
|
||||||
expectedStatus: 201,
|
expectedStatus: 200,
|
||||||
args: args{
|
args: args{
|
||||||
bucketName: "test1",
|
bucketName: "test1",
|
||||||
},
|
},
|
||||||
@@ -3050,7 +3050,7 @@ func TestSetBucketVersioning(t *testing.T) {
|
|||||||
versioning := true
|
versioning := true
|
||||||
|
|
||||||
// 1. Create bucket with versioning as true and locking as false
|
// 1. Create bucket with versioning as true and locking as false
|
||||||
if !setupBucket(bucket, locking, versioning, nil, nil, assert, 201) {
|
if !setupBucket(bucket, locking, versioning, nil, nil, assert, 200) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3133,7 +3133,7 @@ func TestEnableBucketEncryption(t *testing.T) {
|
|||||||
kmsKeyID := ""
|
kmsKeyID := ""
|
||||||
|
|
||||||
// 1. Add bucket
|
// 1. Add bucket
|
||||||
if !setupBucket(bucketName, locking, versioning, nil, nil, assert, 201) {
|
if !setupBucket(bucketName, locking, versioning, nil, nil, assert, 200) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3402,7 +3402,7 @@ func TestBucketLifeCycle(t *testing.T) {
|
|||||||
var noncurrentversionExpirationDays int64
|
var noncurrentversionExpirationDays int64
|
||||||
|
|
||||||
// 1. Add bucket
|
// 1. Add bucket
|
||||||
if !setupBucket(bucketName, locking, versioning, nil, nil, assert, 201) {
|
if !setupBucket(bucketName, locking, versioning, nil, nil, assert, 200) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3612,7 +3612,7 @@ func TestAccessRule(t *testing.T) {
|
|||||||
access := "readonly"
|
access := "readonly"
|
||||||
|
|
||||||
// 1. Add bucket
|
// 1. Add bucket
|
||||||
if !setupBucket(bucketName, locking, versioning, nil, nil, assert, 201) {
|
if !setupBucket(bucketName, locking, versioning, nil, nil, assert, 200) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3856,13 +3856,13 @@ func TestAddRemoteBucket(t *testing.T) {
|
|||||||
fmt.Println("targetBucket: ", targetBucket)
|
fmt.Println("targetBucket: ", targetBucket)
|
||||||
|
|
||||||
// 1. Create bucket
|
// 1. Create bucket
|
||||||
if !setupBucket("source", true, true, nil, nil, assert, 201) {
|
if !setupBucket("source", true, true, nil, nil, assert, 200) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 1.1. Create target bucket
|
// 1.1. Create target bucket
|
||||||
targetEndpoint := "http://localhost:9092"
|
targetEndpoint := "http://localhost:9092"
|
||||||
targetToken := getTokenForEndpoint(targetEndpoint)
|
targetToken := getTokenForEndpoint(targetEndpoint)
|
||||||
if !setupBucketForEndpoint(targetBucket, true, true, nil, nil, assert, 201, &targetEndpoint, &targetToken) {
|
if !setupBucketForEndpoint(targetBucket, true, true, nil, nil, assert, 200, &targetEndpoint, &targetToken) {
|
||||||
log.Println("bucket already exists")
|
log.Println("bucket already exists")
|
||||||
}
|
}
|
||||||
_, err := SetBucketVersioning(targetBucket, false, &targetURL, &targetToken)
|
_, err := SetBucketVersioning(targetBucket, false, &targetURL, &targetToken)
|
||||||
@@ -3915,13 +3915,13 @@ func TestDeleteRemoteBucket(t *testing.T) {
|
|||||||
fmt.Println("targetBucket: ", targetBucket)
|
fmt.Println("targetBucket: ", targetBucket)
|
||||||
|
|
||||||
// 1. Create bucket
|
// 1. Create bucket
|
||||||
if !setupBucket("deletesource", true, true, nil, nil, assert, 201) {
|
if !setupBucket("deletesource", true, true, nil, nil, assert, 200) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 1.1. Create target bucket
|
// 1.1. Create target bucket
|
||||||
targetEndpoint := "http://localhost:9092"
|
targetEndpoint := "http://localhost:9092"
|
||||||
targetToken := getTokenForEndpoint(targetEndpoint)
|
targetToken := getTokenForEndpoint(targetEndpoint)
|
||||||
if !setupBucketForEndpoint(targetBucket, true, true, nil, nil, assert, 201, &targetEndpoint, &targetToken) {
|
if !setupBucketForEndpoint(targetBucket, true, true, nil, nil, assert, 200, &targetEndpoint, &targetToken) {
|
||||||
log.Println("bucket already exists")
|
log.Println("bucket already exists")
|
||||||
}
|
}
|
||||||
_, err := SetBucketVersioning(targetBucket, false, &targetURL, &targetToken)
|
_, err := SetBucketVersioning(targetBucket, false, &targetURL, &targetToken)
|
||||||
|
|||||||
67
models/make_buckets_response.go
Normal file
67
models/make_buckets_response.go
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
// Code generated by go-swagger; DO NOT EDIT.
|
||||||
|
|
||||||
|
// This file is part of MinIO Console Server
|
||||||
|
// Copyright (c) 2023 MinIO, Inc.
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
|
||||||
|
package models
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
|
)
|
||||||
|
|
||||||
|
// MakeBucketsResponse make buckets response
|
||||||
|
//
|
||||||
|
// swagger:model makeBucketsResponse
|
||||||
|
type MakeBucketsResponse struct {
|
||||||
|
|
||||||
|
// bucket name
|
||||||
|
BucketName string `json:"bucketName,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate validates this make buckets response
|
||||||
|
func (m *MakeBucketsResponse) Validate(formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContextValidate validates this make buckets response based on context it is used
|
||||||
|
func (m *MakeBucketsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary interface implementation
|
||||||
|
func (m *MakeBucketsResponse) MarshalBinary() ([]byte, error) {
|
||||||
|
if m == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return swag.WriteJSON(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary interface implementation
|
||||||
|
func (m *MakeBucketsResponse) UnmarshalBinary(b []byte) error {
|
||||||
|
var res MakeBucketsResponse
|
||||||
|
if err := swag.ReadJSON(b, &res); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*m = res
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@@ -430,6 +430,10 @@ export interface AddBucketReplication {
|
|||||||
destination_bucket?: string;
|
destination_bucket?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface MakeBucketsResponse {
|
||||||
|
bucketName?: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ListBucketEventsResponse {
|
export interface ListBucketEventsResponse {
|
||||||
events?: NotificationConfig[];
|
events?: NotificationConfig[];
|
||||||
/**
|
/**
|
||||||
@@ -1927,12 +1931,13 @@ export class Api<
|
|||||||
* @secure
|
* @secure
|
||||||
*/
|
*/
|
||||||
makeBucket: (body: MakeBucketRequest, params: RequestParams = {}) =>
|
makeBucket: (body: MakeBucketRequest, params: RequestParams = {}) =>
|
||||||
this.request<void, Error>({
|
this.request<MakeBucketsResponse, Error>({
|
||||||
path: `/buckets`,
|
path: `/buckets`,
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: body,
|
body: body,
|
||||||
secure: true,
|
secure: true,
|
||||||
type: ContentType.Json,
|
type: ContentType.Json,
|
||||||
|
format: "json",
|
||||||
...params,
|
...params,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|||||||
@@ -175,7 +175,9 @@ export const addBucketsSlice = createSlice({
|
|||||||
})
|
})
|
||||||
.addCase(addBucketAsync.fulfilled, (state, action) => {
|
.addCase(addBucketAsync.fulfilled, (state, action) => {
|
||||||
state.loading = false;
|
state.loading = false;
|
||||||
state.navigateTo = `/buckets/${action.payload}/admin`;
|
state.navigateTo = action.payload.data.bucketName
|
||||||
|
? "/buckets"
|
||||||
|
: `/buckets/${action.payload.data.bucketName}/admin`;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -22,7 +22,9 @@ import {
|
|||||||
IAMPoliciesIcon,
|
IAMPoliciesIcon,
|
||||||
RefreshIcon,
|
RefreshIcon,
|
||||||
SearchIcon,
|
SearchIcon,
|
||||||
|
SectionTitle,
|
||||||
TrashIcon,
|
TrashIcon,
|
||||||
|
Grid,
|
||||||
} from "mds";
|
} from "mds";
|
||||||
import { Theme } from "@mui/material/styles";
|
import { Theme } from "@mui/material/styles";
|
||||||
import createStyles from "@mui/styles/createStyles";
|
import createStyles from "@mui/styles/createStyles";
|
||||||
@@ -34,7 +36,6 @@ import {
|
|||||||
searchField,
|
searchField,
|
||||||
} from "../Common/FormComponents/common/styleLibrary";
|
} from "../Common/FormComponents/common/styleLibrary";
|
||||||
import Paper from "@mui/material/Paper";
|
import Paper from "@mui/material/Paper";
|
||||||
import Grid from "@mui/material/Grid";
|
|
||||||
import { LinearProgress } from "@mui/material";
|
import { LinearProgress } from "@mui/material";
|
||||||
import TableWrapper from "../Common/TableWrapper/TableWrapper";
|
import TableWrapper from "../Common/TableWrapper/TableWrapper";
|
||||||
|
|
||||||
@@ -425,7 +426,9 @@ const PolicyDetails = ({ classes }: IPolicyDetailsProps) => {
|
|||||||
tabConfig: { label: "Summary", disabled: !displayPolicy },
|
tabConfig: { label: "Summary", disabled: !displayPolicy },
|
||||||
content: (
|
content: (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<div className={classes.sectionTitle}>Policy Summary</div>
|
<SectionTitle separator sx={{ marginBottom: 15 }}>
|
||||||
|
Policy Summary
|
||||||
|
</SectionTitle>
|
||||||
<Paper className={classes.paperContainer}>
|
<Paper className={classes.paperContainer}>
|
||||||
<PolicyView policyStatements={policyStatements} />
|
<PolicyView policyStatements={policyStatements} />
|
||||||
</Paper>
|
</Paper>
|
||||||
@@ -439,7 +442,9 @@ const PolicyDetails = ({ classes }: IPolicyDetailsProps) => {
|
|||||||
},
|
},
|
||||||
content: (
|
content: (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<div className={classes.sectionTitle}>Users</div>
|
<SectionTitle separator sx={{ marginBottom: 15 }}>
|
||||||
|
Users
|
||||||
|
</SectionTitle>
|
||||||
<Grid container>
|
<Grid container>
|
||||||
{userList.length > 0 && (
|
{userList.length > 0 && (
|
||||||
<Grid item xs={12} className={classes.actionsTray}>
|
<Grid item xs={12} className={classes.actionsTray}>
|
||||||
@@ -482,7 +487,9 @@ const PolicyDetails = ({ classes }: IPolicyDetailsProps) => {
|
|||||||
},
|
},
|
||||||
content: (
|
content: (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<div className={classes.sectionTitle}>Groups</div>
|
<SectionTitle separator sx={{ marginBottom: 15 }}>
|
||||||
|
Groups
|
||||||
|
</SectionTitle>
|
||||||
<Grid container>
|
<Grid container>
|
||||||
{groupList.length > 0 && (
|
{groupList.length > 0 && (
|
||||||
<Grid item xs={12} className={classes.actionsTray}>
|
<Grid item xs={12} className={classes.actionsTray}>
|
||||||
@@ -522,7 +529,9 @@ const PolicyDetails = ({ classes }: IPolicyDetailsProps) => {
|
|||||||
tabConfig: { label: "Raw Policy", disabled: !displayPolicy },
|
tabConfig: { label: "Raw Policy", disabled: !displayPolicy },
|
||||||
content: (
|
content: (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<div className={classes.sectionTitle}>Raw Policy</div>
|
<SectionTitle separator sx={{ marginBottom: 15 }}>
|
||||||
|
Raw Policy
|
||||||
|
</SectionTitle>
|
||||||
<form
|
<form
|
||||||
noValidate
|
noValidate
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
|
|||||||
@@ -881,8 +881,11 @@ func init() {
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
"201": {
|
"200": {
|
||||||
"description": "A successful response."
|
"description": "A successful response.",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/makeBucketsResponse"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"default": {
|
"default": {
|
||||||
"description": "Generic error response.",
|
"description": "Generic error response.",
|
||||||
@@ -7119,6 +7122,14 @@ func init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"makeBucketsResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"bucketName": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -9866,8 +9877,11 @@ func init() {
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
"201": {
|
"200": {
|
||||||
"description": "A successful response."
|
"description": "A successful response.",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/makeBucketsResponse"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"default": {
|
"default": {
|
||||||
"description": "Generic error response.",
|
"description": "Generic error response.",
|
||||||
@@ -16233,6 +16247,14 @@ func init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"makeBucketsResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"bucketName": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|||||||
@@ -30,29 +30,49 @@ import (
|
|||||||
"github.com/minio/console/models"
|
"github.com/minio/console/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MakeBucketCreatedCode is the HTTP code returned for type MakeBucketCreated
|
// MakeBucketOKCode is the HTTP code returned for type MakeBucketOK
|
||||||
const MakeBucketCreatedCode int = 201
|
const MakeBucketOKCode int = 200
|
||||||
|
|
||||||
/*
|
/*
|
||||||
MakeBucketCreated A successful response.
|
MakeBucketOK A successful response.
|
||||||
|
|
||||||
swagger:response makeBucketCreated
|
swagger:response makeBucketOK
|
||||||
*/
|
*/
|
||||||
type MakeBucketCreated struct {
|
type MakeBucketOK struct {
|
||||||
|
|
||||||
|
/*
|
||||||
|
In: Body
|
||||||
|
*/
|
||||||
|
Payload *models.MakeBucketsResponse `json:"body,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewMakeBucketCreated creates MakeBucketCreated with default headers values
|
// NewMakeBucketOK creates MakeBucketOK with default headers values
|
||||||
func NewMakeBucketCreated() *MakeBucketCreated {
|
func NewMakeBucketOK() *MakeBucketOK {
|
||||||
|
|
||||||
return &MakeBucketCreated{}
|
return &MakeBucketOK{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithPayload adds the payload to the make bucket o k response
|
||||||
|
func (o *MakeBucketOK) WithPayload(payload *models.MakeBucketsResponse) *MakeBucketOK {
|
||||||
|
o.Payload = payload
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetPayload sets the payload to the make bucket o k response
|
||||||
|
func (o *MakeBucketOK) SetPayload(payload *models.MakeBucketsResponse) {
|
||||||
|
o.Payload = payload
|
||||||
}
|
}
|
||||||
|
|
||||||
// WriteResponse to the client
|
// WriteResponse to the client
|
||||||
func (o *MakeBucketCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
func (o *MakeBucketOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||||
|
|
||||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
rw.WriteHeader(200)
|
||||||
|
if o.Payload != nil {
|
||||||
rw.WriteHeader(201)
|
payload := o.Payload
|
||||||
|
if err := producer.Produce(rw, payload); err != nil {
|
||||||
|
panic(err) // let the recovery middleware deal with this
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -54,10 +54,11 @@ func registerBucketsHandlers(api *operations.ConsoleAPI) {
|
|||||||
})
|
})
|
||||||
// make bucket
|
// make bucket
|
||||||
api.BucketMakeBucketHandler = bucketApi.MakeBucketHandlerFunc(func(params bucketApi.MakeBucketParams, session *models.Principal) middleware.Responder {
|
api.BucketMakeBucketHandler = bucketApi.MakeBucketHandlerFunc(func(params bucketApi.MakeBucketParams, session *models.Principal) middleware.Responder {
|
||||||
if err := getMakeBucketResponse(session, params); err != nil {
|
makeBucketResponse, err := getMakeBucketResponse(session, params)
|
||||||
|
if err != nil {
|
||||||
return bucketApi.NewMakeBucketDefault(int(err.Code)).WithPayload(err)
|
return bucketApi.NewMakeBucketDefault(int(err.Code)).WithPayload(err)
|
||||||
}
|
}
|
||||||
return bucketApi.NewMakeBucketCreated()
|
return bucketApi.NewMakeBucketOK().WithPayload(makeBucketResponse)
|
||||||
})
|
})
|
||||||
// delete bucket
|
// delete bucket
|
||||||
api.BucketDeleteBucketHandler = bucketApi.DeleteBucketHandlerFunc(func(params bucketApi.DeleteBucketParams, session *models.Principal) middleware.Responder {
|
api.BucketDeleteBucketHandler = bucketApi.DeleteBucketHandlerFunc(func(params bucketApi.DeleteBucketParams, session *models.Principal) middleware.Responder {
|
||||||
@@ -450,17 +451,17 @@ func makeBucket(ctx context.Context, client MinioClient, bucketName string, obje
|
|||||||
}
|
}
|
||||||
|
|
||||||
// getMakeBucketResponse performs makeBucket() to create a bucket with its access policy
|
// getMakeBucketResponse performs makeBucket() to create a bucket with its access policy
|
||||||
func getMakeBucketResponse(session *models.Principal, params bucketApi.MakeBucketParams) *models.Error {
|
func getMakeBucketResponse(session *models.Principal, params bucketApi.MakeBucketParams) (*models.MakeBucketsResponse, *models.Error) {
|
||||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
// bucket request needed to proceed
|
// bucket request needed to proceed
|
||||||
br := params.Body
|
br := params.Body
|
||||||
if br == nil {
|
if br == nil {
|
||||||
return ErrorWithContext(ctx, ErrBucketBodyNotInRequest)
|
return nil, ErrorWithContext(ctx, ErrBucketBodyNotInRequest)
|
||||||
}
|
}
|
||||||
mClient, err := newMinioClient(session)
|
mClient, err := newMinioClient(session)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ErrorWithContext(ctx, err)
|
return nil, ErrorWithContext(ctx, err)
|
||||||
}
|
}
|
||||||
// create a minioClient interface implementation
|
// create a minioClient interface implementation
|
||||||
// defining the client to be used
|
// defining the client to be used
|
||||||
@@ -472,7 +473,7 @@ func getMakeBucketResponse(session *models.Principal, params bucketApi.MakeBucke
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := makeBucket(ctx, minioClient, *br.Name, br.Locking); err != nil {
|
if err := makeBucket(ctx, minioClient, *br.Name, br.Locking); err != nil {
|
||||||
return ErrorWithContext(ctx, err)
|
return nil, ErrorWithContext(ctx, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// make sure to delete bucket if an errors occurs after bucket was created
|
// make sure to delete bucket if an errors occurs after bucket was created
|
||||||
@@ -489,14 +490,14 @@ func getMakeBucketResponse(session *models.Principal, params bucketApi.MakeBucke
|
|||||||
if br.Versioning || br.Retention != nil {
|
if br.Versioning || br.Retention != nil {
|
||||||
s3Client, err := newS3BucketClient(session, *br.Name, "")
|
s3Client, err := newS3BucketClient(session, *br.Name, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ErrorWithContext(ctx, err)
|
return nil, ErrorWithContext(ctx, err)
|
||||||
}
|
}
|
||||||
// create a mc S3Client interface implementation
|
// create a mc S3Client interface implementation
|
||||||
// defining the client to be used
|
// defining the client to be used
|
||||||
amcClient := mcClient{client: s3Client}
|
amcClient := mcClient{client: s3Client}
|
||||||
|
|
||||||
if err = doSetVersioning(amcClient, VersionEnable); err != nil {
|
if err = doSetVersioning(amcClient, VersionEnable); err != nil {
|
||||||
return ErrorWithContext(ctx, fmt.Errorf("error setting versioning for bucket: %s", err))
|
return nil, ErrorWithContext(ctx, fmt.Errorf("error setting versioning for bucket: %s", err))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -504,7 +505,7 @@ func getMakeBucketResponse(session *models.Principal, params bucketApi.MakeBucke
|
|||||||
if br.Quota != nil && br.Quota.Enabled != nil && *br.Quota.Enabled {
|
if br.Quota != nil && br.Quota.Enabled != nil && *br.Quota.Enabled {
|
||||||
mAdmin, err := NewMinioAdminClient(session)
|
mAdmin, err := NewMinioAdminClient(session)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ErrorWithContext(ctx, err)
|
return nil, ErrorWithContext(ctx, err)
|
||||||
}
|
}
|
||||||
// create a minioClient interface implementation
|
// create a minioClient interface implementation
|
||||||
// defining the client to be used
|
// defining the client to be used
|
||||||
@@ -519,10 +520,10 @@ func getMakeBucketResponse(session *models.Principal, params bucketApi.MakeBucke
|
|||||||
if br.Retention != nil {
|
if br.Retention != nil {
|
||||||
err = setBucketRetentionConfig(ctx, minioClient, *br.Name, *br.Retention.Mode, *br.Retention.Unit, br.Retention.Validity)
|
err = setBucketRetentionConfig(ctx, minioClient, *br.Name, *br.Retention.Mode, *br.Retention.Unit, br.Retention.Validity)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ErrorWithContext(ctx, err)
|
return nil, ErrorWithContext(ctx, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return &models.MakeBucketsResponse{BucketName: *br.Name}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// setBucketAccessPolicy set the access permissions on an existing bucket.
|
// setBucketAccessPolicy set the access permissions on an existing bucket.
|
||||||
|
|||||||
11
swagger.yml
11
swagger.yml
@@ -201,8 +201,10 @@ paths:
|
|||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/makeBucketRequest"
|
$ref: "#/definitions/makeBucketRequest"
|
||||||
responses:
|
responses:
|
||||||
201:
|
200:
|
||||||
description: A successful response.
|
description: A successful response.
|
||||||
|
schema:
|
||||||
|
$ref: "#/definitions/makeBucketsResponse"
|
||||||
default:
|
default:
|
||||||
description: Generic error response.
|
description: Generic error response.
|
||||||
schema:
|
schema:
|
||||||
@@ -4290,6 +4292,13 @@ definitions:
|
|||||||
type: string
|
type: string
|
||||||
destination_bucket:
|
destination_bucket:
|
||||||
type: string
|
type: string
|
||||||
|
|
||||||
|
makeBucketsResponse:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
bucketName:
|
||||||
|
type: string
|
||||||
|
|
||||||
listBucketEventsResponse:
|
listBucketEventsResponse:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
|
|||||||
Reference in New Issue
Block a user