ó 9(Zc@s©dZddlmZddlmZmZddlmZeƒZ de fd„ƒYZ de fd„ƒYZ d e fd „ƒYZ d e fd „ƒYZd e fd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd „ƒYZd!efd"„ƒYZd#efd$„ƒYZd%S(&s-Abstractions to interact with service models.iÿÿÿÿ(t defaultdict(tCachedPropertytinstance_cache(t OrderedDicttNoShapeFoundErrorcBseZRS((t__name__t __module__(((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyRstInvalidShapeErrorcBseZRS((RR(((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyRstOperationNotFoundErrorcBseZRS((RR(((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyRstInvalidShapeReferenceErrorcBseZRS((RR(((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyR #stUndefinedModelAttributeErrorcBseZRS((RR(((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyR 'stShapec Bs¤eZdZddddddddd d d g Zd d ddddddgZeZdd„Ze d„ƒZ e d„ƒZ e d„ƒZ d„Z d„ZRS(s3Object representing a shape from the service model.t locationNamet queryNamet flattenedtlocationtpayloadt streamingttimestampFormatt xmlNamespacet resultWrappert xmlAttributet jsonvaluetrequiredtmintmaxt sensitivetenumtidempotencyTokenterrort exceptioncCsb||_|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(tselft shape_namet shape_modeltshape_resolver((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyt__init__9s      cCsi|j}i}x1|jD]&}||jkr||||(t __class__RR"(R*((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyt__repr__¡s N(RRt__doc__R/R4RtMAP_TYPER&R.RR2R5R6R9R;(((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyR +s     "  tStructureShapecBseZed„ƒZRS(cCsM|jd}|jƒ}x-|jƒD]\}}|j|ƒ||¦st ListShapecBseZed„ƒZRS(cCs|j|jdƒS(Ntmember(R9R%(R*((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyRC·s(RRRRC(((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyRB¶stMapShapecBs&eZed„ƒZed„ƒZRS(cCs|j|jdƒS(Ntkey(R9R%(R*((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyRE½scCs|j|jdƒS(Ntvalue(R9R%(R*((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyRFÁs(RRRRERF(((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyRD¼st StringShapecBseZed„ƒZRS(cCs|jjdgƒS(NR(R5R$(R*((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyRÇs(RRRR(((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyRGÆst ServiceModelcBsàeZdZdd„Zdd„Zd„Zed„ƒZe d„ƒZ ed„ƒZ ed„ƒZ ed„ƒZ ed „ƒZed „ƒZed „ƒZed „ƒZd „Zed„ƒZejd„ƒZRS(sQ :ivar service_description: The parsed service description dictionary. cCsX||_|jdiƒ|_t|jdiƒƒ|_t|_||_i|_dS(s‡ :type service_description: dict :param service_description: The service description model. This value is obtained from a botocore.loader.Loader, or from directly loading the file yourself:: service_description = json.load( open('/path/to/service-description-model.json')) model = ServiceModel(service_description) :type service_name: str :param service_name: The name of the service. Normally this is the endpoint prefix defined in the service_description. However, you can override this value to provide a more convenient name. This is done in a few places in botocore (ses instead of email, emr instead of elasticmapreduce). If this value is not provided, it will default to the endpointPrefix defined in the model. R5tshapesN( t_service_descriptionR$R5t ShapeResolverR(tNOT_SETt_signature_versiont _service_namet_instance_cache(R*tservice_descriptiont service_name((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyR.Ós   cCs|jj||ƒS(N(R(tget_shape_by_name(R*R+t member_traits((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyt shape_forñs cCs|jj|ƒS(N(R(R7(R*R8((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyR7õscCst|jjdiƒƒS(NRI(tlistRJR$(R*((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyt shape_namesøscCsEy|jd|}Wntk r4t|ƒ‚nXt|||ƒS(Nt operations(RJtKeyErrorRtOperationModel(R*toperation_nameR1((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pytoperation_modelüs  cCs|jjddƒS(NR R!(RJR$(R*((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyR scCst|jjdgƒƒS(NRW(RURJR$(R*((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pytoperation_namesscCs!|jdk r|jS|jSdS(s«The name of the service. This defaults to the endpointPrefix defined in the service model. However, this value can be overriden when a ``ServiceModel`` is created. If a service_name was not provided when the ``ServiceModel`` was created and if there is no endpointPrefix defined in the service model, then an ``UndefinedModelAttributeError`` exception will be raised. N(RNR&tendpoint_prefix(R*((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyRQ s cCs.|jjdƒ}|dkr*|j}n|S(s®The name to use when computing signatures. If the model does not define a signing name, this value will be the endpoint prefix defined in the model. t signingNameN(R5R$R&R](R*t signing_name((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyR_s  cCs |jdƒS(Nt apiVersion(t_get_metadata_property(R*((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyt api_version)scCs |jdƒS(Ntprotocol(Ra(R*((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyRc-scCs |jdƒS(NtendpointPrefix(Ra(R*((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyR]1scCs=y|j|SWn'tk r8td||fƒ‚nXdS(Ns5"%s" not defined in the metadata of the the model: %s(R5RXR (R*R"((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyRa5s  cCs4|jtkr-|jjdƒ}||_n|jS(NtsignatureVersion(RMRLR5R$(R*tsignature_version((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyRf@s cCs ||_dS(N(RM(R*RF((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyRfGsN(RRR<R&R.RTR7RRVRR[R R\RQR_RbRcR]RatpropertyRftsetter(((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyRHÌs      RYcBsìeZdd„Zed„ƒZed„ƒZed„ƒZed„ƒZ ed„ƒZ ed„ƒZ ed„ƒZ ed„ƒZ ed „ƒZed „ƒZed „ƒZed „ƒZd „Zd„Zd„Zd„ZRS(cCsR||_||_||_|jdƒ|_|j|_|jdiƒ|_dS(s† :type operation_model: dict :param operation_model: The operation model. This comes from the service model, and is the value associated with the operation name in the service model (i.e ``model['operations'][op_name]``). :type service_model: botocore.model.ServiceModel :param service_model: The service model associated with the operation. :type name: string :param name: The operation name. This is the operation name exposed to the users of this model. This can potentially be different from the "wire_name", which is the operation name that *must* by provided over the wire. For example, given:: "CreateCloudFrontOriginAccessIdentity":{ "name":"CreateCloudFrontOriginAccessIdentity2014_11_06", ... } The ``name`` would be ``CreateCloudFrontOriginAccessIdentity``, but the ``self.wire_name`` would be ``CreateCloudFrontOriginAccessIdentity2014_11_06``, which is the value we must send in the corresponding HTTP request. R"thttpN(t_operation_modelt_service_modelt _api_nameR$t _wire_nameR5Ri(R*R[t service_modelR"((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyR.Ms     cCs!|jdk r|jS|jSdS(N(RlR&t wire_name(R*((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyR"rscCs|jjdƒS(sRThe wire name of the operation. In many situations this is the same value as the ``name``, value, but in some services, the operation name exposed to the user is different from the operaiton name we send across the wire (e.g cloudfront). Any serialization code should use ``wire_name``. R"(RjR$(R*((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyRoys cCs|jS(N(Rk(R*((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyRn‡scCs|jjddƒS(NR R!(RjR$(R*((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyR ‹scCs|jjdtƒS(Nt deprecated(RjR$tFalse(R*((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyRpscCs*d|jkrdS|jj|jdƒS(Ntinput(RjR&RkR7(R*((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyt input_shape“s cCs*d|jkrdS|jj|jdƒS(Ntoutput(RjR&RkR7(R*((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyt output_shapeœs cCsU|j}|sgSg|jjƒD].\}}d|jkr#|jdr#|^q#S(NR(RsR?R@R5(R*RsR"tshape((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pytidempotent_members¦s  cCs|jjdƒS(Ntauthtype(RjR$(R*((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyt auth_type°scs/ˆjjdgƒ}t‡fd†|DƒƒS(Nterrorsc3s!|]}ˆjj|ƒVqdS(N(RkR7(t.0ts(R*(s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pys ·s(RjR$RU(R*RI((R*s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyt error_shapes´scCs|jƒdk S(N(tget_streaming_inputR&(R*((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pythas_streaming_input¹scCs|jƒdk S(N(tget_streaming_outputR&(R*((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pythas_streaming_output½scCs|j|jƒS(N(t_get_streaming_bodyRs(R*((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyR~ÁscCs|j|jƒS(N(R‚Ru(R*((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyR€ÄscCsU|dkrdS|jjdƒ}|dk rQ|j|}|jdkrQ|SndS(s?Returns the streaming member's shape if any; or None otherwise.RtblobN(R&R2R$R?R#(R*RvRt payload_shape((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyR‚Çs   cCsd|jj|jfS(Ns %s(name=%s)(R:RR"(R*((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyR;ÒsN(RRR&R.RR"RgRoRnR RpRsRuRwRyR}RRR~R€R‚R;(((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyRYLs" %      RKcBsNeZdZied6ed6ed6ed6Zd„Zdd„Z d„Z RS( sResolves shape references.t structureRUtmaptstringcCs||_i|_dS(N(t _shape_mapt _shape_cache(R*t shape_map((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyR.ás cCsªy|j|}Wntk r0t|ƒ‚nXy|jj|dtƒ}Wn!tk rqtd|ƒ‚nX|r”|jƒ}|j|ƒn||||ƒ}|S(NRs(Shape is missing required key 'type': %s( RˆRXRt SHAPE_CLASSESR$R Rtcopytupdate(R*R+RSR,t shape_clstresult((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyRRås   cCs†t|ƒdkr/d|kr/|j|dƒS|jƒ}y|jdƒ}Wn!tk rqtd|ƒ‚nX|j||ƒSdS(NiRvs*Invalid model, missing shape reference: %s(tlenRRRŒR0RXR (R*R8RSR+((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyR7õs  N( RRR<R>RBRDRGR‹R.R&RRR7(((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyRKÖs   R'cBs#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(R*R+RS((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyRR scCstdƒ‚dS(Ns?Attempted to resolve shape '%s', but no shape map was provided.(R‘(R*R8((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyR7sN(RRR<R&RRR7(((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyR' s 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…(RR?tShapeNameGeneratort_name_generatorR&tnew_shape_nameR"(R*R"((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyR.:s   cCs ||_|S(sp :type members: dict :param members: The denormalized members. :return: self (t_members(R*R?((s0/tmp/pip-build-wDUJoH/botocore/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…RR?RŠR+R,R-(RR–t _build_modelR"RKR>(R*RIt denormalizedtresolver((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyt build_modelLs   c Cs¹|ddkr)|j||ƒ||>> 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(R*R#t current_index((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyR•¥s  (RRR<R.R•(((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyR“›s N(R<t collectionsRtbotocore.utilsRRtbotocore.compatRtobjectRLt ExceptionRRRR R R R>RBRDRGRHRYRKR'R’R“(((s0/tmp/pip-build-wDUJoH/botocore/botocore/model.pyt s( { €Š4 …