.. _PUT Service ostor-limits:

PUT Service ostor-limits
------------------------

Description
~~~~~~~~~~~

Sets limit values for the specified user or bucket. Either operations count or bandwidth limits can be specified in a single request.

Requests
~~~~~~~~

Syntax
^^^^^^

::

    PUT /?ostor-limits&emailAddress=<value> HTTP/1.1
    Host: s3.amazonaws.com
    Date: <date>
    Authorization: <authorization_string>

::

    GET /?ostor-limits&bucket=<value> HTTP/1.1
    Host: s3.amazonaws.com 
    Date: <date>
    Authorization: <authorization_string>
 
Parameters
^^^^^^^^^^

+------------------+-------------------------------------------------------+----------+
| Parameter        | Description                                           | Required |
+==================+=======================================================+==========+
| ``emailAddress`` | User email address.                                   | Yes*     |
|                  |                                                       |          |
|                  | Type: string.                                         |          |
|                  |                                                       |          |
|                  | Default value: none.                                  |          |
+------------------+-------------------------------------------------------+----------+
| ``id``           | User ID.                                              | Yes*     |
|                  |                                                       |          |
|                  | Type: string.                                         |          |
|                  |                                                       |          |
|                  | Default value: none.                                  |          |
+------------------+-------------------------------------------------------+----------+
| ``bucket``       | Bucket name.                                          | Yes      |
|                  |                                                       |          |
|                  | Type: string.                                         |          |
|                  |                                                       |          |
|                  | Default value: none.                                  |          |
+------------------+-------------------------------------------------------+----------+
| ``bandwidth``    | Enables bandwidth limits.                             | Yes**    |
|                  |                                                       |          |
|                  | Bandwidth limits types: { out | kb/s }                |          |
|                  |                                                       |          |
|                  | Type: flag.                                           |          |
+------------------+-------------------------------------------------------+----------+
| ``ops``          | Enables operations limits. If set, all unspecified    | Yes**    |
|                  | bandwidth limits are set to 0.                        |          |
|                  |                                                       |          |
|                  | Operations limits types: { default | ops/min,         |          |
|                  | put | ops/min , get | ops/min, list | ops/min,        |          |
|                  | delete | ops/min }                                    |          |
|                  |                                                       |          |
|                  | Type: flag.                                           |          |
+------------------+-------------------------------------------------------+----------+
| ``default``      | Sets the default value for operations limits. If set, | No       |
|                  | all unspecified operations limits are set to          |          |
|                  | ``default``, otherwise they are set to 0.             |          |
|                  |                                                       |          |
|                  | Requires the ``ops`` subresource to be set.           |          |
|                  |                                                       |          |
|                  | Type: integer.                                        |          |
|                  |                                                       |          |
|                  | Default: 0.                                           |          |
+------------------+-------------------------------------------------------+----------+
| ``put``          | Sets the ``PUT`` operations limit value.              | No       |
|                  |                                                       |          |
|                  | Requires the ``ops`` subresource to be set.           |          |
|                  |                                                       |          |
|                  | Type: integer.                                        |          |
|                  |                                                       |          |
|                  | Default: ``default``.                                 |          |
+------------------+-------------------------------------------------------+----------+
| ``get``          | Sets the ``GET`` operations limit value.              | No       |
|                  |                                                       |          |
|                  | Requires the ``ops`` subresource to be set.           |          |
|                  |                                                       |          |
|                  | Type: integer.                                        |          |
|                  |                                                       |          |
|                  | Default: ``default``.                                 |          |
+------------------+-------------------------------------------------------+----------+
| ``delete``       | Sets the ``DELETE`` operations limit value.           | No       |
|                  |                                                       |          |
|                  | Requires the ``ops`` subresource to be set.           |          |
|                  |                                                       |          |
|                  | Type: integer.                                        |          |
|                  |                                                       |          |
|                  | Default: ``default``.                                 |          |
+------------------+-------------------------------------------------------+----------+
| ``list``         | Sets the ``LIST`` operations limit value.             | No       |
|                  |                                                       |          |
|                  | Requires the ``ops`` subresource to be set.           |          |
|                  |                                                       |          |
|                  | Type: integer.                                        |          |
|                  |                                                       |          |
|                  | Default: ``default``.                                 |          |
+------------------+-------------------------------------------------------+----------+
| ``out``          | Sets an outgoing bandwidth limit.                     | No       |
|                  |                                                       |          |
|                  | Requires the ``ops`` subresource to be set.           |          |
|                  |                                                       |          |
|                  | Type: integer.                                        |          |
|                  |                                                       |          |
|                  | Default: 0.                                           |          |
+------------------+-------------------------------------------------------+----------+

