ó àtÚ_c@sÏdZddlmZddlmZmZmZddlmZddl m Z ddl m Z e ƒZ defd„ƒYZd efd „ƒYZd efd „ƒYZd efd„ƒYZdefd„ƒYZde fd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZde fd„ƒYZde fd„ƒYZde fd „ƒYZd!e fd"„ƒYZd#e fd$„ƒYZd%e fd&„ƒYZd'S((s-Abstractions to interact with service models.iÿÿÿÿ(t defaultdict(tCachedPropertytinstance_cachethyphenize_service_id(t OrderedDict(tMissingServiceIdError(tUndefinedModelAttributeErrortNoShapeFoundErrorcBseZRS((t__name__t __module__(((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pyRstInvalidShapeErrorcBseZRS((RR (((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pyR stOperationNotFoundErrorcBseZRS((RR (((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pyR stInvalidShapeReferenceErrorcBseZRS((RR (((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pyR $st ServiceIdcBseZd„ZRS(cCs t|ƒS(N(R(tself((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pyt hyphenize)s(RR R(((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pyR (stShapecBsËeZdZddddddddd d d d d ddddgZddddddddddg ZeZd"d„Ze d„ƒZ e d„ƒZ e d„ƒZ d„Z d „Zed!„ƒZRS(#s3Object representing a shape from the service model.t locationNamet queryNamet flattenedtlocationtpayloadt streamingttimestampFormatt xmlNamespacet resultWrappert xmlAttributet eventstreamteventt eventheadert eventpayloadt jsonvaluet hostLabeltrequiredtmintmaxt sensitivetenumtidempotencyTokenterrort exceptiontendpointdiscoveryidt retryablecCsb||_|d|_|jddƒ|_||_|dkrLtƒ}n||_i|_dS(s  :type shape_name: string :param shape_name: The name of the shape. :type shape_model: dict :param shape_model: The shape model. This would be the value associated with the key in the "shapes" dict of the service model (i.e ``model['shapes'][shape_name]``) :type shape_resolver: botocore.model.ShapeResolver :param shape_resolver: A shape resolver object. This is used to resolve references to other shapes. For scalar shape types (string, integer, boolean, etc.), this argument is not required. If a shape_resolver is not provided for a complex type, then a ``ValueError`` will be raised when an attempt to resolve a shape is made. ttypet documentationtN( tnamet type_nametgetR,t _shape_modeltNonetUnresolvableShapeMapt_shape_resolvert_cache(Rt shape_namet shape_modeltshape_resolver((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pyt__init__=s      cCsi|j}i}x1|jD]&}||jkr||||((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pyR@€s  cCs|jjdgƒS(sïA list of members that are required. A structure shape can define members that are required. This value will return a list of required members. If there are no required members an empty list is returned. R!(R@R0(R((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pytrequired_members˜s cCs|jj|ƒS(N(R4tresolve_shape_ref(Rt shape_ref((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pyt_resolve_shape_ref£scCsd|jj|jfS(Ns<%s(%s)>(t __class__RR.(R((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pyt__repr__¦s cCsdS(N(R2(R((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pytevent_stream_nameªsN(RR t__doc__R:R?RtMAP_TYPER2R9RR=R@RARDRFtpropertyRG(((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pyR-s"       "!  tStructureShapecBs5eZed„ƒZed„ƒZed„ƒZRS(cCsM|jd}|jƒ}x-|jƒD]\}}|j|ƒ|| s(R‰R0Rl(RR[((Rs9/opt/awscli/lib/python2.7/site-packages/botocore/model.pyRi scCs|jjdƒS(Ntendpoint(R‰R0(R((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pyRscCs|jjdtƒS(NthttpChecksumRequired(R‰R0RR(R((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pythttp_checksum_requiredscCs|jƒdk S(N(tget_event_stream_inputR2(R((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pythas_event_stream_inputscCs|jƒdk S(N(tget_event_stream_outputR2(R((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pythas_event_stream_outputscCs|j|jƒS(N(t_get_event_streamR“(R((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pyR scCs|j|jƒS(N(R¤R•(R((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pyR¢"scCs.|dkrdS|j}|r*|j|SdS(sAReturns the event stream member's shape if any or None otherwise.N(R2RGRL(RR–t event_name((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pyR¤%s    cCs|jƒdk S(N(tget_streaming_inputR2(R((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pythas_streaming_input.scCs|jƒdk S(N(tget_streaming_outputR2(R((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pythas_streaming_output2scCs|j|jƒS(N(t_get_streaming_bodyR“(R((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pyR¦6scCs|j|jƒS(N(RªR•(R((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pyR¨9scCsU|dkrdS|jjdƒ}|dk rQ|j|}|jdkrQ|SndS(s?Returns the streaming member's shape if any; or None otherwise.RtblobN(R2R=R0RLR/(RR–Rt payload_shape((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pyRª<s   cCsd|jj|jfS(Ns %s(name=%s)(RERR.(R((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pyRFGsN(RR R2R9RR.RJRŽRR,RR‚RR“R•R—R™RiRRŸR¡R£R R¢R¤R§R©R¦R¨RªRF(((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pyRq˜s4 %         R]cBsNeZdZied6ed6ed6ed6Zd„Zdd„Z d„Z RS( sResolves shape references.t structureRltmaptstringcCs||_i|_dS(N(t _shape_mapt _shape_cache(Rt shape_map((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pyR9Vs cCsªy|j|}Wntk r0t|ƒ‚nXy|jj|dtƒ}Wn!tk rqtd|ƒ‚nX|r”|jƒ}|j|ƒn||||ƒ}|S(NR+s(Shape is missing required key 'type': %s( R°RpRt SHAPE_CLASSESR0RR tcopytupdate(RR6ReR7t shape_clstresult((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pyRdZs   cCs†t|ƒdkr/d|kr/|j|dƒS|jƒ}y|jdƒ}Wn!tk rqtd|ƒ‚nX|j||ƒSdS(NiR–s*Invalid model, missing shape reference: %s(tlenRdR´R;RpR (RRCReR6((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pyRBjs  N( RR RHRKRURVRYR³R9R2RdRB(((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pyR]Ks   R3cBs#eZdZdd„Zd„ZRS(sJA ShapeResolver that will throw ValueErrors when shapes are resolved. cCstdƒ‚dS(Ns>Attempted to lookup shape '%s', but no shape map was provided.(t ValueError(RR6Re((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pyRd‚scCstdƒ‚dS(Ns?Attempted to resolve shape '%s', but no shape map was provided.(R¹(RRC((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pyRB†sN(RR RHR2RdRB(((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pyR3s tDenormalizedStructureBuildercBskeZdZd d„Zd„Zd„Zd„Zd„Zd„Z d„Z d„Z d „Z d „Z RS( sÊBuild a StructureShape from a denormalized model. This is a convenience builder class that makes it easy to construct ``StructureShape``s based on a denormalized model. It will handle the details of creating unique shape names and creating the appropriate shape map needed by the ``StructureShape`` class. Example usage:: builder = DenormalizedStructureBuilder() shape = builder.with_members({ 'A': { 'type': 'structure', 'members': { 'B': { 'type': 'structure', 'members': { 'C': { 'type': 'string', } } } } } }).build_model() # ``shape`` is now an instance of botocore.model.StructureShape :type dict_type: class :param dict_type: The dictionary type to use, allowing you to opt-in to using OrderedDict or another dict type. This can be particularly useful for testing when order matters, such as for documentation. cCs@tƒ|_tƒ|_|dkr<|jjdƒ|_ndS(NR­(RRLtShapeNameGeneratort_name_generatorR2tnew_shape_nameR.(RR.((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pyR9¯s   cCs ||_|S(sp :type members: dict :param members: The denormalized members. :return: self (t_members(RRL((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pyt with_membersµs cCshtƒ}idd6|jd6}|j|||jƒtd|ƒ}td|jd||jd|ƒS(s™Build the model based on the provided members. :rtype: botocore.model.StructureShape :return: The built StructureShape object. R­R+RLR²R6R7R8(RR¾t _build_modelR.R]RK(RR[t denormalizedtresolver((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pyt build_modelÁs   c Cs¹|ddkr)|j||ƒ||((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pyRÏüs  cCs |j|ƒS(N(RÏ(RR<((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pyRÎscCs,d|kr|dS|jj|dƒSdS(NR6R+(R¼R½(RR<((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pyRÐ s N(RR RHR2R9R¿RÃRÀRËRÌRÍRÏRÎRÐ(((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pyRº‹s#    R»cBs eZdZd„Zd„ZRS(s³Generate unique shape names for a type. This class can be used in conjunction with the DenormalizedStructureBuilder to generate unique shape names for a given type. cCsttƒ|_dS(N(Rtintt _name_cache(R((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pyR9scCs4|j|cd7<|j|}d|jƒ|fS(sŸGenerate a unique shape name. This method will guarantee a unique shape name each time it is called with the same type. :: >>> s = ShapeNameGenerator() >>> s.new_shape_name('structure') 'StructureType1' >>> s.new_shape_name('structure') 'StructureType2' >>> s.new_shape_name('list') 'ListType1' >>> s.new_shape_name('list') 'ListType2' :type type_name: string :param type_name: The type name (structure, list, map, string, etc.) :rtype: string :return: A unique shape name for the given type is%sType%s(RÖt capitalize(RR/t current_index((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pyR½s  (RR RHR9R½(((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pyR»s N( RHt collectionsRtbotocore.utilsRRRtbotocore.compatRtbotocore.exceptionsRRtobjectR^t ExceptionRR R R tstrR RRKRURVRYRZRqR]R3RºR»(((s9/opt/awscli/lib/python2.7/site-packages/botocore/model.pyt s, ‚" ±³4 †