resources 命令

emqx_ctl resources create <name> <type> [-c [<config>]] [-d [<descr>]]Create a resource
resources list [-t <ResourceType>]List all resources
resources show <ResourceId>Show a resource
resources delete <ResourceId>Delete a resource

resources create

创建一个新的资源:

  1. $ ./bin/emqx_ctl resources create 'webhook1' 'web_hook' -c '{"url": "http://host-name/chats"}' -d 'forward msgs to host-name/chats'
  2. Resource web_hook:webhook1 created

resources list

列出当前所有的资源:

  1. $ ./bin/emqx_ctl resources list
  2. resource(id='web_hook:webhook1', name='webhook1', type='web_hook', config=#{<<"url">> => <<"http://host-name/chats">>}, attrs=undefined, description='forward msgs to host-name/chats')

resources list by type

列出当前所有的资源:

  1. $ ./bin/emqx_ctl resources list --type 'debug_resource_type'
  2. resource(id='web_hook:webhook1', name='webhook1', type='web_hook', config=#{<<"url">> => <<"http://host-name/chats">>}, attrs=undefined, description='forward msgs to host-name/chats')

resources show

查询资源:

  1. $ ./bin/emqx_ctl resources show 'web_hook:webhook1'
  2. resource(id='web_hook:webhook1', name='webhook1', type='web_hook', config=#{<<"url">> => <<"http://host-name/chats">>}, attrs=undefined, description='forward msgs to host-name/chats')

resources delete

删除资源:

  1. $ ./bin/emqx_ctl resources delete 'web_hook:webhook1'
  2. ok