\* Only one of the required parameters can be set in a single request.

\*\* Either ``ops`` or ``bandwidth`` can be set in a single request.

.. note:: Zero limit value means "unlimited".

Headers
^^^^^^^

This implementation uses only common request headers.

Responses
~~~~~~~~~

Headers
^^^^^^^

This implementation uses only common response headers.

Body
^^^^

Empty.

Errors
^^^^^^

Returns Error Code 400, if a wrong set of parameters is specified.

Examples
~~~~~~~~

Sample Request #1
^^^^^^^^^^^^^^^^^

Sets all operations limits for the user with the email ``user1@email.com`` to zero.

::

    PUT /?ostor-limits&emailAddress=user1@email.com&ops&default=0 HTTP/1.1
    Host: s3.amazonaws.com
    Date: Thu, 07 Apr 2016 14:08:55 GMT
    Authorization: <authorization_string>

Sample Response #1
^^^^^^^^^^^^^^^^^^

::

    HTTP/1.1 200 OK
    Transfer-encoding : chunked
    Server : nginx/1.8.1
    Connection: closed
    x-amz-request-id : 80000000000000030005c8caec96d65b
    Date : Thu, 07 Apr 2016 14:08:56 GMT
    Content-type : application/json
 
Sample Request #2
^^^^^^^^^^^^^^^^^

Sets all operations limits for the user with the email ``user1@email.com`` to 1 ops/sec.

::

    PUT /?ostor-limits&emailAddress=user1@email.com&ops&default=60 HTTP/1.1
    Host: s3.amazonaws.com
    Date: Thu, 07 Apr 2016 14:08:55 GMT
    Authorization: <authorization_string>

Sample Response #2
^^^^^^^^^^^^^^^^^^

::

    HTTP/1.1 200 OK
    Transfer-encoding : chunked
    Server : nginx/1.8.1
    Connection: closed
    x-amz-request-id : 80000000000000030005c8caec96d65b
    Date : Thu, 07 Apr 2016 14:08:56 GMT
    Content-type : application/json
 
Sample Request #3
^^^^^^^^^^^^^^^^^

Sets all badwidth.out limit for the bucket ``testbucket`` to 50 kb/s.

::

    PUT /?ostor-limits&bucket=testbucket&bandwidth&out=50 HTTP/1.1
    Host: s3.amazonaws.com
    Date: Thu, 07 Apr 2016 14:08:55 GMT
    Authorization: <authorization_string>

Sample Response #3
^^^^^^^^^^^^^^^^^^

::

    HTTP/1.1 200 OK
    Transfer-encoding : chunked
    Server : nginx/1.8.1
    Connection: closed
    x-amz-request-id : 80000000000000030005c8caec96d65b
    Date : Thu, 07 Apr 2016 14:08:56 GMT
    Content-type : application/json
 
Sample Request #4
^^^^^^^^^^^^^^^^^

Sets operations limits for the bucket ``testbucket.`` The new PUT operations limit is 60 ops/s, LIST limit is 0.5 ops/s, GET and DELETE limits are 1 ops/s.

::

    PUT /?ostor-limits&bucket=testbucket&ops&default=60&put=3600&list=30 HTTP/1.1
    Host: s3.amazonaws.com
    Date: Thu, 07 Apr 2016 14:08:55 GMT
    Authorization: <authorization_string>

Sample Response #4
^^^^^^^^^^^^^^^^^^

::

    HTTP/1.1 200 OK
    Transfer-encoding : chunked
    Server : nginx/1.8.1
    Connection: closed
    x-amz-request-id : 80000000000000030005c8caec96d65b
    Date : Thu, 07 Apr 2016 14:08:56 GMT
    Content-type : application/json

