Skip to content

Commit 8ce791f

Browse files
committed
Add find command to the examples
Change-Id: I6c2789c08012d1e2df4f254cb3ca26d37c302964
1 parent 406838e commit 8ce791f

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

examples/find.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
2+
# not use this file except in compliance with the License. You may obtain
3+
# a copy of the License at
4+
#
5+
# http://www.apache.org/licenses/LICENSE-2.0
6+
#
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10+
# License for the specific language governing permissions and limitations
11+
# under the License.
12+
13+
"""
14+
Example Find Command
15+
16+
For example:
17+
python -m examples.find openstack/network/v2_0/network.py \
18+
--data '{"id": "a1369557-748f-429c-bd3e-fc385aacaec7"}'
19+
"""
20+
21+
import sys
22+
23+
from examples import common
24+
from examples import session
25+
26+
27+
def run_find(opts):
28+
sess = session.make_session(opts)
29+
cls = common.find_resource_cls(opts)
30+
obj = cls.find(sess, opts.data)
31+
print(str(obj))
32+
return
33+
34+
35+
if __name__ == "__main__":
36+
opts = common.setup()
37+
sys.exit(common.main(opts, run_find))

0 commit comments

Comments
 (0)