diff --git a/cmd/config-current.go b/cmd/config-current.go index b7dd9b986..054416eef 100644 --- a/cmd/config-current.go +++ b/cmd/config-current.go @@ -18,7 +18,6 @@ package cmd import ( "context" - "fmt" "strings" "sync" @@ -261,7 +260,112 @@ func lookupConfigs(s config.Config) (err error) { return nil } -var helpMap = map[string]config.HelpKV{ +// Captures help for each sub-system +var helpSubSys = config.HelpKVS{ + config.HelpKV{ + Key: config.RegionSubSys, + Description: "Configure to describe the physical location of the server", + }, + config.HelpKV{ + Key: config.WormSubSys, + Description: "Configure to enable WORM mode, turns-off any overwrites and deletes of content", + }, + config.HelpKV{ + Key: config.StorageClassSubSys, + Description: "Configure to control data and parity per object", + }, + config.HelpKV{ + Key: config.CacheSubSys, + Description: "Configure to enable edge caching", + }, + config.HelpKV{ + Key: config.CompressionSubSys, + Description: "Configure to enable streaming on disk compression", + }, + config.HelpKV{ + Key: config.EtcdSubSys, + Description: "Configure to enable 'etcd' configuration", + }, + config.HelpKV{ + Key: config.IdentityOpenIDSubSys, + Description: "Configure to enable OpenID SSO support", + }, + config.HelpKV{ + Key: config.IdentityLDAPSubSys, + Description: "Configure to enable LDAP SSO support", + }, + config.HelpKV{ + Key: config.PolicyOPASubSys, + Description: "Configure to enable external OPA policy support", + }, + config.HelpKV{ + Key: config.KmsVaultSubSys, + Description: "Configure to enable Vault based external KMS", + }, + config.HelpKV{ + Key: config.LoggerWebhookSubSys, + Description: "Configure to enable Webhook based logger", + MultipleTargets: true, + }, + config.HelpKV{ + Key: config.AuditWebhookSubSys, + Description: "Configure to enable Webhook based audit logger", + MultipleTargets: true, + }, + + config.HelpKV{ + Key: config.NotifyWebhookSubSys, + Description: "Configure to publish events to Webhook target", + MultipleTargets: true, + }, + config.HelpKV{ + Key: config.NotifyAMQPSubSys, + Description: "Configure to publish events to AMQP target", + MultipleTargets: true, + }, + config.HelpKV{ + Key: config.NotifyKafkaSubSys, + Description: "Configure to publish events to Kafka target", + MultipleTargets: true, + }, + config.HelpKV{ + Key: config.NotifyMQTTSubSys, + Description: "Configure to publish events to MQTT target", + MultipleTargets: true, + }, + config.HelpKV{ + Key: config.NotifyNATSSubSys, + Description: "Configure to publish events to NATS target", + MultipleTargets: true, + }, + config.HelpKV{ + Key: config.NotifyNSQSubSys, + Description: "Configure to publish events to NSQ target", + MultipleTargets: true, + }, + config.HelpKV{ + Key: config.NotifyMySQLSubSys, + Description: "Configure to publish events to MySQL target", + MultipleTargets: true, + }, + config.HelpKV{ + Key: config.NotifyPostgresSubSys, + Description: "Configure to publish events to Postgres target", + MultipleTargets: true, + }, + config.HelpKV{ + Key: config.NotifyRedisSubSys, + Description: "Configure to publish events to Redis target", + MultipleTargets: true, + }, + config.HelpKV{ + Key: config.NotifyESSubSys, + Description: "Configure to publish events to Elasticsearch target", + MultipleTargets: true, + }, +} + +var helpMap = map[string]config.HelpKVS{ config.RegionSubSys: config.RegionHelp, config.WormSubSys: config.WormHelp, config.EtcdSubSys: etcd.Help, @@ -286,47 +390,66 @@ var helpMap = map[string]config.HelpKV{ config.NotifyESSubSys: notify.HelpES, } +// Help - return sub-system level help +type Help struct { + SubSys string `json:"subSys"` + Description string `json:"description"` + MultipleTargets bool `json:"multipleTargets"` + KeysHelp config.HelpKVS `json:"keysHelp"` +} + // GetHelp - returns help for sub-sys, a key for a sub-system or all the help. -func GetHelp(subSys, key string, envOnly bool) (config.HelpKV, error) { +func GetHelp(subSys, key string, envOnly bool) (Help, error) { if len(subSys) == 0 { - help := config.HelpKV{} - for _, subSys := range config.SubSystems.ToSlice() { - help[subSys] = fmt.Sprintf("Specify sub-sys '%s' to get further help", subSys) - } - return help, nil + return Help{KeysHelp: helpSubSys}, nil } subSystemValue := strings.SplitN(subSys, config.SubSystemSeparator, 2) if len(subSystemValue) == 0 { - return nil, config.Errorf("invalid number of arguments %s", subSys) + return Help{}, config.Errorf("invalid number of arguments %s", subSys) } if !config.SubSystems.Contains(subSystemValue[0]) { - return nil, config.Errorf("unknown sub-system %s", subSys) + return Help{}, config.Errorf("unknown sub-system %s", subSys) } - help := helpMap[subSystemValue[0]] + h := helpMap[subSystemValue[0]] if key != "" { - value, ok := help[key] + value, ok := h.Lookup(key) if !ok { - return nil, config.Errorf("unknown key %s for sub-system %s", key, subSys) - } - help = config.HelpKV{ - key: value, + return Help{}, config.Errorf("unknown key %s for sub-system %s", key, subSys) } + h = config.HelpKVS{value} } - envHelp := config.HelpKV{} + subSys = subSystemValue[0] + + envHelp := config.HelpKVS{} if envOnly { - for k, v := range help { + for _, hkv := range h { envK := config.EnvPrefix + strings.Join([]string{ - strings.ToTitle(subSys), strings.ToTitle(k), + strings.ToTitle(subSys), strings.ToTitle(hkv.Key), }, config.EnvWordDelimiter) - envHelp[envK] = v + envHelp = append(envHelp, config.HelpKV{ + Key: envK, + Description: hkv.Description, + Optional: hkv.Optional, + Type: hkv.Type, + }) } - help = envHelp + h = envHelp } - return help, nil + subSysHelp, ok := helpSubSys.Lookup(subSys) + if !ok { + return Help{}, config.Errorf("unknown sub-system %s", subSys) + } + + return Help{ + SubSys: subSys, + Description: subSysHelp.Description, + MultipleTargets: subSysHelp.MultipleTargets, + KeysHelp: h, + }, nil } func newServerConfig() config.Config { diff --git a/cmd/config/cache/help.go b/cmd/config/cache/help.go index 2a2db7fa6..17a1e6c8e 100644 --- a/cmd/config/cache/help.go +++ b/cmd/config/cache/help.go @@ -20,12 +20,40 @@ import "github.com/minio/minio/cmd/config" // Help template for caching feature. var ( - Help = config.HelpKV{ - Drives: `List of mounted drives or directories delimited by ";"`, - Exclude: `List of wildcard based cache exclusion patterns delimited by ";"`, - Expiry: `Cache expiry duration in days. eg: "90"`, - Quota: `Maximum permitted usage of the cache in percentage (0-100)`, - config.State: "Indicates if caching is enabled or not", - config.Comment: "A comment to describe the caching setting", + Help = config.HelpKVS{ + config.HelpKV{ + Key: config.State, + Description: "Indicates if caching is enabled or not", + Type: "on|off", + }, + config.HelpKV{ + Key: Drives, + Description: `List of mounted drives or directories delimited by ";"`, + Type: "delimited-string", + }, + config.HelpKV{ + Key: Exclude, + Description: `List of wildcard based cache exclusion patterns delimited by ";"`, + Optional: true, + Type: "delimited-string", + }, + config.HelpKV{ + Key: Expiry, + Description: `Cache expiry duration in days. eg: "90"`, + Optional: true, + Type: "number", + }, + config.HelpKV{ + Key: Quota, + Description: `Maximum permitted usage of the cache in percentage (0-100)`, + Optional: true, + Type: "number", + }, + config.HelpKV{ + Key: config.Comment, + Description: "A comment to describe the 'cache' settings", + Optional: true, + Type: "sentence", + }, } ) diff --git a/cmd/config/compress/help.go b/cmd/config/compress/help.go index 3854fd4d9..70b3f6480 100644 --- a/cmd/config/compress/help.go +++ b/cmd/config/compress/help.go @@ -20,10 +20,29 @@ import "github.com/minio/minio/cmd/config" // Help template for compress feature. var ( - Help = config.HelpKV{ - Extensions: `Comma separated file extensions to compress. eg: ".txt,.log,.csv"`, - MimeTypes: `Comma separate wildcard mime-types to compress. eg: "text/*,application/json,application/xml"`, - config.State: "Indicates if compression is enabled or not", - config.Comment: "A comment to describe the compression setting", + Help = config.HelpKVS{ + config.HelpKV{ + Key: config.State, + Description: "Indicates if compression is enabled or not", + Type: "on|off", + }, + config.HelpKV{ + Key: Extensions, + Description: `Comma separated file extensions to compress eg: ".txt,.log,.csv"`, + Optional: true, + Type: "delimited-string", + }, + config.HelpKV{ + Key: MimeTypes, + Description: `Comma separate wildcard mime-types to compress eg: "text/*,application/json,application/xml"`, + Optional: true, + Type: "delimited-string", + }, + config.HelpKV{ + Key: config.Comment, + Description: "A comment to describe the compression setting", + Optional: true, + Type: "sentence", + }, } ) diff --git a/cmd/config/etcd/help.go b/cmd/config/etcd/help.go index 534ce603d..2bb2e2639 100644 --- a/cmd/config/etcd/help.go +++ b/cmd/config/etcd/help.go @@ -20,12 +20,40 @@ import "github.com/minio/minio/cmd/config" // etcd config documented in default config var ( - Help = config.HelpKV{ - Endpoints: `(required) Comma separated list of etcd endpoints eg: "http://localhost:2379"`, - CoreDNSPath: `(optional) CoreDNS etcd path location to populate DNS srv records eg: "/skydns"`, - ClientCert: `(optional) Etcd client cert for mTLS authentication`, - ClientCertKey: `(optional) Etcd client cert key for mTLS authentication`, - config.State: "Indicates if etcd config is on or off", - config.Comment: "A comment to describe the etcd settings", + Help = config.HelpKVS{ + config.HelpKV{ + Key: config.State, + Description: "Indicates if etcd config is on or off", + Type: "on|off", + }, + config.HelpKV{ + Key: Endpoints, + Description: `Comma separated list of etcd endpoints eg: "http://localhost:2379"`, + Type: "delimited-string", + }, + config.HelpKV{ + Key: CoreDNSPath, + Description: `CoreDNS etcd path location to populate DNS srv records eg: "/skydns"`, + Optional: true, + Type: "path", + }, + config.HelpKV{ + Key: ClientCert, + Description: `Etcd client cert for mTLS authentication`, + Optional: true, + Type: "path", + }, + config.HelpKV{ + Key: ClientCertKey, + Description: `Etcd client cert key for mTLS authentication`, + Optional: true, + Type: "path", + }, + config.HelpKV{ + Key: config.Comment, + Description: "A comment to describe the etcd settings", + Optional: true, + Type: "sentence", + }, } ) diff --git a/cmd/config/help.go b/cmd/config/help.go index 64013a4c4..30677ba2f 100644 --- a/cmd/config/help.go +++ b/cmd/config/help.go @@ -18,18 +18,62 @@ package config // HelpKV - implements help messages for keys // with value as description of the keys. -type HelpKV map[string]string +type HelpKV struct { + Key string `json:"key"` + Type string `json:"type"` + Description string `json:"description"` + Optional bool `json:"optional"` + + // Indicates if sub-sys supports multiple targets. + MultipleTargets bool `json:"multipleTargets"` +} + +// HelpKVS - implement order of keys help messages. +type HelpKVS []HelpKV + +// Lookup - lookup a key from help kvs. +func (hkvs HelpKVS) Lookup(key string) (HelpKV, bool) { + for _, hkv := range hkvs { + if hkv.Key == key { + return hkv, true + } + } + return HelpKV{}, false +} // Region and Worm help is documented in default config var ( - RegionHelp = HelpKV{ - RegionName: `Region name of this deployment, eg: "us-west-2"`, - State: "Indicates if config region is honored or ignored", - Comment: "A comment to describe the region setting", + RegionHelp = HelpKVS{ + HelpKV{ + Key: State, + Type: "on|off", + Description: "Indicates if config region is honored or ignored", + }, + HelpKV{ + Key: RegionName, + Type: "string", + Description: `Region name of this deployment, eg: "us-west-2"`, + Optional: true, + }, + HelpKV{ + Key: Comment, + Type: "sentence", + Description: "A comment to describe the region setting", + Optional: true, + }, } - WormHelp = HelpKV{ - State: `Indicates if worm is "on" or "off"`, - Comment: "A comment to describe the worm state", + WormHelp = HelpKVS{ + HelpKV{ + Key: State, + Type: "on|off", + Description: `Indicates if worm is "on" or "off"`, + }, + HelpKV{ + Key: Comment, + Type: "sentence", + Description: "A comment to describe the worm state", + Optional: true, + }, } ) diff --git a/cmd/config/identity/ldap/config_test.go b/cmd/config/identity/ldap/config_test.go index 6bd7cd0e6..dd0f93f4c 100644 --- a/cmd/config/identity/ldap/config_test.go +++ b/cmd/config/identity/ldap/config_test.go @@ -66,6 +66,12 @@ func TestSubstituter(t *testing.T) { SubstitutableStr: "uid=${usernamedn},cn=users,dc=example,dc=com", ErrExpected: true, }, + { + KV: []string{"username", "john"}, + SubstitutableStr: "(&(objectclass=user)(sAMAccountName={username})(memberOf=CN=myorg,OU=Rialto,OU=Application Managed,OU=Groups,DC=amr,DC=corp,DC=myorg,DC=com))", + SubstitutedStr: "(&(objectclass=user)(sAMAccountName=john)(memberOf=CN=myorg,OU=Rialto,OU=Application Managed,OU=Groups,DC=amr,DC=corp,DC=myorg,DC=com))", + ErrExpected: false, + }, } for _, test := range tests { diff --git a/cmd/config/identity/ldap/help.go b/cmd/config/identity/ldap/help.go index 1995a85bd..f0df4bea6 100644 --- a/cmd/config/identity/ldap/help.go +++ b/cmd/config/identity/ldap/help.go @@ -18,17 +18,59 @@ package ldap import "github.com/minio/minio/cmd/config" -// Help template for Ldap identity feature. +// Help template for LDAP identity feature. var ( - Help = config.HelpKV{ - ServerAddr: `(Required) AD/LDAP server address eg: "myldapserver.com:636"`, - UsernameFormat: `(Required) AD/LDAP format of full username DN eg: "uid={username},cn=accounts,dc=myldapserver,dc=com"`, - GroupSearchFilter: `Search filter to find groups of a user (optional) eg: "(&(objectclass=groupOfNames)(member={usernamedn}))"`, - GroupNameAttribute: `Attribute of search results to use as group name (optional) eg: "cn"`, - GroupSearchBaseDN: `Base DN in AD/LDAP hierarchy to use in search requests (optional) eg: "dc=myldapserver,dc=com"`, - STSExpiry: `AD/LDAP STS credentials validity duration (optional) eg: "1h"`, - TLSSkipVerify: "Set this to 'on', to disable client verification of server certificates", - config.State: "(Required) Enable or disable LDAP/AD identity", - config.Comment: "A comment to describe the LDAP/AD identity setting", + Help = config.HelpKVS{ + config.HelpKV{ + Key: config.State, + Description: "Enable or disable LDAP/AD identity", + Type: "on|off", + }, + config.HelpKV{ + Key: ServerAddr, + Description: `AD/LDAP server address eg: "myldapserver.com:636"`, + Type: "address", + }, + config.HelpKV{ + Key: UsernameFormat, + Description: `AD/LDAP format of full username DN eg: "uid={username},cn=accounts,dc=myldapserver,dc=com"`, + Type: "string", + }, + config.HelpKV{ + Key: GroupSearchFilter, + Description: `Search filter to find groups of a user (optional) eg: "(&(objectclass=groupOfNames)(member={usernamedn}))"`, + Optional: true, + Type: "string", + }, + config.HelpKV{ + Key: GroupNameAttribute, + Description: `Attribute of search results to use as group name (optional) eg: "cn"`, + Optional: true, + Type: "string", + }, + config.HelpKV{ + Key: GroupSearchBaseDN, + Description: `Base DN in AD/LDAP hierarchy to use in search requests (optional) eg: "dc=myldapserver,dc=com"`, + Optional: true, + Type: "string", + }, + config.HelpKV{ + Key: STSExpiry, + Description: `AD/LDAP STS credentials validity duration eg: "1h"`, + Optional: true, + Type: "duration", + }, + config.HelpKV{ + Key: TLSSkipVerify, + Description: "Set this to 'on', to disable client verification of server certificates", + Optional: true, + Type: "on|off", + }, + config.HelpKV{ + Key: config.Comment, + Description: "A comment to describe the LDAP/AD identity setting", + Optional: true, + Type: "sentence", + }, } ) diff --git a/cmd/config/identity/openid/help.go b/cmd/config/identity/openid/help.go index f9bdcb7c8..d060ec49b 100644 --- a/cmd/config/identity/openid/help.go +++ b/cmd/config/identity/openid/help.go @@ -20,9 +20,22 @@ import "github.com/minio/minio/cmd/config" // Help template for OpenID identity feature. var ( - Help = config.HelpKV{ - ConfigURL: `OpenID discovery documented endpoint. eg: "https://accounts.google.com/.well-known/openid-configuration"`, - config.State: "Indicates if OpenID identity is enabled or not", - config.Comment: "A comment to describe the OpenID identity setting", + Help = config.HelpKVS{ + config.HelpKV{ + Key: config.State, + Description: "Indicates if OpenID identity is enabled or not", + Type: "on|off", + }, + config.HelpKV{ + Key: ConfigURL, + Description: `OpenID discovery documented endpoint. eg: "https://accounts.google.com/.well-known/openid-configuration"`, + Type: "url", + }, + config.HelpKV{ + Key: config.Comment, + Description: "A comment to describe the OpenID identity setting", + Optional: true, + Type: "sentence", + }, } ) diff --git a/cmd/config/notify/help.go b/cmd/config/notify/help.go index 7f8546130..bc087f257 100644 --- a/cmd/config/notify/help.go +++ b/cmd/config/notify/help.go @@ -23,141 +23,650 @@ import ( // Help template inputs for all notification targets var ( - HelpAMQP = config.HelpKV{ - config.State: "(Required) Is this server endpoint configuration active/enabled", - config.Comment: "A comment to describe the AMQP target setting", - target.AmqpURL: "(Required) AMQP server endpoint, e.g. `amqp://myuser:mypassword@localhost:5672`", - target.AmqpExchange: "Name of the AMQP exchange", - target.AmqpExchangeType: "Kind of AMQP exchange type", - target.AmqpRoutingKey: "Routing key for publishing", - target.AmqpMandatory: "Set this to 'on' for server to return an unroutable message with a Return method. If this flag is 'off', the server silently drops the message", - target.AmqpDurable: "Set this to 'on' for queue to surive broker restarts", - target.AmqpNoWait: "When no_wait is 'on', declare without waiting for a confirmation from the server", - target.AmqpInternal: "Set this to 'on' for exchange to be not used directly by publishers, but only when bound to other exchanges", - target.AmqpAutoDeleted: "Set this to 'on' for queue that has had at least one consumer is deleted when last consumer unsubscribes", - target.AmqpDeliveryMode: "Delivery queue implementation use non-persistent (1) or persistent (2)", - target.AmqpQueueLimit: "Enable persistent event store queue limit, defaults to '10000'", - target.AmqpQueueDir: "Local directory where events are stored eg: '/home/events'", + HelpAMQP = config.HelpKVS{ + config.HelpKV{ + Key: config.State, + Description: "Is this server endpoint configuration active/enabled", + Type: "on|off", + }, + config.HelpKV{ + Key: target.AmqpURL, + Description: "AMQP server endpoint, e.g. `amqp://myuser:mypassword@localhost:5672`", + Type: "url", + }, + config.HelpKV{ + Key: target.AmqpExchange, + Description: "Name of the AMQP exchange", + Optional: true, + Type: "string", + }, + config.HelpKV{ + Key: target.AmqpExchangeType, + Description: "Kind of AMQP exchange type", + Optional: true, + Type: "string", + }, + config.HelpKV{ + Key: target.AmqpRoutingKey, + Description: "Routing key for publishing", + Optional: true, + Type: "string", + }, + config.HelpKV{ + Key: target.AmqpMandatory, + Description: "Set this to 'on' for server to return an unroutable message with a Return method. If this flag is 'off', the server silently drops the message", + Optional: true, + Type: "on|off", + }, + config.HelpKV{ + Key: target.AmqpDurable, + Description: "Set this to 'on' for queue to survive broker restarts", + Optional: true, + Type: "on|off", + }, + config.HelpKV{ + Key: target.AmqpNoWait, + Description: "When no_wait is 'on', declare without waiting for a confirmation from the server", + Optional: true, + Type: "on|off", + }, + config.HelpKV{ + Key: target.AmqpInternal, + Description: "Set this to 'on' for exchange to be not used directly by publishers, but only when bound to other exchanges", + Optional: true, + Type: "on|off", + }, + config.HelpKV{ + Key: target.AmqpAutoDeleted, + Description: "Set this to 'on' for queue that has had at least one consumer is deleted when last consumer unsubscribes", + Optional: true, + Type: "on|off", + }, + config.HelpKV{ + Key: target.AmqpDeliveryMode, + Description: "Delivery queue implementation use non-persistent (1) or persistent (2)", + Optional: true, + Type: "number", + }, + config.HelpKV{ + Key: target.AmqpQueueDir, + Description: "Local directory where events are stored eg: '/home/events'", + Optional: true, + Type: "path", + }, + config.HelpKV{ + Key: target.AmqpQueueLimit, + Description: "Enable persistent event store queue limit, defaults to '10000'", + Optional: true, + Type: "number", + }, + config.HelpKV{ + Key: config.Comment, + Description: "A comment to describe the AMQP target setting", + Optional: true, + Type: "sentence", + }, } - HelpKafka = config.HelpKV{ - config.State: "(Required) Is this server endpoint configuration active/enabled", - config.Comment: "A comment to describe the Kafka target setting", - target.KafkaTopic: "The Kafka topic for a given message", - target.KafkaBrokers: "Command separated list of Kafka broker addresses", - target.KafkaSASLUsername: "Username for SASL/PLAIN or SASL/SCRAM authentication", - target.KafkaSASLPassword: "Password for SASL/PLAIN or SASL/SCRAM authentication", - target.KafkaTLSClientAuth: "ClientAuth determines the Kafka server's policy for TLS client auth", - target.KafkaSASL: "Set this to 'on' to enable SASL authentication", - target.KafkaTLS: "Set this to 'on' to enable TLS", - target.KafkaTLSSkipVerify: "Set this to 'on' to disable client verification of server certificate chain", - target.KafkaQueueLimit: "Enable persistent event store queue limit, defaults to '10000'", - target.KafkaQueueDir: "Local directory where events are stored eg: '/home/events'", + HelpKafka = config.HelpKVS{ + config.HelpKV{ + Key: config.State, + Description: "Is this server endpoint configuration active/enabled", + Type: "on|off", + }, + config.HelpKV{ + Key: target.KafkaBrokers, + Description: "Command separated list of Kafka broker addresses", + Type: "delimited-string", + }, + config.HelpKV{ + Key: target.KafkaTopic, + Description: "The Kafka topic for a given message", + Optional: true, + Type: "string", + }, + config.HelpKV{ + Key: target.KafkaSASLUsername, + Description: "Username for SASL/PLAIN or SASL/SCRAM authentication", + Optional: true, + Type: "string", + }, + config.HelpKV{ + Key: target.KafkaSASLPassword, + Description: "Password for SASL/PLAIN or SASL/SCRAM authentication", + Optional: true, + Type: "string", + }, + config.HelpKV{ + Key: target.KafkaTLSClientAuth, + Description: "ClientAuth determines the Kafka server's policy for TLS client auth", + Optional: true, + Type: "string", + }, + config.HelpKV{ + Key: target.KafkaSASL, + Description: "Set this to 'on' to enable SASL authentication", + Optional: true, + Type: "on|off", + }, + config.HelpKV{ + Key: target.KafkaTLS, + Description: "Set this to 'on' to enable TLS", + Optional: true, + Type: "on|off", + }, + config.HelpKV{ + Key: target.KafkaTLSSkipVerify, + Description: "Set this to 'on' to disable client verification of server certificate chain", + Optional: true, + Type: "on|off", + }, + config.HelpKV{ + Key: target.KafkaQueueDir, + Description: "Local directory where events are stored eg: '/home/events'", + Optional: true, + Type: "path", + }, + config.HelpKV{ + Key: target.KafkaQueueLimit, + Description: "Enable persistent event store queue limit, defaults to '10000'", + Optional: true, + Type: "number", + }, + config.HelpKV{ + Key: config.Comment, + Description: "A comment to describe the Kafka target setting", + Optional: true, + Type: "sentence", + }, } - HelpMQTT = config.HelpKV{ - config.State: "(Required) Is this server endpoint configuration active/enabled", - config.Comment: "A comment to describe the MQTT target setting", - target.MqttBroker: "(Required) MQTT server endpoint, e.g. `tcp://localhost:1883`", - target.MqttTopic: "(Required) Name of the MQTT topic to publish on, e.g. `minio`", - target.MqttUsername: "Username to connect to the MQTT server (if required)", - target.MqttPassword: "Password to connect to the MQTT server (if required)", - target.MqttQoS: "Set the Quality of Service Level for MQTT endpoint", - target.MqttKeepAliveInterval: "Optional keep alive interval for MQTT connections", - target.MqttReconnectInterval: "Optional reconnect interval for MQTT connections", - target.MqttQueueDir: "Local directory where events are stored eg: '/home/events'", - target.MqttQueueLimit: "Enable persistent event store queue limit, defaults to '10000'", + HelpMQTT = config.HelpKVS{ + config.HelpKV{ + Key: config.State, + Description: "Is this server endpoint configuration active/enabled", + Type: "on|off", + }, + config.HelpKV{ + Key: target.MqttBroker, + Description: "MQTT server endpoint, e.g. `tcp://localhost:1883`", + Type: "uri", + }, + config.HelpKV{ + Key: target.MqttTopic, + Description: "Name of the MQTT topic to publish on, e.g. `minio`", + Type: "string", + }, + config.HelpKV{ + Key: target.MqttUsername, + Description: "Username to connect to the MQTT server", + Optional: true, + Type: "string", + }, + config.HelpKV{ + Key: target.MqttPassword, + Description: "Password to connect to the MQTT server", + Optional: true, + Type: "string", + }, + config.HelpKV{ + Key: target.MqttQoS, + Description: "Set the Quality of Service Level for MQTT endpoint", + Optional: true, + Type: "number", + }, + config.HelpKV{ + Key: target.MqttKeepAliveInterval, + Description: "Keep alive interval for MQTT connections", + Optional: true, + Type: "duration", + }, + config.HelpKV{ + Key: target.MqttReconnectInterval, + Description: "Reconnect interval for MQTT connections", + Optional: true, + Type: "duration", + }, + config.HelpKV{ + Key: target.MqttQueueDir, + Description: "Local directory where events are stored eg: '/home/events'", + Optional: true, + Type: "path", + }, + config.HelpKV{ + Key: target.MqttQueueLimit, + Description: "Enable persistent event store queue limit, defaults to '10000'", + Optional: true, + Type: "number", + }, + config.HelpKV{ + Key: config.Comment, + Description: "A comment to describe the MQTT target setting", + Optional: true, + Type: "sentence", + }, } - HelpES = config.HelpKV{ - config.State: "(Required) Is this server endpoint configuration active/enabled", - config.Comment: "A comment to describe the Elasticsearch target setting", - target.ElasticURL: "(Required) The Elasticsearch server's address, with optional authentication info", - target.ElasticFormat: "(Required) Either `namespace` or `access`, defaults to 'namespace'", - target.ElasticIndex: "(Required) The name of an Elasticsearch index in which MinIO will store document", - target.ElasticQueueDir: "Local directory where events are stored eg: '/home/events'", - target.ElasticQueueLimit: "Enable persistent event store queue limit, defaults to '10000'", + HelpES = config.HelpKVS{ + config.HelpKV{ + Key: config.State, + Description: "Is this server endpoint configuration active/enabled", + Type: "on|off", + }, + config.HelpKV{ + Key: target.ElasticURL, + Description: "The Elasticsearch server's address, with optional authentication info", + Type: "url", + }, + config.HelpKV{ + Key: target.ElasticFormat, + Description: "Either `namespace` or `access`, defaults to 'namespace'", + Type: "namespace*|access", + }, + config.HelpKV{ + Key: target.ElasticIndex, + Description: "The name of an Elasticsearch index in which MinIO will store document", + Type: "string", + }, + config.HelpKV{ + Key: target.ElasticQueueDir, + Description: "Local directory where events are stored eg: '/home/events'", + Optional: true, + Type: "path", + }, + config.HelpKV{ + Key: target.ElasticQueueLimit, + Description: "Enable persistent event store queue limit, defaults to '10000'", + Optional: true, + Type: "number", + }, + config.HelpKV{ + Key: config.Comment, + Description: "A comment to describe the Elasticsearch target setting", + Optional: true, + Type: "sentence", + }, } - HelpWebhook = config.HelpKV{ - config.State: "(Required) Is this server endpoint configuration active/enabled", - config.Comment: "A comment to describe the Webhook target setting", - target.WebhookEndpoint: "Webhook server endpoint eg: http://localhost:8080/minio/events", - target.WebhookAuthToken: "Authorization token used for webhook server endpoint (optional)", - target.WebhookQueueLimit: "Enable persistent event store queue limit, defaults to '10000'", - target.WebhookQueueDir: "Local directory where events are stored eg: '/home/events'", + HelpWebhook = config.HelpKVS{ + config.HelpKV{ + Key: config.State, + Description: "Is this server endpoint configuration active/enabled", + Type: "on|off", + }, + config.HelpKV{ + Key: target.WebhookEndpoint, + Description: "Webhook server endpoint eg: http://localhost:8080/minio/events", + Type: "url", + }, + config.HelpKV{ + Key: target.WebhookAuthToken, + Description: "Authorization token used for webhook server endpoint", + Optional: true, + Type: "string", + }, + config.HelpKV{ + Key: target.WebhookQueueDir, + Description: "Local directory where events are stored eg: '/home/events'", + Optional: true, + Type: "path", + }, + config.HelpKV{ + Key: target.WebhookQueueLimit, + Description: "Enable persistent event store queue limit, defaults to '10000'", + Optional: true, + Type: "number", + }, + config.HelpKV{ + Key: config.Comment, + Description: "A comment to describe the Webhook target setting", + Optional: true, + Type: "sentence", + }, } - HelpRedis = config.HelpKV{ - config.State: "(Required) Is this server endpoint configuration active/enabled", - config.Comment: "A comment to describe the Redis target setting", - target.RedisFormat: "Specify how data is populated, a hash is used in case of `namespace` format and a list in case of `access` format, defaults to 'namespace'", - target.RedisAddress: "(Required) The Redis server's address. For example: `localhost:6379`", - target.RedisKey: "The name of the redis key under which events are stored", - target.RedisPassword: "(Optional) The Redis server's password", - target.RedisQueueDir: "Local directory where events are stored eg: '/home/events'", - target.RedisQueueLimit: "Enable persistent event store queue limit, defaults to '10000'", + HelpRedis = config.HelpKVS{ + config.HelpKV{ + Key: config.State, + Description: "Is this server endpoint configuration active/enabled", + Type: "on|off", + }, + config.HelpKV{ + Key: target.RedisAddress, + Description: "The Redis server's address. For example: `localhost:6379`", + Type: "address", + }, + config.HelpKV{ + Key: target.RedisFormat, + Description: "Specify how data is populated, a hash is used in case of `namespace` format and a list in case of `access` format, defaults to 'namespace'", + Type: "namespace|access", + }, + config.HelpKV{ + Key: target.RedisKey, + Description: "The name of the Redis key under which events are stored", + Type: "string", + }, + config.HelpKV{ + Key: target.RedisPassword, + Description: "The Redis server's password", + Optional: true, + Type: "string", + }, + config.HelpKV{ + Key: target.RedisQueueDir, + Description: "Local directory where events are stored eg: '/home/events'", + Optional: true, + Type: "path", + }, + config.HelpKV{ + Key: target.RedisQueueLimit, + Description: "Enable persistent event store queue limit, defaults to '10000'", + Optional: true, + Type: "number", + }, + config.HelpKV{ + Key: config.Comment, + Description: "A comment to describe the Redis target setting", + Optional: true, + Type: "sentence", + }, } - HelpPostgres = config.HelpKV{ - config.State: "(Required) Is this server endpoint configuration active/enabled", - config.Comment: "A comment to describe the Postgres target setting", - target.PostgresFormat: "Specify how data is populated, `namespace` format and `access` format, defaults to 'namespace'", - target.PostgresConnectionString: "Connection string parameters for the PostgreSQL server", - target.PostgresTable: "(Required) Table name in which events will be stored/updated. If the table does not exist, the MinIO server creates it at start-up", - target.PostgresHost: "(Optional) Host name of the PostgreSQL server. Defaults to `localhost`. IPv6 host should be enclosed with `[` and `]`", - target.PostgresPort: "(Optional) Port on which to connect to PostgreSQL server, defaults to `5432`", - target.PostgresUsername: "Database username, defaults to user running the MinIO process if not specified", - target.PostgresPassword: "Database password", - target.PostgresDatabase: "Database name", - target.PostgresQueueDir: "Local directory where events are stored eg: '/home/events'", - target.PostgresQueueLimit: "Enable persistent event store queue limit, defaults to '10000'", + HelpPostgres = config.HelpKVS{ + config.HelpKV{ + Key: config.State, + Description: "Is this server endpoint configuration active/enabled", + Type: "on|off", + }, + config.HelpKV{ + Key: target.PostgresConnectionString, + Description: "Connection string parameters for the PostgreSQL server", + Type: "string", + }, + config.HelpKV{ + Key: target.PostgresFormat, + Description: "Specify how data is populated, `namespace` format and `access` format, defaults to 'namespace'", + Type: "namespace|access", + }, + config.HelpKV{ + Key: target.PostgresTable, + Description: "Table name in which events will be stored/updated. If the table does not exist, the MinIO server creates it at start-up", + Type: "string", + }, + config.HelpKV{ + Key: target.PostgresHost, + Description: "Host name of the PostgreSQL server. Defaults to `localhost`. IPv6 host should be enclosed with `[` and `]`", + Optional: true, + Type: "hostname", + }, + config.HelpKV{ + Key: target.PostgresPort, + Description: "Port on which to connect to PostgreSQL server, defaults to `5432`", + Optional: true, + Type: "port", + }, + config.HelpKV{ + Key: target.PostgresUsername, + Description: "Database username, defaults to user running the MinIO process if not specified", + Optional: true, + Type: "string", + }, + config.HelpKV{ + Key: target.PostgresPassword, + Description: "Database password", + Optional: true, + Type: "string", + }, + config.HelpKV{ + Key: target.PostgresDatabase, + Description: "Postgres Database name", + Optional: true, + Type: "string", + }, + config.HelpKV{ + Key: target.PostgresQueueDir, + Description: "Local directory where events are stored eg: '/home/events'", + Optional: true, + Type: "path", + }, + config.HelpKV{ + Key: target.PostgresQueueLimit, + Description: "Enable persistent event store queue limit, defaults to '10000'", + Optional: true, + Type: "number", + }, + config.HelpKV{ + Key: config.Comment, + Description: "A comment to describe the Postgres target setting", + Optional: true, + Type: "sentence", + }, } - HelpMySQL = config.HelpKV{ - config.State: "(Required) Is this server endpoint configuration active/enabled", - config.Comment: "A comment to describe the MySQL target setting", - target.MySQLFormat: "Specify how data is populated, `namespace` format and `access` format, defaults to 'namespace'", - target.MySQLHost: "Host name of the MySQL server (used only if `dsnString` is empty)", - target.MySQLPort: "Port on which to connect to the MySQL server (used only if `dsn_string` is empty)", - target.MySQLUsername: "Database user-name (used only if `dsnString` is empty)", - target.MySQLPassword: "Database password (used only if `dsnString` is empty)", - target.MySQLDatabase: "Database name (used only if `dsnString` is empty)", - target.MySQLDSNString: "Data-Source-Name connection string for the MySQL server", - target.MySQLTable: "(Required) Table name in which events will be stored/updated. If the table does not exist, the MinIO server creates it at start-up", - target.MySQLQueueLimit: "Enable persistent event store queue limit, defaults to '10000'", - target.MySQLQueueDir: "Local directory where events are stored eg: '/home/events'", + HelpMySQL = config.HelpKVS{ + config.HelpKV{ + Key: config.State, + Description: "Is this server endpoint configuration active/enabled", + Type: "on|off", + }, + config.HelpKV{ + Key: target.MySQLDSNString, + Description: "Data-Source-Name connection string for the MySQL server", + Type: "string", + }, + config.HelpKV{ + Key: target.MySQLTable, + Description: "Table name in which events will be stored/updated. If the table does not exist, the MinIO server creates it at start-up", + Type: "string", + }, + config.HelpKV{ + Key: target.MySQLFormat, + Description: "Specify how data is populated, `namespace` format and `access` format, defaults to 'namespace'", + Type: "namespace|access", + }, + config.HelpKV{ + Key: target.MySQLHost, + Description: "Host name of the MySQL server (used only if `dsnString` is empty)", + Optional: true, + Type: "hostname", + }, + config.HelpKV{ + Key: target.MySQLPort, + Description: "Port on which to connect to the MySQL server (used only if `dsn_string` is empty)", + Optional: true, + Type: "port", + }, + config.HelpKV{ + Key: target.MySQLUsername, + Description: "Database user-name (used only if `dsnString` is empty)", + Optional: true, + Type: "string", + }, + config.HelpKV{ + Key: target.MySQLPassword, + Description: "Database password (used only if `dsnString` is empty)", + Optional: true, + Type: "string", + }, + config.HelpKV{ + Key: target.MySQLDatabase, + Description: "Database name (used only if `dsnString` is empty)", + Optional: true, + Type: "string", + }, + config.HelpKV{ + Key: target.MySQLQueueDir, + Description: "Local directory where events are stored eg: '/home/events'", + Optional: true, + Type: "path", + }, + config.HelpKV{ + Key: target.MySQLQueueLimit, + Description: "Enable persistent event store queue limit, defaults to '10000'", + Optional: true, + Type: "number", + }, + config.HelpKV{ + Key: config.Comment, + Description: "A comment to describe the MySQL target setting", + Optional: true, + Type: "sentence", + }, } - HelpNATS = config.HelpKV{ - config.State: "(Required) Is this server endpoint configuration active/enabled", - config.Comment: "A comment to describe the NATS target setting", - target.NATSAddress: "NATS server address eg: '0.0.0.0:4222'", - target.NATSSubject: "NATS subject that represents this subscription", - target.NATSUsername: "Username to be used when connecting to the server", - target.NATSPassword: "Password to be used when connecting to a server", - target.NATSToken: "Token to be used when connecting to a server", - target.NATSSecure: "Set this to 'on', enables TLS secure connections that skip server verification (not recommended)", - target.NATSPingInterval: "Client ping commands interval to the server, disabled by default", - target.NATSStreaming: "Set this to 'on', to use streaming NATS server", - target.NATSStreamingAsync: "Set this to 'on', to enable asynchronous publish, process the ACK or error state", - target.NATSStreamingMaxPubAcksInFlight: "Specifies how many messages can be published without getting ACKs back from NATS streaming server", - target.NATSStreamingClusterID: "Unique ID for the NATS streaming cluster", - target.NATSQueueLimit: "Enable persistent event store queue limit, defaults to '10000'", - target.NATSQueueDir: "Local directory where events are stored eg: '/home/events'", - target.NATSCertAuthority: "Certificate chain of the target NATS server if self signed certs were used", - target.NATSClientCert: "TLS Cert used to authenticate against NATS configured to require client certificates", - target.NATSClientKey: "TLS Key used to authenticate against NATS configured to require client certificates", + HelpNATS = config.HelpKVS{ + config.HelpKV{ + Key: config.State, + Description: "Is this server endpoint configuration active/enabled", + Type: "on|off", + }, + config.HelpKV{ + Key: target.NATSAddress, + Description: "NATS server address eg: '0.0.0.0:4222'", + Type: "address", + }, + config.HelpKV{ + Key: target.NATSSubject, + Description: "NATS subject that represents this subscription", + Type: "string", + }, + config.HelpKV{ + Key: target.NATSUsername, + Description: "Username to be used when connecting to the server", + Optional: true, + Type: "string", + }, + config.HelpKV{ + Key: target.NATSPassword, + Description: "Password to be used when connecting to a server", + Optional: true, + Type: "string", + }, + config.HelpKV{ + Key: target.NATSToken, + Description: "Token to be used when connecting to a server", + Optional: true, + Type: "string", + }, + config.HelpKV{ + Key: target.NATSSecure, + Description: "Set this to 'on', enables TLS secure connections that skip server verification (not recommended)", + Optional: true, + Type: "on|off", + }, + config.HelpKV{ + Key: target.NATSPingInterval, + Description: "Client ping commands interval to the server, disabled by default", + Optional: true, + Type: "duration", + }, + config.HelpKV{ + Key: target.NATSStreaming, + Description: "Set this to 'on', to use streaming NATS server", + Optional: true, + Type: "on|off", + }, + config.HelpKV{ + Key: target.NATSStreamingAsync, + Description: "Set this to 'on', to enable asynchronous publish, process the ACK or error state", + Optional: true, + Type: "on|off", + }, + config.HelpKV{ + Key: target.NATSStreamingMaxPubAcksInFlight, + Description: "Specifies how many messages can be published without getting ACKs back from NATS streaming server", + Optional: true, + Type: "number", + }, + config.HelpKV{ + Key: target.NATSStreamingClusterID, + Description: "Unique ID for the NATS streaming cluster", + Optional: true, + Type: "string", + }, + config.HelpKV{ + Key: target.NATSQueueLimit, + Description: "Enable persistent event store queue limit, defaults to '10000'", + Optional: true, + Type: "number", + }, + config.HelpKV{ + Key: target.NATSQueueDir, + Description: "Local directory where events are stored eg: '/home/events'", + Optional: true, + Type: "path", + }, + config.HelpKV{ + Key: target.NATSCertAuthority, + Description: "Certificate chain of the target NATS server if self signed certs were used", + Optional: true, + Type: "string", + }, + config.HelpKV{ + Key: target.NATSClientCert, + Description: "TLS Cert used to authenticate against NATS configured to require client certificates", + Optional: true, + Type: "string", + }, + config.HelpKV{ + Key: target.NATSClientKey, + Description: "TLS Key used to authenticate against NATS configured to require client certificates", + Optional: true, + Type: "string", + }, + config.HelpKV{ + Key: config.Comment, + Description: "A comment to describe the NATS target setting", + Optional: true, + Type: "sentence", + }, } - HelpNSQ = config.HelpKV{ - config.State: "(Required) Is this server endpoint configuration active/enabled", - config.Comment: "A comment to describe the NSQ target setting", - target.NSQAddress: "NSQ server address eg: '127.0.0.1:4150'", - target.NSQTopic: "NSQ topic unique per target", - target.NSQTLS: "Set this to 'on', to enable TLS negotiation", - target.NSQTLSSkipVerify: "Set this to 'on', to disable client verification of server certificates", - target.NSQQueueLimit: "Enable persistent event store queue limit, defaults to '10000'", - target.NSQQueueDir: "Local directory where events are stored eg: '/home/events'", + HelpNSQ = config.HelpKVS{ + config.HelpKV{ + Key: config.State, + Description: "Is this server endpoint configuration active/enabled", + Type: "on|off", + }, + config.HelpKV{ + Key: target.NSQAddress, + Description: "NSQ server address eg: '127.0.0.1:4150'", + Type: "address", + }, + config.HelpKV{ + Key: target.NSQTopic, + Description: "NSQ topic unique per target", + Type: "string", + }, + config.HelpKV{ + Key: target.NSQTLS, + Description: "Set this to 'on', to enable TLS negotiation", + Optional: true, + Type: "on|off", + }, + config.HelpKV{ + Key: target.NSQTLSSkipVerify, + Description: "Set this to 'on', to disable client verification of server certificates", + Optional: true, + Type: "on|off", + }, + config.HelpKV{ + Key: target.NSQQueueDir, + Description: "Local directory where events are stored eg: '/home/events'", + Optional: true, + Type: "path", + }, + config.HelpKV{ + Key: target.NSQQueueLimit, + Description: "Enable persistent event store queue limit, defaults to '10000'", + Optional: true, + Type: "number", + }, + config.HelpKV{ + Key: config.Comment, + Description: "A comment to describe the NSQ target setting", + Optional: true, + Type: "sentence", + }, } ) diff --git a/cmd/config/policy/opa/help.go b/cmd/config/policy/opa/help.go index 88415131a..92f19f41f 100644 --- a/cmd/config/policy/opa/help.go +++ b/cmd/config/policy/opa/help.go @@ -20,10 +20,28 @@ import "github.com/minio/minio/cmd/config" // Help template for OPA policy feature. var ( - Help = config.HelpKV{ - URL: `Points to URL for OPA HTTP API endpoint. eg: "http://localhost:8181/v1/data/httpapi/authz/allow"`, - AuthToken: "Authorization token for the OPA HTTP API endpoint (optional)", - config.State: "Indicates if OPA policy is enabled or not", - config.Comment: "A comment to describe the OPA policy setting", + Help = config.HelpKVS{ + config.HelpKV{ + Key: config.State, + Description: "Indicates if OPA policy is enabled or not", + Type: "on|off", + }, + config.HelpKV{ + Key: URL, + Description: `Points to URL for OPA HTTP API endpoint. eg: "http://localhost:8181/v1/data/httpapi/authz/allow"`, + Type: "url", + }, + config.HelpKV{ + Key: AuthToken, + Description: "Authorization token for the OPA HTTP API endpoint", + Optional: true, + Type: "string", + }, + config.HelpKV{ + Key: config.Comment, + Description: "A comment to describe the OPA policy setting", + Optional: true, + Type: "sentence", + }, } ) diff --git a/cmd/config/storageclass/help.go b/cmd/config/storageclass/help.go index b58f78319..13f85d05d 100644 --- a/cmd/config/storageclass/help.go +++ b/cmd/config/storageclass/help.go @@ -20,10 +20,29 @@ import "github.com/minio/minio/cmd/config" // Help template for storageclass feature. var ( - Help = config.HelpKV{ - ClassRRS: "Set reduced redundancy storage class parity ratio. eg: \"EC:2\"", - ClassStandard: "Set standard storage class parity ratio. eg: \"EC:4\"", - config.State: "Indicates if storageclass is enabled or not", - config.Comment: "A comment to describe the storageclass setting", + Help = config.HelpKVS{ + config.HelpKV{ + Key: config.State, + Description: "Indicates if storageclass is enabled or not", + Type: "on|off", + }, + config.HelpKV{ + Key: ClassRRS, + Description: `Set reduced redundancy storage class parity ratio. eg: "EC:2"`, + Optional: true, + Type: "string", + }, + config.HelpKV{ + Key: ClassStandard, + Description: `Set standard storage class parity ratio. eg: "EC:4"`, + Optional: true, + Type: "string", + }, + config.HelpKV{ + Key: config.Comment, + Description: "A comment to describe the storageclass setting", + Optional: true, + Type: "sentence", + }, } ) diff --git a/cmd/crypto/help.go b/cmd/crypto/help.go index 7d6ab6670..0ff4b7f84 100644 --- a/cmd/crypto/help.go +++ b/cmd/crypto/help.go @@ -20,16 +20,60 @@ import "github.com/minio/minio/cmd/config" // Help template for KMS vault var ( - Help = config.HelpKV{ - KMSVaultEndpoint: `Points to Vault API endpoint eg: "http://vault-endpoint-ip:8200"`, - KMSVaultKeyName: `Transit key name used in vault policy, must be unique name eg: "my-minio-key"`, - KMSVaultAuthType: `Authentication type to Vault API endpoint eg: "approle"`, - KMSVaultAppRoleID: `Unique role ID created for AppRole`, - KMSVaultAppRoleSecret: `Unique secret ID created for AppRole`, - KMSVaultNamespace: `Only needed if AppRole engine is scoped to Vault Namespace eg: "ns1"`, - KMSVaultKeyVersion: `Key version (optional)`, - KMSVaultCAPath: `Path to PEM-encoded CA cert files to use mTLS authentication (optional) eg: "/home/user/custom-certs"`, - config.State: "Indicates if KMS Vault is enabled or not", - config.Comment: "A comment to describe the KMS Vault setting", + Help = config.HelpKVS{ + config.HelpKV{ + Key: config.State, + Description: "Indicates if KMS Vault is enabled or not", + Type: "on|off", + }, + config.HelpKV{ + Key: KMSVaultEndpoint, + Description: `Points to Vault API endpoint eg: "http://vault-endpoint-ip:8200"`, + Type: "url", + }, + config.HelpKV{ + Key: KMSVaultKeyName, + Description: `Transit key name used in vault policy, must be unique name eg: "my-minio-key"`, + Type: "string", + }, + config.HelpKV{ + Key: KMSVaultAuthType, + Description: `Authentication type to Vault API endpoint eg: "approle"`, + Type: "string", + }, + config.HelpKV{ + Key: KMSVaultAppRoleID, + Description: `Unique role ID created for AppRole`, + Type: "string", + }, + config.HelpKV{ + Key: KMSVaultAppRoleSecret, + Description: `Unique secret ID created for AppRole`, + Type: "string", + }, + config.HelpKV{ + Key: KMSVaultNamespace, + Description: `Only needed if AppRole engine is scoped to Vault Namespace eg: "ns1"`, + Optional: true, + Type: "string", + }, + config.HelpKV{ + Key: KMSVaultKeyVersion, + Description: `KMS Vault key version`, + Optional: true, + Type: "number", + }, + config.HelpKV{ + Key: KMSVaultCAPath, + Description: `Path to PEM-encoded CA cert files to use mTLS authentication (optional) eg: "/home/user/custom-certs"`, + Optional: true, + Type: "path", + }, + config.HelpKV{ + Key: config.Comment, + Description: "A comment to describe the KMS Vault setting", + Optional: true, + Type: "sentence", + }, } ) diff --git a/cmd/logger/help.go b/cmd/logger/help.go index 5d124a402..536944e42 100644 --- a/cmd/logger/help.go +++ b/cmd/logger/help.go @@ -20,17 +20,53 @@ import "github.com/minio/minio/cmd/config" // Help template for logger http and audit var ( - Help = config.HelpKV{ - Endpoint: `HTTP logger endpoint eg: "http://localhost:8080/minio/logs/server"`, - AuthToken: "Authorization token for logger endpoint", - config.State: "Indicates if HTTP logger is enabled or not", - config.Comment: "A comment to describe the HTTP logger setting", + Help = config.HelpKVS{ + config.HelpKV{ + Key: config.State, + Description: "Indicates if HTTP logger is enabled or not", + Type: "on|off", + }, + config.HelpKV{ + Key: Endpoint, + Description: `HTTP logger endpoint eg: "http://localhost:8080/minio/logs/server"`, + Type: "url", + }, + config.HelpKV{ + Key: AuthToken, + Description: "Authorization token for logger endpoint", + Optional: true, + Type: "string", + }, + config.HelpKV{ + Key: config.Comment, + Description: "A comment to describe the HTTP logger setting", + Optional: true, + Type: "sentence", + }, } - HelpAudit = config.HelpKV{ - Endpoint: `HTTP Audit logger endpoint eg: "http://localhost:8080/minio/logs/audit"`, - AuthToken: "Authorization token for logger endpoint", - config.State: "Indicates if HTTP Audit logger is enabled or not", - config.Comment: "A comment to describe the HTTP Audit logger setting", + HelpAudit = config.HelpKVS{ + config.HelpKV{ + Key: config.State, + Description: "Indicates if HTTP Audit logger is enabled or not", + Type: "on|off", + }, + config.HelpKV{ + Key: Endpoint, + Description: `HTTP Audit logger endpoint eg: "http://localhost:8080/minio/logs/audit"`, + Type: "url", + }, + config.HelpKV{ + Key: AuthToken, + Description: "Authorization token for logger endpoint", + Optional: true, + Type: "string", + }, + config.HelpKV{ + Key: config.Comment, + Description: "A comment to describe the HTTP Audit logger setting", + Optional: true, + Type: "sentence", + }, } ) diff --git a/go.mod b/go.mod index ae7520c1b..139a66fdb 100644 --- a/go.mod +++ b/go.mod @@ -49,7 +49,8 @@ require ( github.com/minio/sha256-simd v0.1.1 github.com/minio/sio v0.2.0 github.com/mitchellh/go-homedir v1.1.0 - github.com/nats-io/nats.go v1.8.0 + github.com/nats-io/nats-server/v2 v2.1.2 + github.com/nats-io/nats.go v1.9.1 github.com/nats-io/stan.go v0.4.5 github.com/ncw/directio v1.0.5 github.com/nsqio/go-nsq v1.0.7 diff --git a/go.sum b/go.sum index 553ecb1b9..75dce11d2 100644 --- a/go.sum +++ b/go.sum @@ -191,6 +191,8 @@ github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= @@ -497,18 +499,28 @@ github.com/nats-io/go-nats-streaming v0.0.0-20161216191029-077898146bfb/go.mod h github.com/nats-io/go-nats-streaming v0.4.2/go.mod h1:gfq4R3c9sKAINOpelo0gn/b9QDMBZnmrttcsNF+lqyo= github.com/nats-io/go-nats-streaming v0.4.4 h1:1I3lkZDRdQYXb+holjdqZ2J6xyekrD06o9Fd8rWlgP4= github.com/nats-io/go-nats-streaming v0.4.4/go.mod h1:gfq4R3c9sKAINOpelo0gn/b9QDMBZnmrttcsNF+lqyo= +github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= +github.com/nats-io/jwt v0.3.2 h1:+RB5hMpXUUA2dfxuhBTEkMOrYmM+gKIZYS1KjSostMI= +github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= github.com/nats-io/nats v0.0.0-20160916181735-70b70be17b77/go.mod h1:PpmYZwlgTfBI56QypJLfIMOfLnMRuVs+VL6r8mQ2SoQ= github.com/nats-io/nats v1.7.2/go.mod h1:PpmYZwlgTfBI56QypJLfIMOfLnMRuVs+VL6r8mQ2SoQ= github.com/nats-io/nats-server v1.4.1 h1:Ul1oSOGNV/L8kjr4v6l2f9Yet6WY+LevH1/7cRZ/qyA= github.com/nats-io/nats-server v1.4.1/go.mod h1:c8f/fHd2B6Hgms3LtCaI7y6pC4WD1f4SUxcCud5vhBc= +github.com/nats-io/nats-server/v2 v2.1.2 h1:i2Ly0B+1+rzNZHHWtD4ZwKi+OU5l+uQo1iDHZ2PmiIc= +github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= github.com/nats-io/nats-streaming-server v0.12.2/go.mod h1:RyqtDJZvMZO66YmyjIYdIvS69zu/wDAkyNWa8PIUa5c= github.com/nats-io/nats-streaming-server v0.14.1/go.mod h1:RyqtDJZvMZO66YmyjIYdIvS69zu/wDAkyNWa8PIUa5c= github.com/nats-io/nats-streaming-server v0.14.2 h1:WjQMDqVOwsI0Nb0E+XmEs1LY17CwHRbTCSTWKhw9fXs= github.com/nats-io/nats-streaming-server v0.14.2/go.mod h1:RyqtDJZvMZO66YmyjIYdIvS69zu/wDAkyNWa8PIUa5c= github.com/nats-io/nats.go v1.8.0 h1:PXePcr71qzI9MMvQFfV0OBuNItkRQyyZowPfXzvdmVI= github.com/nats-io/nats.go v1.8.0/go.mod h1:BrFz9vVn0fU3AcH9Vn4Kd7W0NpJ651tD5omQ3M8LwxM= +github.com/nats-io/nats.go v1.9.1 h1:ik3HbLhZ0YABLto7iX80pZLPw/6dx3T+++MZJwLnMrQ= +github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= github.com/nats-io/nkeys v0.0.2 h1:+qM7QpgXnvDDixitZtQUBDY9w/s9mu1ghS+JIbsrx6M= github.com/nats-io/nkeys v0.0.2/go.mod h1:dab7URMsZm6Z/jp9Z5UGa87Uutgc2mVpXLC4B7TDb/4= +github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/nkeys v0.1.3 h1:6JrEfig+HzTH85yxzhSVbjHRJv9cn0p6n3IngIcM5/k= +github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nuid v1.0.0/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= @@ -698,6 +710,7 @@ golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586 h1:7KByu05hhLed2MO29w7p1XfZvZ13m8mub3shuVftRs0= golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392 h1:ACG4HJsFiNMf47Y4PeRoebLNy/2lXT9EtprMuTFWt1M= @@ -773,6 +786,7 @@ golang.org/x/sys v0.0.0-20190322080309-f49334f85ddc/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190429190828-d89cdac9e872/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456 h1:ng0gs1AKnRRuEMZoTLLlbOd+C17zUDepwGQBb/n+JVg= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190922100055-0a153f010e69 h1:rOhMmluY6kLMhdnrivzec6lLgaVbMHMn2ISQXJeJ5EM= diff --git a/pkg/madmin/config-help-commands.go b/pkg/madmin/config-help-commands.go index db4f5ed0f..77f3c42d6 100644 --- a/pkg/madmin/config-help-commands.go +++ b/pkg/madmin/config-help-commands.go @@ -23,8 +23,29 @@ import ( "net/url" ) +// Help - return sub-system level help +type Help struct { + SubSys string `json:"subSys"` + Description string `json:"description"` + MultipleTargets bool `json:"multipleTargets"` + KeysHelp HelpKVS `json:"keysHelp"` +} + +// HelpKV - implements help messages for keys +// with value as description of the keys. +type HelpKV struct { + Key string `json:"key"` + Description string `json:"description"` + Optional bool `json:"optional"` + Type string `json:"type"` + MultipleTargets bool `json:"multipleTargets"` +} + +// HelpKVS - implement order of keys help messages. +type HelpKVS []HelpKV + // HelpConfigKV - return help for a given sub-system. -func (adm *AdminClient) HelpConfigKV(subSys, key string, envOnly bool) (map[string]string, error) { +func (adm *AdminClient) HelpConfigKV(subSys, key string, envOnly bool) (Help, error) { v := url.Values{} v.Set("subSys", subSys) v.Set("key", key) @@ -40,18 +61,19 @@ func (adm *AdminClient) HelpConfigKV(subSys, key string, envOnly bool) (map[stri // Execute GET on /minio/admin/v2/help-config-kv resp, err := adm.executeMethod(http.MethodGet, reqData) if err != nil { - return nil, err + return Help{}, err } defer closeResponse(resp) if resp.StatusCode != http.StatusOK { - return nil, httpRespToErrorResponse(resp) + return Help{}, httpRespToErrorResponse(resp) } - var help = make(map[string]string) + var help = Help{} d := json.NewDecoder(resp.Body) + d.DisallowUnknownFields() if err = d.Decode(&help); err != nil { - return nil, err + return help, err } return help, nil