Rearrange docs.
This commit is contained in:
parent
b81e427b99
commit
d0cde0218c
@ -2,6 +2,7 @@
|
||||
|
||||
[](https://travis-ci.org/spulec/moto)
|
||||
[](https://coveralls.io/r/spulec/moto)
|
||||
[](http://docs.getmoto.org)
|
||||
|
||||
# In a nutshell
|
||||
|
||||
|
BIN
docs/_build/doctrees/docs/ec2_tut.doctree
vendored
Normal file
BIN
docs/_build/doctrees/docs/ec2_tut.doctree
vendored
Normal file
Binary file not shown.
BIN
docs/_build/doctrees/docs/getting_started.doctree
vendored
Normal file
BIN
docs/_build/doctrees/docs/getting_started.doctree
vendored
Normal file
Binary file not shown.
BIN
docs/_build/doctrees/docs/moto_apis.doctree
vendored
Normal file
BIN
docs/_build/doctrees/docs/moto_apis.doctree
vendored
Normal file
Binary file not shown.
BIN
docs/_build/doctrees/docs/other_langs.doctree
vendored
Normal file
BIN
docs/_build/doctrees/docs/other_langs.doctree
vendored
Normal file
Binary file not shown.
BIN
docs/_build/doctrees/docs/server_mode.doctree
vendored
Normal file
BIN
docs/_build/doctrees/docs/server_mode.doctree
vendored
Normal file
Binary file not shown.
BIN
docs/_build/doctrees/environment.pickle
vendored
BIN
docs/_build/doctrees/environment.pickle
vendored
Binary file not shown.
BIN
docs/_build/doctrees/index.doctree
vendored
BIN
docs/_build/doctrees/index.doctree
vendored
Binary file not shown.
BIN
docs/_build/doctrees/other_langs.doctree
vendored
BIN
docs/_build/doctrees/other_langs.doctree
vendored
Binary file not shown.
114
docs/_build/html/_sources/docs/getting_started.rst.txt
vendored
Normal file
114
docs/_build/html/_sources/docs/getting_started.rst.txt
vendored
Normal file
@ -0,0 +1,114 @@
|
||||
.. _getting_started:
|
||||
|
||||
=========================
|
||||
Getting Started with Moto
|
||||
=========================
|
||||
|
||||
Installing Moto
|
||||
---------------
|
||||
|
||||
You can use ``pip`` to install the latest released version of ``moto``::
|
||||
|
||||
pip install moto
|
||||
|
||||
If you want to install ``moto`` from source::
|
||||
|
||||
git clone git://github.com/spulec/moto.git
|
||||
cd moto
|
||||
python setup.py install
|
||||
|
||||
Moto usage
|
||||
----------
|
||||
|
||||
For example we have the following code we want to test:
|
||||
|
||||
.. sourcecode:: python
|
||||
|
||||
import boto
|
||||
from boto.s3.key import Key
|
||||
|
||||
class MyModel(object):
|
||||
def __init__(self, name, value):
|
||||
self.name = name
|
||||
self.value = value
|
||||
|
||||
def save(self):
|
||||
conn = boto.connect_s3()
|
||||
bucket = conn.get_bucket('mybucket')
|
||||
k = Key(bucket)
|
||||
k.key = self.name
|
||||
k.set_contents_from_string(self.value)
|
||||
|
||||
There are several method to do this, just keep in mind Moto creates a full blank environment.
|
||||
|
||||
Decorator
|
||||
~~~~~~~~~
|
||||
|
||||
With a decorator wrapping all the calls to S3 are automatically mocked out.
|
||||
|
||||
.. sourcecode:: python
|
||||
|
||||
import boto
|
||||
from moto import mock_s3
|
||||
from mymodule import MyModel
|
||||
|
||||
@mock_s3
|
||||
def test_my_model_save():
|
||||
conn = boto.connect_s3()
|
||||
# We need to create the bucket since this is all in Moto's 'virtual' AWS account
|
||||
conn.create_bucket('mybucket')
|
||||
|
||||
model_instance = MyModel('steve', 'is awesome')
|
||||
model_instance.save()
|
||||
|
||||
assert conn.get_bucket('mybucket').get_key('steve').get_contents_as_string() == 'is awesome'
|
||||
|
||||
Context manager
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
Same as decorator, every call inside ``with`` statement are mocked out.
|
||||
|
||||
.. sourcecode:: python
|
||||
|
||||
def test_my_model_save():
|
||||
with mock_s3():
|
||||
conn = boto.connect_s3()
|
||||
conn.create_bucket('mybucket')
|
||||
|
||||
model_instance = MyModel('steve', 'is awesome')
|
||||
model_instance.save()
|
||||
|
||||
assert conn.get_bucket('mybucket').get_key('steve').get_contents_as_string() == 'is awesome'
|
||||
|
||||
Raw
|
||||
~~~
|
||||
|
||||
You can also start and stop manually the mocking.
|
||||
|
||||
.. sourcecode:: python
|
||||
|
||||
def test_my_model_save():
|
||||
mock = mock_s3()
|
||||
mock.start()
|
||||
|
||||
conn = boto.connect_s3()
|
||||
conn.create_bucket('mybucket')
|
||||
|
||||
model_instance = MyModel('steve', 'is awesome')
|
||||
model_instance.save()
|
||||
|
||||
assert conn.get_bucket('mybucket').get_key('steve').get_contents_as_string() == 'is awesome'
|
||||
|
||||
mock.stop()
|
||||
|
||||
Stand-alone server mode
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Moto comes with a stand-alone server allowing you to mock out an AWS HTTP endpoint. It is very useful to test even if you don't use Python.
|
||||
|
||||
.. sourcecode:: bash
|
||||
|
||||
$ moto_server ec2 -p3000
|
||||
* Running on http://127.0.0.1:3000/
|
||||
|
||||
This method isn't encouraged if you're using ``boto``, best is to use decorator method.
|
@ -4,7 +4,7 @@
|
||||
Other languages
|
||||
===============
|
||||
|
||||
You don't need to use Python to use Moto; it can be used with any language. To use it with another language, run moto_server and here are some examples in other languages.
|
||||
You don't need to use Python to use Moto; it can be used with any language. To use it with another language, run moto_server. Here are some examples in other languages:
|
||||
|
||||
* `Java`_
|
||||
* `Ruby`_
|
67
docs/_build/html/_sources/docs/server_mode.rst.txt
vendored
Normal file
67
docs/_build/html/_sources/docs/server_mode.rst.txt
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
.. _server_mode:
|
||||
|
||||
===========
|
||||
Server mode
|
||||
===========
|
||||
|
||||
Moto has a stand-alone server mode. This allows you to utilize
|
||||
the backend structure of Moto even if you don't use Python.
|
||||
|
||||
It uses flask, which isn't a default dependency. You can install the
|
||||
server 'extra' package with:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
pip install moto[server]
|
||||
|
||||
|
||||
You can then start it running a service:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
$ moto_server ec2
|
||||
|
||||
You can also pass the port:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ moto_server ec2 -p3000
|
||||
* Running on http://127.0.0.1:3000/
|
||||
|
||||
If you want to be able to use the server externally you can pass an IP
|
||||
address to bind to as a hostname or allow any of your external
|
||||
interfaces with 0.0.0.0:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ moto_server ec2 -H 0.0.0.0
|
||||
* Running on http://0.0.0.0:5000/
|
||||
|
||||
Please be aware this might allow other network users to access your
|
||||
server.
|
||||
|
||||
Then go to localhost_ to see a list of running instances (it will be empty since you haven't added any yet).
|
||||
|
||||
If you want to use boto3 with this, you can pass an `endpoint_url` to the resource
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
boto3.resource(
|
||||
service_name='s3',
|
||||
region_name='us-west-1',
|
||||
endpoint_url='http://localhost:5000',
|
||||
)
|
||||
|
||||
Other languages
|
||||
---------------
|
||||
|
||||
You don't need to use Python to use Moto; it can be used with any language. Here are some examples to run it with other languages:
|
||||
|
||||
* `Java`_
|
||||
* `Ruby`_
|
||||
* `Javascript`_
|
||||
|
||||
.. _Java: https://github.com/spulec/moto/blob/master/other_langs/sqsSample.java
|
||||
.. _Ruby: https://github.com/spulec/moto/blob/master/other_langs/test.rb
|
||||
.. _Javascript: https://github.com/spulec/moto/blob/master/other_langs/test.js
|
||||
.. _localhost: http://localhost:5000/?Action=DescribeInstances
|
21
docs/_build/html/_sources/index.rst.txt
vendored
21
docs/_build/html/_sources/index.rst.txt
vendored
@ -5,18 +5,17 @@ Moto: Mock AWS Services
|
||||
=============================
|
||||
|
||||
A library that allows you to easily mock out tests based on
|
||||
_`AWS infrastructure`.
|
||||
|
||||
.. _AWS infrastructure: http://aws.amazon.com/
|
||||
`AWS infrastructure`_.
|
||||
|
||||
Getting Started
|
||||
---------------
|
||||
|
||||
If you've never used ``moto`` before, you should read the
|
||||
:doc:`Getting Started with Moto <getting_started>` guide to get familiar
|
||||
:doc:`Getting Started with Moto <docs/getting_started>` guide to get familiar
|
||||
with ``moto`` and its usage.
|
||||
|
||||
Currently implemented Services:
|
||||
-------------------------------
|
||||
|
||||
+-----------------------+---------------------+-----------------------------------+
|
||||
| Service Name | Decorator | Development Status |
|
||||
@ -79,11 +78,6 @@ Currently implemented Services:
|
||||
+-----------------------+---------------------+-----------------------------------+
|
||||
|
||||
|
||||
Moto APIs
|
||||
---------
|
||||
some stuff
|
||||
|
||||
|
||||
|
||||
Additional Resources
|
||||
--------------------
|
||||
@ -91,6 +85,7 @@ Additional Resources
|
||||
* `Moto Source Repository`_
|
||||
* `Moto Issue Tracker`_
|
||||
|
||||
.. _AWS infrastructure: http://aws.amazon.com/
|
||||
.. _Moto Issue Tracker: https://github.com/spulec/moto/issues
|
||||
.. _Moto Source Repository: https://github.com/spulec/moto
|
||||
|
||||
@ -99,7 +94,7 @@ Additional Resources
|
||||
:hidden:
|
||||
:glob:
|
||||
|
||||
index
|
||||
getting_started
|
||||
other_langs
|
||||
moto_apis
|
||||
docs/getting_started
|
||||
docs/server_mode
|
||||
docs/moto_apis
|
||||
docs/ec2_tut
|
||||
|
@ -4,7 +4,7 @@
|
||||
Other languages
|
||||
===============
|
||||
|
||||
You don't need to use Python to use Moto; it can be used with any language. To use it with another language, run moto_server and here are some examples in other languages.
|
||||
You don't need to use Python to use Moto; it can be used with any language. To use it with another language, run moto_server. Here are some examples in other languages:
|
||||
|
||||
* `Java`_
|
||||
* `Ruby`_
|
||||
|
306
docs/_build/html/docs/ec2_tut.html
vendored
Normal file
306
docs/_build/html/docs/ec2_tut.html
vendored
Normal file
@ -0,0 +1,306 @@
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>Use Moto as EC2 backend — Moto 0.4.10 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="index" title="Index"
|
||||
href="../genindex.html"/>
|
||||
<link rel="search" title="Search" href="../search.html"/>
|
||||
<link rel="top" title="Moto 0.4.10 documentation" href="../index.html"/>
|
||||
<link rel="prev" title="Moto APIs" href="moto_apis.html"/>
|
||||
|
||||
|
||||
<script src="../_static/js/modernizr.min.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body class="wy-body-for-nav" role="document">
|
||||
|
||||
|
||||
<div class="wy-grid-for-nav">
|
||||
|
||||
|
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||
<div class="wy-side-scroll">
|
||||
<div class="wy-side-nav-search">
|
||||
|
||||
|
||||
|
||||
<a href="../index.html" class="icon icon-home"> Moto
|
||||
|
||||
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="version">
|
||||
0.4.10
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="search">
|
||||
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
|
||||
<input type="text" name="q" placeholder="Search docs" />
|
||||
<input type="hidden" name="check_keywords" value="yes" />
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ul class="current">
|
||||
<li class="toctree-l1"><a class="reference internal" href="getting_started.html">Getting Started with Moto</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="other_langs.html">Other languages</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="moto_apis.html">Moto APIs</a></li>
|
||||
<li class="toctree-l1 current"><a class="current reference internal" href="#">Use Moto as EC2 backend</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="#launching-instances">Launching instances</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
||||
|
||||
|
||||
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
|
||||
|
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||
<a href="../index.html">Moto</a>
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
|
||||
<div class="wy-nav-content">
|
||||
<div class="rst-content">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="navigation" aria-label="breadcrumbs navigation">
|
||||
|
||||
<ul class="wy-breadcrumbs">
|
||||
|
||||
<li><a href="../index.html">Docs</a> »</li>
|
||||
|
||||
<li>Use Moto as EC2 backend</li>
|
||||
|
||||
|
||||
<li class="wy-breadcrumbs-aside">
|
||||
|
||||
|
||||
<a href="../_sources/docs/ec2_tut.rst.txt" rel="nofollow"> View page source</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<hr/>
|
||||
</div>
|
||||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
<div itemprop="articleBody">
|
||||
|
||||
<div class="section" id="use-moto-as-ec2-backend">
|
||||
<span id="ec2-tut"></span><h1>Use Moto as EC2 backend<a class="headerlink" href="#use-moto-as-ec2-backend" title="Permalink to this headline">¶</a></h1>
|
||||
<p>This tutorial explains <code class="docutils literal"><span class="pre">moto.ec2</span></code>‘s features and how to use it. This
|
||||
tutorial assumes that you have already downloaded and installed boto and moto.
|
||||
Before all code examples the following snippet is launched:</p>
|
||||
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">boto.ec2</span><span class="o">,</span> <span class="nn">moto</span>
|
||||
<span class="gp">>>> </span><span class="n">mock_ec2</span> <span class="o">=</span> <span class="n">moto</span><span class="o">.</span><span class="n">mock_ec2</span><span class="p">()</span>
|
||||
<span class="gp">>>> </span><span class="n">mock_ec2</span><span class="o">.</span><span class="n">start</span><span class="p">()</span>
|
||||
<span class="gp">>>> </span><span class="n">conn</span> <span class="o">=</span> <span class="n">boto</span><span class="o">.</span><span class="n">ec2</span><span class="o">.</span><span class="n">connect_to_region</span><span class="p">(</span><span class="s2">"eu-west-1"</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="section" id="launching-instances">
|
||||
<h2>Launching instances<a class="headerlink" href="#launching-instances" title="Permalink to this headline">¶</a></h2>
|
||||
<p>After mock is started, the behavior is the same than previously:</p>
|
||||
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">reservation</span> <span class="o">=</span> <span class="n">conn</span><span class="o">.</span><span class="n">run_instances</span><span class="p">(</span><span class="s1">'ami-f00ba4'</span><span class="p">)</span>
|
||||
<span class="gp">>>> </span><span class="n">reservation</span><span class="o">.</span><span class="n">instances</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
|
||||
<span class="go">Instance:i-91dd2f32</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Moto set static or generate random object’s attributes:</p>
|
||||
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="nb">vars</span><span class="p">(</span><span class="n">reservation</span><span class="o">.</span><span class="n">instances</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
|
||||
<span class="go">{'_in_monitoring_element': False,</span>
|
||||
<span class="go"> '_placement': None,</span>
|
||||
<span class="go"> '_previous_state': None,</span>
|
||||
<span class="go"> '_state': pending(0),</span>
|
||||
<span class="go"> 'ami_launch_index': u'0',</span>
|
||||
<span class="go"> 'architecture': u'x86_64',</span>
|
||||
<span class="go"> 'block_device_mapping': None,</span>
|
||||
<span class="go"> 'client_token': '',</span>
|
||||
<span class="go"> 'connection': EC2Connection:ec2.eu-west-1.amazonaws.com,</span>
|
||||
<span class="go"> 'dns_name': u'ec2-54.214.135.84.compute-1.amazonaws.com',</span>
|
||||
<span class="go"> 'ebs_optimized': False,</span>
|
||||
<span class="go"> 'eventsSet': None,</span>
|
||||
<span class="go"> 'group_name': None,</span>
|
||||
<span class="go"> 'groups': [],</span>
|
||||
<span class="go"> 'hypervisor': u'xen',</span>
|
||||
<span class="go"> 'id': u'i-91dd2f32',</span>
|
||||
<span class="go"> 'image_id': u'f00ba4',</span>
|
||||
<span class="go"> 'instance_profile': None,</span>
|
||||
<span class="go"> 'instance_type': u'm1.small',</span>
|
||||
<span class="go"> 'interfaces': [NetworkInterface:eni-ed65f870],</span>
|
||||
<span class="go"> 'ip_address': u'54.214.135.84',</span>
|
||||
<span class="go"> 'item': u'\n ',</span>
|
||||
<span class="go"> 'kernel': u'None',</span>
|
||||
<span class="go"> 'key_name': u'None',</span>
|
||||
<span class="go"> 'launch_time': u'2015-07-27T05:59:57Z',</span>
|
||||
<span class="go"> 'monitored': True,</span>
|
||||
<span class="go"> 'monitoring': u'\n ',</span>
|
||||
<span class="go"> 'monitoring_state': u'enabled',</span>
|
||||
<span class="go"> 'persistent': False,</span>
|
||||
<span class="go"> 'platform': None,</span>
|
||||
<span class="go"> 'private_dns_name': u'ip-10.136.187.180.ec2.internal',</span>
|
||||
<span class="go"> 'private_ip_address': u'10.136.187.180',</span>
|
||||
<span class="go"> 'product_codes': [],</span>
|
||||
<span class="go"> 'public_dns_name': u'ec2-54.214.135.84.compute-1.amazonaws.com',</span>
|
||||
<span class="go"> 'ramdisk': None,</span>
|
||||
<span class="go"> 'reason': '',</span>
|
||||
<span class="go"> 'region': RegionInfo:eu-west-1,</span>
|
||||
<span class="go"> 'requester_id': None,</span>
|
||||
<span class="go"> 'root_device_name': None,</span>
|
||||
<span class="go"> 'root_device_type': None,</span>
|
||||
<span class="go"> 'sourceDestCheck': u'true',</span>
|
||||
<span class="go"> 'spot_instance_request_id': None,</span>
|
||||
<span class="go"> 'state_reason': None,</span>
|
||||
<span class="go"> 'subnet_id': None,</span>
|
||||
<span class="go"> 'tags': {},</span>
|
||||
<span class="go"> 'virtualization_type': u'paravirtual',</span>
|
||||
<span class="go"> 'vpc_id': None}</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="articleComments">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<footer>
|
||||
|
||||
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
|
||||
|
||||
|
||||
<a href="moto_apis.html" class="btn btn-neutral" title="Moto APIs" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<hr/>
|
||||
|
||||
<div role="contentinfo">
|
||||
<p>
|
||||
© Copyright 2015, Steve Pulec.
|
||||
|
||||
</p>
|
||||
</div>
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'../',
|
||||
VERSION:'0.4.10',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
HAS_SOURCE: true,
|
||||
SOURCELINK_SUFFIX: '.txt'
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" src="../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="../_static/doctools.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="../_static/js/theme.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(function () {
|
||||
SphinxRtdTheme.StickyNav.enable();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
343
docs/_build/html/docs/getting_started.html
vendored
Normal file
343
docs/_build/html/docs/getting_started.html
vendored
Normal file
@ -0,0 +1,343 @@
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>Getting Started with Moto — Moto 0.4.10 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="index" title="Index"
|
||||
href="../genindex.html"/>
|
||||
<link rel="search" title="Search" href="../search.html"/>
|
||||
<link rel="top" title="Moto 0.4.10 documentation" href="../index.html"/>
|
||||
<link rel="next" title="Moto APIs" href="moto_apis.html"/>
|
||||
<link rel="prev" title="Moto: Mock AWS Services" href="../index.html"/>
|
||||
|
||||
|
||||
<script src="../_static/js/modernizr.min.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body class="wy-body-for-nav" role="document">
|
||||
|
||||
|
||||
<div class="wy-grid-for-nav">
|
||||
|
||||
|
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||
<div class="wy-side-scroll">
|
||||
<div class="wy-side-nav-search">
|
||||
|
||||
|
||||
|
||||
<a href="../index.html" class="icon icon-home"> Moto
|
||||
|
||||
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="version">
|
||||
0.4.10
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="search">
|
||||
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
|
||||
<input type="text" name="q" placeholder="Search docs" />
|
||||
<input type="hidden" name="check_keywords" value="yes" />
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ul class="current">
|
||||
<li class="toctree-l1 current"><a class="current reference internal" href="#">Getting Started with Moto</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="#installing-moto">Installing Moto</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="#moto-usage">Moto usage</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#decorator">Decorator</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#context-manager">Context manager</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#raw">Raw</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#stand-alone-server-mode">Stand-alone server mode</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="moto_apis.html">Moto APIs</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="ec2_tut.html">Use Moto as EC2 backend</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
||||
|
||||
|
||||
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
|
||||
|
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||
<a href="../index.html">Moto</a>
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
|
||||
<div class="wy-nav-content">
|
||||
<div class="rst-content">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="navigation" aria-label="breadcrumbs navigation">
|
||||
|
||||
<ul class="wy-breadcrumbs">
|
||||
|
||||
<li><a href="../index.html">Docs</a> »</li>
|
||||
|
||||
<li>Getting Started with Moto</li>
|
||||
|
||||
|
||||
<li class="wy-breadcrumbs-aside">
|
||||
|
||||
|
||||
<a href="../_sources/docs/getting_started.rst.txt" rel="nofollow"> View page source</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<hr/>
|
||||
</div>
|
||||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
<div itemprop="articleBody">
|
||||
|
||||
<div class="section" id="getting-started-with-moto">
|
||||
<span id="getting-started"></span><h1>Getting Started with Moto<a class="headerlink" href="#getting-started-with-moto" title="Permalink to this headline">¶</a></h1>
|
||||
<div class="section" id="installing-moto">
|
||||
<h2>Installing Moto<a class="headerlink" href="#installing-moto" title="Permalink to this headline">¶</a></h2>
|
||||
<p>You can use <code class="docutils literal"><span class="pre">pip</span></code> to install the latest released version of <code class="docutils literal"><span class="pre">moto</span></code>:</p>
|
||||
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">pip</span> <span class="n">install</span> <span class="n">moto</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>If you want to install <code class="docutils literal"><span class="pre">moto</span></code> from source:</p>
|
||||
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">git</span> <span class="n">clone</span> <span class="n">git</span><span class="p">:</span><span class="o">//</span><span class="n">github</span><span class="o">.</span><span class="n">com</span><span class="o">/</span><span class="n">spulec</span><span class="o">/</span><span class="n">moto</span><span class="o">.</span><span class="n">git</span>
|
||||
<span class="n">cd</span> <span class="n">moto</span>
|
||||
<span class="n">python</span> <span class="n">setup</span><span class="o">.</span><span class="n">py</span> <span class="n">install</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="moto-usage">
|
||||
<h2>Moto usage<a class="headerlink" href="#moto-usage" title="Permalink to this headline">¶</a></h2>
|
||||
<p>For example we have the following code we want to test:</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">boto</span>
|
||||
<span class="kn">from</span> <span class="nn">boto.s3.key</span> <span class="kn">import</span> <span class="n">Key</span>
|
||||
|
||||
<span class="k">class</span> <span class="nc">MyModel</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">name</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">value</span> <span class="o">=</span> <span class="n">value</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">save</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="n">conn</span> <span class="o">=</span> <span class="n">boto</span><span class="o">.</span><span class="n">connect_s3</span><span class="p">()</span>
|
||||
<span class="n">bucket</span> <span class="o">=</span> <span class="n">conn</span><span class="o">.</span><span class="n">get_bucket</span><span class="p">(</span><span class="s1">'mybucket'</span><span class="p">)</span>
|
||||
<span class="n">k</span> <span class="o">=</span> <span class="n">Key</span><span class="p">(</span><span class="n">bucket</span><span class="p">)</span>
|
||||
<span class="n">k</span><span class="o">.</span><span class="n">key</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">name</span>
|
||||
<span class="n">k</span><span class="o">.</span><span class="n">set_contents_from_string</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">value</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>There are several method to do this, just keep in mind Moto creates a full blank environment.</p>
|
||||
<div class="section" id="decorator">
|
||||
<h3>Decorator<a class="headerlink" href="#decorator" title="Permalink to this headline">¶</a></h3>
|
||||
<p>With a decorator wrapping all the calls to S3 are automatically mocked out.</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">boto</span>
|
||||
<span class="kn">from</span> <span class="nn">moto</span> <span class="kn">import</span> <span class="n">mock_s3</span>
|
||||
<span class="kn">from</span> <span class="nn">mymodule</span> <span class="kn">import</span> <span class="n">MyModel</span>
|
||||
|
||||
<span class="nd">@mock_s3</span>
|
||||
<span class="k">def</span> <span class="nf">test_my_model_save</span><span class="p">():</span>
|
||||
<span class="n">conn</span> <span class="o">=</span> <span class="n">boto</span><span class="o">.</span><span class="n">connect_s3</span><span class="p">()</span>
|
||||
<span class="c1"># We need to create the bucket since this is all in Moto's 'virtual' AWS account</span>
|
||||
<span class="n">conn</span><span class="o">.</span><span class="n">create_bucket</span><span class="p">(</span><span class="s1">'mybucket'</span><span class="p">)</span>
|
||||
|
||||
<span class="n">model_instance</span> <span class="o">=</span> <span class="n">MyModel</span><span class="p">(</span><span class="s1">'steve'</span><span class="p">,</span> <span class="s1">'is awesome'</span><span class="p">)</span>
|
||||
<span class="n">model_instance</span><span class="o">.</span><span class="n">save</span><span class="p">()</span>
|
||||
|
||||
<span class="k">assert</span> <span class="n">conn</span><span class="o">.</span><span class="n">get_bucket</span><span class="p">(</span><span class="s1">'mybucket'</span><span class="p">)</span><span class="o">.</span><span class="n">get_key</span><span class="p">(</span><span class="s1">'steve'</span><span class="p">)</span><span class="o">.</span><span class="n">get_contents_as_string</span><span class="p">()</span> <span class="o">==</span> <span class="s1">'is awesome'</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="context-manager">
|
||||
<h3>Context manager<a class="headerlink" href="#context-manager" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Same as decorator, every call inside <code class="docutils literal"><span class="pre">with</span></code> statement are mocked out.</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">test_my_model_save</span><span class="p">():</span>
|
||||
<span class="k">with</span> <span class="n">mock_s3</span><span class="p">():</span>
|
||||
<span class="n">conn</span> <span class="o">=</span> <span class="n">boto</span><span class="o">.</span><span class="n">connect_s3</span><span class="p">()</span>
|
||||
<span class="n">conn</span><span class="o">.</span><span class="n">create_bucket</span><span class="p">(</span><span class="s1">'mybucket'</span><span class="p">)</span>
|
||||
|
||||
<span class="n">model_instance</span> <span class="o">=</span> <span class="n">MyModel</span><span class="p">(</span><span class="s1">'steve'</span><span class="p">,</span> <span class="s1">'is awesome'</span><span class="p">)</span>
|
||||
<span class="n">model_instance</span><span class="o">.</span><span class="n">save</span><span class="p">()</span>
|
||||
|
||||
<span class="k">assert</span> <span class="n">conn</span><span class="o">.</span><span class="n">get_bucket</span><span class="p">(</span><span class="s1">'mybucket'</span><span class="p">)</span><span class="o">.</span><span class="n">get_key</span><span class="p">(</span><span class="s1">'steve'</span><span class="p">)</span><span class="o">.</span><span class="n">get_contents_as_string</span><span class="p">()</span> <span class="o">==</span> <span class="s1">'is awesome'</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="raw">
|
||||
<h3>Raw<a class="headerlink" href="#raw" title="Permalink to this headline">¶</a></h3>
|
||||
<p>You can also start and stop manually the mocking.</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">test_my_model_save</span><span class="p">():</span>
|
||||
<span class="n">mock</span> <span class="o">=</span> <span class="n">mock_s3</span><span class="p">()</span>
|
||||
<span class="n">mock</span><span class="o">.</span><span class="n">start</span><span class="p">()</span>
|
||||
|
||||
<span class="n">conn</span> <span class="o">=</span> <span class="n">boto</span><span class="o">.</span><span class="n">connect_s3</span><span class="p">()</span>
|
||||
<span class="n">conn</span><span class="o">.</span><span class="n">create_bucket</span><span class="p">(</span><span class="s1">'mybucket'</span><span class="p">)</span>
|
||||
|
||||
<span class="n">model_instance</span> <span class="o">=</span> <span class="n">MyModel</span><span class="p">(</span><span class="s1">'steve'</span><span class="p">,</span> <span class="s1">'is awesome'</span><span class="p">)</span>
|
||||
<span class="n">model_instance</span><span class="o">.</span><span class="n">save</span><span class="p">()</span>
|
||||
|
||||
<span class="k">assert</span> <span class="n">conn</span><span class="o">.</span><span class="n">get_bucket</span><span class="p">(</span><span class="s1">'mybucket'</span><span class="p">)</span><span class="o">.</span><span class="n">get_key</span><span class="p">(</span><span class="s1">'steve'</span><span class="p">)</span><span class="o">.</span><span class="n">get_contents_as_string</span><span class="p">()</span> <span class="o">==</span> <span class="s1">'is awesome'</span>
|
||||
|
||||
<span class="n">mock</span><span class="o">.</span><span class="n">stop</span><span class="p">()</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="stand-alone-server-mode">
|
||||
<h3>Stand-alone server mode<a class="headerlink" href="#stand-alone-server-mode" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Moto comes with a stand-alone server allowing you to mock out an AWS HTTP endpoint. It is very useful to test even if you don’t use Python.</p>
|
||||
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ moto_server ec2 -p3000
|
||||
* Running on http://127.0.0.1:3000/
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>This method isn’t encouraged if you’re using <code class="docutils literal"><span class="pre">boto</span></code>, best is to use decorator method.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="articleComments">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<footer>
|
||||
|
||||
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
|
||||
|
||||
<a href="moto_apis.html" class="btn btn-neutral float-right" title="Moto APIs" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
|
||||
|
||||
|
||||
<a href="../index.html" class="btn btn-neutral" title="Moto: Mock AWS Services" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<hr/>
|
||||
|
||||
<div role="contentinfo">
|
||||
<p>
|
||||
© Copyright 2015, Steve Pulec.
|
||||
|
||||
</p>
|
||||
</div>
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'../',
|
||||
VERSION:'0.4.10',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
HAS_SOURCE: true,
|
||||
SOURCELINK_SUFFIX: '.txt'
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" src="../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="../_static/doctools.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="../_static/js/theme.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(function () {
|
||||
SphinxRtdTheme.StickyNav.enable();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
256
docs/_build/html/docs/moto_apis.html
vendored
Normal file
256
docs/_build/html/docs/moto_apis.html
vendored
Normal file
@ -0,0 +1,256 @@
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>Moto APIs — Moto 0.4.10 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="index" title="Index"
|
||||
href="../genindex.html"/>
|
||||
<link rel="search" title="Search" href="../search.html"/>
|
||||
<link rel="top" title="Moto 0.4.10 documentation" href="../index.html"/>
|
||||
<link rel="next" title="Use Moto as EC2 backend" href="ec2_tut.html"/>
|
||||
<link rel="prev" title="Other languages" href="other_langs.html"/>
|
||||
|
||||
|
||||
<script src="../_static/js/modernizr.min.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body class="wy-body-for-nav" role="document">
|
||||
|
||||
|
||||
<div class="wy-grid-for-nav">
|
||||
|
||||
|
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||
<div class="wy-side-scroll">
|
||||
<div class="wy-side-nav-search">
|
||||
|
||||
|
||||
|
||||
<a href="../index.html" class="icon icon-home"> Moto
|
||||
|
||||
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="version">
|
||||
0.4.10
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="search">
|
||||
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
|
||||
<input type="text" name="q" placeholder="Search docs" />
|
||||
<input type="hidden" name="check_keywords" value="yes" />
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ul class="current">
|
||||
<li class="toctree-l1"><a class="reference internal" href="getting_started.html">Getting Started with Moto</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="other_langs.html">Other languages</a></li>
|
||||
<li class="toctree-l1 current"><a class="current reference internal" href="#">Moto APIs</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="#reset-api">Reset API</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="#dashboard">Dashboard</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="ec2_tut.html">Use Moto as EC2 backend</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
||||
|
||||
|
||||
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
|
||||
|
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||
<a href="../index.html">Moto</a>
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
|
||||
<div class="wy-nav-content">
|
||||
<div class="rst-content">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="navigation" aria-label="breadcrumbs navigation">
|
||||
|
||||
<ul class="wy-breadcrumbs">
|
||||
|
||||
<li><a href="../index.html">Docs</a> »</li>
|
||||
|
||||
<li>Moto APIs</li>
|
||||
|
||||
|
||||
<li class="wy-breadcrumbs-aside">
|
||||
|
||||
|
||||
<a href="../_sources/docs/moto_apis.rst.txt" rel="nofollow"> View page source</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<hr/>
|
||||
</div>
|
||||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
<div itemprop="articleBody">
|
||||
|
||||
<div class="section" id="moto-apis">
|
||||
<span id="id1"></span><h1>Moto APIs<a class="headerlink" href="#moto-apis" title="Permalink to this headline">¶</a></h1>
|
||||
<p>Moto provides some internal APIs to view and change the state of the backends.</p>
|
||||
<div class="section" id="reset-api">
|
||||
<h2>Reset API<a class="headerlink" href="#reset-api" title="Permalink to this headline">¶</a></h2>
|
||||
<p>This API resets the state of all of the backends. Send an HTTP POST to reset:</p>
|
||||
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">requests</span><span class="o">.</span><span class="n">post</span><span class="p">(</span><span class="s2">"http://motoapi.amazonaws.com/moto-api/reset"</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="dashboard">
|
||||
<h2>Dashboard<a class="headerlink" href="#dashboard" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Moto comes with a dashboard to view the current state of the system:</p>
|
||||
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">http</span><span class="p">:</span><span class="o">//</span><span class="n">localhost</span><span class="p">:</span><span class="mi">5000</span><span class="o">/</span><span class="n">moto</span><span class="o">-</span><span class="n">api</span><span class="o">/</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="articleComments">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<footer>
|
||||
|
||||
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
|
||||
|
||||
<a href="ec2_tut.html" class="btn btn-neutral float-right" title="Use Moto as EC2 backend" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
|
||||
|
||||
|
||||
<a href="other_langs.html" class="btn btn-neutral" title="Other languages" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<hr/>
|
||||
|
||||
<div role="contentinfo">
|
||||
<p>
|
||||
© Copyright 2015, Steve Pulec.
|
||||
|
||||
</p>
|
||||
</div>
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'../',
|
||||
VERSION:'0.4.10',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
HAS_SOURCE: true,
|
||||
SOURCELINK_SUFFIX: '.txt'
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" src="../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="../_static/doctools.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="../_static/js/theme.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(function () {
|
||||
SphinxRtdTheme.StickyNav.enable();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
243
docs/_build/html/docs/other_langs.html
vendored
Normal file
243
docs/_build/html/docs/other_langs.html
vendored
Normal file
@ -0,0 +1,243 @@
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>Other languages — Moto 0.4.10 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="index" title="Index"
|
||||
href="../genindex.html"/>
|
||||
<link rel="search" title="Search" href="../search.html"/>
|
||||
<link rel="top" title="Moto 0.4.10 documentation" href="../index.html"/>
|
||||
<link rel="next" title="Moto APIs" href="moto_apis.html"/>
|
||||
<link rel="prev" title="Getting Started with Moto" href="getting_started.html"/>
|
||||
|
||||
|
||||
<script src="../_static/js/modernizr.min.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body class="wy-body-for-nav" role="document">
|
||||
|
||||
|
||||
<div class="wy-grid-for-nav">
|
||||
|
||||
|
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||
<div class="wy-side-scroll">
|
||||
<div class="wy-side-nav-search">
|
||||
|
||||
|
||||
|
||||
<a href="../index.html" class="icon icon-home"> Moto
|
||||
|
||||
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="version">
|
||||
0.4.10
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="search">
|
||||
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
|
||||
<input type="text" name="q" placeholder="Search docs" />
|
||||
<input type="hidden" name="check_keywords" value="yes" />
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ul class="current">
|
||||
<li class="toctree-l1"><a class="reference internal" href="getting_started.html">Getting Started with Moto</a></li>
|
||||
<li class="toctree-l1 current"><a class="current reference internal" href="#">Other languages</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="moto_apis.html">Moto APIs</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="ec2_tut.html">Use Moto as EC2 backend</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
||||
|
||||
|
||||
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
|
||||
|
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||
<a href="../index.html">Moto</a>
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
|
||||
<div class="wy-nav-content">
|
||||
<div class="rst-content">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="navigation" aria-label="breadcrumbs navigation">
|
||||
|
||||
<ul class="wy-breadcrumbs">
|
||||
|
||||
<li><a href="../index.html">Docs</a> »</li>
|
||||
|
||||
<li>Other languages</li>
|
||||
|
||||
|
||||
<li class="wy-breadcrumbs-aside">
|
||||
|
||||
|
||||
<a href="../_sources/docs/other_langs.rst.txt" rel="nofollow"> View page source</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<hr/>
|
||||
</div>
|
||||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
<div itemprop="articleBody">
|
||||
|
||||
<div class="section" id="other-languages">
|
||||
<span id="other-langs"></span><h1>Other languages<a class="headerlink" href="#other-languages" title="Permalink to this headline">¶</a></h1>
|
||||
<p>You don’t need to use Python to use Moto; it can be used with any language. To use it with another language, run moto_server. Here are some examples in other languages:</p>
|
||||
<ul class="simple">
|
||||
<li><a class="reference external" href="https://github.com/spulec/moto/blob/master/other_langs/sqsSample.java">Java</a></li>
|
||||
<li><a class="reference external" href="https://github.com/spulec/moto/blob/master/other_langs/test.rb">Ruby</a></li>
|
||||
<li><a class="reference external" href="https://github.com/spulec/moto/blob/master/other_langs/test.js">Javascript</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="articleComments">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<footer>
|
||||
|
||||
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
|
||||
|
||||
<a href="moto_apis.html" class="btn btn-neutral float-right" title="Moto APIs" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
|
||||
|
||||
|
||||
<a href="getting_started.html" class="btn btn-neutral" title="Getting Started with Moto" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<hr/>
|
||||
|
||||
<div role="contentinfo">
|
||||
<p>
|
||||
© Copyright 2015, Steve Pulec.
|
||||
|
||||
</p>
|
||||
</div>
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'../',
|
||||
VERSION:'0.4.10',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
HAS_SOURCE: true,
|
||||
SOURCELINK_SUFFIX: '.txt'
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" src="../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="../_static/doctools.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="../_static/js/theme.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(function () {
|
||||
SphinxRtdTheme.StickyNav.enable();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
283
docs/_build/html/docs/server_mode.html
vendored
Normal file
283
docs/_build/html/docs/server_mode.html
vendored
Normal file
@ -0,0 +1,283 @@
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>Server mode — Moto 0.4.10 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="index" title="Index"
|
||||
href="../genindex.html"/>
|
||||
<link rel="search" title="Search" href="../search.html"/>
|
||||
<link rel="top" title="Moto 0.4.10 documentation" href="../index.html"/>
|
||||
<link rel="next" title="Moto APIs" href="moto_apis.html"/>
|
||||
<link rel="prev" title="Getting Started with Moto" href="getting_started.html"/>
|
||||
|
||||
|
||||
<script src="../_static/js/modernizr.min.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body class="wy-body-for-nav" role="document">
|
||||
|
||||
|
||||
<div class="wy-grid-for-nav">
|
||||
|
||||
|
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||
<div class="wy-side-scroll">
|
||||
<div class="wy-side-nav-search">
|
||||
|
||||
|
||||
|
||||
<a href="../index.html" class="icon icon-home"> Moto
|
||||
|
||||
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="version">
|
||||
0.4.10
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="search">
|
||||
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
|
||||
<input type="text" name="q" placeholder="Search docs" />
|
||||
<input type="hidden" name="check_keywords" value="yes" />
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ul class="current">
|
||||
<li class="toctree-l1"><a class="reference internal" href="getting_started.html">Getting Started with Moto</a></li>
|
||||
<li class="toctree-l1 current"><a class="current reference internal" href="#">Server mode</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="#other-languages">Other languages</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="moto_apis.html">Moto APIs</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="ec2_tut.html">Use Moto as EC2 backend</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
||||
|
||||
|
||||
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
|
||||
|
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||
<a href="../index.html">Moto</a>
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
|
||||
<div class="wy-nav-content">
|
||||
<div class="rst-content">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="navigation" aria-label="breadcrumbs navigation">
|
||||
|
||||
<ul class="wy-breadcrumbs">
|
||||
|
||||
<li><a href="../index.html">Docs</a> »</li>
|
||||
|
||||
<li>Server mode</li>
|
||||
|
||||
|
||||
<li class="wy-breadcrumbs-aside">
|
||||
|
||||
|
||||
<a href="../_sources/docs/server_mode.rst.txt" rel="nofollow"> View page source</a>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<hr/>
|
||||
</div>
|
||||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
<div itemprop="articleBody">
|
||||
|
||||
<div class="section" id="server-mode">
|
||||
<span id="id1"></span><h1>Server mode<a class="headerlink" href="#server-mode" title="Permalink to this headline">¶</a></h1>
|
||||
<p>Moto has a stand-alone server mode. This allows you to utilize
|
||||
the backend structure of Moto even if you don’t use Python.</p>
|
||||
<p>It uses flask, which isn’t a default dependency. You can install the
|
||||
server ‘extra’ package with:</p>
|
||||
<div class="code bash highlight-default"><div class="highlight"><pre><span></span><span class="n">pip</span> <span class="n">install</span> <span class="n">moto</span><span class="p">[</span><span class="n">server</span><span class="p">]</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>You can then start it running a service:</p>
|
||||
<div class="code bash highlight-default"><div class="highlight"><pre><span></span>$ moto_server ec2
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>You can also pass the port:</p>
|
||||
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ moto_server ec2 -p3000
|
||||
* Running on http://127.0.0.1:3000/
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>If you want to be able to use the server externally you can pass an IP
|
||||
address to bind to as a hostname or allow any of your external
|
||||
interfaces with 0.0.0.0:</p>
|
||||
<div class="highlight-bash"><div class="highlight"><pre><span></span>$ moto_server ec2 -H <span class="m">0</span>.0.0.0
|
||||
* Running on http://0.0.0.0:5000/
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Please be aware this might allow other network users to access your
|
||||
server.</p>
|
||||
<p>Then go to <a class="reference external" href="http://localhost:5000/?Action=DescribeInstances">localhost</a> to see a list of running instances (it will be empty since you haven’t added any yet).</p>
|
||||
<p>If you want to use boto3 with this, you can pass an <cite>endpoint_url</cite> to the resource</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">boto3</span><span class="o">.</span><span class="n">resource</span><span class="p">(</span>
|
||||
<span class="n">service_name</span><span class="o">=</span><span class="s1">'s3'</span><span class="p">,</span>
|
||||
<span class="n">region_name</span><span class="o">=</span><span class="s1">'us-west-1'</span><span class="p">,</span>
|
||||
<span class="n">endpoint_url</span><span class="o">=</span><span class="s1">'http://localhost:5000'</span><span class="p">,</span>
|
||||
<span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="section" id="other-languages">
|
||||
<h2>Other languages<a class="headerlink" href="#other-languages" title="Permalink to this headline">¶</a></h2>
|
||||
<p>You don’t need to use Python to use Moto; it can be used with any language. Here are some examples to run it with other languages:</p>
|
||||
<ul class="simple">
|
||||
<li><a class="reference external" href="https://github.com/spulec/moto/blob/master/other_langs/sqsSample.java">Java</a></li>
|
||||
<li><a class="reference external" href="https://github.com/spulec/moto/blob/master/other_langs/test.rb">Ruby</a></li>
|
||||
<li><a class="reference external" href="https://github.com/spulec/moto/blob/master/other_langs/test.js">Javascript</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="articleComments">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<footer>
|
||||
|
||||
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
|
||||
|
||||
<a href="moto_apis.html" class="btn btn-neutral float-right" title="Moto APIs" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
|
||||
|
||||
|
||||
<a href="getting_started.html" class="btn btn-neutral" title="Getting Started with Moto" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<hr/>
|
||||
|
||||
<div role="contentinfo">
|
||||
<p>
|
||||
© Copyright 2015, Steve Pulec.
|
||||
|
||||
</p>
|
||||
</div>
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'../',
|
||||
VERSION:'0.4.10',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
HAS_SOURCE: true,
|
||||
SOURCELINK_SUFFIX: '.txt'
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" src="../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="../_static/doctools.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="../_static/js/theme.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(function () {
|
||||
SphinxRtdTheme.StickyNav.enable();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
8
docs/_build/html/genindex.html
vendored
8
docs/_build/html/genindex.html
vendored
@ -90,10 +90,10 @@
|
||||
|
||||
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="index.html">Moto: Mock AWS Services</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="getting_started.html">Getting Started with Moto</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="other_langs.html">Other languages</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="moto_apis.html">Moto APIs</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="docs/getting_started.html">Getting Started with Moto</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="docs/server_mode.html">Server mode</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="docs/moto_apis.html">Moto APIs</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="docs/ec2_tut.html">Use Moto as EC2 backend</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
36
docs/_build/html/index.html
vendored
36
docs/_build/html/index.html
vendored
@ -36,7 +36,7 @@
|
||||
href="genindex.html"/>
|
||||
<link rel="search" title="Search" href="search.html"/>
|
||||
<link rel="top" title="Moto 0.4.10 documentation" href="#"/>
|
||||
<link rel="next" title="Getting Started with Moto" href="getting_started.html"/>
|
||||
<link rel="next" title="Getting Started with Moto" href="docs/getting_started.html"/>
|
||||
|
||||
|
||||
<script src="_static/js/modernizr.min.js"></script>
|
||||
@ -89,21 +89,11 @@
|
||||
|
||||
|
||||
|
||||
<ul class="current">
|
||||
<li class="toctree-l1 current"><a class="current reference internal" href="#">Moto: Mock AWS Services</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="#getting-started">Getting Started</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="#moto-apis">Moto APIs</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="#additional-resources">Additional Resources</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="getting_started.html">Getting Started with Moto</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="other_langs.html">Other languages</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="moto_apis.html">Moto APIs</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="getting_started.html">Getting Started with Moto</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="other_langs.html">Other languages</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="moto_apis.html">Moto APIs</a></li>
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="docs/getting_started.html">Getting Started with Moto</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="docs/server_mode.html">Server mode</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="docs/moto_apis.html">Moto APIs</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="docs/ec2_tut.html">Use Moto as EC2 backend</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
@ -170,13 +160,15 @@
|
||||
<div class="section" id="moto-mock-aws-services">
|
||||
<span id="index"></span><h1>Moto: Mock AWS Services<a class="headerlink" href="#moto-mock-aws-services" title="Permalink to this headline">¶</a></h1>
|
||||
<p>A library that allows you to easily mock out tests based on
|
||||
<span class="target" id="aws-infrastructure">AWS infrastructure</span>.</p>
|
||||
<a class="reference external" href="http://aws.amazon.com/">AWS infrastructure</a>.</p>
|
||||
<div class="section" id="getting-started">
|
||||
<h2>Getting Started<a class="headerlink" href="#getting-started" title="Permalink to this headline">¶</a></h2>
|
||||
<p>If you’ve never used <code class="docutils literal"><span class="pre">moto</span></code> before, you should read the
|
||||
<a class="reference internal" href="getting_started.html"><span class="doc">Getting Started with Moto</span></a> guide to get familiar
|
||||
<a class="reference internal" href="docs/getting_started.html"><span class="doc">Getting Started with Moto</span></a> guide to get familiar
|
||||
with <code class="docutils literal"><span class="pre">moto</span></code> and its usage.</p>
|
||||
<p>Currently implemented Services:</p>
|
||||
</div>
|
||||
<div class="section" id="currently-implemented-services">
|
||||
<h2>Currently implemented Services:<a class="headerlink" href="#currently-implemented-services" title="Permalink to this headline">¶</a></h2>
|
||||
<table border="1" class="docutils">
|
||||
<colgroup>
|
||||
<col width="29%" />
|
||||
@ -321,10 +313,6 @@ all endpoints done</td>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="section" id="moto-apis">
|
||||
<h2>Moto APIs<a class="headerlink" href="#moto-apis" title="Permalink to this headline">¶</a></h2>
|
||||
<p>some stuff</p>
|
||||
</div>
|
||||
<div class="section" id="additional-resources">
|
||||
<h2>Additional Resources<a class="headerlink" href="#additional-resources" title="Permalink to this headline">¶</a></h2>
|
||||
<ul class="simple">
|
||||
@ -346,7 +334,7 @@ all endpoints done</td>
|
||||
|
||||
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
|
||||
|
||||
<a href="getting_started.html" class="btn btn-neutral float-right" title="Getting Started with Moto" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
|
||||
<a href="docs/getting_started.html" class="btn btn-neutral float-right" title="Getting Started with Moto" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
|
||||
|
||||
|
||||
</div>
|
||||
|
BIN
docs/_build/html/objects.inv
vendored
BIN
docs/_build/html/objects.inv
vendored
Binary file not shown.
12
docs/_build/html/other_langs.html
vendored
12
docs/_build/html/other_langs.html
vendored
@ -91,6 +91,16 @@
|
||||
|
||||
|
||||
<ul class="current">
|
||||
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Moto: Mock AWS Services</a><ul class="current">
|
||||
<li class="toctree-l2"><a class="reference internal" href="index.html#getting-started">Getting Started</a></li>
|
||||
<li class="toctree-l2 current"><a class="reference internal" href="index.html#additional-resources">Additional Resources</a><ul class="current">
|
||||
<li class="toctree-l3"><a class="reference internal" href="getting_started.html">Getting Started with Moto</a></li>
|
||||
<li class="toctree-l3 current"><a class="current reference internal" href="#">Other languages</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="moto_apis.html">Moto APIs</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="getting_started.html">Getting Started with Moto</a></li>
|
||||
<li class="toctree-l1 current"><a class="current reference internal" href="#">Other languages</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="moto_apis.html">Moto APIs</a></li>
|
||||
@ -159,7 +169,7 @@
|
||||
|
||||
<div class="section" id="other-languages">
|
||||
<span id="other-langs"></span><h1>Other languages<a class="headerlink" href="#other-languages" title="Permalink to this headline">¶</a></h1>
|
||||
<p>You don’t need to use Python to use Moto; it can be used with any language. To use it with another language, run moto_server and here are some examples in other languages.</p>
|
||||
<p>You don’t need to use Python to use Moto; it can be used with any language. To use it with another language, run moto_server. Here are some examples in other languages:</p>
|
||||
<ul class="simple">
|
||||
<li><a class="reference external" href="https://github.com/spulec/moto/blob/master/other_langs/sqsSample.java">Java</a></li>
|
||||
<li><a class="reference external" href="https://github.com/spulec/moto/blob/master/other_langs/test.rb">Ruby</a></li>
|
||||
|
8
docs/_build/html/search.html
vendored
8
docs/_build/html/search.html
vendored
@ -89,10 +89,10 @@
|
||||
|
||||
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="index.html">Moto: Mock AWS Services</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="getting_started.html">Getting Started with Moto</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="other_langs.html">Other languages</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="moto_apis.html">Moto APIs</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="docs/getting_started.html">Getting Started with Moto</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="docs/server_mode.html">Server mode</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="docs/moto_apis.html">Moto APIs</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="docs/ec2_tut.html">Use Moto as EC2 backend</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
2
docs/_build/html/searchindex.js
vendored
2
docs/_build/html/searchindex.js
vendored
@ -1 +1 @@
|
||||
Search.setIndex({docnames:["ec2_tut","getting_started","index","moto_apis","other_langs"],envversion:50,filenames:["ec2_tut.rst","getting_started.rst","index.rst","moto_apis.rst","other_langs.rst"],objects:{},objnames:{},objtypes:{},terms:{"27t05":0,"57z":0,"91dd2f32":0,"class":1,"import":[0,1],"static":0,"true":0,"var":0,AWS:1,EBS:2,ECS:2,For:1,KMS:2,RDS:2,SES:2,SNS:2,SQS:2,STS:2,There:1,With:1,__init__:1,_in_monitoring_el:0,_placement:0,_previous_st:0,_state:0,access:[],account:1,administr:[],after:0,all:[0,1,2,3],allow:[1,2],alreadi:0,also:1,amazonaw:[0,3],ami:[0,2],ami_launch_index:0,analyt:[],ani:4,anoth:4,api:[],applic:[],architectur:0,assert:1,assum:0,attribut:0,auto:[],automat:1,autosc:2,awesom:1,backend:3,base:2,basic:2,befor:[0,2],behavior:0,best:1,blank:1,block:[],block_device_map:0,bodi:[],boto:[0,1],bucket:1,call:1,can:[1,4],cell:[],chang:3,client_token:0,clone:1,cloud:[],cloudform:2,cloudwatch:2,code:[0,1],column:[],com:[0,1,3],come:[1,3],comput:0,conn:[0,1],connect:0,connect_s3:1,connect_to_region:0,contain:[],content:[],core:2,creat:1,create_bucket:1,current:[2,3],data:2,databas:[],decor:2,def:1,deliveri:[],deploy:[],develop:2,dns_name:0,don:[1,4],done:2,download:0,dynamodb2:2,dynamodb:2,easili:2,ebs_optim:0,ec2:[1,2],ec2connect:0,ed65f870:0,elast:[],elb:2,emr:2,enabl:0,encourag:1,endpoint:[1,2],eni:0,environ:1,even:1,eventsset:0,everi:1,exampl:[0,1,4],explain:0,f00ba4:0,fals:0,familiar:2,featur:0,follow:[0,1],from:1,full:1,gatewai:2,gener:0,get_bucket:1,get_contents_as_str:1,get_kei:1,git:1,github:1,glacier:2,grid:[],group:[0,2],group_nam:0,guid:2,have:[0,1],header:[],here:4,how:0,http:[1,3],hypervisor:0,iam:2,ident:[],image_id:0,implement:2,index:2,infrastructur:2,insid:1,instal:0,instanc:2,instance_profil:0,instance_typ:0,interfac:0,intern:[0,3],ip_address:0,isn:1,issu:2,item:0,its:2,java:4,javascript:4,just:1,keep:1,kei:1,kernel:0,key_nam:0,kinesi:2,lambda:2,languag:[],latest:1,launch_tim:0,librari:2,localhost:3,mai:[],manag:[],manual:1,method:1,mind:1,mobil:[],mock:[0,1],mock_apigatewai:2,mock_autosc:2,mock_cloudform:2,mock_cloudwatch:2,mock_datapipelin:2,mock_dynamodb2:2,mock_dynamodb:2,mock_ec2:[0,2],mock_ec:2,mock_elb:2,mock_emr:2,mock_glaci:2,mock_iam:2,mock_kinesi:2,mock_km:2,mock_lambda:2,mock_rd:2,mock_rds2:2,mock_redshift:2,mock_route53:2,mock_s3:[1,2],mock_s:2,mock_sfw:2,mock_sn:2,mock_sq:2,mock_st:2,model_inst:1,modul:[],monitor:0,monitoring_st:0,moto:4,moto_serv:[1,4],motoapi:3,mybucket:1,mymodel:1,mymodul:1,name:[1,2],need:[1,4],network:[],networkinterfac:0,never:2,none:0,object:[0,1],other:[],out:[1,2],p3000:1,page:[],paravirtu:0,partial:2,pend:0,persist:0,pip:1,pipelin:2,platform:0,post:3,previous:0,private_dns_nam:0,private_ip_address:0,product_cod:0,provid:3,public_dns_nam:0,python:[1,4],ramdisk:0,random:0,rds2:2,read:2,reason:0,redshift:2,region:0,regioninfo:0,releas:1,repositori:2,request:3,requester_id:0,reserv:0,root_device_nam:0,root_device_typ:0,route53:2,row:[],rubi:4,run:[1,4],run_inst:0,same:[0,1],save:1,scale:[],search:[],secur:2,self:1,send:3,set:0,set_contents_from_str:1,setup:1,sever:1,should:2,sinc:1,small:0,snippet:0,some:[2,3,4],sourc:[1,2],sourcedestcheck:0,span:[],spot_instance_request_id:0,spulec:1,start:0,state:3,state_reason:0,statement:1,statu:2,steve:1,stop:1,storag:[],stuff:2,subnet_id:0,swf:2,system:3,tabl:[],tag:[0,2],test:[1,2],test_my_model_sav:1,than:0,thi:[0,1,3],tracker:2,tutori:0,usag:2,use:[0,1,4],used:[2,4],useful:1,using:1,valu:1,veri:1,version:1,view:3,virtual:1,virtualization_typ:0,vpc_id:0,want:1,west:0,wrap:1,x86_64:0,xen:0,you:[0,1,2,4]},titles:["Use Moto as EC2 backend","Getting Started with Moto","Moto: Mock AWS Services","Moto APIs","Other languages"],titleterms:{AWS:2,Use:0,addit:2,alon:1,ani:[],anoth:[],api:[2,3],backend:0,boto:[],can:[],context:1,current:[],dashboard:3,decor:1,don:[],ec2:0,exampl:[],get:[1,2],here:[],implement:[],indic:[],instal:1,instanc:0,languag:4,launch:0,librari:[],manag:1,mock:2,mode:1,moto:[0,1,2,3],moto_serv:[],need:[],other:4,python:[],raw:1,reset:3,resourc:2,run:[],server:1,servic:2,some:[],stand:1,start:[1,2],tabl:[],usag:1,use:[],used:[],you:[]}})
|
||||
Search.setIndex({docnames:["docs/ec2_tut","docs/getting_started","docs/moto_apis","docs/server_mode","index"],envversion:50,filenames:["docs/ec2_tut.rst","docs/getting_started.rst","docs/moto_apis.rst","docs/server_mode.rst","index.rst"],objects:{},objnames:{},objtypes:{},terms:{"27t05":0,"57z":0,"91dd2f32":0,"class":1,"default":3,"import":[0,1],"static":0,"true":0,"var":0,AWS:1,EBS:4,ECS:4,For:1,KMS:4,RDS:4,SES:4,SNS:4,SQS:4,STS:4,Then:3,There:1,With:1,__init__:1,_in_monitoring_el:0,_placement:0,_previous_st:0,_state:0,abl:3,abov:[],access:3,account:1,action:[],added:3,address:3,administr:[],after:0,all:[0,1,2,4],allow:[1,3,4],alon:3,alreadi:0,also:[1,3],amazonaw:[0,2],ami:[0,4],ami_launch_index:0,analyt:[],ani:3,anoth:[],api:4,applic:[],architectur:0,assert:1,assum:0,attribut:0,auto:[],automat:1,autosc:4,awar:3,awesom:1,backend:[2,3],base:4,basic:4,befor:[0,4],behavior:0,best:1,bind:3,blank:1,block:[],block_device_map:0,bodi:[],boto3:3,boto:[0,1],bucket:1,call:1,can:[1,3],cell:[],chang:2,client_token:0,clone:1,cloud:[],cloudform:4,cloudwatch:4,code:[0,1],column:[],com:[0,1,2],come:[1,2],comput:0,config:[],conn:[0,1],connect:0,connect_s3:1,connect_to_region:0,contain:[],content:[],core:4,creat:1,create_bucket:1,current:2,data:4,databas:[],decor:4,def:1,deliveri:[],depend:3,deploy:[],describeinst:[],develop:4,dns_name:0,don:[1,3],done:4,download:0,dynamodb2:4,dynamodb:4,easiest:[],easili:4,ebs_optim:0,ec2:[1,3,4],ec2connect:0,ed65f870:0,elast:[],elb:4,empti:3,emr:4,enabl:0,encourag:1,endpoint:[1,4],endpoint_url:3,eni:0,environ:1,even:[1,3],eventsset:0,everi:1,exampl:[0,1,3],explain:0,extern:3,extra:3,f00ba4:0,fals:0,familiar:4,featur:0,file:[],flask:3,follow:[0,1],from:1,full:1,gatewai:4,gener:0,get_bucket:1,get_contents_as_str:1,get_kei:1,git:1,github:1,glacier:4,grid:[],group:[0,4],group_nam:0,guid:4,has:3,have:[0,1],haven:3,header:[],here:3,hostnam:3,how:0,http:[1,2,3],https_validate_certif:[],hypervisor:0,iam:4,ident:[],image_id:0,implement:[],index:4,infrastructur:4,insid:1,instal:[0,3],instanc:[3,4],instance_profil:0,instance_typ:0,instead:[],interfac:[0,3],intern:[0,2],ip_address:0,is_secur:[],isn:[1,3],issu:4,item:0,its:4,java:3,javascript:3,just:1,keep:1,kei:1,kernel:0,key_nam:0,kinesi:4,lambda:4,languag:[],latest:1,launch_tim:0,librari:4,list:3,localhost:[2,3],mai:[],manag:[],manual:1,method:1,might:3,mind:1,mobil:[],mock:[0,1],mock_apigatewai:4,mock_autosc:4,mock_cloudform:4,mock_cloudwatch:4,mock_datapipelin:4,mock_dynamodb2:4,mock_dynamodb:4,mock_ec2:[0,4],mock_ec:4,mock_elb:4,mock_emr:4,mock_glaci:4,mock_iam:4,mock_kinesi:4,mock_km:4,mock_lambda:4,mock_rd:4,mock_rds2:4,mock_redshift:4,mock_route53:4,mock_s3:[1,4],mock_s:4,mock_sfw:4,mock_sn:4,mock_sq:4,mock_st:4,model_inst:1,modul:[],monitor:0,monitoring_st:0,moto:3,moto_serv:[1,3],motoapi:2,mybucket:1,mymodel:1,mymodul:1,name:[1,4],need:[1,3],network:3,networkinterfac:0,never:4,none:0,object:[0,1],other:[],out:[1,4],p3000:[1,3],packag:3,page:[],paravirtu:0,partial:4,pass:3,pend:0,persist:0,pip:[1,3],pipelin:4,platform:0,pleas:3,port:3,post:2,previous:0,private_dns_nam:0,private_ip_address:0,product_cod:0,provid:2,proxi:[],proxy_port:[],public_dns_nam:0,python:[1,3],ramdisk:0,random:0,rds2:4,read:4,reason:0,redshift:4,region:0,region_nam:3,regioninfo:0,releas:1,repositori:4,request:2,requester_id:0,reserv:0,resourc:3,root_device_nam:0,root_device_typ:0,route53:4,row:[],rubi:3,run:[1,3],run_inst:0,same:[0,1],save:1,scale:[],search:[],secur:4,see:3,self:1,send:2,servic:3,service_nam:3,set:0,set_contents_from_str:1,setup:1,sever:1,should:4,simpler:[],sinc:[1,3],small:0,snippet:0,some:[2,3],sourc:[1,4],sourcedestcheck:0,span:[],spot_instance_request_id:0,spulec:1,stand:3,start:[0,3],state:2,state_reason:0,statement:1,statu:4,steve:1,stop:1,storag:[],strongli:[],structur:3,stuff:[],subnet_id:0,swf:4,system:2,tabl:[],tag:[0,4],test:[1,4],test_my_model_sav:1,than:0,thi:[0,1,2,3],tracker:4,tutori:0,usag:4,use:[0,1,3],used:[3,4],useful:1,user:3,uses:3,using:1,util:3,valu:1,veri:1,version:1,view:2,virtual:1,virtualization_typ:0,vpc_id:0,wai:[],want:[1,3],west:[0,3],which:3,wrap:1,x86_64:0,xen:0,yet:3,you:[0,1,3,4],your:3},titles:["Use Moto as EC2 backend","Getting Started with Moto","Moto APIs","Server mode","Moto: Mock AWS Services"],titleterms:{AWS:4,Use:0,addit:4,alon:1,ani:[],anoth:[],api:2,backend:0,boto:[],can:[],context:1,current:4,dashboard:2,decor:1,don:[],ec2:0,exampl:[],get:[1,4],here:[],implement:4,indic:[],instal:1,instanc:0,languag:3,launch:0,librari:[],manag:1,mock:4,mode:[1,3],moto:[0,1,2,4],moto_serv:[],need:[],other:3,python:[],raw:1,reset:2,resourc:4,run:[],server:[1,3],servic:4,some:[],stand:1,start:[1,4],tabl:[],usag:1,use:[],used:[],you:[]}})
|
74
docs/docs/ec2_tut.rst
Normal file
74
docs/docs/ec2_tut.rst
Normal file
@ -0,0 +1,74 @@
|
||||
.. _ec2_tut:
|
||||
|
||||
=======================
|
||||
Use Moto as EC2 backend
|
||||
=======================
|
||||
|
||||
This tutorial explains ``moto.ec2``'s features and how to use it. This
|
||||
tutorial assumes that you have already downloaded and installed boto and moto.
|
||||
Before all code examples the following snippet is launched::
|
||||
|
||||
>>> import boto.ec2, moto
|
||||
>>> mock_ec2 = moto.mock_ec2()
|
||||
>>> mock_ec2.start()
|
||||
>>> conn = boto.ec2.connect_to_region("eu-west-1")
|
||||
|
||||
Launching instances
|
||||
-------------------
|
||||
|
||||
After mock is started, the behavior is the same than previously::
|
||||
|
||||
>>> reservation = conn.run_instances('ami-f00ba4')
|
||||
>>> reservation.instances[0]
|
||||
Instance:i-91dd2f32
|
||||
|
||||
Moto set static or generate random object's attributes::
|
||||
|
||||
>>> vars(reservation.instances[0])
|
||||
{'_in_monitoring_element': False,
|
||||
'_placement': None,
|
||||
'_previous_state': None,
|
||||
'_state': pending(0),
|
||||
'ami_launch_index': u'0',
|
||||
'architecture': u'x86_64',
|
||||
'block_device_mapping': None,
|
||||
'client_token': '',
|
||||
'connection': EC2Connection:ec2.eu-west-1.amazonaws.com,
|
||||
'dns_name': u'ec2-54.214.135.84.compute-1.amazonaws.com',
|
||||
'ebs_optimized': False,
|
||||
'eventsSet': None,
|
||||
'group_name': None,
|
||||
'groups': [],
|
||||
'hypervisor': u'xen',
|
||||
'id': u'i-91dd2f32',
|
||||
'image_id': u'f00ba4',
|
||||
'instance_profile': None,
|
||||
'instance_type': u'm1.small',
|
||||
'interfaces': [NetworkInterface:eni-ed65f870],
|
||||
'ip_address': u'54.214.135.84',
|
||||
'item': u'\n ',
|
||||
'kernel': u'None',
|
||||
'key_name': u'None',
|
||||
'launch_time': u'2015-07-27T05:59:57Z',
|
||||
'monitored': True,
|
||||
'monitoring': u'\n ',
|
||||
'monitoring_state': u'enabled',
|
||||
'persistent': False,
|
||||
'platform': None,
|
||||
'private_dns_name': u'ip-10.136.187.180.ec2.internal',
|
||||
'private_ip_address': u'10.136.187.180',
|
||||
'product_codes': [],
|
||||
'public_dns_name': u'ec2-54.214.135.84.compute-1.amazonaws.com',
|
||||
'ramdisk': None,
|
||||
'reason': '',
|
||||
'region': RegionInfo:eu-west-1,
|
||||
'requester_id': None,
|
||||
'root_device_name': None,
|
||||
'root_device_type': None,
|
||||
'sourceDestCheck': u'true',
|
||||
'spot_instance_request_id': None,
|
||||
'state_reason': None,
|
||||
'subnet_id': None,
|
||||
'tags': {},
|
||||
'virtualization_type': u'paravirtual',
|
||||
'vpc_id': None}
|
@ -1,3 +1,5 @@
|
||||
.. _getting_started:
|
||||
|
||||
=========================
|
||||
Getting Started with Moto
|
||||
=========================
|
21
docs/docs/moto_apis.rst
Normal file
21
docs/docs/moto_apis.rst
Normal file
@ -0,0 +1,21 @@
|
||||
.. _moto_apis:
|
||||
|
||||
=========
|
||||
Moto APIs
|
||||
=========
|
||||
|
||||
Moto provides some internal APIs to view and change the state of the backends.
|
||||
|
||||
Reset API
|
||||
---------
|
||||
|
||||
This API resets the state of all of the backends. Send an HTTP POST to reset::
|
||||
|
||||
requests.post("http://motoapi.amazonaws.com/moto-api/reset")
|
||||
|
||||
Dashboard
|
||||
---------
|
||||
|
||||
Moto comes with a dashboard to view the current state of the system::
|
||||
|
||||
http://localhost:5000/moto-api/
|
67
docs/docs/server_mode.rst
Normal file
67
docs/docs/server_mode.rst
Normal file
@ -0,0 +1,67 @@
|
||||
.. _server_mode:
|
||||
|
||||
===========
|
||||
Server mode
|
||||
===========
|
||||
|
||||
Moto has a stand-alone server mode. This allows you to utilize
|
||||
the backend structure of Moto even if you don't use Python.
|
||||
|
||||
It uses flask, which isn't a default dependency. You can install the
|
||||
server 'extra' package with:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
pip install moto[server]
|
||||
|
||||
|
||||
You can then start it running a service:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
$ moto_server ec2
|
||||
|
||||
You can also pass the port:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ moto_server ec2 -p3000
|
||||
* Running on http://127.0.0.1:3000/
|
||||
|
||||
If you want to be able to use the server externally you can pass an IP
|
||||
address to bind to as a hostname or allow any of your external
|
||||
interfaces with 0.0.0.0:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ moto_server ec2 -H 0.0.0.0
|
||||
* Running on http://0.0.0.0:5000/
|
||||
|
||||
Please be aware this might allow other network users to access your
|
||||
server.
|
||||
|
||||
Then go to localhost_ to see a list of running instances (it will be empty since you haven't added any yet).
|
||||
|
||||
If you want to use boto3 with this, you can pass an `endpoint_url` to the resource
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
boto3.resource(
|
||||
service_name='s3',
|
||||
region_name='us-west-1',
|
||||
endpoint_url='http://localhost:5000',
|
||||
)
|
||||
|
||||
Other languages
|
||||
---------------
|
||||
|
||||
You don't need to use Python to use Moto; it can be used with any language. Here are some examples to run it with other languages:
|
||||
|
||||
* `Java`_
|
||||
* `Ruby`_
|
||||
* `Javascript`_
|
||||
|
||||
.. _Java: https://github.com/spulec/moto/blob/master/other_langs/sqsSample.java
|
||||
.. _Ruby: https://github.com/spulec/moto/blob/master/other_langs/test.rb
|
||||
.. _Javascript: https://github.com/spulec/moto/blob/master/other_langs/test.js
|
||||
.. _localhost: http://localhost:5000/?Action=DescribeInstances
|
@ -5,18 +5,17 @@ Moto: Mock AWS Services
|
||||
=============================
|
||||
|
||||
A library that allows you to easily mock out tests based on
|
||||
_`AWS infrastructure`.
|
||||
|
||||
.. _AWS infrastructure: http://aws.amazon.com/
|
||||
`AWS infrastructure`_.
|
||||
|
||||
Getting Started
|
||||
---------------
|
||||
|
||||
If you've never used ``moto`` before, you should read the
|
||||
:doc:`Getting Started with Moto <getting_started>` guide to get familiar
|
||||
:doc:`Getting Started with Moto <docs/getting_started>` guide to get familiar
|
||||
with ``moto`` and its usage.
|
||||
|
||||
Currently implemented Services:
|
||||
-------------------------------
|
||||
|
||||
+-----------------------+---------------------+-----------------------------------+
|
||||
| Service Name | Decorator | Development Status |
|
||||
@ -79,11 +78,6 @@ Currently implemented Services:
|
||||
+-----------------------+---------------------+-----------------------------------+
|
||||
|
||||
|
||||
Moto APIs
|
||||
---------
|
||||
some stuff
|
||||
|
||||
|
||||
|
||||
Additional Resources
|
||||
--------------------
|
||||
@ -91,6 +85,7 @@ Additional Resources
|
||||
* `Moto Source Repository`_
|
||||
* `Moto Issue Tracker`_
|
||||
|
||||
.. _AWS infrastructure: http://aws.amazon.com/
|
||||
.. _Moto Issue Tracker: https://github.com/spulec/moto/issues
|
||||
.. _Moto Source Repository: https://github.com/spulec/moto
|
||||
|
||||
@ -99,7 +94,7 @@ Additional Resources
|
||||
:hidden:
|
||||
:glob:
|
||||
|
||||
index
|
||||
getting_started
|
||||
other_langs
|
||||
moto_apis
|
||||
docs/getting_started
|
||||
docs/server_mode
|
||||
docs/moto_apis
|
||||
docs/ec2_tut
|
||||
|
Loading…
Reference in New Issue
Block a user