o ckF[X @s ddlmZGdddeZdS))DynamoDBItemErrorc@seZdZdZd!ddZeddZeddZed d Zed d Z d dZ d"ddZ ddZ d#ddZ d#ddZd#ddZddZddZddZdd ZdS)$Itemay An item in Amazon DynamoDB. :ivar hash_key: The HashKey of this item. :ivar range_key: The RangeKey of this item or None if no RangeKey is defined. :ivar hash_key_name: The name of the HashKey associated with this item. :ivar range_key_name: The name of the RangeKey associated with this item. :ivar table: The Table this item belongs to. NcCs||_d|_|jjj|_|jjj|_|duri}|dur#||jd}|||j<|jr;|dur6||jd}|||j<i|_|D]\}}||jkrT||jkrT|||<qBd|_ dS)Nr) table_updatesschema hash_key_name_hash_key_namerange_key_name_range_key_namegetitemsconsumed_units)selfrhash_key range_keyattrskeyvaluer4/usr/lib/python3/dist-packages/boto/dynamodb/item.py__init__'s&     z Item.__init__cCs ||jSNrrrrrr;s z Item.hash_keycCs ||jSr)r r rrrrr?s zItem.range_keycC|jSrrrrrrrCzItem.hash_key_namecCrr)r rrrrr GrzItem.range_key_namecCd|f|j|<dS)a Queue the addition of an attribute to an item in DynamoDB. This will eventually result in an UpdateItem request being issued with an update action of ADD when the save method is called. :type attr_name: str :param attr_name: Name of the attribute you want to alter. :type attr_value: int|long|float|set :param attr_value: Value which is to be added to the attribute. ADDNrr attr_name attr_valuerrr add_attributeK zItem.add_attributecCr)a Queue the deletion of an attribute from an item in DynamoDB. This call will result in a UpdateItem request being issued with update action of DELETE when the save method is called. :type attr_name: str :param attr_name: Name of the attribute you want to alter. :type attr_value: set :param attr_value: A set of values to be removed from the attribute. This parameter is optional. If None, the whole attribute is removed from the item. DELETENrrrrrdelete_attributeYszItem.delete_attributecCr)a Queue the putting of an attribute to an item in DynamoDB. This call will result in an UpdateItem request being issued with the update action of PUT when the save method is called. :type attr_name: str :param attr_name: Name of the attribute you want to alter. :type attr_value: int|long|float|str|set :param attr_value: New value of the attribute. PUTNrrrrr put_attributeir#zItem.put_attributecC|jj|||S)a Commits pending updates to Amazon DynamoDB. :type expected_value: dict :param expected_value: A dictionary of name/value pairs that you expect. This dictionary should have name/value pairs where the name is the name of the attribute and the value is either the value you are expecting or False if you expect the attribute not to exist. :type return_values: str :param return_values: Controls the return of attribute name/value pairs before they were updated. Possible values are: None, 'ALL_OLD', 'UPDATED_OLD', 'ALL_NEW' or 'UPDATED_NEW'. If 'ALL_OLD' is specified and the item is overwritten, the content of the old item is returned. If 'ALL_NEW' is specified, then all the attributes of the new version of the item are returned. If 'UPDATED_NEW' is specified, the new versions of only the updated attributes are returned. )rlayer2 update_itemrexpected_value return_valuesrrrsavews z Item.savecCr()a Delete the item from DynamoDB. :type expected_value: dict :param expected_value: A dictionary of name/value pairs that you expect. This dictionary should have name/value pairs where the name is the name of the attribute and the value is either the value you are expecting or False if you expect the attribute not to exist. :type return_values: str :param return_values: Controls the return of attribute name-value pairs before then were changed. Possible values are: None or 'ALL_OLD'. If 'ALL_OLD' is specified and the item is overwritten, the content of the old item is returned. )rr) delete_itemr+rrrdeletes z Item.deletecCr()a Store a new item or completely replace an existing item in Amazon DynamoDB. :type expected_value: dict :param expected_value: A dictionary of name/value pairs that you expect. This dictionary should have name/value pairs where the name is the name of the attribute and the value is either the value you are expecting or False if you expect the attribute not to exist. :type return_values: str :param return_values: Controls the return of attribute name-value pairs before then were changed. Possible values are: None or 'ALL_OLD'. If 'ALL_OLD' is specified and the item is overwritten, the content of the old item is returned. )rr)put_itemr+rrrputszItem.putcCs(|jdur |||t|||dS)zfOverrwrite the setter to instead update the _updates method so this can act like a normal dictN)rr'dict __setitem__)rrrrrrr4s  zItem.__setitem__cCs$|jdur ||t||dS)zRemove this key from the itemsN)rr%r3 __delitem__)rrrrrr5s  zItem.__delitem__cCrr)__dict__rrrr __getstate__szItem.__getstate__cCs|j|dSr)r6update)rdrrr __setstate__szItem.__setstate__)NNNr)NN)__name__ __module__ __qualname____doc__rpropertyrrrr r"r%r'r.r0r2r4r5r7r:rrrrrs*          rN)boto.dynamodb.exceptionsrr3rrrrrs