Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filters #77

Open
Romathonat opened this issue Jul 21, 2016 · 0 comments
Open

Filters #77

Romathonat opened this issue Jul 21, 2016 · 0 comments

Comments

@Romathonat
Copy link
Contributor

Romathonat commented Jul 21, 2016

Could you provide concretes examples about filters ? I can't make a single one work.
For instance :
http://...?category=URL_ENCODE(http://example.org/occi#my_category)
With

curl -H 'Accept: application/json' -X GET http://localhost:8080?category=http%3A%2F%2Fschemas.ogf.org%2Focci%2Finfrastructure%23compute

or

curl -H 'Accept: application/json' -X GET http://localhost:8080/categories/compute?category=http%3A%2F%2Fschemas.ogf.org%2Focci%2Finfrastructure%23compute

I have this result :

Ranch listener http had connection process started with cowboy_protocol:start_link/4 at <0.258.0> exit with reason: {cowboy_handler,[{class,error},{reason,function_clause},{mfa,{erocci_http_handler,init,2}},{stacktrace,[{erocci_http_handler,'-parse_filters/1-fun-0-',[[{'=:=',scheme,<<"http://schemas.ogf.org/occi/infrastructure">>},{'=:=',term,<<"compute">>}],[]],[{file,"src/erocci_http_handler.erl"},{line,462}]},{lists,foldl,3,[{file,"lists.erl"},{line,1263}]},{erocci_http_handler,init_occi,2,[{file,"src/erocci_http_handler.erl"},{line,256}]},{cowboy_handler,execute,2,[{file,"src/cowboy_handler.erl"},{line,41}]},{cowboy_protocol,execute,4,[{file,"src/cowboy_protocol.erl"},{line,470}]}]},{req,[{socket,#Port<0.6523>},{transport,ranch_tcp},{connection,keepalive},{pid,<0.258.0>},{method,<<"GET">>},{version,'HTTP/1.1'},{peer,{{127,0,0,1},56898}},{host,<<"localhost">>},{host_info,undefined},{port,8080},{path,<<"/categories/compute">>},{path_info,undefined},{qs,<<"category=http%3A%2F%2Fschemas.ogf.org%2Focci%2Finfrastructure%23compute">>},{bindings,[]},{headers,[{<<"user-agent">>,<<"curl/7.35.0">>},{<<"host">>,<<"localhost:8080">>},{<<"accept">>,<<"application/json">>}]},{meta,[]},{body_state,waiting},{buffer,<<>>},{multipart,undefined},{resp_compress,true},{resp_state,waiting},{resp_headers,[]},{resp_body,<<>>},{onresponse,undefined}]},{opts,{kind,{kind,{<<"http://schemas.ogf.org/occi/infrastructure#">>,<<"compute">>},#{actions => #{{<<"http://schemas.ogf.org/occi/infrastructure/compute/action#">>,<<"restart">>} => {action,{<<"http://schemas.ogf.org/occi/infrastructure/compute/action#">>,<<"restart">>},#{attributes => #{<<"method">> => #{category => {<<"http://schemas.ogf.org/occi/infrastructure/compute/action#">>,<<"restart">>},default => undefined,description => <<>>,mutable => true,name => <<"method">>,pattern => undefined,required => false,title => <<>>,type => string}},category => {<<"http://schemas.ogf.org/occi/infrastructure#">>,<<"compute">>},location => undefined,title => <<"Restart the system (graceful, warm or cold)">>}},{<<"http://schemas.ogf.org/occi/infrastructure/compute/action#">>,<<"start">>} => {action,{<<"http://schemas.ogf.org/occi/infrastructure/compute/action#">>,<<"start">>},#{attributes => #{},category => {<<"http://schemas.ogf.org/occi/infrastructure#">>,<<"compute">>},location => undefined,title => <<"Start the system">>}},{<<"http://schemas.ogf.org/occi/infrastructure/compute/action#">>,<<"stop">>} => {action,{<<"http://schemas.ogf.org/occi/infrastructure/compute/action#">>,<<"stop">>},#{attributes => #{<<"method">> => #{category => {<<"http://schemas.ogf.org/occi/infrastructure/compute/action#">>,<<"stop">>},default => undefined,description => <<>>,mutable => true,name => <<"method">>,pattern => undefined,required => false,title => <<>>,type => string}},category => {<<"http://schemas.ogf.org/occi/infrastructure#">>,<<"compute">>},location => undefined,title => <<"Stop the system (graceful, acpioff or poweroff)">>}},{<<"http://schemas.ogf.org/occi/infrastructure/compute/action#">>,<<"suspend">>} => {action,{<<"http://schemas.ogf.org/occi/infrastructure/compute/action#">>,<<"suspend">>},#{attributes => #{<<"method">> => #{category => {<<"http://schemas.ogf.org/occi/infrastructure/compute/action#">>,<<"suspend">>},default => undefined,description => <<>>,mutable => true,name => <<"method">>,pattern => undefined,required => false,title => <<>>,type => string}},category => {<<"http://schemas.ogf.org/occi/infrastructure#">>,<<"compute">>},location => undefined,title => <<"Suspend the system (hibernate or in RAM)">>}}},attributes => #{<<"occi.compute.architecture">> => #{category => {<<"http://schemas.ogf.org/occi/infrastructure#">>,<<"compute">>},default => undefined,description => <<>>,mutable => true,name => <<"occi.compute.architecture">>,pattern => undefined,required => false,title => <<"CPU Architecture">>,type => {enum,[x64,x86]}},<<"occi.compute.cores">> => #{category => {<<"http://schemas.ogf.org/occi/infrastructure#">>,<<"compute">>},default => undefined,description => <<>>,mutable => true,name => <<"occi.compute.cores">>,pattern => undefined,required => false,title => <<"CPU cores number">>,type => integer},<<"occi.compute.hostname">> => #{category => {<<"http://schemas.ogf.org/occi/infrastructure#">>,<<"compute">>},default => undefined,description => <<>>,mutable => true,name => <<"occi.compute.hostname">>,pattern => undefined,required => false,title => <<"System hostname">>,type => string},<<"occi.compute.memory">> => #{category => {<<"http://schemas.ogf.org/occi/infrastructure#">>,<<"compute">>},default => undefined,description => <<>>,mutable => true,name => <<"occi.compute.memory">>,pattern => undefined,required => false,title => <<"System RAM (GB)">>,type => float},<<"occi.compute.speed">> => #{category => {<<"http://schemas.ogf.org/occi/infrastructure#">>,<<"compute">>},default => undefined,description => <<>>,mutable => true,name => <<"occi.compute.speed">>,pattern => undefined,required => false,title => <<"CPU speed (GHz)">>,type => float},<<"occi.compute.state">> => #{category => {<<"http://schemas.ogf.org/occi/infrastructure#">>,<<"compute">>},default => inactive,description => <<>>,mutable => false,name => <<"occi.compute.state">>,pattern => undefined,required => true,title => <<"System state">>,type => {enum,[error,suspended,inactive,active]}}},location => <<"/categories/compute">>,parents => [{<<"http://schemas.ogf.org/occi/core#">>,<<"resource">>},{<<"http://schemas.ogf.org/occi/core#">>,<<"entity">>}],title => <<"Compute Resource">>}}}}]}

The attribute filter, seemed to work, but give all results like there were no filter :

curl -H 'Accept: application/json' -X GET http://localhost:8080/categories/compute?q=occi.core.id%3D6df690d2-3158-40c4-88fb-d1c41584d6e4

Could you provide more explanations about /prefix/path, please?

Paging is working fine.
The output of this issue could be some documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant