%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/modules/boto_dynamodb.pyo

�
���^c
@@s�dZddlmZmZmZddlZddlZeje�Z	ejd�j
ej�ddlm
Z
ddlmZddlmZddlZyzddlZddlZddlmZmZdd	lmZmZmZmZdd
lmZddlm Z e!Z"Wne#k
r1e$Z"nXd�Z%ddddddddddddd
�Z'ddddd�Z(ddddd�Z)ddddddd�Z*ddddd�Z+ddddd�Z,ddddd�Z-e$d�Z.dS(u�
Connection module for Amazon DynamoDB

.. versionadded:: 2015.5.0

:configuration: This module accepts explicit DynamoDB credentials but can also
    utilize IAM roles assigned to the instance through Instance Profiles.
    Dynamic credentials are then automatically obtained from AWS API and no
    further configuration is necessary. More Information available at:

    .. code-block:: text

        http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html

    If IAM roles are not used you need to specify them either in a pillar or
    in the minion's config file:

    .. code-block:: yaml

        keyid: GKTADJGHEIQSXMKKRBJ08H
        key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs

    A region may also be specified in the configuration:

    .. code-block:: yaml

        region: us-east-1

    If a region is not specified, the default is us-east-1.

    It's also possible to specify key, keyid and region via a profile, either
    as a passed in dict, or as a string to pull from pillars or minion config:

    .. code-block:: yaml

        myprofile:
            keyid: GKTADJGHEIQSXMKKRBJ08H
            key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
            region: us-east-1

