api docs: refine logging api description

Signed-off-by: huanggze <loganhuang@yunify.com>
This commit is contained in:
huanggze
2019-06-22 12:46:02 +08:00
parent cd96ec0c21
commit 580c1c3568
3 changed files with 66 additions and 65 deletions

View File

@@ -6,7 +6,7 @@
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@@ -49,21 +49,21 @@ func addWebService(c *restful.Container) error {
Filter(filter.Logging).
Doc("Query logs against the cluster.").
Param(ws.QueryParameter("operation", "Query operation type. One of query, statistics, histogram.").DataType("string").Required(true)).
Param(ws.QueryParameter("workspaces", "List of workspaces separated by comma the query will perform against.").DataType("string").Required(false)).
Param(ws.QueryParameter("workspace_query", "List of keywords for filtering workspaces. Workspaces whose name contains at least one keyword will be matched for query. Non case-sensitive matching. eg. one,two.").DataType("string").Required(false)).
Param(ws.QueryParameter("namespaces", "List of namespaces the query will perform against, eg. ns-one,ns-two").DataType("string").Required(false)).
Param(ws.QueryParameter("namespace_query", "List of keywords for filtering namespaces. Namespaces whose name contains at least one keyword will be matched for query. Non case-sensitive matching. eg. one,two.").DataType("string").Required(false)).
Param(ws.QueryParameter("workloads", "List of workloads the query will perform against, eg. wl-one,wl-two").DataType("string").Required(false)).
Param(ws.QueryParameter("workload_query", "List of keywords for filtering workloads. Workloads whose name contains at least one keyword will be matched for query. Non case-sensitive matching. eg. one,two.").DataType("string").Required(false)).
Param(ws.QueryParameter("pods", "List of pods the query will perform against, eg. pod-one,pod-two").DataType("string").Required(false)).
Param(ws.QueryParameter("pod_query", "List of keywords for filtering pods. Pods whose name contains at least one keyword will be matched for query. Non case-sensitive matching. eg. one,two.").DataType("string").Required(false)).
Param(ws.QueryParameter("containers", "List of containers the query will perform against, eg. container-one,container-two").DataType("string").Required(false)).
Param(ws.QueryParameter("container_query", "List of keywords for filtering containers. Containers whose name contains at least one keyword will be matched for query. Non case-sensitive matching. eg. one,two.").DataType("string").Required(false)).
Param(ws.QueryParameter("log_query", "List of keywords for filtering logs. The query returns log containing at least one keyword. Non case-sensitive matching. eg. err,INFO.").DataType("string").Required(false)).
Param(ws.QueryParameter("workspaces", "List of workspaces, separated by comma, the query will perform against.").DataType("string").Required(false)).
Param(ws.QueryParameter("workspace_query", "List of keywords, separated by comma, for filtering workspaces. Workspaces whose name contains at least one keyword will be matched for query. Non case-sensitive matching.").DataType("string").Required(false)).
Param(ws.QueryParameter("namespaces", "List of namespaces, separated by comma, the query will perform against.").DataType("string").Required(false)).
Param(ws.QueryParameter("namespace_query", "List of keywords, separated by comma, for filtering namespaces. Namespaces whose name contains at least one keyword will be matched for query. Non case-sensitive matching.").DataType("string").Required(false)).
Param(ws.QueryParameter("workloads", "List of workloads, separated by comma, the query will perform against.").DataType("string").Required(false)).
Param(ws.QueryParameter("workload_query", "List of keywords, separated by comma, for filtering workloads. Workloads whose name contains at least one keyword will be matched for query. Non case-sensitive matching.").DataType("string").Required(false)).
Param(ws.QueryParameter("pods", "List of pods, separated by comma, the query will perform against.").DataType("string").Required(false)).
Param(ws.QueryParameter("pod_query", "List of keywords, separated by comma, for filtering pods. Pods whose name contains at least one keyword will be matched for query. Non case-sensitive matching.").DataType("string").Required(false)).
Param(ws.QueryParameter("containers", "List of containers, separated by comma, the query will perform against.").DataType("string").Required(false)).
Param(ws.QueryParameter("container_query", "List of keywords, separated by comma, for filtering containers. Containers whose name contains at least one keyword will be matched for query. Non case-sensitive matching.").DataType("string").Required(false)).
Param(ws.QueryParameter("log_query", "List of keywords, separated by comma, for filtering logs. The query returns log containing at least one keyword. Non case-sensitive matching. eg. err,INFO.").DataType("string").Required(false)).
Param(ws.QueryParameter("interval", "Count logs at intervals. Valid only if operation is histogram. The unit can be ms(milliseconds), s(seconds), m(minutes), h(hours), d(days), w(weeks), M(months), q(quarters), y(years). eg. 30m.").DataType("string").Required(false)).
Param(ws.QueryParameter("start_time", "Start time of query range, eg. 1559664000000.").DataType("string").Required(false)).
Param(ws.QueryParameter("end_time", "End time of query range, eg. 1559664000000.").DataType("string").Required(false)).
Param(ws.QueryParameter("sort", "Sort log by time. One of acs, desc.").DataType("string").DefaultValue("desc").Required(false)).
Param(ws.QueryParameter("start_time", "Start of query range. Default to 0. This option accepts built-in formats supported by Elasticsearch, such as epoch_millis (eg. 1559664000000).").DataType("string").Required(false)).
Param(ws.QueryParameter("end_time", "End of query range. Default to now. This option accepts built-in formats supported by Elasticsearch, such as epoch_millis (eg. 1559664000000).").DataType("string").Required(false)).
Param(ws.QueryParameter("sort", "Sort logs by timestamp. One of acs, desc.").DataType("string").DefaultValue("desc").Required(false)).
Param(ws.QueryParameter("from", "Beginning index of result to return. Use this option together with size.").DataType("integer").DefaultValue("0").Required(false)).
Param(ws.QueryParameter("size", "Size of result to return.").DataType("integer").DefaultValue("10").Required(false)).
Metadata(restfulspec.KeyOpenAPITags, []string{"Logging", "query"}).
@@ -77,19 +77,19 @@ func addWebService(c *restful.Container) error {
Doc("Query logs against a specific workspace.").
Param(ws.PathParameter("workspace", "Perform query against a specific workspace.").DataType("string").Required(true)).
Param(ws.QueryParameter("operation", "Query operation type. One of query, statistics, histogram.").DataType("string").Required(true)).
Param(ws.QueryParameter("namespaces", "List of namespaces the query will perform against, eg. ns-one,ns-two").DataType("string").Required(false)).
Param(ws.QueryParameter("namespace_query", "List of keywords for filtering namespaces. Namespaces whose name contains at least one keyword will be matched for query. Non case-sensitive matching. eg. one,two.").DataType("string").Required(false)).
Param(ws.QueryParameter("workloads", "List of workloads the query will perform against, eg. wl-one,wl-two").DataType("string").Required(false)).
Param(ws.QueryParameter("workload_query", "List of keywords for filtering workloads. Workloads whose name contains at least one keyword will be matched for query. Non case-sensitive matching. eg. one,two.").DataType("string").Required(false)).
Param(ws.QueryParameter("pods", "List of pods the query will perform against, eg. pod-one,pod-two").DataType("string").Required(false)).
Param(ws.QueryParameter("pod_query", "List of keywords for filtering pods. Pods whose name contains at least one keyword will be matched for query. Non case-sensitive matching. eg. one,two.").DataType("string").Required(false)).
Param(ws.QueryParameter("containers", "List of containers the query will perform against, eg. container-one,container-two").DataType("string").Required(false)).
Param(ws.QueryParameter("container_query", "List of keywords for filtering containers. Containers whose name contains at least one keyword will be matched for query. Non case-sensitive matching. eg. one,two.").DataType("string").Required(false)).
Param(ws.QueryParameter("log_query", "List of keywords for filtering logs. The query returns log containing at least one keyword. Non case-sensitive matching. eg. err,INFO.").DataType("string").Required(false)).
Param(ws.QueryParameter("namespaces", "List of namespaces, separated by comma, the query will perform against.").DataType("string").Required(false)).
Param(ws.QueryParameter("namespace_query", "List of keywords, separated by comma, for filtering namespaces. Namespaces whose name contains at least one keyword will be matched for query. Non case-sensitive matching.").DataType("string").Required(false)).
Param(ws.QueryParameter("workloads", "List of workloads, separated by comma, the query will perform against.").DataType("string").Required(false)).
Param(ws.QueryParameter("workload_query", "List of keywords, separated by comma, for filtering workloads. Workloads whose name contains at least one keyword will be matched for query. Non case-sensitive matching.").DataType("string").Required(false)).
Param(ws.QueryParameter("pods", "List of pods, separated by comma, the query will perform against.").DataType("string").Required(false)).
Param(ws.QueryParameter("pod_query", "List of keywords, separated by comma, for filtering pods. Pods whose name contains at least one keyword will be matched for query. Non case-sensitive matching.").DataType("string").Required(false)).
Param(ws.QueryParameter("containers", "List of containers, separated by comma, the query will perform against.").DataType("string").Required(false)).
Param(ws.QueryParameter("container_query", "List of keywords, separated by comma, for filtering containers. Containers whose name contains at least one keyword will be matched for query. Non case-sensitive matching.").DataType("string").Required(false)).
Param(ws.QueryParameter("log_query", "List of keywords, separated by comma, for filtering logs. The query returns log containing at least one keyword. Non case-sensitive matching. eg. err,INFO.").DataType("string").Required(false)).
Param(ws.QueryParameter("interval", "Count logs at intervals. Valid only if operation is histogram. The unit can be ms(milliseconds), s(seconds), m(minutes), h(hours), d(days), w(weeks), M(months), q(quarters), y(years). eg. 30m.").DataType("string").Required(false)).
Param(ws.QueryParameter("start_time", "Start time of query range, eg. 1559664000000.").DataType("string").Required(false)).
Param(ws.QueryParameter("end_time", "End time of query range, eg. 1559664000000.").DataType("string").Required(false)).
Param(ws.QueryParameter("sort", "Sort log by time. One of acs, desc.").DataType("string").DefaultValue("desc").Required(false)).
Param(ws.QueryParameter("start_time", "Start of query range. Default to 0. This option accepts built-in formats supported by Elasticsearch, such as epoch_millis (eg. 1559664000000).").DataType("string").Required(false)).
Param(ws.QueryParameter("end_time", "End of query range. Default to now. This option accepts built-in formats supported by Elasticsearch, such as epoch_millis (eg. 1559664000000).").DataType("string").Required(false)).
Param(ws.QueryParameter("sort", "Sort logs by timestamp. One of acs, desc.").DataType("string").DefaultValue("desc").Required(false)).
Param(ws.QueryParameter("from", "Beginning index of result to return. Use this option together with size.").DataType("integer").DefaultValue("0").Required(false)).
Param(ws.QueryParameter("size", "Size of result to return.").DataType("integer").DefaultValue("10").Required(false)).
Metadata(restfulspec.KeyOpenAPITags, []string{"Logging", "query"}).
@@ -103,17 +103,17 @@ func addWebService(c *restful.Container) error {
Doc("Query logs against a specific namespace.").
Param(ws.PathParameter("namespace", "Perform query against a specific namespace.").DataType("string").Required(true)).
Param(ws.QueryParameter("operation", "Query operation type. One of query, statistics, histogram.").DataType("string").Required(true)).
Param(ws.QueryParameter("workloads", "List of workloads the query will perform against, eg. wl-one,wl-two").DataType("string").Required(false)).
Param(ws.QueryParameter("workload_query", "List of keywords for filtering workloads. Workloads whose name contains at least one keyword will be matched for query. Non case-sensitive matching. eg. one,two.").DataType("string").Required(false)).
Param(ws.QueryParameter("pods", "List of pods the query will perform against, eg. pod-one,pod-two").DataType("string").Required(false)).
Param(ws.QueryParameter("pod_query", "List of keywords for filtering pods. Pods whose name contains at least one keyword will be matched for query. Non case-sensitive matching. eg. one,two.").DataType("string").Required(false)).
Param(ws.QueryParameter("containers", "List of containers the query will perform against, eg. container-one,container-two").DataType("string").Required(false)).
Param(ws.QueryParameter("container_query", "List of keywords for filtering containers. Containers whose name contains at least one keyword will be matched for query. Non case-sensitive matching. eg. one,two.").DataType("string").Required(false)).
Param(ws.QueryParameter("log_query", "List of keywords for filtering logs. The query returns log containing at least one keyword. Non case-sensitive matching. eg. err,INFO.").DataType("string").Required(false)).
Param(ws.QueryParameter("workloads", "List of workloads, separated by comma, the query will perform against.").DataType("string").Required(false)).
Param(ws.QueryParameter("workload_query", "List of keywords, separated by comma, for filtering workloads. Workloads whose name contains at least one keyword will be matched for query. Non case-sensitive matching.").DataType("string").Required(false)).
Param(ws.QueryParameter("pods", "List of pods, separated by comma, the query will perform against.").DataType("string").Required(false)).
Param(ws.QueryParameter("pod_query", "List of keywords, separated by comma, for filtering pods. Pods whose name contains at least one keyword will be matched for query. Non case-sensitive matching.").DataType("string").Required(false)).
Param(ws.QueryParameter("containers", "List of containers, separated by comma, the query will perform against.").DataType("string").Required(false)).
Param(ws.QueryParameter("container_query", "List of keywords, separated by comma, for filtering containers. Containers whose name contains at least one keyword will be matched for query. Non case-sensitive matching.").DataType("string").Required(false)).
Param(ws.QueryParameter("log_query", "List of keywords, separated by comma, for filtering logs. The query returns log containing at least one keyword. Non case-sensitive matching. eg. err,INFO.").DataType("string").Required(false)).
Param(ws.QueryParameter("interval", "Count logs at intervals. Valid only if operation is histogram. The unit can be ms(milliseconds), s(seconds), m(minutes), h(hours), d(days), w(weeks), M(months), q(quarters), y(years). eg. 30m.").DataType("string").Required(false)).
Param(ws.QueryParameter("start_time", "Start time of query range, eg. 1559664000000.").DataType("string").Required(false)).
Param(ws.QueryParameter("end_time", "End time of query range, eg. 1559664000000.").DataType("string").Required(false)).
Param(ws.QueryParameter("sort", "Sort log by time. One of acs, desc.").DataType("string").DefaultValue("desc").Required(false)).
Param(ws.QueryParameter("start_time", "Start of query range. Default to 0. This option accepts built-in formats supported by Elasticsearch, such as epoch_millis (eg. 1559664000000).").DataType("string").Required(false)).
Param(ws.QueryParameter("end_time", "End of query range. Default to now. This option accepts built-in formats supported by Elasticsearch, such as epoch_millis (eg. 1559664000000).").DataType("string").Required(false)).
Param(ws.QueryParameter("sort", "Sort logs by timestamp. One of acs, desc.").DataType("string").DefaultValue("desc").Required(false)).
Param(ws.QueryParameter("from", "Beginning index of result to return. Use this option together with size.").DataType("integer").DefaultValue("0").Required(false)).
Param(ws.QueryParameter("size", "Size of result to return.").DataType("integer").DefaultValue("10").Required(false)).
Metadata(restfulspec.KeyOpenAPITags, []string{"Logging", "query"}).
@@ -128,15 +128,15 @@ func addWebService(c *restful.Container) error {
Param(ws.PathParameter("namespace", "Specify the namespace of the workload.").DataType("string").Required(true)).
Param(ws.PathParameter("workload", "Perform query against a specific workload.").DataType("string").Required(true)).
Param(ws.QueryParameter("operation", "Query operation type. One of query, statistics, histogram.").DataType("string").Required(true)).
Param(ws.QueryParameter("pods", "List of pods the query will perform against, eg. pod-one,pod-two").DataType("string").Required(false)).
Param(ws.QueryParameter("pod_query", "List of keywords for filtering pods. Pods whose name contains at least one keyword will be matched for query. Non case-sensitive matching. eg. one,two.").DataType("string").Required(false)).
Param(ws.QueryParameter("containers", "List of containers the query will perform against, eg. container-one,container-two").DataType("string").Required(false)).
Param(ws.QueryParameter("container_query", "List of keywords for filtering containers. Containers whose name contains at least one keyword will be matched for query. Non case-sensitive matching. eg. one,two.").DataType("string").Required(false)).
Param(ws.QueryParameter("log_query", "List of keywords for filtering logs. The query returns log containing at least one keyword. Non case-sensitive matching. eg. err,INFO.").DataType("string").Required(false)).
Param(ws.QueryParameter("pods", "List of pods, separated by comma, the query will perform against.").DataType("string").Required(false)).
Param(ws.QueryParameter("pod_query", "List of keywords, separated by comma, for filtering pods. Pods whose name contains at least one keyword will be matched for query. Non case-sensitive matching.").DataType("string").Required(false)).
Param(ws.QueryParameter("containers", "List of containers, separated by comma, the query will perform against.").DataType("string").Required(false)).
Param(ws.QueryParameter("container_query", "List of keywords, separated by comma, for filtering containers. Containers whose name contains at least one keyword will be matched for query. Non case-sensitive matching.").DataType("string").Required(false)).
Param(ws.QueryParameter("log_query", "List of keywords, separated by comma, for filtering logs. The query returns log containing at least one keyword. Non case-sensitive matching. eg. err,INFO.").DataType("string").Required(false)).
Param(ws.QueryParameter("interval", "Count logs at intervals. Valid only if operation is histogram. The unit can be ms(milliseconds), s(seconds), m(minutes), h(hours), d(days), w(weeks), M(months), q(quarters), y(years). eg. 30m.").DataType("string").Required(false)).
Param(ws.QueryParameter("start_time", "Start time of query range, eg. 1559664000000.").DataType("string").Required(false)).
Param(ws.QueryParameter("end_time", "End time of query range, eg. 1559664000000.").DataType("string").Required(false)).
Param(ws.QueryParameter("sort", "Sort log by time. One of acs, desc.").DataType("string").DefaultValue("desc").Required(false)).
Param(ws.QueryParameter("start_time", "Start of query range. Default to 0. This option accepts built-in formats supported by Elasticsearch, such as epoch_millis (eg. 1559664000000).").DataType("string").Required(false)).
Param(ws.QueryParameter("end_time", "End of query range. Default to now. This option accepts built-in formats supported by Elasticsearch, such as epoch_millis (eg. 1559664000000).").DataType("string").Required(false)).
Param(ws.QueryParameter("sort", "Sort logs by timestamp. One of acs, desc.").DataType("string").DefaultValue("desc").Required(false)).
Param(ws.QueryParameter("from", "Beginning index of result to return. Use this option together with size.").DataType("integer").DefaultValue("0").Required(false)).
Param(ws.QueryParameter("size", "Size of result to return.").DataType("integer").DefaultValue("10").Required(false)).
Metadata(restfulspec.KeyOpenAPITags, []string{"Logging", "query"}).
@@ -151,13 +151,13 @@ func addWebService(c *restful.Container) error {
Param(ws.PathParameter("namespace", "Specify the namespace of the pod.").DataType("string").Required(true)).
Param(ws.PathParameter("pod", "Perform query against a specific pod.").DataType("string").Required(true)).
Param(ws.QueryParameter("operation", "Query operation type. One of query, statistics, histogram.").DataType("string").Required(true)).
Param(ws.QueryParameter("containers", "List of containers the query will perform against, eg. container-one,container-two").DataType("string").Required(false)).
Param(ws.QueryParameter("container_query", "List of keywords for filtering containers. Containers whose name contains at least one keyword will be matched for query. Non case-sensitive matching. eg. one,two.").DataType("string").Required(false)).
Param(ws.QueryParameter("log_query", "List of keywords for filtering logs. The query returns log containing at least one keyword. Non case-sensitive matching. eg. err,INFO.").DataType("string").Required(false)).
Param(ws.QueryParameter("containers", "List of containers, separated by comma, the query will perform against.").DataType("string").Required(false)).
Param(ws.QueryParameter("container_query", "List of keywords, separated by comma, for filtering containers. Containers whose name contains at least one keyword will be matched for query. Non case-sensitive matching.").DataType("string").Required(false)).
Param(ws.QueryParameter("log_query", "List of keywords, separated by comma, for filtering logs. The query returns log containing at least one keyword. Non case-sensitive matching. eg. err,INFO.").DataType("string").Required(false)).
Param(ws.QueryParameter("interval", "Count logs at intervals. Valid only if operation is histogram. The unit can be ms(milliseconds), s(seconds), m(minutes), h(hours), d(days), w(weeks), M(months), q(quarters), y(years). eg. 30m.").DataType("string").Required(false)).
Param(ws.QueryParameter("start_time", "Start time of query range, eg. 1559664000000.").DataType("string").Required(false)).
Param(ws.QueryParameter("end_time", "End time of query range, eg. 1559664000000.").DataType("string").Required(false)).
Param(ws.QueryParameter("sort", "Sort log by time. One of acs, desc.").DataType("string").DefaultValue("desc").Required(false)).
Param(ws.QueryParameter("start_time", "Start of query range. Default to 0. This option accepts built-in formats supported by Elasticsearch, such as epoch_millis (eg. 1559664000000).").DataType("string").Required(false)).
Param(ws.QueryParameter("end_time", "End of query range. Default to now. This option accepts built-in formats supported by Elasticsearch, such as epoch_millis (eg. 1559664000000).").DataType("string").Required(false)).
Param(ws.QueryParameter("sort", "Sort logs by timestamp. One of acs, desc.").DataType("string").DefaultValue("desc").Required(false)).
Param(ws.QueryParameter("from", "Beginning index of result to return. Use this option together with size.").DataType("integer").DefaultValue("0").Required(false)).
Param(ws.QueryParameter("size", "Size of result to return.").DataType("integer").DefaultValue("10").Required(false)).
Metadata(restfulspec.KeyOpenAPITags, []string{"Logging", "query"}).
@@ -173,11 +173,11 @@ func addWebService(c *restful.Container) error {
Param(ws.PathParameter("pod", "Specify the pod of the container.").DataType("string").Required(true)).
Param(ws.PathParameter("container", "Perform query against a specific container.").DataType("string").Required(true)).
Param(ws.QueryParameter("operation", "Query operation type. One of query, statistics, histogram.").DataType("string").Required(true)).
Param(ws.QueryParameter("log_query", "List of keywords for filtering logs. The query returns log containing at least one keyword. Non case-sensitive matching. eg. err,INFO.").DataType("string").Required(false)).
Param(ws.QueryParameter("log_query", "List of keywords, separated by comma, for filtering logs. The query returns log containing at least one keyword. Non case-sensitive matching. eg. err,INFO.").DataType("string").Required(false)).
Param(ws.QueryParameter("interval", "Count logs at intervals. Valid only if operation is histogram. The unit can be ms(milliseconds), s(seconds), m(minutes), h(hours), d(days), w(weeks), M(months), q(quarters), y(years). eg. 30m.").DataType("string").Required(false)).
Param(ws.QueryParameter("start_time", "Start time of query range, eg. 1559664000000.").DataType("string").Required(false)).
Param(ws.QueryParameter("end_time", "End time of query range, eg. 1559664000000.").DataType("string").Required(false)).
Param(ws.QueryParameter("sort", "Sort log by time. One of acs, desc.").DataType("string").DefaultValue("desc").Required(false)).
Param(ws.QueryParameter("start_time", "Start of query range. Default to 0. This option accepts built-in formats supported by Elasticsearch, such as epoch_millis (eg. 1559664000000).").DataType("string").Required(false)).
Param(ws.QueryParameter("end_time", "End of query range. Default to now. This option accepts built-in formats supported by Elasticsearch, such as epoch_millis (eg. 1559664000000).").DataType("string").Required(false)).
Param(ws.QueryParameter("sort", "Sort logs by timestamp. One of acs, desc.").DataType("string").DefaultValue("desc").Required(false)).
Param(ws.QueryParameter("from", "Beginning index of result to return. Use this option together with size.").DataType("integer").DefaultValue("0").Required(false)).
Param(ws.QueryParameter("size", "Size of result to return.").DataType("integer").DefaultValue("10").Required(false)).
Metadata(restfulspec.KeyOpenAPITags, []string{"Logging", "query"}).