Giter Club home page Giter Club logo

falcon-plus-api's Introduction

Falcon Plus Api

OpenFalcon Plus Api. Generate from its doc.

Installation

def deps do
  [{:falcon_plus_api, "~> 1.0.0"}]
end

Config

Token

#Set some tokens

config :falcon_plus_api, sigs: [
  %{"name" => "root", "sig" => "default-token-used-in-server-side"},
  %{"name" => "foo",  "sig" => "none_exist_sig"},
]

#Also can add token like this
FalconPlusApi.Sig.add_sig(%{"name" => "bar", "sig" => "bar's token"})

Address

config :falcon_plus_api, addr: %{
  first:  "127.0.0.1:8080",
  second: "127.0.0.2:8080",
}

## How to use

```elixir
#see help
h FalconPlusApi.Api.User.list

#list user from default address with root's token
{:ok, users} = FalconPlusApi.Api.User.list("root", :first)

#list user from second address with root's token
{:ok, users} = FalconPlusApi.Api.User.list("root", :second)

#list user from second address with foo's token
{:ok, users} = FalconPlusApi.Api.User.list("foo", :second)

# /api/v1/team?q=a.+
{:ok, teams} = FalconPlusApi.Api.Team.list("root", :first, query: %{"q" => "a.+"})

# /api/v1/hostgroup/#{hostgroup_id}
h FalconPlusApi.Api.Hostgroup.get_info_by_id
FalconPlusApi.Api.Hostgroup.get_info_by_id(3221, "root", :first)

Generate Script

You can generate api by your self.

Run script and specify falcon plus root dir by passing FALCON_PLUS envirenment.

FALCON_PLUS=SOME_PATH/falcon-plus perl ./script/gen.pl

falcon-plus-api's People

Contributors

milkwine avatar

Stargazers

谢宇恒 / Xie Yuheng avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.