:depends: boto
i(tabsolute_importtprint_functiontunicode_literalsNuboto(tsix(trange(tSaltInvocationError(tHashKeytRangeKey(tAllIndextGlobalAllIndextGlobalIncludeIndextGlobalKeysOnlyIndex(tTable(tJSONResponseErrorcC@sBtjjjdt�}|tkr>tdtddt�n|S(u,
    Only load if boto libraries exist.
    tcheck_boto3uboto.assign_funcsu	dynamodb2tpack(	tsalttutilstversionstcheck_boto_reqstFalsetTruet	__utils__t__name__t__salt__(t
has_boto_reqs((s>/usr/lib/python2.7/site-packages/salt/modules/boto_dynamodb.pyt__virtual__Ksc
C@s�g}
g}d}|rQt|d|�}|
j|�|j|�||7}n|	r�t|	d|
�}|
j|�|j|�|d7}||	7}n|d7}i|d6|d6}g}|r�x$|D]}|jt|��q�Wng}|r$x*|D]}|jt|dt��q�Wntd|d	|d
|d|�}tj|d|
d
|d|d|d|�d}x=t|�D]/}t	|||||�r�tSt
jd�q�WtS(u\
    Creates a DynamoDB table.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_dynamodb.create_table table_name /
        region=us-east-1 /
        hash_key=id /
        hash_key_data_type=N /
        range_key=created_at /
        range_key_data_type=N /
        read_capacity_units=1 /
        write_capacity_units=1
    ut	data_typeu_u_indexureaduwritetglobal_indextregiontkeytkeyidtprofiletschemat
throughputtindexestglobal_indexest
connectionii(
RtappendRt
extract_indexRt	_get_connRtcreateRtexiststtimetsleepR(t
table_nameRRRR tread_capacity_unitstwrite_capacity_unitsthash_keythash_key_data_typet	range_keytrange_key_data_typet
local_indexesR$R!tprimary_index_fieldstprimary_index_namethash_key_objt
range_key_objR"tlocal_table_indexestindextglobal_table_indexestconntMAX_ATTEMPTSti((s>/usr/lib/python2.7/site-packages/salt/modules/boto_dynamodb.pytcreate_tableUs\










!	c	C@sby2td|d|d|d|�}|j|�Wn)tk
r]}|jdkrWtS�nXtS(u�
    Check to see if a table exists.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_dynamodb.exists table_name region=us-east-1
    RRRR uResourceNotFoundException(R(tdescribe_tableR
t
error_codeRR(R-RRRR R<te((s>/usr/lib/python2.7/site-packages/salt/modules/boto_dynamodb.pyR*�s
!c		C@s�td|d|d|d|�}t|d|�}|j�d}x=t|�D]/}t|||||�srtStjd�qPWtS(u�
    Delete a DynamoDB table.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_dynamodb.delete table_name region=us-east-1
    RRRR R%ii(	R(RtdeleteRR*RR+R,R(	R-RRRR R<ttableR=R>((s>/usr/lib/python2.7/site-packages/salt/modules/boto_dynamodb.pyRC�s
!
c		C@sItd|d|d|d|�}t|d|�}|jd|d|�S(u}
    Update a DynamoDB table.

    CLI example::

        salt myminion boto_dynamodb.update table_name region=us-east-1
    RRRR R%R"R$(R(Rtupdate(	R-R"R$RRRR R<RD((s>/usr/lib/python2.7/site-packages/salt/modules/boto_dynamodb.pyRE�s	!c	C@s@td|d|d|d|�}t|d|�}|j|�S(u�
    Creates a single global secondary index on a DynamoDB table.

    CLI Example:
    .. code-block:: bash

        salt myminion boto_dynamodb.create_global_secondary_index table_name /
        index_name
    RRRR R%(R(Rtcreate_global_secondary_index(R-RRRRR R<RD((s>/usr/lib/python2.7/site-packages/salt/modules/boto_dynamodb.pyRF�s!c	C@s@td|d|d|d|�}t|d|�}|j|�S(u�
    Updates the throughput of the given global secondary indexes.

    CLI Example:
    .. code-block:: bash

        salt myminion boto_dynamodb.update_global_secondary_index table_name /
        indexes
    RRRR R%(R(Rtupdate_global_secondary_index(R-R$RRRR R<RD((s>/usr/lib/python2.7/site-packages/salt/modules/boto_dynamodb.pyRG�s!c	C@s=td|d|d|d|�}t|d|�}|j�S(u�
    Describe a DynamoDB table.

    CLI example::

        salt myminion boto_dynamodb.describe table_name region=us-east-1
    RRRR R%(R(Rtdescribe(R-RRRR R<RD((s>/usr/lib/python2.7/site-packages/salt/modules/boto_dynamodb.pyRHs!c	
C@s�i}g}x/tj|�D]\}}x|D]}x�tj|�D]�\}}|dkrj||d<qE|dkr�||d<qE|dkr�||d<qE|dkr�||d<qE|dkr�||d<qE|dkr�||d<qE|dkr||d<qE|dkr||d<qE|d	krEt|d	<qEqEWq/WqW|drl|jt|dd
|d��n|jd�r�|jt|dd
|d��n|r�|dr�|dr�i|dd6|dd6|d
<n|dr�t|�dkr�|r�|jd	�r+|jd�r+td��n|jd�rbt	|dd|d|d
d|d�S|jd	�r�t
|dd|d|d
�St|dd|d|d
�Sq�t|dd|�SndS(u�
    Instantiates and returns an AllIndex object given a valid index
    configuration

    CLI Example:
        salt myminion boto_dynamodb.extract_index index
    uhash_keyuhash_key_data_typeu	range_keyurange_key_data_typeunameuread_capacity_unitsuwrite_capacity_unitsuincludesu	keys_onlyRureaduwriteu
throughputiu,Only one type of GSI projection can be used.tpartsR"tincludesN(
Rt	iteritemsRR&RtgetRtlenRR
RR	R(	t
index_dataRtparsed_datatkeysRtvaluetitemtfieldtdata((s>/usr/lib/python2.7/site-packages/salt/modules/boto_dynamodb.pyR'sz


















(/t__doc__t
__future__RRRtloggingR+t	getLoggerRtloggertsetLeveltINFOtsalt.extRtsalt.ext.six.movesRtsalt.exceptionsRtsalt.utils.versionsRtbototboto.dynamodb2tboto.dynamodb2.fieldsRRRR	R
Rtboto.dynamodb2.tableRtboto.exceptionR
RtHAS_BOTOtImportErrorRRtNoneR?R*RCRERFRGRHR'(((s>/usr/lib/python2.7/site-packages/salt/modules/boto_dynamodb.pyt<module>+sF"


	
	K


Zerion Mini Shell 1.0