fix: swagger examples for PostgreSQL, Matrix and Timescale
This commit is contained in:
parent
d03674a505
commit
f070d80b1a
|
@ -81,7 +81,7 @@ connector_examples(Method) ->
|
||||||
#{
|
#{
|
||||||
<<"matrix">> => #{
|
<<"matrix">> => #{
|
||||||
summary => <<"Matrix Connector">>,
|
summary => <<"Matrix Connector">>,
|
||||||
value => emqx_postgresql_connector_schema:values({Method, connector})
|
value => emqx_postgresql_connector_schema:values({Method, <<"matrix">>})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
].
|
].
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
roots/0,
|
roots/0,
|
||||||
fields/1,
|
fields/1,
|
||||||
desc/1,
|
desc/1,
|
||||||
values/2,
|
|
||||||
fields/2
|
fields/2
|
||||||
]).
|
]).
|
||||||
|
|
||||||
|
@ -133,8 +132,8 @@ bridge_v2_examples(Method) ->
|
||||||
[
|
[
|
||||||
#{
|
#{
|
||||||
<<"pgsql">> => #{
|
<<"pgsql">> => #{
|
||||||
summary => <<"PostgreSQL Producer Action">>,
|
summary => <<"PostgreSQL Action">>,
|
||||||
value => values({Method, bridge_v2_producer})
|
value => values({Method, pgsql})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
].
|
].
|
||||||
|
@ -143,7 +142,7 @@ conn_bridge_examples(Method) ->
|
||||||
[
|
[
|
||||||
#{
|
#{
|
||||||
<<"pgsql">> => #{
|
<<"pgsql">> => #{
|
||||||
summary => <<"PostgreSQL Producer Bridge">>,
|
summary => <<"PostgreSQL Bridge">>,
|
||||||
value => values_conn_bridge_examples(Method, pgsql)
|
value => values_conn_bridge_examples(Method, pgsql)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,21 +159,17 @@ values({get, PostgreSQLType}) ->
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
values({post, PostgreSQLType})
|
|
||||||
);
|
|
||||||
values({post, PostgreSQLType}) ->
|
|
||||||
maps:merge(
|
|
||||||
#{
|
|
||||||
name => <<"my_pgsql_action">>,
|
|
||||||
type => PostgreSQLType
|
|
||||||
},
|
|
||||||
values({put, PostgreSQLType})
|
values({put, PostgreSQLType})
|
||||||
);
|
);
|
||||||
|
values({post, PostgreSQLType}) ->
|
||||||
|
values({put, PostgreSQLType});
|
||||||
values({put, PostgreSQLType}) ->
|
values({put, PostgreSQLType}) ->
|
||||||
maps:merge(
|
maps:merge(
|
||||||
#{
|
#{
|
||||||
|
name => <<"my_action">>,
|
||||||
|
type => PostgreSQLType,
|
||||||
enable => true,
|
enable => true,
|
||||||
connector => <<"my_pgsql_connector">>,
|
connector => <<"my_connector">>,
|
||||||
resource_opts => #{
|
resource_opts => #{
|
||||||
batch_size => 1,
|
batch_size => 1,
|
||||||
batch_time => <<"50ms">>,
|
batch_time => <<"50ms">>,
|
||||||
|
@ -184,9 +179,9 @@ values({put, PostgreSQLType}) ->
|
||||||
worker_pool_size => 16
|
worker_pool_size => 16
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
values({producer, PostgreSQLType})
|
values(parameters)
|
||||||
);
|
);
|
||||||
values({producer, _PostgreSQLType}) ->
|
values(parameters) ->
|
||||||
#{
|
#{
|
||||||
<<"parameters">> => #{
|
<<"parameters">> => #{
|
||||||
<<"sql">> =>
|
<<"sql">> =>
|
||||||
|
@ -201,6 +196,19 @@ values({producer, _PostgreSQLType}) ->
|
||||||
}
|
}
|
||||||
}.
|
}.
|
||||||
|
|
||||||
|
values_conn_bridge_examples(get, Type) ->
|
||||||
|
maps:merge(
|
||||||
|
#{
|
||||||
|
status => <<"connected">>,
|
||||||
|
node_status => [
|
||||||
|
#{
|
||||||
|
node => <<"emqx@localhost">>,
|
||||||
|
status => <<"connected">>
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
values_conn_bridge_examples(post, Type)
|
||||||
|
);
|
||||||
values_conn_bridge_examples(_Method, Type) ->
|
values_conn_bridge_examples(_Method, Type) ->
|
||||||
#{
|
#{
|
||||||
enable => true,
|
enable => true,
|
||||||
|
@ -222,6 +230,3 @@ values_conn_bridge_examples(_Method, Type) ->
|
||||||
max_buffer_bytes => ?DEFAULT_BUFFER_BYTES
|
max_buffer_bytes => ?DEFAULT_BUFFER_BYTES
|
||||||
}
|
}
|
||||||
}.
|
}.
|
||||||
|
|
||||||
values(Method, Type) ->
|
|
||||||
values_conn_bridge_examples(Method, Type).
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ connector_examples(Method) ->
|
||||||
#{
|
#{
|
||||||
<<"timescale">> => #{
|
<<"timescale">> => #{
|
||||||
summary => <<"Timescale Connector">>,
|
summary => <<"Timescale Connector">>,
|
||||||
value => emqx_postgresql_connector_schema:values({Method, connector})
|
value => emqx_postgresql_connector_schema:values({Method, <<"timescale">>})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
].
|
].
|
||||||
|
|
|
@ -99,8 +99,8 @@ connector_examples(Method) ->
|
||||||
[
|
[
|
||||||
#{
|
#{
|
||||||
<<"pgsql">> => #{
|
<<"pgsql">> => #{
|
||||||
summary => <<"PostgreSQL Producer Connector">>,
|
summary => <<"PostgreSQL Connector">>,
|
||||||
value => values({Method, connector})
|
value => values({Method, pgsql})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
].
|
].
|
||||||
|
@ -119,93 +119,35 @@ values({get, PostgreSQLType}) ->
|
||||||
},
|
},
|
||||||
values({post, PostgreSQLType})
|
values({post, PostgreSQLType})
|
||||||
);
|
);
|
||||||
values({post, connector}) ->
|
|
||||||
maps:merge(
|
|
||||||
#{
|
|
||||||
name => <<"my_pgsql_connector">>,
|
|
||||||
type => <<"pgsql">>
|
|
||||||
},
|
|
||||||
values(common_config)
|
|
||||||
);
|
|
||||||
values({post, PostgreSQLType}) ->
|
values({post, PostgreSQLType}) ->
|
||||||
maps:merge(
|
values({put, PostgreSQLType});
|
||||||
#{
|
|
||||||
name => <<"my_pgsql_action">>,
|
|
||||||
type => <<"pgsql">>
|
|
||||||
},
|
|
||||||
values({put, PostgreSQLType})
|
|
||||||
);
|
|
||||||
values({put, bridge_v2_producer}) ->
|
|
||||||
values(bridge_v2_producer);
|
|
||||||
values({put, connector}) ->
|
|
||||||
values(common_config);
|
|
||||||
values({put, PostgreSQLType}) ->
|
values({put, PostgreSQLType}) ->
|
||||||
maps:merge(values(common_config), values(PostgreSQLType));
|
|
||||||
values(bridge_v2_producer) ->
|
|
||||||
maps:merge(
|
maps:merge(
|
||||||
#{
|
#{
|
||||||
enable => true,
|
name => <<"my_action">>,
|
||||||
connector => <<"my_pgsql_connector">>,
|
type => PostgreSQLType
|
||||||
resource_opts => #{
|
|
||||||
health_check_interval => "32s"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
values(producer)
|
values(common)
|
||||||
);
|
);
|
||||||
values(common_config) ->
|
values(common) ->
|
||||||
#{
|
#{
|
||||||
authentication => #{
|
<<"database">> => <<"emqx_data">>,
|
||||||
mechanism => <<"plain">>,
|
<<"enable">> => true,
|
||||||
username => <<"username">>,
|
<<"password">> => <<"public">>,
|
||||||
password => <<"******">>
|
<<"pool_size">> => 8,
|
||||||
|
<<"server">> => <<"127.0.0.1:5432">>,
|
||||||
|
<<"ssl">> => #{
|
||||||
|
<<"ciphers">> => [],
|
||||||
|
<<"depth">> => 10,
|
||||||
|
<<"enable">> => false,
|
||||||
|
<<"hibernate_after">> => <<"5s">>,
|
||||||
|
<<"log_level">> => <<"notice">>,
|
||||||
|
<<"reuse_sessions">> => true,
|
||||||
|
<<"secure_renegotiate">> => true,
|
||||||
|
<<"verify">> => <<"verify_peer">>,
|
||||||
|
<<"versions">> => [<<"tlsv1.3">>, <<"tlsv1.2">>]
|
||||||
},
|
},
|
||||||
bootstrap_hosts => <<"localhost:9092">>,
|
<<"username">> => <<"postgres">>
|
||||||
connect_timeout => <<"5s">>,
|
|
||||||
enable => true,
|
|
||||||
metadata_request_timeout => <<"4s">>,
|
|
||||||
min_metadata_refresh_interval => <<"3s">>,
|
|
||||||
socket_opts => #{
|
|
||||||
sndbuf => <<"1024KB">>,
|
|
||||||
recbuf => <<"1024KB">>,
|
|
||||||
nodelay => true,
|
|
||||||
tcp_keepalive => <<"none">>
|
|
||||||
}
|
|
||||||
};
|
|
||||||
values(producer) ->
|
|
||||||
#{
|
|
||||||
kafka => #{
|
|
||||||
topic => <<"kafka-topic">>,
|
|
||||||
message => #{
|
|
||||||
key => <<"${.clientid}">>,
|
|
||||||
value => <<"${.}">>,
|
|
||||||
timestamp => <<"${.timestamp}">>
|
|
||||||
},
|
|
||||||
max_batch_bytes => <<"896KB">>,
|
|
||||||
compression => <<"no_compression">>,
|
|
||||||
partition_strategy => <<"random">>,
|
|
||||||
required_acks => <<"all_isr">>,
|
|
||||||
partition_count_refresh_interval => <<"60s">>,
|
|
||||||
kafka_headers => <<"${pub_props}">>,
|
|
||||||
kafka_ext_headers => [
|
|
||||||
#{
|
|
||||||
kafka_ext_header_key => <<"clientid">>,
|
|
||||||
kafka_ext_header_value => <<"${clientid}">>
|
|
||||||
},
|
|
||||||
#{
|
|
||||||
kafka_ext_header_key => <<"topic">>,
|
|
||||||
kafka_ext_header_value => <<"${topic}">>
|
|
||||||
}
|
|
||||||
],
|
|
||||||
kafka_header_value_encode_mode => none,
|
|
||||||
max_inflight => 10,
|
|
||||||
buffer => #{
|
|
||||||
mode => <<"hybrid">>,
|
|
||||||
per_partition_limit => <<"2GB">>,
|
|
||||||
segment_bytes => <<"100MB">>,
|
|
||||||
memory_overload_protection => true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
local_topic => <<"mqtt/local/topic">>
|
|
||||||
}.
|
}.
|
||||||
|
|
||||||
desc("config_connector") ->
|
desc("config_connector") ->
|
||||||
|
|
Loading…
Reference in New Issue