%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python2.7/site-packages/salt/states/
Upload File :
Create Path :
Current File : //lib/python2.7/site-packages/salt/states/boto_kinesis.pyo

�
���^c	@@s�dZddlmZmZmZddlZeje�ZdZ	d�Z
eeeeeeeed�Z
eeeed�Zd�ZdS(	u�
Manage Kinesis Streams
======================

.. versionadded:: 2017.7.0

Create and destroy Kinesis streams. Be aware that this interacts with Amazon's
services, and so may incur charges.

This module uses ``boto3``, which can be installed via package, or pip.

This module accepts explicit Kinesis 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 `here
<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 file or
in the minion's config file:

.. code-block:: yaml

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

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

.. code-block:: yaml

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

.. code-block:: yaml

    Ensure Kinesis stream does not exist:
      boto_kinesis.absent:
        - name: new_stream
        - keyid: GKTADJGHEIQSXMKKRBJ08H
        - key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
        - region: us-east-1

    Ensure Kinesis stream exists:
      boto_kinesis.present:
        - name: new_stream
        - retention_hours: 168
        - enhanced_monitoring: ['ALL']
        - num_shards: 2
        - keyid: GKTADJGHEIQSXMKKRBJ08H
        - key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
        - region: us-east-1
i(tabsolute_importtprint_functiontunicode_literalsNuboto_kinesiscC@sdtkrtStdfS(u1
    Only load if boto_kinesis is available.
    uboto_kinesis.existsuFThe boto_kinesis module could not be loaded: boto libraries not found.(t__salt__t__virtualname__tFalse(((s</usr/lib/python2.7/site-packages/salt/states/boto_kinesis.pyt__virtual__Esc	#C@s9i|d6td6dd6id6}	g}
i}i}td|||||�}
|
dtkr7tdr�d;|	d<|
jdj|��t|	|||
�|	Std	||||||�}d
|kr
t|	d<|
jdj||d
��t|	|||
�|	S|
jdj|��||d<||d
<n|
jdj|��td|||||�}d
|kr�t|	d<|
jdj||d
��t|	|||
�|	S|dd}|d;k	rm|d}||k}|sQtdrd;|	d<|
jdj||��qj||krGtd||||||�}ntd||||||�}d
|kr�t|	d<|
jdj||d
��t|	|||
�|	S|
jdj|��||d<||d<td|||||�}d
|kr@t|	d<|
jdj||d
��t|	|||
�|	S|dd}q�|
jdj||��n|
jdj|��|d;k	r�|tks�|dgkr�ddddd d!d"g}n!|tks�|d#kr�g}n|jd$�d%d&}t	|�}t	|�}|j
|�}t|j|��}t|j|��}t
|�d%krtdr�d;|	d<|
jd'j||��qtd(||||||�}d
|kr�t|	d<|
jd)j||d
��t|	|||
�|	S|
jd*j||��nt
|�d%kr�tdrZd;|	d<|
jd+j||��q�td,||||||�}d
|kr�t|	d<|
jd-j||d
��t|	|||
�|	S|
jd.j||��nt
|�d%kr7t
|�d%kr7|
jd/j|t
|�d%kr*|nd#��q�tds�t
|�d%krY|nd#|d0<t
|�d%kr{|nd#|d0<q�n|
jd1j|��td2|�\}}}t
|d3�}|d;k	r	|r	||k} | s�tdr!d;|	d<|
jd4j|||��qtjd5||�t}!x�|!r�td6|||||||�}"d
|"kr�t|	d<|
jd7j||"d
��t|	|||
�|	S|"d}!q=W|
jd8j||��||d
<||d
<q"|
jd9j||��n|
jd:j||��t|	|||
�|	S(<u�
    Ensure the kinesis stream is properly configured and scaled.

    name (string)
        Stream name

    retention_hours (int)
        Retain data for this many hours.
        AWS allows minimum 24 hours, maximum 168 hours.

    enhanced_monitoring (list of string)
        Turn on enhanced monitoring for the specified shard-level metrics.
        Pass in ['ALL'] or True for all metrics, [] or False for no metrics.
        Turn on individual metrics by passing in a list: ['IncomingBytes', 'OutgoingBytes']
        Note that if only some metrics are supplied, the remaining metrics will be turned off.

    num_shards (int)
        Reshard stream (if necessary) to this number of shards
        !!!!! Resharding is expensive! Each split or merge can take up to 30 seconds,
        and the reshard method balances the partition space evenly.
        Resharding from N to N+1 can require 2N operations.
        Resharding is much faster with powers of 2 (e.g. 2^N to 2^N+1) !!!!!

    do_reshard (boolean)
        If set to False, this script will NEVER reshard the stream,
        regardless of other input. Useful for testing.

    region (string)
        Region to connect to.

    key (string)
        Secret key to be used.

    keyid (string)
        Access key to be used.

    profile (dict)
        A dict with region, key and keyid, or a pillar key (string)
        that contains a dict with region, key and keyid.
    unameuresultuucommentuchangesuboto_kinesis.existsutestu#Kinesis stream {0} would be createduboto_kinesis.create_streamuerroru Failed to create stream {0}: {1}u'Kinesis stream {0} successfully createdu
num_shardsu!Kinesis stream {0} already existsu#boto_kinesis.get_stream_when_activeu2Kinesis stream {0}: error getting description: {1}uStreamDescriptionuRetentionPeriodHoursu;Kinesis stream {0}: retention hours would be updated to {1}u-boto_kinesis.decrease_stream_retention_periodu-boto_kinesis.increase_stream_retention_periodu9Kinesis stream {0}: failed to update retention hours: {1}u<Kinesis stream {0}: retention hours was successfully updateduretention_hoursuNKinesis stream {0}: retention hours did not require change, already set at {1}u5Kinesis stream {0}: did not configure retention hoursuALLu
IncomingBytesuOutgoingRecordsuIteratorAgeMillisecondsuIncomingRecordsu!ReadProvisionedThroughputExceededu"WriteProvisionedThroughputExceededu
OutgoingBytesuNoneuEnhancedMonitoringiuShardLevelMetricsu<Kinesis stream {0}: would enable enhanced monitoring for {1}u'boto_kinesis.enable_enhanced_monitoringu=Kinesis stream {0}: failed to enable enhanced monitoring: {1}uOKinesis stream {0}: enhanced monitoring was enabled for shard-level metrics {1}u=Kinesis stream {0}: would disable enhanced monitoring for {1}u(boto_kinesis.disable_enhanced_monitoringu>Kinesis stream {0}: failed to disable enhanced monitoring: {1}uPKinesis stream {0}: enhanced monitoring was disabled for shard-level metrics {1}uRKinesis stream {0}: enhanced monitoring did not require change, already set at {1}uenhanced_monitoringu9Kinesis stream {0}: did not configure enhanced monitoringu!boto_kinesis.get_info_for_reshardu
OpenShardsu=Kinesis stream {0}: would be resharded from {1} to {2} shardsu?Resharding stream from %s to %s shards, this could take a whileuboto_kinesis.reshardu+Encountered error while resharding {0}: {1}u8Kinesis stream {0}: successfully resharded to {1} shardsuEKinesis stream {0}: did not require resharding, remains at {1} shardsu:Kinesis stream {0}: did not reshard, remains at {1} shardsN(tTrueRRt__opts__tNonetappendtformatt_add_changestgettsettintersectiontlistt
differencetlentlogtinfo(#tnametretention_hourstenhanced_monitoringt
num_shardst
do_reshardtregiontkeytkeyidtprofiletrettcommentstchanges_oldtchanges_newtexistst
is_createdtstream_responsetstream_detailstold_retention_hourstretention_matchestretention_updatedtold_enhanced_monitoringtnew_monitoring_settold_monitoring_settmatching_metricstenable_metricstdisable_metricstmetrics_enabledtmetrics_disabledtmin_hash_keytmax_hash_keytfull_stream_detailstold_num_shardstnum_shards_matchestcontinue_reshardtreshard_response((s</usr/lib/python2.7/site-packages/salt/states/boto_kinesis.pytpresentNs�2"	

	


	



	


	
	

	


	
$(




		


cC@s0i|d6td6dd6id6}td|||||�}|dtkredj|�|d<|Stdr�d	j|�|d<d|d<|Std
|||||�}d|kr�dj||d�|d<t|d<nMd
j|�|d<|djddj|��|djddj|��|S(u�
    Delete the kinesis stream, if it exists.

    name (string)
        Stream name

    region (string)
        Region to connect to.

    key (string)
        Secret key to be used.

    keyid (string)
        Access key to be used.

    profile (dict)
        A dict with region, key and keyid, or a pillar key (string)
        that contains a dict with region, key and keyid.
    unameuresultuucommentuchangesuboto_kinesis.existsu!Kinesis stream {0} does not existutestu#Kinesis stream {0} would be deleteduboto_kinesis.delete_streamuerroru Failed to delete stream {0}: {1}uDeleted stream {0}uolduStream {0} existsunewuStream {0} deletedN(RRRRRR	t
setdefault(RRRRRRR"t
is_deleted((s</usr/lib/python2.7/site-packages/salt/states/boto_kinesis.pytabsent�s6"	

	
cC@sEdj|�|d<|r*||dd<n|rA||dd<ndS(Nu,
ucommentuchangesuoldunew(tjoin(RR R!R((s</usr/lib/python2.7/site-packages/salt/states/boto_kinesis.pyR�s
(t__doc__t
__future__RRRtloggingt	getLoggert__name__RRRR	RR8R;R(((s</usr/lib/python2.7/site-packages/salt/states/boto_kinesis.pyt<module>9s&	
�/8

Zerion Mini Shell 1.0