Tenant Logs (#1140)

Co-authored-by: Adam Stafford <adamstafford@Adams-MacBook-Pro.local>
This commit is contained in:
adfost
2022-01-11 15:18:31 -08:00
committed by GitHub
parent 3a0a2b14d9
commit 0400e0c6d5
32 changed files with 4093 additions and 25 deletions

412
models/tenant_logs.go Normal file
View File

@@ -0,0 +1,412 @@
// Code generated by go-swagger; DO NOT EDIT.
// 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 <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"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// TenantLogs tenant logs
//
// swagger:model tenantLogs
type TenantLogs struct {
// annotations
Annotations []*Annotation `json:"annotations"`
// db annotations
DbAnnotations []*Annotation `json:"dbAnnotations"`
// db image
DbImage string `json:"dbImage,omitempty"`
// db labels
DbLabels []*Label `json:"dbLabels"`
// db node selector
DbNodeSelector []*NodeSelector `json:"dbNodeSelector"`
// db service account name
DbServiceAccountName string `json:"dbServiceAccountName,omitempty"`
// disabled
Disabled bool `json:"disabled,omitempty"`
// disk capacity g b
DiskCapacityGB string `json:"diskCapacityGB,omitempty"`
// image
Image string `json:"image,omitempty"`
// labels
Labels []*Label `json:"labels"`
// node selector
NodeSelector []*NodeSelector `json:"nodeSelector"`
// service account name
ServiceAccountName string `json:"serviceAccountName,omitempty"`
}
// Validate validates this tenant logs
func (m *TenantLogs) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateAnnotations(formats); err != nil {
res = append(res, err)
}
if err := m.validateDbAnnotations(formats); err != nil {
res = append(res, err)
}
if err := m.validateDbLabels(formats); err != nil {
res = append(res, err)
}
if err := m.validateDbNodeSelector(formats); err != nil {
res = append(res, err)
}
if err := m.validateLabels(formats); err != nil {
res = append(res, err)
}
if err := m.validateNodeSelector(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *TenantLogs) validateAnnotations(formats strfmt.Registry) error {
if swag.IsZero(m.Annotations) { // not required
return nil
}
for i := 0; i < len(m.Annotations); i++ {
if swag.IsZero(m.Annotations[i]) { // not required
continue
}
if m.Annotations[i] != nil {
if err := m.Annotations[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("annotations" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *TenantLogs) validateDbAnnotations(formats strfmt.Registry) error {
if swag.IsZero(m.DbAnnotations) { // not required
return nil
}
for i := 0; i < len(m.DbAnnotations); i++ {
if swag.IsZero(m.DbAnnotations[i]) { // not required
continue
}
if m.DbAnnotations[i] != nil {
if err := m.DbAnnotations[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("dbAnnotations" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *TenantLogs) validateDbLabels(formats strfmt.Registry) error {
if swag.IsZero(m.DbLabels) { // not required
return nil
}
for i := 0; i < len(m.DbLabels); i++ {
if swag.IsZero(m.DbLabels[i]) { // not required
continue
}
if m.DbLabels[i] != nil {
if err := m.DbLabels[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("dbLabels" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *TenantLogs) validateDbNodeSelector(formats strfmt.Registry) error {
if swag.IsZero(m.DbNodeSelector) { // not required
return nil
}
for i := 0; i < len(m.DbNodeSelector); i++ {
if swag.IsZero(m.DbNodeSelector[i]) { // not required
continue
}
if m.DbNodeSelector[i] != nil {
if err := m.DbNodeSelector[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("dbNodeSelector" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *TenantLogs) validateLabels(formats strfmt.Registry) error {
if swag.IsZero(m.Labels) { // not required
return nil
}
for i := 0; i < len(m.Labels); i++ {
if swag.IsZero(m.Labels[i]) { // not required
continue
}
if m.Labels[i] != nil {
if err := m.Labels[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("labels" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *TenantLogs) validateNodeSelector(formats strfmt.Registry) error {
if swag.IsZero(m.NodeSelector) { // not required
return nil
}
for i := 0; i < len(m.NodeSelector); i++ {
if swag.IsZero(m.NodeSelector[i]) { // not required
continue
}
if m.NodeSelector[i] != nil {
if err := m.NodeSelector[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("nodeSelector" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// ContextValidate validate this tenant logs based on the context it is used
func (m *TenantLogs) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateAnnotations(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateDbAnnotations(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateDbLabels(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateDbNodeSelector(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateLabels(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateNodeSelector(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *TenantLogs) contextValidateAnnotations(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.Annotations); i++ {
if m.Annotations[i] != nil {
if err := m.Annotations[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("annotations" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *TenantLogs) contextValidateDbAnnotations(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.DbAnnotations); i++ {
if m.DbAnnotations[i] != nil {
if err := m.DbAnnotations[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("dbAnnotations" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *TenantLogs) contextValidateDbLabels(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.DbLabels); i++ {
if m.DbLabels[i] != nil {
if err := m.DbLabels[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("dbLabels" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *TenantLogs) contextValidateDbNodeSelector(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.DbNodeSelector); i++ {
if m.DbNodeSelector[i] != nil {
if err := m.DbNodeSelector[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("dbNodeSelector" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *TenantLogs) contextValidateLabels(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.Labels); i++ {
if m.Labels[i] != nil {
if err := m.Labels[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("labels" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *TenantLogs) contextValidateNodeSelector(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.NodeSelector); i++ {
if m.NodeSelector[i] != nil {
if err := m.NodeSelector[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("nodeSelector" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// MarshalBinary interface implementation
func (m *TenantLogs) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *TenantLogs) UnmarshalBinary(b []byte) error {
var res TenantLogs
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

12
node_modules/.yarn-integrity generated vendored
View File

@@ -1,12 +0,0 @@
{
"systemParams": "linux-x64-102",
"modulesFolders": [
"node_modules"
],
"flags": [],
"linkedModules": [],
"topLevelPatterns": [],
"lockfileEntries": {},
"files": [],
"artifacts": {}
}

View File

@@ -662,6 +662,80 @@ func init() {
}
}
},
"/namespaces/{namespace}/tenants/{tenant}/disable-logging": {
"post": {
"tags": [
"OperatorAPI"
],
"summary": "Disable Tenant Logging",
"operationId": "DisableTenantLogging",
"parameters": [
{
"type": "string",
"name": "namespace",
"in": "path",
"required": true
},
{
"type": "string",
"name": "tenant",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"type": "boolean"
}
},
"default": {
"description": "Generic error response.",
"schema": {
"$ref": "#/definitions/error"
}
}
}
}
},
"/namespaces/{namespace}/tenants/{tenant}/enable-logging": {
"post": {
"tags": [
"OperatorAPI"
],
"summary": "Enable Tenant Logging",
"operationId": "EnableTenantLogging",
"parameters": [
{
"type": "string",
"name": "namespace",
"in": "path",
"required": true
},
{
"type": "string",
"name": "tenant",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"type": "boolean"
}
},
"default": {
"description": "Generic error response.",
"schema": {
"$ref": "#/definitions/error"
}
}
}
}
},
"/namespaces/{namespace}/tenants/{tenant}/encryption": {
"put": {
"tags": [
@@ -704,6 +778,86 @@ func init() {
}
}
},
"/namespaces/{namespace}/tenants/{tenant}/log": {
"get": {
"tags": [
"OperatorAPI"
],
"summary": "Get Tenant Logs",
"operationId": "GetTenantLogs",
"parameters": [
{
"type": "string",
"name": "namespace",
"in": "path",
"required": true
},
{
"type": "string",
"name": "tenant",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/tenantLogs"
}
},
"default": {
"description": "Generic error response.",
"schema": {
"$ref": "#/definitions/error"
}
}
}
},
"put": {
"tags": [
"OperatorAPI"
],
"summary": "Set Tenant Logs",
"operationId": "SetTenantLogs",
"parameters": [
{
"type": "string",
"name": "namespace",
"in": "path",
"required": true
},
{
"type": "string",
"name": "tenant",
"in": "path",
"required": true
},
{
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/tenantLogs"
}
}
],
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"type": "boolean"
}
},
"default": {
"description": "Generic error response.",
"schema": {
"$ref": "#/definitions/error"
}
}
}
}
},
"/namespaces/{namespace}/tenants/{tenant}/monitoring": {
"get": {
"tags": [
@@ -3123,6 +3277,65 @@ func init() {
}
}
},
"tenantLogs": {
"type": "object",
"properties": {
"annotations": {
"type": "array",
"items": {
"$ref": "#/definitions/annotation"
}
},
"dbAnnotations": {
"type": "array",
"items": {
"$ref": "#/definitions/annotation"
}
},
"dbImage": {
"type": "string"
},
"dbLabels": {
"type": "array",
"items": {
"$ref": "#/definitions/label"
}
},
"dbNodeSelector": {
"type": "array",
"items": {
"$ref": "#/definitions/nodeSelector"
}
},
"dbServiceAccountName": {
"type": "string"
},
"disabled": {
"type": "boolean"
},
"diskCapacityGB": {
"type": "string"
},
"image": {
"type": "string"
},
"labels": {
"type": "array",
"items": {
"$ref": "#/definitions/label"
}
},
"nodeSelector": {
"type": "array",
"items": {
"$ref": "#/definitions/nodeSelector"
}
},
"serviceAccountName": {
"type": "string"
}
}
},
"tenantMonitoringInfo": {
"type": "object",
"properties": {
@@ -4073,6 +4286,80 @@ func init() {
}
}
},
"/namespaces/{namespace}/tenants/{tenant}/disable-logging": {
"post": {
"tags": [
"OperatorAPI"
],
"summary": "Disable Tenant Logging",
"operationId": "DisableTenantLogging",
"parameters": [
{
"type": "string",
"name": "namespace",
"in": "path",
"required": true
},
{
"type": "string",
"name": "tenant",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"type": "boolean"
}
},
"default": {
"description": "Generic error response.",
"schema": {
"$ref": "#/definitions/error"
}
}
}
}
},
"/namespaces/{namespace}/tenants/{tenant}/enable-logging": {
"post": {
"tags": [
"OperatorAPI"
],
"summary": "Enable Tenant Logging",
"operationId": "EnableTenantLogging",
"parameters": [
{
"type": "string",
"name": "namespace",
"in": "path",
"required": true
},
{
"type": "string",
"name": "tenant",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"type": "boolean"
}
},
"default": {
"description": "Generic error response.",
"schema": {
"$ref": "#/definitions/error"
}
}
}
}
},
"/namespaces/{namespace}/tenants/{tenant}/encryption": {
"put": {
"tags": [
@@ -4115,6 +4402,86 @@ func init() {
}
}
},
"/namespaces/{namespace}/tenants/{tenant}/log": {
"get": {
"tags": [
"OperatorAPI"
],
"summary": "Get Tenant Logs",
"operationId": "GetTenantLogs",
"parameters": [
{
"type": "string",
"name": "namespace",
"in": "path",
"required": true
},
{
"type": "string",
"name": "tenant",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/tenantLogs"
}
},
"default": {
"description": "Generic error response.",
"schema": {
"$ref": "#/definitions/error"
}
}
}
},
"put": {
"tags": [
"OperatorAPI"
],
"summary": "Set Tenant Logs",
"operationId": "SetTenantLogs",
"parameters": [
{
"type": "string",
"name": "namespace",
"in": "path",
"required": true
},
{
"type": "string",
"name": "tenant",
"in": "path",
"required": true
},
{
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/tenantLogs"
}
}
],
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"type": "boolean"
}
},
"default": {
"description": "Generic error response.",
"schema": {
"$ref": "#/definitions/error"
}
}
}
}
},
"/namespaces/{namespace}/tenants/{tenant}/monitoring": {
"get": {
"tags": [
@@ -7112,6 +7479,65 @@ func init() {
}
}
},
"tenantLogs": {
"type": "object",
"properties": {
"annotations": {
"type": "array",
"items": {
"$ref": "#/definitions/annotation"
}
},
"dbAnnotations": {
"type": "array",
"items": {
"$ref": "#/definitions/annotation"
}
},
"dbImage": {
"type": "string"
},
"dbLabels": {
"type": "array",
"items": {
"$ref": "#/definitions/label"
}
},
"dbNodeSelector": {
"type": "array",
"items": {
"$ref": "#/definitions/nodeSelector"
}
},
"dbServiceAccountName": {
"type": "string"
},
"disabled": {
"type": "boolean"
},
"diskCapacityGB": {
"type": "string"
},
"image": {
"type": "string"
},
"labels": {
"type": "array",
"items": {
"$ref": "#/definitions/label"
}
},
"nodeSelector": {
"type": "array",
"items": {
"$ref": "#/definitions/nodeSelector"
}
},
"serviceAccountName": {
"type": "string"
}
}
},
"tenantMonitoringInfo": {
"type": "object",
"properties": {

View File

@@ -23,6 +23,7 @@ var (
// Explicit error messages
errorInvalidErasureCodingValue = errors.New("invalid Erasure Coding Value")
errorUnableToGetTenantUsage = errors.New("unable to get tenant usage")
errorUnableToGetTenantLogs = errors.New("unable to get tenant logs")
errorUnableToUpdateTenantCertificates = errors.New("unable to update tenant certificates")
errorUpdatingEncryptionConfig = errors.New("unable to update encryption configuration")
errBucketBodyNotInRequest = errors.New("error bucket body not in request")

View File

@@ -81,6 +81,12 @@ func NewOperatorAPI(spec *loads.Document) *OperatorAPI {
OperatorAPIDirectCSIFormatDriveHandler: operator_api.DirectCSIFormatDriveHandlerFunc(func(params operator_api.DirectCSIFormatDriveParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation operator_api.DirectCSIFormatDrive has not yet been implemented")
}),
OperatorAPIDisableTenantLoggingHandler: operator_api.DisableTenantLoggingHandlerFunc(func(params operator_api.DisableTenantLoggingParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation operator_api.DisableTenantLogging has not yet been implemented")
}),
OperatorAPIEnableTenantLoggingHandler: operator_api.EnableTenantLoggingHandlerFunc(func(params operator_api.EnableTenantLoggingParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation operator_api.EnableTenantLogging has not yet been implemented")
}),
OperatorAPIGetAllocatableResourcesHandler: operator_api.GetAllocatableResourcesHandlerFunc(func(params operator_api.GetAllocatableResourcesParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation operator_api.GetAllocatableResources has not yet been implemented")
}),
@@ -105,6 +111,9 @@ func NewOperatorAPI(spec *loads.Document) *OperatorAPI {
OperatorAPIGetResourceQuotaHandler: operator_api.GetResourceQuotaHandlerFunc(func(params operator_api.GetResourceQuotaParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation operator_api.GetResourceQuota has not yet been implemented")
}),
OperatorAPIGetTenantLogsHandler: operator_api.GetTenantLogsHandlerFunc(func(params operator_api.GetTenantLogsParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation operator_api.GetTenantLogs has not yet been implemented")
}),
OperatorAPIGetTenantMonitoringHandler: operator_api.GetTenantMonitoringHandlerFunc(func(params operator_api.GetTenantMonitoringParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation operator_api.GetTenantMonitoring has not yet been implemented")
}),
@@ -150,6 +159,9 @@ func NewOperatorAPI(spec *loads.Document) *OperatorAPI {
UserAPISessionCheckHandler: user_api.SessionCheckHandlerFunc(func(params user_api.SessionCheckParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation user_api.SessionCheck has not yet been implemented")
}),
OperatorAPISetTenantLogsHandler: operator_api.SetTenantLogsHandlerFunc(func(params operator_api.SetTenantLogsParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation operator_api.SetTenantLogs has not yet been implemented")
}),
OperatorAPISetTenantMonitoringHandler: operator_api.SetTenantMonitoringHandlerFunc(func(params operator_api.SetTenantMonitoringParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation operator_api.SetTenantMonitoring has not yet been implemented")
}),
@@ -250,6 +262,10 @@ type OperatorAPI struct {
OperatorAPIDeleteTenantHandler operator_api.DeleteTenantHandler
// OperatorAPIDirectCSIFormatDriveHandler sets the operation handler for the direct c s i format drive operation
OperatorAPIDirectCSIFormatDriveHandler operator_api.DirectCSIFormatDriveHandler
// OperatorAPIDisableTenantLoggingHandler sets the operation handler for the disable tenant logging operation
OperatorAPIDisableTenantLoggingHandler operator_api.DisableTenantLoggingHandler
// OperatorAPIEnableTenantLoggingHandler sets the operation handler for the enable tenant logging operation
OperatorAPIEnableTenantLoggingHandler operator_api.EnableTenantLoggingHandler
// OperatorAPIGetAllocatableResourcesHandler sets the operation handler for the get allocatable resources operation
OperatorAPIGetAllocatableResourcesHandler operator_api.GetAllocatableResourcesHandler
// OperatorAPIGetDirectCSIDriveListHandler sets the operation handler for the get direct c s i drive list operation
@@ -266,6 +282,8 @@ type OperatorAPI struct {
OperatorAPIGetPodLogsHandler operator_api.GetPodLogsHandler
// OperatorAPIGetResourceQuotaHandler sets the operation handler for the get resource quota operation
OperatorAPIGetResourceQuotaHandler operator_api.GetResourceQuotaHandler
// OperatorAPIGetTenantLogsHandler sets the operation handler for the get tenant logs operation
OperatorAPIGetTenantLogsHandler operator_api.GetTenantLogsHandler
// OperatorAPIGetTenantMonitoringHandler sets the operation handler for the get tenant monitoring operation
OperatorAPIGetTenantMonitoringHandler operator_api.GetTenantMonitoringHandler
// OperatorAPIGetTenantPodsHandler sets the operation handler for the get tenant pods operation
@@ -296,6 +314,8 @@ type OperatorAPI struct {
OperatorAPIPutTenantYAMLHandler operator_api.PutTenantYAMLHandler
// UserAPISessionCheckHandler sets the operation handler for the session check operation
UserAPISessionCheckHandler user_api.SessionCheckHandler
// OperatorAPISetTenantLogsHandler sets the operation handler for the set tenant logs operation
OperatorAPISetTenantLogsHandler operator_api.SetTenantLogsHandler
// OperatorAPISetTenantMonitoringHandler sets the operation handler for the set tenant monitoring operation
OperatorAPISetTenantMonitoringHandler operator_api.SetTenantMonitoringHandler
// OperatorAPISubscriptionActivateHandler sets the operation handler for the subscription activate operation
@@ -421,6 +441,12 @@ func (o *OperatorAPI) Validate() error {
if o.OperatorAPIDirectCSIFormatDriveHandler == nil {
unregistered = append(unregistered, "operator_api.DirectCSIFormatDriveHandler")
}
if o.OperatorAPIDisableTenantLoggingHandler == nil {
unregistered = append(unregistered, "operator_api.DisableTenantLoggingHandler")
}
if o.OperatorAPIEnableTenantLoggingHandler == nil {
unregistered = append(unregistered, "operator_api.EnableTenantLoggingHandler")
}
if o.OperatorAPIGetAllocatableResourcesHandler == nil {
unregistered = append(unregistered, "operator_api.GetAllocatableResourcesHandler")
}
@@ -445,6 +471,9 @@ func (o *OperatorAPI) Validate() error {
if o.OperatorAPIGetResourceQuotaHandler == nil {
unregistered = append(unregistered, "operator_api.GetResourceQuotaHandler")
}
if o.OperatorAPIGetTenantLogsHandler == nil {
unregistered = append(unregistered, "operator_api.GetTenantLogsHandler")
}
if o.OperatorAPIGetTenantMonitoringHandler == nil {
unregistered = append(unregistered, "operator_api.GetTenantMonitoringHandler")
}
@@ -490,6 +519,9 @@ func (o *OperatorAPI) Validate() error {
if o.UserAPISessionCheckHandler == nil {
unregistered = append(unregistered, "user_api.SessionCheckHandler")
}
if o.OperatorAPISetTenantLogsHandler == nil {
unregistered = append(unregistered, "operator_api.SetTenantLogsHandler")
}
if o.OperatorAPISetTenantMonitoringHandler == nil {
unregistered = append(unregistered, "operator_api.SetTenantMonitoringHandler")
}
@@ -651,6 +683,14 @@ func (o *OperatorAPI) initHandlerCache() {
o.handlers["POST"] = make(map[string]http.Handler)
}
o.handlers["POST"]["/direct-csi/drives/format"] = operator_api.NewDirectCSIFormatDrive(o.context, o.OperatorAPIDirectCSIFormatDriveHandler)
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)
}
o.handlers["POST"]["/namespaces/{namespace}/tenants/{tenant}/disable-logging"] = operator_api.NewDisableTenantLogging(o.context, o.OperatorAPIDisableTenantLoggingHandler)
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)
}
o.handlers["POST"]["/namespaces/{namespace}/tenants/{tenant}/enable-logging"] = operator_api.NewEnableTenantLogging(o.context, o.OperatorAPIEnableTenantLoggingHandler)
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
}
@@ -686,6 +726,10 @@ func (o *OperatorAPI) initHandlerCache() {
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/namespaces/{namespace}/tenants/{tenant}/log"] = operator_api.NewGetTenantLogs(o.context, o.OperatorAPIGetTenantLogsHandler)
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/namespaces/{namespace}/tenants/{tenant}/monitoring"] = operator_api.NewGetTenantMonitoring(o.context, o.OperatorAPIGetTenantMonitoringHandler)
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
@@ -746,6 +790,10 @@ func (o *OperatorAPI) initHandlerCache() {
if o.handlers["PUT"] == nil {
o.handlers["PUT"] = make(map[string]http.Handler)
}
o.handlers["PUT"]["/namespaces/{namespace}/tenants/{tenant}/log"] = operator_api.NewSetTenantLogs(o.context, o.OperatorAPISetTenantLogsHandler)
if o.handlers["PUT"] == nil {
o.handlers["PUT"] = make(map[string]http.Handler)
}
o.handlers["PUT"]["/namespaces/{namespace}/tenants/{tenant}/monitoring"] = operator_api.NewSetTenantMonitoring(o.context, o.OperatorAPISetTenantMonitoringHandler)
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)

View File

@@ -0,0 +1,88 @@
// Code generated by go-swagger; DO NOT EDIT.
// 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 <http://www.gnu.org/licenses/>.
//
package operator_api
// 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"
)
// DisableTenantLoggingHandlerFunc turns a function with the right signature into a disable tenant logging handler
type DisableTenantLoggingHandlerFunc func(DisableTenantLoggingParams, *models.Principal) middleware.Responder
// Handle executing the request and returning a response
func (fn DisableTenantLoggingHandlerFunc) Handle(params DisableTenantLoggingParams, principal *models.Principal) middleware.Responder {
return fn(params, principal)
}
// DisableTenantLoggingHandler interface for that can handle valid disable tenant logging params
type DisableTenantLoggingHandler interface {
Handle(DisableTenantLoggingParams, *models.Principal) middleware.Responder
}
// NewDisableTenantLogging creates a new http.Handler for the disable tenant logging operation
func NewDisableTenantLogging(ctx *middleware.Context, handler DisableTenantLoggingHandler) *DisableTenantLogging {
return &DisableTenantLogging{Context: ctx, Handler: handler}
}
/* DisableTenantLogging swagger:route POST /namespaces/{namespace}/tenants/{tenant}/disable-logging OperatorAPI disableTenantLogging
Disable Tenant Logging
*/
type DisableTenantLogging struct {
Context *middleware.Context
Handler DisableTenantLoggingHandler
}
func (o *DisableTenantLogging) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, rCtx, _ := o.Context.RouteInfo(r)
if rCtx != nil {
*r = *rCtx
}
var Params = NewDisableTenantLoggingParams()
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)
}

View File

@@ -0,0 +1,112 @@
// Code generated by go-swagger; DO NOT EDIT.
// 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 <http://www.gnu.org/licenses/>.
//
package operator_api
// 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"
)
// NewDisableTenantLoggingParams creates a new DisableTenantLoggingParams object
//
// There are no default values defined in the spec.
func NewDisableTenantLoggingParams() DisableTenantLoggingParams {
return DisableTenantLoggingParams{}
}
// DisableTenantLoggingParams contains all the bound params for the disable tenant logging operation
// typically these are obtained from a http.Request
//
// swagger:parameters DisableTenantLogging
type DisableTenantLoggingParams struct {
// HTTP Request Object
HTTPRequest *http.Request `json:"-"`
/*
Required: true
In: path
*/
Namespace string
/*
Required: true
In: path
*/
Tenant 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 NewDisableTenantLoggingParams() beforehand.
func (o *DisableTenantLoggingParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace")
if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil {
res = append(res, err)
}
rTenant, rhkTenant, _ := route.Params.GetOK("tenant")
if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
// bindNamespace binds and validates parameter Namespace from path.
func (o *DisableTenantLoggingParams) bindNamespace(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.Namespace = raw
return nil
}
// bindTenant binds and validates parameter Tenant from path.
func (o *DisableTenantLoggingParams) bindTenant(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.Tenant = raw
return nil
}

View File

@@ -0,0 +1,131 @@
// Code generated by go-swagger; DO NOT EDIT.
// 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 <http://www.gnu.org/licenses/>.
//
package operator_api
// 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"
)
// DisableTenantLoggingOKCode is the HTTP code returned for type DisableTenantLoggingOK
const DisableTenantLoggingOKCode int = 200
/*DisableTenantLoggingOK A successful response.
swagger:response disableTenantLoggingOK
*/
type DisableTenantLoggingOK struct {
/*
In: Body
*/
Payload bool `json:"body,omitempty"`
}
// NewDisableTenantLoggingOK creates DisableTenantLoggingOK with default headers values
func NewDisableTenantLoggingOK() *DisableTenantLoggingOK {
return &DisableTenantLoggingOK{}
}
// WithPayload adds the payload to the disable tenant logging o k response
func (o *DisableTenantLoggingOK) WithPayload(payload bool) *DisableTenantLoggingOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the disable tenant logging o k response
func (o *DisableTenantLoggingOK) SetPayload(payload bool) {
o.Payload = payload
}
// WriteResponse to the client
func (o *DisableTenantLoggingOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(200)
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
/*DisableTenantLoggingDefault Generic error response.
swagger:response disableTenantLoggingDefault
*/
type DisableTenantLoggingDefault struct {
_statusCode int
/*
In: Body
*/
Payload *models.Error `json:"body,omitempty"`
}
// NewDisableTenantLoggingDefault creates DisableTenantLoggingDefault with default headers values
func NewDisableTenantLoggingDefault(code int) *DisableTenantLoggingDefault {
if code <= 0 {
code = 500
}
return &DisableTenantLoggingDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the disable tenant logging default response
func (o *DisableTenantLoggingDefault) WithStatusCode(code int) *DisableTenantLoggingDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the disable tenant logging default response
func (o *DisableTenantLoggingDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the disable tenant logging default response
func (o *DisableTenantLoggingDefault) WithPayload(payload *models.Error) *DisableTenantLoggingDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the disable tenant logging default response
func (o *DisableTenantLoggingDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *DisableTenantLoggingDefault) 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
}
}
}

View File

@@ -0,0 +1,124 @@
// Code generated by go-swagger; DO NOT EDIT.
// 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 <http://www.gnu.org/licenses/>.
//
package operator_api
// 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"
)
// DisableTenantLoggingURL generates an URL for the disable tenant logging operation
type DisableTenantLoggingURL struct {
Namespace string
Tenant 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 *DisableTenantLoggingURL) WithBasePath(bp string) *DisableTenantLoggingURL {
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 *DisableTenantLoggingURL) SetBasePath(bp string) {
o._basePath = bp
}
// Build a url path and query string
func (o *DisableTenantLoggingURL) Build() (*url.URL, error) {
var _result url.URL
var _path = "/namespaces/{namespace}/tenants/{tenant}/disable-logging"
namespace := o.Namespace
if namespace != "" {
_path = strings.Replace(_path, "{namespace}", namespace, -1)
} else {
return nil, errors.New("namespace is required on DisableTenantLoggingURL")
}
tenant := o.Tenant
if tenant != "" {
_path = strings.Replace(_path, "{tenant}", tenant, -1)
} else {
return nil, errors.New("tenant is required on DisableTenantLoggingURL")
}
_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 *DisableTenantLoggingURL) 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 *DisableTenantLoggingURL) String() string {
return o.Must(o.Build()).String()
}
// BuildFull builds a full url with scheme, host, path and query string
func (o *DisableTenantLoggingURL) BuildFull(scheme, host string) (*url.URL, error) {
if scheme == "" {
return nil, errors.New("scheme is required for a full url on DisableTenantLoggingURL")
}
if host == "" {
return nil, errors.New("host is required for a full url on DisableTenantLoggingURL")
}
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 *DisableTenantLoggingURL) StringFull(scheme, host string) string {
return o.Must(o.BuildFull(scheme, host)).String()
}

View File

@@ -0,0 +1,88 @@
// Code generated by go-swagger; DO NOT EDIT.
// 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 <http://www.gnu.org/licenses/>.
//
package operator_api
// 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"
)
// EnableTenantLoggingHandlerFunc turns a function with the right signature into a enable tenant logging handler
type EnableTenantLoggingHandlerFunc func(EnableTenantLoggingParams, *models.Principal) middleware.Responder
// Handle executing the request and returning a response
func (fn EnableTenantLoggingHandlerFunc) Handle(params EnableTenantLoggingParams, principal *models.Principal) middleware.Responder {
return fn(params, principal)
}
// EnableTenantLoggingHandler interface for that can handle valid enable tenant logging params
type EnableTenantLoggingHandler interface {
Handle(EnableTenantLoggingParams, *models.Principal) middleware.Responder
}
// NewEnableTenantLogging creates a new http.Handler for the enable tenant logging operation
func NewEnableTenantLogging(ctx *middleware.Context, handler EnableTenantLoggingHandler) *EnableTenantLogging {
return &EnableTenantLogging{Context: ctx, Handler: handler}
}
/* EnableTenantLogging swagger:route POST /namespaces/{namespace}/tenants/{tenant}/enable-logging OperatorAPI enableTenantLogging
Enable Tenant Logging
*/
type EnableTenantLogging struct {
Context *middleware.Context
Handler EnableTenantLoggingHandler
}
func (o *EnableTenantLogging) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, rCtx, _ := o.Context.RouteInfo(r)
if rCtx != nil {
*r = *rCtx
}
var Params = NewEnableTenantLoggingParams()
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)
}

View File

@@ -0,0 +1,112 @@
// Code generated by go-swagger; DO NOT EDIT.
// 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 <http://www.gnu.org/licenses/>.
//
package operator_api
// 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"
)
// NewEnableTenantLoggingParams creates a new EnableTenantLoggingParams object
//
// There are no default values defined in the spec.
func NewEnableTenantLoggingParams() EnableTenantLoggingParams {
return EnableTenantLoggingParams{}
}
// EnableTenantLoggingParams contains all the bound params for the enable tenant logging operation
// typically these are obtained from a http.Request
//
// swagger:parameters EnableTenantLogging
type EnableTenantLoggingParams struct {
// HTTP Request Object
HTTPRequest *http.Request `json:"-"`
/*
Required: true
In: path
*/
Namespace string
/*
Required: true
In: path
*/
Tenant 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 NewEnableTenantLoggingParams() beforehand.
func (o *EnableTenantLoggingParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace")
if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil {
res = append(res, err)
}
rTenant, rhkTenant, _ := route.Params.GetOK("tenant")
if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
// bindNamespace binds and validates parameter Namespace from path.
func (o *EnableTenantLoggingParams) bindNamespace(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.Namespace = raw
return nil
}
// bindTenant binds and validates parameter Tenant from path.
func (o *EnableTenantLoggingParams) bindTenant(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.Tenant = raw
return nil
}

View File

@@ -0,0 +1,131 @@
// Code generated by go-swagger; DO NOT EDIT.
// 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 <http://www.gnu.org/licenses/>.
//
package operator_api
// 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"
)
// EnableTenantLoggingOKCode is the HTTP code returned for type EnableTenantLoggingOK
const EnableTenantLoggingOKCode int = 200
/*EnableTenantLoggingOK A successful response.
swagger:response enableTenantLoggingOK
*/
type EnableTenantLoggingOK struct {
/*
In: Body
*/
Payload bool `json:"body,omitempty"`
}
// NewEnableTenantLoggingOK creates EnableTenantLoggingOK with default headers values
func NewEnableTenantLoggingOK() *EnableTenantLoggingOK {
return &EnableTenantLoggingOK{}
}
// WithPayload adds the payload to the enable tenant logging o k response
func (o *EnableTenantLoggingOK) WithPayload(payload bool) *EnableTenantLoggingOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the enable tenant logging o k response
func (o *EnableTenantLoggingOK) SetPayload(payload bool) {
o.Payload = payload
}
// WriteResponse to the client
func (o *EnableTenantLoggingOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(200)
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
/*EnableTenantLoggingDefault Generic error response.
swagger:response enableTenantLoggingDefault
*/
type EnableTenantLoggingDefault struct {
_statusCode int
/*
In: Body
*/
Payload *models.Error `json:"body,omitempty"`
}
// NewEnableTenantLoggingDefault creates EnableTenantLoggingDefault with default headers values
func NewEnableTenantLoggingDefault(code int) *EnableTenantLoggingDefault {
if code <= 0 {
code = 500
}
return &EnableTenantLoggingDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the enable tenant logging default response
func (o *EnableTenantLoggingDefault) WithStatusCode(code int) *EnableTenantLoggingDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the enable tenant logging default response
func (o *EnableTenantLoggingDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the enable tenant logging default response
func (o *EnableTenantLoggingDefault) WithPayload(payload *models.Error) *EnableTenantLoggingDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the enable tenant logging default response
func (o *EnableTenantLoggingDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *EnableTenantLoggingDefault) 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
}
}
}

View File

@@ -0,0 +1,124 @@
// Code generated by go-swagger; DO NOT EDIT.
// 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 <http://www.gnu.org/licenses/>.
//
package operator_api
// 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"
)
// EnableTenantLoggingURL generates an URL for the enable tenant logging operation
type EnableTenantLoggingURL struct {
Namespace string
Tenant 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 *EnableTenantLoggingURL) WithBasePath(bp string) *EnableTenantLoggingURL {
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 *EnableTenantLoggingURL) SetBasePath(bp string) {
o._basePath = bp
}
// Build a url path and query string
func (o *EnableTenantLoggingURL) Build() (*url.URL, error) {
var _result url.URL
var _path = "/namespaces/{namespace}/tenants/{tenant}/enable-logging"
namespace := o.Namespace
if namespace != "" {
_path = strings.Replace(_path, "{namespace}", namespace, -1)
} else {
return nil, errors.New("namespace is required on EnableTenantLoggingURL")
}
tenant := o.Tenant
if tenant != "" {
_path = strings.Replace(_path, "{tenant}", tenant, -1)
} else {
return nil, errors.New("tenant is required on EnableTenantLoggingURL")
}
_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 *EnableTenantLoggingURL) 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 *EnableTenantLoggingURL) String() string {
return o.Must(o.Build()).String()
}
// BuildFull builds a full url with scheme, host, path and query string
func (o *EnableTenantLoggingURL) BuildFull(scheme, host string) (*url.URL, error) {
if scheme == "" {
return nil, errors.New("scheme is required for a full url on EnableTenantLoggingURL")
}
if host == "" {
return nil, errors.New("host is required for a full url on EnableTenantLoggingURL")
}
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 *EnableTenantLoggingURL) StringFull(scheme, host string) string {
return o.Must(o.BuildFull(scheme, host)).String()
}

View File

@@ -0,0 +1,88 @@
// Code generated by go-swagger; DO NOT EDIT.
// 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 <http://www.gnu.org/licenses/>.
//
package operator_api
// 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"
)
// GetTenantLogsHandlerFunc turns a function with the right signature into a get tenant logs handler
type GetTenantLogsHandlerFunc func(GetTenantLogsParams, *models.Principal) middleware.Responder
// Handle executing the request and returning a response
func (fn GetTenantLogsHandlerFunc) Handle(params GetTenantLogsParams, principal *models.Principal) middleware.Responder {
return fn(params, principal)
}
// GetTenantLogsHandler interface for that can handle valid get tenant logs params
type GetTenantLogsHandler interface {
Handle(GetTenantLogsParams, *models.Principal) middleware.Responder
}
// NewGetTenantLogs creates a new http.Handler for the get tenant logs operation
func NewGetTenantLogs(ctx *middleware.Context, handler GetTenantLogsHandler) *GetTenantLogs {
return &GetTenantLogs{Context: ctx, Handler: handler}
}
/* GetTenantLogs swagger:route GET /namespaces/{namespace}/tenants/{tenant}/log OperatorAPI getTenantLogs
Get Tenant Logs
*/
type GetTenantLogs struct {
Context *middleware.Context
Handler GetTenantLogsHandler
}
func (o *GetTenantLogs) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, rCtx, _ := o.Context.RouteInfo(r)
if rCtx != nil {
*r = *rCtx
}
var Params = NewGetTenantLogsParams()
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)
}

View File

@@ -0,0 +1,112 @@
// Code generated by go-swagger; DO NOT EDIT.
// 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 <http://www.gnu.org/licenses/>.
//
package operator_api
// 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"
)
// NewGetTenantLogsParams creates a new GetTenantLogsParams object
//
// There are no default values defined in the spec.
func NewGetTenantLogsParams() GetTenantLogsParams {
return GetTenantLogsParams{}
}
// GetTenantLogsParams contains all the bound params for the get tenant logs operation
// typically these are obtained from a http.Request
//
// swagger:parameters GetTenantLogs
type GetTenantLogsParams struct {
// HTTP Request Object
HTTPRequest *http.Request `json:"-"`
/*
Required: true
In: path
*/
Namespace string
/*
Required: true
In: path
*/
Tenant 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 NewGetTenantLogsParams() beforehand.
func (o *GetTenantLogsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace")
if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil {
res = append(res, err)
}
rTenant, rhkTenant, _ := route.Params.GetOK("tenant")
if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
// bindNamespace binds and validates parameter Namespace from path.
func (o *GetTenantLogsParams) bindNamespace(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.Namespace = raw
return nil
}
// bindTenant binds and validates parameter Tenant from path.
func (o *GetTenantLogsParams) bindTenant(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.Tenant = raw
return nil
}

View File

@@ -0,0 +1,133 @@
// Code generated by go-swagger; DO NOT EDIT.
// 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 <http://www.gnu.org/licenses/>.
//
package operator_api
// 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"
)
// GetTenantLogsOKCode is the HTTP code returned for type GetTenantLogsOK
const GetTenantLogsOKCode int = 200
/*GetTenantLogsOK A successful response.
swagger:response getTenantLogsOK
*/
type GetTenantLogsOK struct {
/*
In: Body
*/
Payload *models.TenantLogs `json:"body,omitempty"`
}
// NewGetTenantLogsOK creates GetTenantLogsOK with default headers values
func NewGetTenantLogsOK() *GetTenantLogsOK {
return &GetTenantLogsOK{}
}
// WithPayload adds the payload to the get tenant logs o k response
func (o *GetTenantLogsOK) WithPayload(payload *models.TenantLogs) *GetTenantLogsOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get tenant logs o k response
func (o *GetTenantLogsOK) SetPayload(payload *models.TenantLogs) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetTenantLogsOK) 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
}
}
}
/*GetTenantLogsDefault Generic error response.
swagger:response getTenantLogsDefault
*/
type GetTenantLogsDefault struct {
_statusCode int
/*
In: Body
*/
Payload *models.Error `json:"body,omitempty"`
}
// NewGetTenantLogsDefault creates GetTenantLogsDefault with default headers values
func NewGetTenantLogsDefault(code int) *GetTenantLogsDefault {
if code <= 0 {
code = 500
}
return &GetTenantLogsDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the get tenant logs default response
func (o *GetTenantLogsDefault) WithStatusCode(code int) *GetTenantLogsDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the get tenant logs default response
func (o *GetTenantLogsDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the get tenant logs default response
func (o *GetTenantLogsDefault) WithPayload(payload *models.Error) *GetTenantLogsDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get tenant logs default response
func (o *GetTenantLogsDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetTenantLogsDefault) 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
}
}
}

View File

@@ -0,0 +1,124 @@
// Code generated by go-swagger; DO NOT EDIT.
// 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 <http://www.gnu.org/licenses/>.
//
package operator_api
// 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"
)
// GetTenantLogsURL generates an URL for the get tenant logs operation
type GetTenantLogsURL struct {
Namespace string
Tenant 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 *GetTenantLogsURL) WithBasePath(bp string) *GetTenantLogsURL {
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 *GetTenantLogsURL) SetBasePath(bp string) {
o._basePath = bp
}
// Build a url path and query string
func (o *GetTenantLogsURL) Build() (*url.URL, error) {
var _result url.URL
var _path = "/namespaces/{namespace}/tenants/{tenant}/log"
namespace := o.Namespace
if namespace != "" {
_path = strings.Replace(_path, "{namespace}", namespace, -1)
} else {
return nil, errors.New("namespace is required on GetTenantLogsURL")
}
tenant := o.Tenant
if tenant != "" {
_path = strings.Replace(_path, "{tenant}", tenant, -1)
} else {
return nil, errors.New("tenant is required on GetTenantLogsURL")
}
_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 *GetTenantLogsURL) 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 *GetTenantLogsURL) String() string {
return o.Must(o.Build()).String()
}
// BuildFull builds a full url with scheme, host, path and query string
func (o *GetTenantLogsURL) BuildFull(scheme, host string) (*url.URL, error) {
if scheme == "" {
return nil, errors.New("scheme is required for a full url on GetTenantLogsURL")
}
if host == "" {
return nil, errors.New("host is required for a full url on GetTenantLogsURL")
}
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 *GetTenantLogsURL) StringFull(scheme, host string) string {
return o.Must(o.BuildFull(scheme, host)).String()
}

View File

@@ -0,0 +1,88 @@
// Code generated by go-swagger; DO NOT EDIT.
// 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 <http://www.gnu.org/licenses/>.
//
package operator_api
// 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"
)
// SetTenantLogsHandlerFunc turns a function with the right signature into a set tenant logs handler
type SetTenantLogsHandlerFunc func(SetTenantLogsParams, *models.Principal) middleware.Responder
// Handle executing the request and returning a response
func (fn SetTenantLogsHandlerFunc) Handle(params SetTenantLogsParams, principal *models.Principal) middleware.Responder {
return fn(params, principal)
}
// SetTenantLogsHandler interface for that can handle valid set tenant logs params
type SetTenantLogsHandler interface {
Handle(SetTenantLogsParams, *models.Principal) middleware.Responder
}
// NewSetTenantLogs creates a new http.Handler for the set tenant logs operation
func NewSetTenantLogs(ctx *middleware.Context, handler SetTenantLogsHandler) *SetTenantLogs {
return &SetTenantLogs{Context: ctx, Handler: handler}
}
/* SetTenantLogs swagger:route PUT /namespaces/{namespace}/tenants/{tenant}/log OperatorAPI setTenantLogs
Set Tenant Logs
*/
type SetTenantLogs struct {
Context *middleware.Context
Handler SetTenantLogsHandler
}
func (o *SetTenantLogs) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, rCtx, _ := o.Context.RouteInfo(r)
if rCtx != nil {
*r = *rCtx
}
var Params = NewSetTenantLogsParams()
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)
}

View File

@@ -0,0 +1,151 @@
// Code generated by go-swagger; DO NOT EDIT.
// 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 <http://www.gnu.org/licenses/>.
//
package operator_api
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"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"
)
// NewSetTenantLogsParams creates a new SetTenantLogsParams object
//
// There are no default values defined in the spec.
func NewSetTenantLogsParams() SetTenantLogsParams {
return SetTenantLogsParams{}
}
// SetTenantLogsParams contains all the bound params for the set tenant logs operation
// typically these are obtained from a http.Request
//
// swagger:parameters SetTenantLogs
type SetTenantLogsParams struct {
// HTTP Request Object
HTTPRequest *http.Request `json:"-"`
/*
Required: true
In: body
*/
Data *models.TenantLogs
/*
Required: true
In: path
*/
Namespace string
/*
Required: true
In: path
*/
Tenant 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 NewSetTenantLogsParams() beforehand.
func (o *SetTenantLogsParams) 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.TenantLogs
if err := route.Consumer.Consume(r.Body, &body); err != nil {
if err == io.EOF {
res = append(res, errors.Required("data", "body", ""))
} else {
res = append(res, errors.NewParseError("data", "body", "", err))
}
} else {
// validate body object
if err := body.Validate(route.Formats); err != nil {
res = append(res, err)
}
ctx := validate.WithOperationRequest(context.Background())
if err := body.ContextValidate(ctx, route.Formats); err != nil {
res = append(res, err)
}
if len(res) == 0 {
o.Data = &body
}
}
} else {
res = append(res, errors.Required("data", "body", ""))
}
rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace")
if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil {
res = append(res, err)
}
rTenant, rhkTenant, _ := route.Params.GetOK("tenant")
if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
// bindNamespace binds and validates parameter Namespace from path.
func (o *SetTenantLogsParams) bindNamespace(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.Namespace = raw
return nil
}
// bindTenant binds and validates parameter Tenant from path.
func (o *SetTenantLogsParams) bindTenant(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.Tenant = raw
return nil
}

View File

@@ -0,0 +1,131 @@
// Code generated by go-swagger; DO NOT EDIT.
// 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 <http://www.gnu.org/licenses/>.
//
package operator_api
// 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"
)
// SetTenantLogsOKCode is the HTTP code returned for type SetTenantLogsOK
const SetTenantLogsOKCode int = 200
/*SetTenantLogsOK A successful response.
swagger:response setTenantLogsOK
*/
type SetTenantLogsOK struct {
/*
In: Body
*/
Payload bool `json:"body,omitempty"`
}
// NewSetTenantLogsOK creates SetTenantLogsOK with default headers values
func NewSetTenantLogsOK() *SetTenantLogsOK {
return &SetTenantLogsOK{}
}
// WithPayload adds the payload to the set tenant logs o k response
func (o *SetTenantLogsOK) WithPayload(payload bool) *SetTenantLogsOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the set tenant logs o k response
func (o *SetTenantLogsOK) SetPayload(payload bool) {
o.Payload = payload
}
// WriteResponse to the client
func (o *SetTenantLogsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(200)
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
/*SetTenantLogsDefault Generic error response.
swagger:response setTenantLogsDefault
*/
type SetTenantLogsDefault struct {
_statusCode int
/*
In: Body
*/
Payload *models.Error `json:"body,omitempty"`
}
// NewSetTenantLogsDefault creates SetTenantLogsDefault with default headers values
func NewSetTenantLogsDefault(code int) *SetTenantLogsDefault {
if code <= 0 {
code = 500
}
return &SetTenantLogsDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the set tenant logs default response
func (o *SetTenantLogsDefault) WithStatusCode(code int) *SetTenantLogsDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the set tenant logs default response
func (o *SetTenantLogsDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the set tenant logs default response
func (o *SetTenantLogsDefault) WithPayload(payload *models.Error) *SetTenantLogsDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the set tenant logs default response
func (o *SetTenantLogsDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *SetTenantLogsDefault) 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
}
}
}

View File

@@ -0,0 +1,124 @@
// Code generated by go-swagger; DO NOT EDIT.
// 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 <http://www.gnu.org/licenses/>.
//
package operator_api
// 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"
)
// SetTenantLogsURL generates an URL for the set tenant logs operation
type SetTenantLogsURL struct {
Namespace string
Tenant 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 *SetTenantLogsURL) WithBasePath(bp string) *SetTenantLogsURL {
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 *SetTenantLogsURL) SetBasePath(bp string) {
o._basePath = bp
}
// Build a url path and query string
func (o *SetTenantLogsURL) Build() (*url.URL, error) {
var _result url.URL
var _path = "/namespaces/{namespace}/tenants/{tenant}/log"
namespace := o.Namespace
if namespace != "" {
_path = strings.Replace(_path, "{namespace}", namespace, -1)
} else {
return nil, errors.New("namespace is required on SetTenantLogsURL")
}
tenant := o.Tenant
if tenant != "" {
_path = strings.Replace(_path, "{tenant}", tenant, -1)
} else {
return nil, errors.New("tenant is required on SetTenantLogsURL")
}
_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 *SetTenantLogsURL) 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 *SetTenantLogsURL) String() string {
return o.Must(o.Build()).String()
}
// BuildFull builds a full url with scheme, host, path and query string
func (o *SetTenantLogsURL) BuildFull(scheme, host string) (*url.URL, error) {
if scheme == "" {
return nil, errors.New("scheme is required for a full url on SetTenantLogsURL")
}
if host == "" {
return nil, errors.New("host is required for a full url on SetTenantLogsURL")
}
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 *SetTenantLogsURL) StringFull(scheme, host string) string {
return o.Must(o.BuildFull(scheme, host)).String()
}

View File

@@ -177,6 +177,40 @@ func registerTenantHandlers(api *operations.OperatorAPI) {
return operator_api.NewGetTenantUsageOK().WithPayload(payload)
})
// Get Tenant Logs
api.OperatorAPIGetTenantLogsHandler = operator_api.GetTenantLogsHandlerFunc(func(params operator_api.GetTenantLogsParams, session *models.Principal) middleware.Responder {
payload, err := getTenantLogsResponse(session, params)
if err != nil {
return operator_api.NewGetTenantLogsDefault(int(err.Code)).WithPayload(err)
}
return operator_api.NewGetTenantLogsOK().WithPayload(payload)
})
api.OperatorAPISetTenantLogsHandler = operator_api.SetTenantLogsHandlerFunc(func(params operator_api.SetTenantLogsParams, session *models.Principal) middleware.Responder {
payload, err := setTenantLogsResponse(session, params)
if err != nil {
return operator_api.NewSetTenantLogsDefault(int(err.Code)).WithPayload(err)
}
return operator_api.NewSetTenantLogsOK().WithPayload(payload)
})
// Get Tenant Logs
api.OperatorAPIEnableTenantLoggingHandler = operator_api.EnableTenantLoggingHandlerFunc(func(params operator_api.EnableTenantLoggingParams, session *models.Principal) middleware.Responder {
payload, err := enableTenantLoggingResponse(session, params)
if err != nil {
return operator_api.NewEnableTenantLoggingDefault(int(err.Code)).WithPayload(err)
}
return operator_api.NewEnableTenantLoggingOK().WithPayload(payload)
})
api.OperatorAPIDisableTenantLoggingHandler = operator_api.DisableTenantLoggingHandlerFunc(func(params operator_api.DisableTenantLoggingParams, session *models.Principal) middleware.Responder {
payload, err := disableTenantLoggingResponse(session, params)
if err != nil {
return operator_api.NewDisableTenantLoggingDefault(int(err.Code)).WithPayload(err)
}
return operator_api.NewDisableTenantLoggingOK().WithPayload(payload)
})
api.OperatorAPIGetTenantPodsHandler = operator_api.GetTenantPodsHandlerFunc(func(params operator_api.GetTenantPodsParams, session *models.Principal) middleware.Responder {
payload, err := getTenantPodsResponse(session, params)
if err != nil {
@@ -1715,6 +1749,307 @@ func getTenantUsageResponse(session *models.Principal, params operator_api.GetTe
return info, nil
}
// getTenantLogsResponse returns the logs of a tenant
func getTenantLogsResponse(session *models.Principal, params operator_api.GetTenantLogsParams) (*models.TenantLogs, *models.Error) {
// 30 seconds timeout
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
opClientClientSet, err := cluster.OperatorClient(session.STSSessionToken)
if err != nil {
return nil, prepareError(err, errorUnableToGetTenantLogs)
}
opClient := &operatorClient{
client: opClientClientSet,
}
minTenant, err := getTenant(ctx, opClient, params.Namespace, params.Tenant)
if err != nil {
return nil, prepareError(err, errorUnableToGetTenantLogs)
}
if minTenant.Spec.Log == nil {
retval := &models.TenantLogs{
Disabled: true,
}
return retval, nil
}
annotations := []*models.Annotation{}
for k, v := range minTenant.Spec.Log.Annotations {
annotations = append(annotations, &models.Annotation{Key: k, Value: v})
}
labels := []*models.Label{}
for k, v := range minTenant.Spec.Log.Labels {
labels = append(labels, &models.Label{Key: k, Value: v})
}
nodeSelector := []*models.NodeSelector{}
for k, v := range minTenant.Spec.Log.NodeSelector {
nodeSelector = append(nodeSelector, &models.NodeSelector{Key: k, Value: v})
}
if minTenant.Spec.Log.Db == nil {
minTenant.Spec.Log.Db = &miniov2.LogDbConfig{}
}
dbAnnotations := []*models.Annotation{}
for k, v := range minTenant.Spec.Log.Db.Annotations {
dbAnnotations = append(dbAnnotations, &models.Annotation{Key: k, Value: v})
}
dbLabels := []*models.Label{}
for k, v := range minTenant.Spec.Log.Db.Labels {
dbLabels = append(dbLabels, &models.Label{Key: k, Value: v})
}
dbNodeSelector := []*models.NodeSelector{}
for k, v := range minTenant.Spec.Log.Db.NodeSelector {
dbNodeSelector = append(dbNodeSelector, &models.NodeSelector{Key: k, Value: v})
}
if minTenant.Spec.Log.Audit == nil || minTenant.Spec.Log.Audit.DiskCapacityGB == nil {
minTenant.Spec.Log.Audit = &miniov2.AuditConfig{DiskCapacityGB: swag.Int(0)}
}
/*if minTenant.Spec.Log.Image == "" {
minTenant.Spec.Log.Image = miniov2.DefaultLogSearchAPIImage
}
if minTenant.Spec.Log.Db.Image == "" {
minTenant.Spec.Log.Db.Image = miniov2.LogPgImage
}*/
retval := &models.TenantLogs{
Image: minTenant.Spec.Log.Image,
DiskCapacityGB: fmt.Sprintf("%d", *minTenant.Spec.Log.Audit.DiskCapacityGB),
Annotations: annotations,
Labels: labels,
NodeSelector: nodeSelector,
ServiceAccountName: minTenant.Spec.Log.ServiceAccountName,
DbImage: minTenant.Spec.Log.Db.Image,
DbAnnotations: dbAnnotations,
DbLabels: dbLabels,
DbNodeSelector: dbNodeSelector,
DbServiceAccountName: minTenant.Spec.Log.Db.ServiceAccountName,
Disabled: false,
}
return retval, nil
}
// setTenantLogsResponse returns the logs of a tenant
func setTenantLogsResponse(session *models.Principal, params operator_api.SetTenantLogsParams) (bool, *models.Error) {
// 30 seconds timeout
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
opClientClientSet, err := cluster.OperatorClient(session.STSSessionToken)
if err != nil {
return false, prepareError(err, errorUnableToGetTenantUsage)
}
opClient := &operatorClient{
client: opClientClientSet,
}
minTenant, err := getTenant(ctx, opClient, params.Namespace, params.Tenant)
if err != nil {
return false, prepareError(err, errorUnableToGetTenantUsage)
}
var labels = make(map[string]string)
for i := 0; i < len(params.Data.Labels); i++ {
if params.Data.Labels[i] != nil {
labels[params.Data.Labels[i].Key] = params.Data.Labels[i].Value
}
}
minTenant.Spec.Log.Labels = labels
var annotations = make(map[string]string)
for i := 0; i < len(params.Data.Annotations); i++ {
if params.Data.Annotations[i] != nil {
annotations[params.Data.Annotations[i].Key] = params.Data.Annotations[i].Value
}
}
minTenant.Spec.Log.Annotations = annotations
var nodeSelector = make(map[string]string)
for i := 0; i < len(params.Data.NodeSelector); i++ {
if params.Data.NodeSelector[i] != nil {
nodeSelector[params.Data.NodeSelector[i].Key] = params.Data.NodeSelector[i].Value
}
}
minTenant.Spec.Log.NodeSelector = nodeSelector
modified := false
if minTenant.Spec.Log.Db != nil {
modified = true
}
var dbLabels = make(map[string]string)
for i := 0; i < len(params.Data.DbLabels); i++ {
if params.Data.DbLabels[i] != nil {
dbLabels[params.Data.DbLabels[i].Key] = params.Data.DbLabels[i].Value
}
modified = true
}
var dbAnnotations = make(map[string]string)
for i := 0; i < len(params.Data.DbAnnotations); i++ {
if params.Data.DbAnnotations[i] != nil {
dbAnnotations[params.Data.DbAnnotations[i].Key] = params.Data.DbAnnotations[i].Value
}
modified = true
}
var dbNodeSelector = make(map[string]string)
for i := 0; i < len(params.Data.DbNodeSelector); i++ {
if params.Data.DbNodeSelector[i] != nil {
dbNodeSelector[params.Data.DbNodeSelector[i].Key] = params.Data.DbNodeSelector[i].Value
}
modified = true
}
minTenant.Spec.Log.Image = params.Data.Image
diskCapacityGB, err := strconv.Atoi(params.Data.DiskCapacityGB)
if err == nil {
if minTenant.Spec.Log.Audit != nil && minTenant.Spec.Log.Audit.DiskCapacityGB != nil {
*minTenant.Spec.Log.Audit.DiskCapacityGB = diskCapacityGB
} else {
minTenant.Spec.Log.Audit = &miniov2.AuditConfig{DiskCapacityGB: swag.Int(diskCapacityGB)}
}
}
minTenant.Spec.Log.ServiceAccountName = params.Data.ServiceAccountName
if params.Data.DbImage != "" || params.Data.DbServiceAccountName != "" {
modified = true
}
if modified {
if minTenant.Spec.Log.Db == nil {
//Default class name for Log search
diskSpaceFromAPI := int64(5) * humanize.GiByte // Default is 5Gi
logSearchStorageClass := "standard"
logSearchDiskSpace := resource.NewQuantity(diskSpaceFromAPI, resource.DecimalExponent)
minTenant.Spec.Log.Db = &miniov2.LogDbConfig{
VolumeClaimTemplate: &corev1.PersistentVolumeClaim{
ObjectMeta: metav1.ObjectMeta{
Name: params.Tenant + "-log",
},
Spec: corev1.PersistentVolumeClaimSpec{
AccessModes: []corev1.PersistentVolumeAccessMode{
corev1.ReadWriteOnce,
},
Resources: corev1.ResourceRequirements{
Requests: corev1.ResourceList{
corev1.ResourceStorage: *logSearchDiskSpace,
},
},
StorageClassName: &logSearchStorageClass,
},
},
Labels: dbLabels,
Annotations: dbAnnotations,
NodeSelector: dbNodeSelector,
Image: params.Data.DbImage,
ServiceAccountName: params.Data.DbServiceAccountName,
}
} else {
minTenant.Spec.Log.Db.Labels = dbLabels
minTenant.Spec.Log.Db.Annotations = dbAnnotations
minTenant.Spec.Log.Db.NodeSelector = dbNodeSelector
minTenant.Spec.Log.Db.Image = params.Data.DbImage
minTenant.Spec.Log.Db.ServiceAccountName = params.Data.DbServiceAccountName
}
}
_, err = opClient.TenantUpdate(ctx, minTenant, metav1.UpdateOptions{})
if err != nil {
return false, prepareError(err)
}
return true, nil
}
// enableTenantLoggingResponse enables Tenant Logging
func enableTenantLoggingResponse(session *models.Principal, params operator_api.EnableTenantLoggingParams) (bool, *models.Error) {
// 30 seconds timeout
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
opClientClientSet, err := cluster.OperatorClient(session.STSSessionToken)
if err != nil {
return false, prepareError(err, errorUnableToGetTenantUsage)
}
opClient := &operatorClient{
client: opClientClientSet,
}
minTenant, err := getTenant(ctx, opClient, params.Namespace, params.Tenant)
if err != nil {
return false, prepareError(err, errorUnableToGetTenantUsage)
}
minTenant.EnsureDefaults()
//Default class name for Log search
diskSpaceFromAPI := int64(5) * humanize.GiByte // Default is 5Gi
logSearchStorageClass := "standard"
logSearchDiskSpace := resource.NewQuantity(diskSpaceFromAPI, resource.DecimalExponent)
auditMaxCap := 10
if (diskSpaceFromAPI / humanize.GiByte) < int64(auditMaxCap) {
auditMaxCap = int(diskSpaceFromAPI / humanize.GiByte)
}
minTenant.Spec.Log = &miniov2.LogConfig{
Audit: &miniov2.AuditConfig{DiskCapacityGB: swag.Int(auditMaxCap)},
Db: &miniov2.LogDbConfig{
VolumeClaimTemplate: &corev1.PersistentVolumeClaim{
ObjectMeta: metav1.ObjectMeta{
Name: params.Tenant + "-log",
},
Spec: corev1.PersistentVolumeClaimSpec{
AccessModes: []corev1.PersistentVolumeAccessMode{
corev1.ReadWriteOnce,
},
Resources: corev1.ResourceRequirements{
Requests: corev1.ResourceList{
corev1.ResourceStorage: *logSearchDiskSpace,
},
},
StorageClassName: &logSearchStorageClass,
},
},
},
}
_, err = opClient.TenantUpdate(ctx, minTenant, metav1.UpdateOptions{})
if err != nil {
return false, prepareError(err)
}
return true, nil
}
// disableTenantLoggingResponse disables Tenant Logging
func disableTenantLoggingResponse(session *models.Principal, params operator_api.DisableTenantLoggingParams) (bool, *models.Error) {
// 30 seconds timeout
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
opClientClientSet, err := cluster.OperatorClient(session.STSSessionToken)
if err != nil {
return false, prepareError(err, errorUnableToGetTenantUsage)
}
if err != nil {
return false, prepareError(err, errorUnableToGetTenantUsage)
}
opClient := &operatorClient{
client: opClientClientSet,
}
minTenant, err := getTenant(ctx, opClient, params.Namespace, params.Tenant)
if err != nil {
return false, prepareError(err, errorUnableToGetTenantUsage)
}
minTenant.EnsureDefaults()
minTenant.Spec.Log = nil
_, err = opClient.TenantUpdate(ctx, minTenant, metav1.UpdateOptions{})
if err != nil {
return false, prepareError(err)
}
return true, nil
}
func getTenantPodsResponse(session *models.Principal, params operator_api.GetTenantPodsParams) ([]*models.TenantPod, *models.Error) {
ctx := context.Background()
clientset, err := cluster.K8sClient(session.STSSessionToken)

View File

@@ -193,6 +193,8 @@ export const IAM_PAGES = {
"/namespaces/:tenantNamespace/tenants/:tenantName/security",
NAMESPACE_TENANT_MONITORING:
"/namespaces/:tenantNamespace/tenants/:tenantName/monitoring",
NAMESPACE_TENANT_LOGGING:
"/namespaces/:tenantNamespace/tenants/:tenantName/logging",
LICENSE: "/license",
DOCUMENTATION: "/documentation",
};

View File

@@ -441,11 +441,8 @@ const Console = ({
},
{
component: TenantDetails,
path: "/namespaces/:tenantNamespace/tenants/:tenantName/monitoring",
},
{
component: TenantDetails,
path: "/namespaces/:tenantNamespace/tenants/:tenantName/monitoring",
path: IAM_PAGES.NAMESPACE_TENANT_LOGGING,
forceDisplay: true,
},
{
component: License,

View File

@@ -161,9 +161,19 @@ export interface ITenantMonitoringStruct {
prometheusEnabled: boolean;
}
export interface IKeyValue {
key: string;
value: string;
export interface ITenantLogsStruct {
image: string;
labels: IKeyValue[];
annotations: IKeyValue[];
nodeSelector: IKeyValue[];
diskCapacityGB: number;
serviceAccountName: string;
dbImage: string;
dbLabels: IKeyValue[];
dbAnnotations: IKeyValue[];
dbNodeSelector: IKeyValue[];
dbServiceAccountName: string;
disabled: boolean;
}
export interface ValueUnit {

View File

@@ -0,0 +1,394 @@
import React, { useEffect, useState } from "react";
import ModalWrapper from "../../Common/ModalWrapper/ModalWrapper";
import createStyles from "@mui/styles/createStyles";
import withStyles from "@mui/styles/withStyles";
import { Theme } from "@mui/material/styles";
import { modalBasic } from "../../Common/FormComponents/common/styleLibrary";
import { Button } from "@mui/material";
import api from "../../../../common/api";
import { ITenant } from "../ListTenants/types";
import { ErrorResponseHandler } from "../../../../common/types";
import { IKeyValue } from "../ListTenants/types";
import KeyPairEdit from "./KeyPairEdit";
import InputBoxWrapper from "../../Common/FormComponents/InputBoxWrapper/InputBoxWrapper";
import {
commonFormValidation,
IValidation,
} from "../../../../utils/validationFunctions";
import { clearValidationError } from "../utils";
import { setModalErrorSnackMessage } from "../../../../actions";
interface IEditTenantLogsProps {
tenant: ITenant;
classes: any;
open: boolean;
onClose: (shouldReload: boolean) => void;
image: string;
labels: IKeyValue[];
annotations: IKeyValue[];
nodeSelector: IKeyValue[];
diskCapacityGB: number;
serviceAccountName: string;
dbImage: string;
dbLabels: IKeyValue[];
dbAnnotations: IKeyValue[];
dbNodeSelector: IKeyValue[];
dbServiceAccountName: string;
}
const styles = (theme: Theme) =>
createStyles({
buttonContainer: {
textAlign: "right",
},
multiContainer: {
display: "flex",
alignItems: "center" as const,
justifyContent: "flex-start" as const,
},
sizeFactorContainer: {
marginLeft: 8,
},
bottomContainer: {
display: "flex",
flexGrow: 1,
alignItems: "center",
"& div": {
flexGrow: 1,
width: "100%",
},
},
factorElements: {
display: "flex",
justifyContent: "flex-start",
},
sizeNumber: {
fontSize: 35,
fontWeight: 700,
textAlign: "center",
},
sizeDescription: {
fontSize: 14,
color: "#777",
textAlign: "center",
},
shortened: {
gridTemplateColumns: "auto auto 20px 20px",
display: "grid",
gridGap: 20,
},
...modalBasic,
});
const EditTenantLogsModal = ({
tenant,
classes,
open,
onClose,
image,
labels,
annotations,
nodeSelector,
diskCapacityGB,
serviceAccountName,
dbLabels,
dbAnnotations,
dbNodeSelector,
dbImage,
dbServiceAccountName,
}: IEditTenantLogsProps) => {
const [validationErrors, setValidationErrors] = useState<any>({});
const [newLabels, setNewLabels] = useState<IKeyValue[]>(
labels.length > 0 ? [...labels] : [{ key: "", value: "" }]
);
const [newAnnotations, setNewAnnotations] = useState<IKeyValue[]>(
annotations.length > 0 ? [...annotations] : [{ key: "", value: "" }]
);
const [newNodeSelector, setNewNodeSelector] = useState<IKeyValue[]>(
nodeSelector.length > 0 ? [...nodeSelector] : [{ key: "", value: "" }]
);
const [newImage, setNewImage] = useState<string>(image);
const [newDiskCapacityGB, setNewDiskCapacityGB] =
useState<number>(diskCapacityGB);
const [newServiceAccountName, setNewServiceAccountName] = useState<string>(
serviceAccountName != null ? serviceAccountName : ""
);
const [newDbLabels, setNewDbLabels] = useState<IKeyValue[]>(
dbLabels.length > 0 ? [...dbLabels] : [{ key: "", value: "" }]
);
const [newDbAnnotations, setNewDbAnnotations] = useState<IKeyValue[]>(
dbAnnotations.length > 0 ? [...dbAnnotations] : [{ key: "", value: "" }]
);
const [newDbNodeSelector, setNewDbNodeSelector] = useState<IKeyValue[]>(
dbNodeSelector.length > 0 ? [...dbNodeSelector] : [{ key: "", value: "" }]
);
const [newDbImage, setNewDbImage] = useState<string>(dbImage);
const [newDbServiceAccountName, setNewDbServiceAccountName] =
useState<string>(dbServiceAccountName != null ? dbServiceAccountName : "");
const [labelsError, setLabelsError] = useState<any>({});
const [annotationsError, setAnnotationsError] = useState<any>({});
const [nodeSelectorError, setNodeSelectorError] = useState<any>({});
const [dbLabelsError, setDbLabelsError] = useState<any>({});
const [dbAnnotationsError, setDbAnnotationsError] = useState<any>({});
const [dbNodeSelectorError, setDbNodeSelectorError] = useState<any>({});
const trim = (x: IKeyValue[]): IKeyValue[] => {
let retval: IKeyValue[] = [];
for (let i = 0; i < x.length; i++) {
if (x[i].key !== "") {
retval.push(x[i]);
}
}
return retval;
};
const cleanValidation = (fieldName: string) => {
setValidationErrors(clearValidationError(validationErrors, fieldName));
};
useEffect(() => {
let tenantLogValidation: IValidation[] = [];
tenantLogValidation.push({
fieldKey: `image`,
required: false,
value: newImage,
pattern:
/^([a-zA-Z0-9])([a-zA-Z0-9-._])*([a-zA-Z0-9]?)+(\/(([a-zA-Z0-9])([a-zA-Z0-9-._])*([a-zA-Z0-9])?)+)*:([a-zA-Z0-9])[a-zA-Z0-9-.]{0,127}$/,
customPatternMessage: "Invalid image",
});
tenantLogValidation.push({
fieldKey: `dbImage`,
required: false,
value: newDbImage,
pattern:
/^([a-zA-Z0-9])([a-zA-Z0-9-._])*([a-zA-Z0-9]?)+(\/(([a-zA-Z0-9])([a-zA-Z0-9-._])*([a-zA-Z0-9])?)+)*:([a-zA-Z0-9])[a-zA-Z0-9-.]{0,127}$/,
customPatternMessage: "Invalid image",
});
tenantLogValidation.push({
fieldKey: `diskCapacityGB`,
required: true,
value: newDiskCapacityGB as any as string,
pattern: /^[0-9]?(10)?$/,
customPatternMessage: "Must be an integer between 0 and 10",
});
tenantLogValidation.push({
fieldKey: `serviceAccountName`,
required: false,
value: newServiceAccountName,
pattern: /^[a-zA-Z0-9-.]{1,253}$/,
customPatternMessage: "Invalid service account name",
});
tenantLogValidation.push({
fieldKey: `dbServiceAccountName`,
required: false,
value: newDbServiceAccountName,
pattern: /^[a-zA-Z0-9-.]{1,253}$/,
customPatternMessage: "Invalid service account name",
});
const commonVal = commonFormValidation(tenantLogValidation);
setValidationErrors(commonVal);
}, [
newImage,
newDbImage,
newDiskCapacityGB,
newServiceAccountName,
newDbServiceAccountName,
setValidationErrors,
]);
const checkValid = (): boolean => {
if (
Object.keys(validationErrors).length !== 0 ||
Object.keys(labelsError).length !== 0 ||
Object.keys(annotationsError).length !== 0 ||
Object.keys(nodeSelectorError).length !== 0 ||
Object.keys(dbLabelsError).length !== 0 ||
Object.keys(dbAnnotationsError).length !== 0 ||
Object.keys(dbNodeSelectorError).length !== 0
) {
return false;
} else {
return true;
}
};
return (
<ModalWrapper
onClose={() => onClose(true)}
modalOpen={open}
title="Edit Logging"
>
<form
noValidate
autoComplete="off"
onSubmit={(e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
if (!checkValid()) {
setModalErrorSnackMessage({
errorMessage: "Some fields have invalid values",
detailedError: "",
});
} else {
api
.invoke(
"PUT",
`/api/v1/namespaces/${tenant.namespace}/tenants/${tenant.name}/log`,
{
labels: trim(newLabels),
annotations: trim(newAnnotations),
nodeSelector: trim(newNodeSelector),
image: newImage,
diskCapacityGB: newDiskCapacityGB,
serviceAccountName: newServiceAccountName,
dbLabels: trim(newDbLabels),
dbAnnotations: trim(newDbAnnotations),
dbNodeSelector: trim(newDbNodeSelector),
dbImage: newDbImage,
dbServiceAccountName: newDbServiceAccountName,
}
)
.then(() => {
onClose(true);
})
.catch((err: ErrorResponseHandler) => {});
}
}}
>
<h4>Image</h4>
<InputBoxWrapper
id={`image`}
label={""}
placeholder={"Image"}
name={`image`}
value={newImage}
onChange={(e) => {
setNewImage(e.target.value);
cleanValidation(`image`);
}}
key={`image`}
error={validationErrors[`image`] || ""}
/>
<h4>Disk Capacity (GB)</h4>
<InputBoxWrapper
id={`diskCapacityGB`}
label={""}
placeholder={"Disk Capacity (GB)"}
name={`diskCapacityGB`}
value={newDiskCapacityGB as any as string}
onChange={(e) => {
setNewDiskCapacityGB(e.target.value as any as number);
cleanValidation(`diskCapacityGB`);
}}
key={`diskCapacityGB`}
error={validationErrors[`diskCapacityGB`] || ""}
/>
<h4>Service Account Name</h4>
<InputBoxWrapper
id={`serviceAccountName`}
label={""}
placeholder={"Service Account Name"}
name={`serviceAccountName`}
value={newServiceAccountName}
onChange={(e) => {
setNewServiceAccountName(e.target.value);
cleanValidation(`serviceAccountName`);
}}
key={`serviceAccountName`}
error={validationErrors[`serviceAccountName`] || ""}
/>
<h4>Labels</h4>
<KeyPairEdit
newValues={newLabels}
setNewValues={setNewLabels}
paramName={"Labels"}
error={labelsError}
setError={setLabelsError}
/>
<h4>Annotations</h4>
<KeyPairEdit
newValues={newAnnotations}
setNewValues={setNewAnnotations}
paramName={"Annotations"}
error={annotationsError}
setError={setAnnotationsError}
/>
<h4>Node Selector</h4>
<KeyPairEdit
newValues={newNodeSelector}
setNewValues={setNewNodeSelector}
paramName={"Node Selector"}
error={nodeSelectorError}
setError={setNodeSelectorError}
/>
<hr className={classes.hrClass} />
<h4>Db Image</h4>
<InputBoxWrapper
id={`dbImage`}
label={""}
placeholder={"Db Image"}
name={`dbImage`}
value={newDbImage}
onChange={(e) => {
setNewDbImage(e.target.value);
cleanValidation(`dbImage`);
}}
key={`dbImage`}
error={validationErrors[`dbImage`] || ""}
/>
<h4>Db Service Account Name</h4>
<InputBoxWrapper
id={`dbServiceAccountName`}
label={""}
placeholder={"Db Service Account Name"}
name={`dbServiceAccountName`}
value={newDbServiceAccountName}
onChange={(e) => {
setNewDbServiceAccountName(e.target.value);
cleanValidation(`dbServiceAccountName`);
}}
key={`dbServiceAccountName`}
error={validationErrors[`dbServiceAccountName`] || ""}
/>
<h4>Db Labels</h4>
<KeyPairEdit
newValues={newDbLabels}
setNewValues={setNewDbLabels}
paramName={"Db Labels"}
error={dbLabelsError}
setError={setDbLabelsError}
/>
<h4>Db Annotations</h4>
<KeyPairEdit
newValues={newDbAnnotations}
setNewValues={setNewDbAnnotations}
paramName={"Db Annotations"}
error={dbAnnotationsError}
setError={setDbAnnotationsError}
/>
<h4>Db Node Selector</h4>
<KeyPairEdit
newValues={newDbNodeSelector}
setNewValues={setNewDbNodeSelector}
paramName={"DbNode Selector"}
error={dbNodeSelectorError}
setError={setDbNodeSelectorError}
/>
<br />
<div className={classes.buttonContainer}>
<Button
type="submit"
variant="contained"
color="primary"
disabled={!checkValid()}
>
Save
</Button>
</div>
</form>
</ModalWrapper>
);
};
export default withStyles(styles)(EditTenantLogsModal);

View File

@@ -87,12 +87,14 @@ const KeyPairEdit = ({
fieldKey: `key-${i.toString()}`,
required: false,
value: newValues[i].key,
pattern: /^[a-zA-Z0-9-_.]{1,63}$/,
customPatternMessage: "Invalid key",
});
keyPairValidation.push({
fieldKey: `val-${i.toString()}`,
required: false,
value: newValues[i].value,
pattern: /^[a-zA-Z0-9-_.]{1,63}$/,
customPatternMessage: "Invalid value",
});
}

View File

@@ -37,7 +37,6 @@ interface IKeyPairView {
const styles = (theme: Theme) =>
createStyles({
...tenantDetailsStyles,
centerAlign: {
textAlign: "center",
},

View File

@@ -56,6 +56,7 @@ const TenantSummary = withSuspense(React.lazy(() => import("./TenantSummary")));
const TenantLicense = withSuspense(React.lazy(() => import("./TenantLicense")));
const PoolsSummary = withSuspense(React.lazy(() => import("./PoolsSummary")));
const PodsSummary = withSuspense(React.lazy(() => import("./PodsSummary")));
const TenantLogging = withSuspense(React.lazy(() => import("./TenantLogging")));
const VolumesSummary = withSuspense(
React.lazy(() => import("./VolumesSummary"))
);
@@ -449,6 +450,10 @@ const TenantDetails = ({
path="/namespaces/:tenantNamespace/tenants/:tenantName/monitoring"
component={TenantMonitoring}
/>
<Route
path="/namespaces/:tenantNamespace/tenants/:tenantName/logging"
component={TenantLogging}
/>
<Route
path="/namespaces/:tenantNamespace/tenants/:tenantName"
component={() => (
@@ -510,7 +515,6 @@ const TenantDetails = ({
to: getRoutePath("volumes"),
},
}}
{{
tabConfig: {
label: "License",
@@ -519,7 +523,6 @@ const TenantDetails = ({
to: getRoutePath("license"),
},
}}
{{
tabConfig: {
label: "Monitoring",
@@ -528,6 +531,14 @@ const TenantDetails = ({
to: getRoutePath("monitoring"),
},
}}
{{
tabConfig: {
label: "Logging",
value: "logging",
component: Link,
to: getRoutePath("logging"),
},
}}
</VerticalTabs>
</PageLayout>
</Fragment>

View File

@@ -0,0 +1,414 @@
// 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 <http://www.gnu.org/licenses/>.
import React, { Fragment, useEffect, useState } from "react";
import { connect } from "react-redux";
import createStyles from "@mui/styles/createStyles";
import withStyles from "@mui/styles/withStyles";
import { Theme } from "@mui/material/styles";
import {
actionsTray,
containerForHeader,
searchField,
tenantDetailsStyles,
} from "../../Common/FormComponents/common/styleLibrary";
import Grid from "@mui/material/Grid";
import { Button, CircularProgress, DialogContentText } from "@mui/material";
import Paper from "@mui/material/Paper";
import api from "../../../../common/api";
import { ITenant } from "../ListTenants/types";
import { AppState } from "../../../../store";
import { ErrorResponseHandler } from "../../../../common/types";
import { EditIcon } from "../../../../icons";
import { setErrorSnackMessage } from "../../../../actions";
import EditTenantLogsModal from "./EditTenantLogsModal";
import KeyPairView from "./KeyPairView";
import { ITenantLogsStruct } from "../ListTenants/types";
import ConfirmDialog from "../../Common/ModalWrapper/ConfirmDialog";
import FormSwitchWrapper from "../../Common/FormComponents/FormSwitchWrapper/FormSwitchWrapper";
interface ITenantLogs {
classes: any;
match: any;
tenant: ITenant | null;
loadingTenant: boolean;
}
const styles = (theme: Theme) =>
createStyles({
...tenantDetailsStyles,
headerLabel: {
fontSize: 22,
fontWeight: 600,
color: "#000",
marginTop: 4,
},
breadcrumLink: {
textDecoration: "none",
color: "black",
},
tableWrapper: {
height: "calc(100vh - 267px)",
},
paperContainer: {
padding: "15px 15px 15px 50px",
},
...actionsTray,
...searchField,
...containerForHeader(theme.spacing(4)),
});
const TenantLogging = ({
classes,
match,
tenant,
loadingTenant,
}: ITenantLogs) => {
const [loadingTenantLogs, setLoadingTenantLogs] = useState<boolean>(true);
const [logInfo, setLogInfo] = useState<ITenantLogsStruct>();
const [edit, setEdit] = useState<boolean>(false);
const [disabled, setDisabled] = useState<boolean>(false);
const [preDisabled, setPreDisabled] = useState<boolean>(false);
const [disableDialogOpen, setDisableDialogOpen] = useState<boolean>(false);
const [enableDialogOpen, setEnableDialogOpen] = useState<boolean>(false);
const tenantName = match.params["tenantName"];
const tenantNamespace = match.params["tenantNamespace"];
useEffect(() => {
if (loadingTenantLogs) {
api
.invoke(
"GET",
`/api/v1/namespaces/${tenantNamespace}/tenants/${tenantName}/log`
)
.then((result: ITenantLogsStruct) => {
setLogInfo(result);
setPreDisabled(result.disabled);
setDisabled(result.disabled);
setLoadingTenantLogs(false);
})
.catch((err: ErrorResponseHandler) => {
setErrorSnackMessage({
errorMessage: "Error getting tenant logs",
detailedError: err.detailedError,
});
});
}
}, [tenantName, tenantNamespace, loadingTenantLogs, setDisabled, disabled]);
const onCloseEditAndRefresh = () => {
setDisableDialogOpen(false);
setEdit(false);
setLoadingTenantLogs(true);
};
const onCloseEnableAndRefresh = () => {
setEnableDialogOpen(false);
setDisabled(false);
setLoadingTenantLogs(true);
};
return (
<Fragment>
<ConfirmDialog
title="Disable Logging?"
confirmText="Disable"
isOpen={disableDialogOpen}
onConfirm={() => {
api
.invoke(
"POST",
`/api/v1/namespaces/${tenantNamespace}/tenants/${tenantName}/disable-logging`
)
.then(() => {
setPreDisabled(true);
setDisabled(true);
})
.catch((err: ErrorResponseHandler) => {
setErrorSnackMessage({
errorMessage: "Error disabling logging",
detailedError: err.detailedError,
});
});
onCloseEditAndRefresh();
}}
onClose={() => setDisableDialogOpen(false)}
confirmationContent={
<DialogContentText>
Disabling logging will erase any custom values you have used to
configure logging
</DialogContentText>
}
/>
<ConfirmDialog
title="Enable Logging?"
confirmText="Enable"
isOpen={enableDialogOpen}
onConfirm={() => {
api
.invoke(
"POST",
`/api/v1/namespaces/${tenantNamespace}/tenants/${tenantName}/enable-logging`
)
.then(() => {
setPreDisabled(false);
})
.catch((err: ErrorResponseHandler) => {
setErrorSnackMessage({
errorMessage: "Error enabling logging",
detailedError: err.detailedError,
});
});
onCloseEnableAndRefresh();
}}
onClose={() => setEnableDialogOpen(false)}
confirmationContent={
<DialogContentText>
Logging will be enabled with default values
</DialogContentText>
}
/>
{edit && tenant !== null && logInfo != null && !disabled && (
<EditTenantLogsModal
open={edit}
onClose={onCloseEditAndRefresh}
tenant={tenant}
image={logInfo.image}
labels={logInfo.labels}
annotations={logInfo.annotations}
nodeSelector={logInfo.nodeSelector}
diskCapacityGB={logInfo.diskCapacityGB}
serviceAccountName={logInfo.serviceAccountName}
dbImage={logInfo.dbImage}
dbLabels={logInfo.dbLabels}
dbAnnotations={logInfo.dbAnnotations}
dbNodeSelector={logInfo.dbNodeSelector}
dbServiceAccountName={logInfo.dbServiceAccountName}
/>
)}
<h1 className={classes.sectionTitle}>Logging</h1>
<div className={classes.actionsTray}>
<FormSwitchWrapper
value="enableLogging"
id="enableLogging"
name="enableLogging"
checked={!preDisabled}
onChange={(e) => {
const targetD = e.target;
const checked = targetD.checked;
if (checked) {
setEnableDialogOpen(true);
} else {
setDisableDialogOpen(true);
}
}}
label={"Logging"}
indicatorLabels={["Enabled", "Disabled"]}
/>
{!disabled && !loadingTenantLogs && (
<Button
variant="contained"
color="primary"
startIcon={<EditIcon />}
onClick={() => {
setEdit(true);
}}
>
Edit
</Button>
)}
</div>
{!disabled && !loadingTenantLogs && (
<Paper className={classes.paperContainer}>
<Grid container>
<Grid item xs={12}>
<table width={"100%"}>
<tbody>
{loadingTenant ? (
<tr>
<td className={classes.centerAlign} colSpan={4}>
<CircularProgress />
</td>
</tr>
) : (
<Fragment>
<tr>
<td className={classes.titleCol}>Image:</td>
<td>{logInfo?.image}</td>
</tr>
<tr>
<td className={classes.titleCol}>
Disk Capacity (GB):
</td>
<td>{logInfo?.diskCapacityGB}</td>
</tr>
<tr>
<td className={classes.titleCol}>
Service Account Name:
</td>
<td>{logInfo?.serviceAccountName}</td>
</tr>
<tr>
<td>
<h4>Labels</h4>
</td>
</tr>
<tr>
<td>
<KeyPairView
records={
logInfo != null && logInfo.labels.length > 0
? logInfo.labels
: []
}
recordName="Labels"
/>
</td>
</tr>
<tr>
<td>
<h4>Annotations</h4>
</td>
</tr>
<tr>
<td>
<KeyPairView
records={
logInfo != null && logInfo.annotations.length > 0
? logInfo.annotations
: []
}
recordName="Annotations"
/>
</td>
</tr>
<tr>
<td>
<h4>Node Selector</h4>
</td>
</tr>
<tr>
<td>
<KeyPairView
records={
logInfo != null && logInfo.nodeSelector.length > 0
? logInfo.nodeSelector
: []
}
recordName="Node Selector"
/>
</td>
</tr>
</Fragment>
)}
</tbody>
</table>
<hr className={classes.hrClass} />
<table width={"100%"}>
<tbody>
{loadingTenant ? (
<tr>
<td className={classes.centerAlign} colSpan={4}>
<CircularProgress />
</td>
</tr>
) : (
<Fragment>
<tr>
<td className={classes.titleCol}>Db Image:</td>
<td>{logInfo?.dbImage}</td>
</tr>
<tr>
<td className={classes.titleCol}>
Db Service Account Name:
</td>
<td>{logInfo?.dbServiceAccountName}</td>
</tr>
<tr>
<td>
<h4>Db Labels</h4>
</td>
</tr>
<tr>
<td>
<KeyPairView
records={
logInfo != null && logInfo.dbLabels?.length > 0
? logInfo.dbLabels
: []
}
recordName="Db Labels"
/>
</td>
</tr>
<tr>
<td>
<h4>Db Annotations</h4>
</td>
</tr>
<tr>
<td>
<KeyPairView
records={
logInfo != null &&
logInfo.dbAnnotations?.length > 0
? logInfo.dbAnnotations
: []
}
recordName="Db Annotations"
/>
</td>
</tr>
<tr>
<td>
<h4>Db Node Selector</h4>
</td>
</tr>
<tr>
<td>
<KeyPairView
records={
logInfo != null &&
logInfo.dbNodeSelector?.length > 0
? logInfo.dbNodeSelector
: []
}
recordName="Db Node Selector"
/>
</td>
</tr>
</Fragment>
)}
</tbody>
</table>
</Grid>
</Grid>
</Paper>
)}
</Fragment>
);
};
const mapState = (state: AppState) => ({
loadingTenant: state.tenants.tenantDetails.loadingTenant,
selectedTenant: state.tenants.tenantDetails.currentTenant,
tenant: state.tenants.tenantDetails.tenantInfo,
});
const connector = connect(mapState, null);
export default withStyles(styles)(connector(TenantLogging));

View File

@@ -53,10 +53,12 @@ export const commonFormValidation = (fieldsValidate: IValidation[]) => {
if (field.pattern && field.customPatternMessage) {
const rgx = new RegExp(field.pattern, "g");
console.log(field);
if (
field.value &&
field.value.trim() !== "" &&
!field.value.match(rgx) &&
typeof field.value !== "undefined" &&
field.value.trim() !== ""
typeof field.value !== "undefined"
) {
returnErrors[field.fieldKey] = field.customPatternMessage;
}

View File

@@ -344,6 +344,109 @@ paths:
tags:
- OperatorAPI
/namespaces/{namespace}/tenants/{tenant}/log:
get:
summary: Get Tenant Logs
operationId: GetTenantLogs
parameters:
- name: namespace
in: path
required: true
type: string
- name: tenant
in: path
required: true
type: string
responses:
200:
description: A successful response.
schema:
$ref: "#/definitions/tenantLogs"
default:
description: Generic error response.
schema:
$ref: "#/definitions/error"
tags:
- OperatorAPI
put:
summary: Set Tenant Logs
operationId: SetTenantLogs
parameters:
- name: namespace
in: path
required: true
type: string
- name: tenant
in: path
required: true
type: string
- name: data
in: body
required: true
schema:
$ref: "#/definitions/tenantLogs"
responses:
200:
description: A successful response.
schema:
type: boolean
default:
description: Generic error response.
schema:
$ref: "#/definitions/error"
tags:
- OperatorAPI
/namespaces/{namespace}/tenants/{tenant}/enable-logging:
post:
summary: Enable Tenant Logging
operationId: EnableTenantLogging
parameters:
- name: namespace
in: path
required: true
type: string
- name: tenant
in: path
required: true
type: string
responses:
200:
description: A successful response.
schema:
type: boolean
default:
description: Generic error response.
schema:
$ref: "#/definitions/error"
tags:
- OperatorAPI
/namespaces/{namespace}/tenants/{tenant}/disable-logging:
post:
summary: Disable Tenant Logging
operationId: DisableTenantLogging
parameters:
- name: namespace
in: path
required: true
type: string
- name: tenant
in: path
required: true
type: string
responses:
200:
description: A successful response.
schema:
type: boolean
default:
description: Generic error response.
schema:
$ref: "#/definitions/error"
tags:
- OperatorAPI
/namespaces/{namespace}/tenants/{tenant}:
get:
summary: Tenant Details
@@ -2350,6 +2453,46 @@ definitions:
yaml:
type: string
tenantLogs:
type: object
properties:
image:
type: string
labels:
type: array
items:
$ref: "#/definitions/label"
annotations:
type: array
items:
$ref: "#/definitions/annotation"
diskCapacityGB:
type: string
nodeSelector:
type: array
items:
$ref: "#/definitions/nodeSelector"
serviceAccountName:
type: string
dbImage:
type: string
dbLabels:
type: array
items:
$ref: "#/definitions/label"
dbAnnotations:
type: array
items:
$ref: "#/definitions/annotation"
dbNodeSelector:
type: array
items:
$ref: "#/definitions/nodeSelector"
dbServiceAccountName:
type: string
disabled:
type: boolean
listPVCsResponse:
type: object
properties:
@@ -2530,3 +2673,26 @@ definitions:
max_allocatable_mem:
type: integer
format: int64
label:
type: object
properties:
key:
type: string
value:
type: string
annotation:
type: object
properties:
key:
type: string
value:
type: string
nodeSelector:
type: object
properties:
key:
type: string
value:
type: string