diff --git a/go.mod b/go.mod index 4a63fd035..8a1210c58 100644 --- a/go.mod +++ b/go.mod @@ -19,7 +19,7 @@ require ( github.com/minio/cli v1.22.0 github.com/minio/direct-csi v1.3.5-0.20210601185811-f7776f7961bf github.com/minio/kes v0.11.0 - github.com/minio/madmin-go v1.1.5 + github.com/minio/madmin-go v1.1.6-0.20210917204419-f12dc0d0a8bd github.com/minio/mc v0.0.0-20210626002108-cebf3318546f github.com/minio/minio-go/v7 v7.0.14 github.com/minio/operator v0.0.0-20210812082324-26350f153661 diff --git a/go.sum b/go.sum index 8e59910e1..5b8846dd6 100644 --- a/go.sum +++ b/go.sum @@ -877,8 +877,8 @@ github.com/minio/filepath v1.0.0/go.mod h1:/nRZA2ldl5z6jT9/KQuvZcQlxZIMQoFFQPvEX github.com/minio/kes v0.11.0 h1:8ma6OCVSxKT50b1uYXLJro3m7PmZtCLxBaTddQexI5k= github.com/minio/kes v0.11.0/go.mod h1:mTF1Bv8YVEtQqF/B7Felp4tLee44Pp+dgI0rhCvgNg8= github.com/minio/madmin-go v1.0.12/go.mod h1:BK+z4XRx7Y1v8SFWXsuLNqQqnq5BO/axJ8IDJfgyvfs= -github.com/minio/madmin-go v1.1.5 h1:xfzHwQ/KeKDQZKLqllNSyexwOPM/tvc13UdCeVMzADY= -github.com/minio/madmin-go v1.1.5/go.mod h1:xIPJHUbyYhNDgeD9Wov5Fz5/p7DIW0u+q6Rs/+Xu2TM= +github.com/minio/madmin-go v1.1.6-0.20210917204419-f12dc0d0a8bd h1:NRQh43NGG+GThP26HufDWUp6pNhR1anfG7phaUDxYMk= +github.com/minio/madmin-go v1.1.6-0.20210917204419-f12dc0d0a8bd/go.mod h1:vw+c3/u+DeVKqReEavo///Cl2OO8nt5s4ee843hJeLs= github.com/minio/mc v0.0.0-20210626002108-cebf3318546f h1:hyFvo5hSFw2K417YvDr/vAKlgCG69uTuhZW/5LNdL0U= github.com/minio/mc v0.0.0-20210626002108-cebf3318546f/go.mod h1:tuaonkPjVApCXkbtKENHBtsqUf7YTV33qmFrC+Pgp5g= github.com/minio/md5-simd v1.1.0/go.mod h1:XpBqgZULrMYD3R+M28PcmP0CkI7PEMzB3U77ZrKZ0Gw= @@ -1062,8 +1062,9 @@ github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsT github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.6.0 h1:mxy4L2jP6qMonqmq+aTtOx1ifVWUgG/TAmntgbh3xv4= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= +github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/quasilyte/go-consistent v0.0.0-20190521200055-c6f3937de18c/go.mod h1:5STLWrekHfjyYwxBRVRXNOSewLJ3PWfDJd1VyTS21fI= github.com/quasilyte/go-ruleguard v0.1.2-0.20200318202121-b00d7a75d3d8/go.mod h1:CGFX09Ci3pq9QZdj86B+VGIdNj4VyCo2iPOGS9esB/k= diff --git a/models/bucket.go b/models/bucket.go index ddc6ceee0..6486ce338 100644 --- a/models/bucket.go +++ b/models/bucket.go @@ -24,6 +24,7 @@ package models import ( "context" + "encoding/json" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" @@ -42,11 +43,20 @@ type Bucket struct { // creation date CreationDate string `json:"creation_date,omitempty"` + // details + Details *BucketDetails `json:"details,omitempty"` + // name // Required: true // Min Length: 3 Name *string `json:"name"` + // objects + Objects int64 `json:"objects,omitempty"` + + // rw access + RwAccess *BucketRwAccess `json:"rw_access,omitempty"` + // size Size int64 `json:"size,omitempty"` } @@ -59,10 +69,18 @@ func (m *Bucket) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateDetails(formats); err != nil { + res = append(res, err) + } + if err := m.validateName(formats); err != nil { res = append(res, err) } + if err := m.validateRwAccess(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -86,6 +104,23 @@ func (m *Bucket) validateAccess(formats strfmt.Registry) error { return nil } +func (m *Bucket) validateDetails(formats strfmt.Registry) error { + if swag.IsZero(m.Details) { // not required + return nil + } + + if m.Details != nil { + if err := m.Details.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("details") + } + return err + } + } + + return nil +} + func (m *Bucket) validateName(formats strfmt.Registry) error { if err := validate.Required("name", "body", m.Name); err != nil { @@ -99,6 +134,23 @@ func (m *Bucket) validateName(formats strfmt.Registry) error { return nil } +func (m *Bucket) validateRwAccess(formats strfmt.Registry) error { + if swag.IsZero(m.RwAccess) { // not required + return nil + } + + if m.RwAccess != nil { + if err := m.RwAccess.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rw_access") + } + return err + } + } + + return nil +} + // ContextValidate validate this bucket based on the context it is used func (m *Bucket) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error @@ -107,6 +159,14 @@ func (m *Bucket) ContextValidate(ctx context.Context, formats strfmt.Registry) e res = append(res, err) } + if err := m.contextValidateDetails(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRwAccess(ctx, formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -127,6 +187,34 @@ func (m *Bucket) contextValidateAccess(ctx context.Context, formats strfmt.Regis return nil } +func (m *Bucket) contextValidateDetails(ctx context.Context, formats strfmt.Registry) error { + + if m.Details != nil { + if err := m.Details.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("details") + } + return err + } + } + + return nil +} + +func (m *Bucket) contextValidateRwAccess(ctx context.Context, formats strfmt.Registry) error { + + if m.RwAccess != nil { + if err := m.RwAccess.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rw_access") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *Bucket) MarshalBinary() ([]byte, error) { if m == nil { @@ -144,3 +232,236 @@ func (m *Bucket) UnmarshalBinary(b []byte) error { *m = res return nil } + +// BucketDetails bucket details +// +// swagger:model BucketDetails +type BucketDetails struct { + + // locking + Locking bool `json:"locking,omitempty"` + + // quota + Quota *BucketDetailsQuota `json:"quota,omitempty"` + + // replication + Replication bool `json:"replication,omitempty"` + + // tags + Tags map[string]string `json:"tags,omitempty"` + + // versioning + Versioning bool `json:"versioning,omitempty"` + + // versioning suspended + VersioningSuspended bool `json:"versioningSuspended,omitempty"` +} + +// Validate validates this bucket details +func (m *BucketDetails) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateQuota(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *BucketDetails) validateQuota(formats strfmt.Registry) error { + if swag.IsZero(m.Quota) { // not required + return nil + } + + if m.Quota != nil { + if err := m.Quota.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("details" + "." + "quota") + } + return err + } + } + + return nil +} + +// ContextValidate validate this bucket details based on the context it is used +func (m *BucketDetails) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateQuota(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *BucketDetails) contextValidateQuota(ctx context.Context, formats strfmt.Registry) error { + + if m.Quota != nil { + if err := m.Quota.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("details" + "." + "quota") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *BucketDetails) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *BucketDetails) UnmarshalBinary(b []byte) error { + var res BucketDetails + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} + +// BucketDetailsQuota bucket details quota +// +// swagger:model BucketDetailsQuota +type BucketDetailsQuota struct { + + // quota + Quota int64 `json:"quota,omitempty"` + + // type + // Enum: [fifo hard] + Type string `json:"type,omitempty"` +} + +// Validate validates this bucket details quota +func (m *BucketDetailsQuota) 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 bucketDetailsQuotaTypeTypePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["fifo","hard"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + bucketDetailsQuotaTypeTypePropEnum = append(bucketDetailsQuotaTypeTypePropEnum, v) + } +} + +const ( + + // BucketDetailsQuotaTypeFifo captures enum value "fifo" + BucketDetailsQuotaTypeFifo string = "fifo" + + // BucketDetailsQuotaTypeHard captures enum value "hard" + BucketDetailsQuotaTypeHard string = "hard" +) + +// prop value enum +func (m *BucketDetailsQuota) validateTypeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, bucketDetailsQuotaTypeTypePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *BucketDetailsQuota) validateType(formats strfmt.Registry) error { + if swag.IsZero(m.Type) { // not required + return nil + } + + // value enum + if err := m.validateTypeEnum("details"+"."+"quota"+"."+"type", "body", m.Type); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this bucket details quota based on context it is used +func (m *BucketDetailsQuota) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *BucketDetailsQuota) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *BucketDetailsQuota) UnmarshalBinary(b []byte) error { + var res BucketDetailsQuota + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} + +// BucketRwAccess bucket rw access +// +// swagger:model BucketRwAccess +type BucketRwAccess struct { + + // read + Read bool `json:"read,omitempty"` + + // write + Write bool `json:"write,omitempty"` +} + +// Validate validates this bucket rw access +func (m *BucketRwAccess) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this bucket rw access based on context it is used +func (m *BucketRwAccess) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *BucketRwAccess) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *BucketRwAccess) UnmarshalBinary(b []byte) error { + var res BucketRwAccess + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/portal-ui/package.json b/portal-ui/package.json index 0bade166b..add539e56 100644 --- a/portal-ui/package.json +++ b/portal-ui/package.json @@ -6,10 +6,10 @@ "dependencies": { "@date-io/moment": "1.x", "@hot-loader/react-dom": "17.0.1", - "@material-ui/core": "^4.11.2", + "@material-ui/core": "^4.12.3", "@material-ui/icons": "^4.11.2", - "@material-ui/lab": "^4.0.0-alpha.58", - "@material-ui/pickers": "^3.2.10", + "@material-ui/lab": "^4.0.0-alpha.60", + "@material-ui/pickers": "^3.3.10", "@types/history": "^4.7.3", "@types/jest": "24.0.23", "@types/lodash": "^4.14.149", diff --git a/portal-ui/public/index.html b/portal-ui/public/index.html index 6d30b8bdb..901fa3e12 100644 --- a/portal-ui/public/index.html +++ b/portal-ui/public/index.html @@ -3,8 +3,16 @@ - - + +