chore(authz api): update swagger json
Signed-off-by: zhanghongtong <rory-z@outlook.com>
This commit is contained in:
parent
fae12051bb
commit
c6ed72df3e
|
@ -41,7 +41,15 @@ definitions() ->
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
Sources = #{
|
Sources = #{
|
||||||
oneOf => [ minirest:ref(<<"redis">>)
|
oneOf => [ minirest:ref(<<"http">>)
|
||||||
|
, minirest:ref(<<"mongo_single">>)
|
||||||
|
, minirest:ref(<<"mongo_rs">>)
|
||||||
|
, minirest:ref(<<"mongo_sharded">>)
|
||||||
|
, minirest:ref(<<"mysql">>)
|
||||||
|
, minirest:ref(<<"pgsql">>)
|
||||||
|
, minirest:ref(<<"redis_single">>)
|
||||||
|
, minirest:ref(<<"redis_sentinel">>)
|
||||||
|
, minirest:ref(<<"redis_cluster">>)
|
||||||
, minirest:ref(<<"file">>)
|
, minirest:ref(<<"file">>)
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -56,9 +64,309 @@ definitions() ->
|
||||||
verify => #{type => boolean, example => false}
|
verify => #{type => boolean, example => false}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Redis = #{
|
HTTP = #{
|
||||||
type => object,
|
type => object,
|
||||||
required => [type, enable, config, cmd],
|
required => [ type
|
||||||
|
, enable
|
||||||
|
, method
|
||||||
|
, headers
|
||||||
|
, request_timeout
|
||||||
|
, connect_timeout
|
||||||
|
, max_retries
|
||||||
|
, retry_interval
|
||||||
|
, pool_type
|
||||||
|
, pool_size
|
||||||
|
, enable_pipelining
|
||||||
|
, ssl
|
||||||
|
],
|
||||||
|
properties => #{
|
||||||
|
type => #{
|
||||||
|
type => string,
|
||||||
|
enum => [<<"http">>],
|
||||||
|
example => <<"http">>
|
||||||
|
},
|
||||||
|
enable => #{
|
||||||
|
type => boolean,
|
||||||
|
example => true
|
||||||
|
},
|
||||||
|
url => #{
|
||||||
|
type => string,
|
||||||
|
example => <<"https://emqx.com">>
|
||||||
|
},
|
||||||
|
method => #{
|
||||||
|
type => string,
|
||||||
|
enum => [<<"get">>, <<"post">>, <<"put">>],
|
||||||
|
example => <<"get">>
|
||||||
|
},
|
||||||
|
headers => #{type => object},
|
||||||
|
body => #{type => object},
|
||||||
|
connect_timeout => #{type => integer},
|
||||||
|
max_retries => #{type => integer},
|
||||||
|
retry_interval => #{type => integer},
|
||||||
|
pool_type => #{
|
||||||
|
type => string,
|
||||||
|
enum => [<<"random">>, <<"hash">>],
|
||||||
|
example => <<"random">>
|
||||||
|
},
|
||||||
|
pool_size => #{type => integer},
|
||||||
|
enable_pipelining => #{type => boolean},
|
||||||
|
ssl => minirest:ref(<<"ssl">>)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
MongoSingle= #{
|
||||||
|
type => object,
|
||||||
|
required => [ type
|
||||||
|
, enable
|
||||||
|
, collection
|
||||||
|
, find
|
||||||
|
, mongo_type
|
||||||
|
, server
|
||||||
|
, pool_size
|
||||||
|
, username
|
||||||
|
, password
|
||||||
|
, auth_source
|
||||||
|
, database
|
||||||
|
, topology
|
||||||
|
, ssl
|
||||||
|
],
|
||||||
|
properties => #{
|
||||||
|
type => #{
|
||||||
|
type => string,
|
||||||
|
enum => [<<"mongo">>],
|
||||||
|
example => <<"mongo">>
|
||||||
|
},
|
||||||
|
enable => #{
|
||||||
|
type => boolean,
|
||||||
|
example => true
|
||||||
|
},
|
||||||
|
collection => #{type => string},
|
||||||
|
find => #{type => object},
|
||||||
|
mongo_type => #{type => string,
|
||||||
|
enum => [<<"single">>],
|
||||||
|
example => <<"single">>},
|
||||||
|
server => #{type => string, example => <<"127.0.0.1:27017">>},
|
||||||
|
pool_size => #{type => integer},
|
||||||
|
username => #{type => string},
|
||||||
|
password => #{type => string},
|
||||||
|
auth_source => #{type => string},
|
||||||
|
database => #{type => string},
|
||||||
|
topology => #{type => object,
|
||||||
|
properties => #{
|
||||||
|
pool_size => #{type => integer},
|
||||||
|
max_overflow => #{type => integer},
|
||||||
|
overflow_ttl => #{type => integer},
|
||||||
|
overflow_check_period => #{type => integer},
|
||||||
|
local_threshold_ms => #{type => integer},
|
||||||
|
connect_timeout_ms => #{type => integer},
|
||||||
|
socket_timeout_ms => #{type => integer},
|
||||||
|
server_selection_timeout_ms => #{type => integer},
|
||||||
|
wait_queue_timeout_ms => #{type => integer},
|
||||||
|
heartbeat_frequency_ms => #{type => integer},
|
||||||
|
min_heartbeat_frequency_ms => #{type => integer}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
ssl => minirest:ref(<<"ssl">>)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
MongoRs= #{
|
||||||
|
type => object,
|
||||||
|
required => [ type
|
||||||
|
, enable
|
||||||
|
, collection
|
||||||
|
, find
|
||||||
|
, mongo_type
|
||||||
|
, servers
|
||||||
|
, replica_set_name
|
||||||
|
, pool_size
|
||||||
|
, username
|
||||||
|
, password
|
||||||
|
, auth_source
|
||||||
|
, database
|
||||||
|
, topology
|
||||||
|
, ssl
|
||||||
|
],
|
||||||
|
properties => #{
|
||||||
|
type => #{
|
||||||
|
type => string,
|
||||||
|
enum => [<<"mongo">>],
|
||||||
|
example => <<"mongo">>
|
||||||
|
},
|
||||||
|
enable => #{
|
||||||
|
type => boolean,
|
||||||
|
example => true
|
||||||
|
},
|
||||||
|
collection => #{type => string},
|
||||||
|
find => #{type => object},
|
||||||
|
mongo_type => #{type => string,
|
||||||
|
enum => [<<"rs">>],
|
||||||
|
example => <<"rs">>},
|
||||||
|
servers => #{type => array,
|
||||||
|
items => #{type => string,example => <<"127.0.0.1:27017">>}},
|
||||||
|
replica_set_name => #{type => string},
|
||||||
|
pool_size => #{type => integer},
|
||||||
|
username => #{type => string},
|
||||||
|
password => #{type => string},
|
||||||
|
auth_source => #{type => string},
|
||||||
|
database => #{type => string},
|
||||||
|
topology => #{type => object,
|
||||||
|
properties => #{
|
||||||
|
pool_size => #{type => integer},
|
||||||
|
max_overflow => #{type => integer},
|
||||||
|
overflow_ttl => #{type => integer},
|
||||||
|
overflow_check_period => #{type => integer},
|
||||||
|
local_threshold_ms => #{type => integer},
|
||||||
|
connect_timeout_ms => #{type => integer},
|
||||||
|
socket_timeout_ms => #{type => integer},
|
||||||
|
server_selection_timeout_ms => #{type => integer},
|
||||||
|
wait_queue_timeout_ms => #{type => integer},
|
||||||
|
heartbeat_frequency_ms => #{type => integer},
|
||||||
|
min_heartbeat_frequency_ms => #{type => integer}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
ssl => minirest:ref(<<"ssl">>)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
MongoSharded = #{
|
||||||
|
type => object,
|
||||||
|
required => [ type
|
||||||
|
, enable
|
||||||
|
, collection
|
||||||
|
, find
|
||||||
|
, mongo_type
|
||||||
|
, servers
|
||||||
|
, pool_size
|
||||||
|
, username
|
||||||
|
, password
|
||||||
|
, auth_source
|
||||||
|
, database
|
||||||
|
, topology
|
||||||
|
, ssl
|
||||||
|
],
|
||||||
|
properties => #{
|
||||||
|
type => #{
|
||||||
|
type => string,
|
||||||
|
enum => [<<"mongo">>],
|
||||||
|
example => <<"mongo">>
|
||||||
|
},
|
||||||
|
enable => #{
|
||||||
|
type => boolean,
|
||||||
|
example => true
|
||||||
|
},
|
||||||
|
collection => #{type => string},
|
||||||
|
find => #{type => object},
|
||||||
|
mongo_type => #{type => string,
|
||||||
|
enum => [<<"sharded">>],
|
||||||
|
example => <<"sharded">>},
|
||||||
|
servers => #{type => array,
|
||||||
|
items => #{type => string,example => <<"127.0.0.1:27017">>}},
|
||||||
|
pool_size => #{type => integer},
|
||||||
|
username => #{type => string},
|
||||||
|
password => #{type => string},
|
||||||
|
auth_source => #{type => string},
|
||||||
|
database => #{type => string},
|
||||||
|
topology => #{type => object,
|
||||||
|
properties => #{
|
||||||
|
pool_size => #{type => integer},
|
||||||
|
max_overflow => #{type => integer},
|
||||||
|
overflow_ttl => #{type => integer},
|
||||||
|
overflow_check_period => #{type => integer},
|
||||||
|
local_threshold_ms => #{type => integer},
|
||||||
|
connect_timeout_ms => #{type => integer},
|
||||||
|
socket_timeout_ms => #{type => integer},
|
||||||
|
server_selection_timeout_ms => #{type => integer},
|
||||||
|
wait_queue_timeout_ms => #{type => integer},
|
||||||
|
heartbeat_frequency_ms => #{type => integer},
|
||||||
|
min_heartbeat_frequency_ms => #{type => integer}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
ssl => minirest:ref(<<"ssl">>)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Mysql = #{
|
||||||
|
type => object,
|
||||||
|
required => [ type
|
||||||
|
, enable
|
||||||
|
, sql
|
||||||
|
, server
|
||||||
|
, database
|
||||||
|
, pool_size
|
||||||
|
, username
|
||||||
|
, password
|
||||||
|
, auto_reconnect
|
||||||
|
, ssl
|
||||||
|
],
|
||||||
|
properties => #{
|
||||||
|
type => #{
|
||||||
|
type => string,
|
||||||
|
enum => [<<"mysql">>],
|
||||||
|
example => <<"mysql">>
|
||||||
|
},
|
||||||
|
enable => #{
|
||||||
|
type => boolean,
|
||||||
|
example => true
|
||||||
|
},
|
||||||
|
sql => #{type => string},
|
||||||
|
server => #{type => string,
|
||||||
|
example => <<"127.0.0.1:3306">>
|
||||||
|
},
|
||||||
|
database => #{type => string},
|
||||||
|
pool_size => #{type => integer},
|
||||||
|
username => #{type => string},
|
||||||
|
password => #{type => string},
|
||||||
|
auto_reconnect => #{type => boolean,
|
||||||
|
example => true
|
||||||
|
},
|
||||||
|
ssl => minirest:ref(<<"ssl">>)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Pgsql = #{
|
||||||
|
type => object,
|
||||||
|
required => [ type
|
||||||
|
, enable
|
||||||
|
, sql
|
||||||
|
, server
|
||||||
|
, database
|
||||||
|
, pool_size
|
||||||
|
, username
|
||||||
|
, password
|
||||||
|
, auto_reconnect
|
||||||
|
, ssl
|
||||||
|
],
|
||||||
|
properties => #{
|
||||||
|
type => #{
|
||||||
|
type => string,
|
||||||
|
enum => [<<"pgsql">>],
|
||||||
|
example => <<"pgsql">>
|
||||||
|
},
|
||||||
|
enable => #{
|
||||||
|
type => boolean,
|
||||||
|
example => true
|
||||||
|
},
|
||||||
|
sql => #{type => string},
|
||||||
|
server => #{type => string,
|
||||||
|
example => <<"127.0.0.1:5432">>
|
||||||
|
},
|
||||||
|
database => #{type => string},
|
||||||
|
pool_size => #{type => integer},
|
||||||
|
username => #{type => string},
|
||||||
|
password => #{type => string},
|
||||||
|
auto_reconnect => #{type => boolean,
|
||||||
|
example => true
|
||||||
|
},
|
||||||
|
ssl => minirest:ref(<<"ssl">>)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
RedisSingle = #{
|
||||||
|
type => object,
|
||||||
|
required => [ type
|
||||||
|
, enable
|
||||||
|
, cmd
|
||||||
|
, server
|
||||||
|
, redis_type
|
||||||
|
, pool_size
|
||||||
|
, auto_reconnect
|
||||||
|
, ssl
|
||||||
|
],
|
||||||
properties => #{
|
properties => #{
|
||||||
type => #{
|
type => #{
|
||||||
type => string,
|
type => string,
|
||||||
|
@ -69,10 +377,10 @@ definitions() ->
|
||||||
type => boolean,
|
type => boolean,
|
||||||
example => true
|
example => true
|
||||||
},
|
},
|
||||||
config => #{
|
cmd => #{
|
||||||
oneOf => [ #{type => object,
|
type => string,
|
||||||
required => [server, redis_type, pool_size, auto_reconnect],
|
example => <<"HGETALL mqtt_authz">>
|
||||||
properties => #{
|
},
|
||||||
server => #{type => string, example => <<"127.0.0.1:3306">>},
|
server => #{type => string, example => <<"127.0.0.1:3306">>},
|
||||||
redis_type => #{type => string,
|
redis_type => #{type => string,
|
||||||
enum => [<<"single">>],
|
enum => [<<"single">>],
|
||||||
|
@ -83,10 +391,33 @@ definitions() ->
|
||||||
database => #{type => integer},
|
database => #{type => integer},
|
||||||
ssl => minirest:ref(<<"ssl">>)
|
ssl => minirest:ref(<<"ssl">>)
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
, #{type => object,
|
RedisSentinel= #{
|
||||||
required => [servers, redis_type, sentinel, pool_size, auto_reconnect],
|
type => object,
|
||||||
|
required => [ type
|
||||||
|
, enable
|
||||||
|
, cmd
|
||||||
|
, servers
|
||||||
|
, redis_type
|
||||||
|
, sentinel
|
||||||
|
, pool_size
|
||||||
|
, auto_reconnect
|
||||||
|
, ssl
|
||||||
|
],
|
||||||
properties => #{
|
properties => #{
|
||||||
|
type => #{
|
||||||
|
type => string,
|
||||||
|
enum => [<<"redis">>],
|
||||||
|
example => <<"redis">>
|
||||||
|
},
|
||||||
|
enable => #{
|
||||||
|
type => boolean,
|
||||||
|
example => true
|
||||||
|
},
|
||||||
|
cmd => #{
|
||||||
|
type => string,
|
||||||
|
example => <<"HGETALL mqtt_authz">>
|
||||||
|
},
|
||||||
servers => #{type => array,
|
servers => #{type => array,
|
||||||
items => #{type => string,example => <<"127.0.0.1:3306">>}},
|
items => #{type => string,example => <<"127.0.0.1:3306">>}},
|
||||||
redis_type => #{type => string,
|
redis_type => #{type => string,
|
||||||
|
@ -99,10 +430,31 @@ definitions() ->
|
||||||
database => #{type => integer},
|
database => #{type => integer},
|
||||||
ssl => minirest:ref(<<"ssl">>)
|
ssl => minirest:ref(<<"ssl">>)
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
, #{type => object,
|
RedisCluster= #{
|
||||||
required => [servers, redis_type, pool_size, auto_reconnect],
|
type => object,
|
||||||
|
required => [ type
|
||||||
|
, enable
|
||||||
|
, cmd
|
||||||
|
, servers
|
||||||
|
, redis_type
|
||||||
|
, pool_size
|
||||||
|
, auto_reconnect
|
||||||
|
, ssl],
|
||||||
properties => #{
|
properties => #{
|
||||||
|
type => #{
|
||||||
|
type => string,
|
||||||
|
enum => [<<"redis">>],
|
||||||
|
example => <<"redis">>
|
||||||
|
},
|
||||||
|
enable => #{
|
||||||
|
type => boolean,
|
||||||
|
example => true
|
||||||
|
},
|
||||||
|
cmd => #{
|
||||||
|
type => string,
|
||||||
|
example => <<"HGETALL mqtt_authz">>
|
||||||
|
},
|
||||||
servers => #{type => array,
|
servers => #{type => array,
|
||||||
items => #{type => string, example => <<"127.0.0.1:3306">>}},
|
items => #{type => string, example => <<"127.0.0.1:3306">>}},
|
||||||
redis_type => #{type => string,
|
redis_type => #{type => string,
|
||||||
|
@ -114,15 +466,6 @@ definitions() ->
|
||||||
database => #{type => integer},
|
database => #{type => integer},
|
||||||
ssl => minirest:ref(<<"ssl">>)
|
ssl => minirest:ref(<<"ssl">>)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
],
|
|
||||||
type => object
|
|
||||||
},
|
|
||||||
cmd => #{
|
|
||||||
type => string,
|
|
||||||
example => <<"HGETALL mqtt_authz">>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
File = #{
|
File = #{
|
||||||
type => object,
|
type => object,
|
||||||
|
@ -153,6 +496,14 @@ definitions() ->
|
||||||
[ #{<<"returned_sources">> => RetruenedSources}
|
[ #{<<"returned_sources">> => RetruenedSources}
|
||||||
, #{<<"sources">> => Sources}
|
, #{<<"sources">> => Sources}
|
||||||
, #{<<"ssl">> => SSL}
|
, #{<<"ssl">> => SSL}
|
||||||
, #{<<"redis">> => Redis}
|
, #{<<"http">> => HTTP}
|
||||||
|
, #{<<"mongo_single">> => MongoSingle}
|
||||||
|
, #{<<"mongo_rs">> => MongoRs}
|
||||||
|
, #{<<"mongo_sharded">> => MongoSharded}
|
||||||
|
, #{<<"mysql">> => Mysql}
|
||||||
|
, #{<<"pgsql">> => Pgsql}
|
||||||
|
, #{<<"redis_single">> => RedisSingle}
|
||||||
|
, #{<<"redis_sentinel">> => RedisSentinel}
|
||||||
|
, #{<<"redis_cluster">> => RedisCluster}
|
||||||
, #{<<"file">> => File}
|
, #{<<"file">> => File}
|
||||||
].
|
].
|
||||||
|
|
|
@ -52,6 +52,7 @@ fields(http_get) ->
|
||||||
, {enable, #{type => boolean(),
|
, {enable, #{type => boolean(),
|
||||||
default => true}}
|
default => true}}
|
||||||
, {url, #{type => url()}}
|
, {url, #{type => url()}}
|
||||||
|
, {method, #{type => get, default => get }}
|
||||||
, {headers, #{type => map(),
|
, {headers, #{type => map(),
|
||||||
default => #{ <<"accept">> => <<"application/json">>
|
default => #{ <<"accept">> => <<"application/json">>
|
||||||
, <<"cache-control">> => <<"no-cache">>
|
, <<"cache-control">> => <<"no-cache">>
|
||||||
|
@ -71,7 +72,6 @@ fields(http_get) ->
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
, {method, #{type => get, default => get }}
|
|
||||||
, {request_timeout, #{type => timeout(), default => 30000 }}
|
, {request_timeout, #{type => timeout(), default => 30000 }}
|
||||||
] ++ proplists:delete(base_url, emqx_connector_http:fields(config));
|
] ++ proplists:delete(base_url, emqx_connector_http:fields(config));
|
||||||
fields(http_post) ->
|
fields(http_post) ->
|
||||||
|
@ -79,6 +79,8 @@ fields(http_post) ->
|
||||||
, {enable, #{type => boolean(),
|
, {enable, #{type => boolean(),
|
||||||
default => true}}
|
default => true}}
|
||||||
, {url, #{type => url()}}
|
, {url, #{type => url()}}
|
||||||
|
, {method, #{type => hoconsc:enum([post, put]),
|
||||||
|
default => get}}
|
||||||
, {headers, #{type => map(),
|
, {headers, #{type => map(),
|
||||||
default => #{ <<"accept">> => <<"application/json">>
|
default => #{ <<"accept">> => <<"application/json">>
|
||||||
, <<"cache-control">> => <<"no-cache">>
|
, <<"cache-control">> => <<"no-cache">>
|
||||||
|
@ -100,8 +102,7 @@ fields(http_post) ->
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
, {method, #{type => hoconsc:enum([post, put]),
|
, {request_timeout, #{type => timeout(), default => 30000 }}
|
||||||
default => get}}
|
|
||||||
, {body, #{type => map(),
|
, {body, #{type => map(),
|
||||||
nullable => true
|
nullable => true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue