B -<`ÃPã@s¶dZddlZddlmZe e¡ZGdd„deƒZGdd„deƒZ Gdd „d eƒZ Gd d „d eƒZ Gd d „d e ƒZ Gdd„de ƒZ Gdd„deƒZGdd„de ƒZGdd„deƒZdS)a  The models defined in this file represent the resource JSON description format and provide a layer of abstraction from the raw JSON. The advantages of this are: * Pythonic interface (e.g. ``action.request.operation``) * Consumers need not change for minor JSON changes (e.g. renamed field) These models are used both by the resource factory to generate resource classes as well as by the documentation generator. éN)Ú xform_namec@seZdZdZddd„ZdS)Ú Identifierzw A resource identifier, given by its name. :type name: string :param name: The name of the identifier NcCs||_||_dS)N)ÚnameÚ member_name)Úselfrr©rú) } :type shape: botocore.model.Shape :param shape: The underlying shape for this resource. :rtype: dict :return: Mapping of resource attributes. cSsg|] }|j‘qSr)r)Ú.0Úirrrú —sz0ResourceModel.get_attributes..r@F)r:)r,rFrErrQ)rr1Ú attributesZidentifier_namesrÚmemberZ snake_casedrrrÚget_attributes‡szResourceModel.get_attributescCs\g}xR|j dg¡D]@}| d|d¡}| dd¡}|rD| d|¡}| t||ƒ¡qW|S)zb Get a list of resource identifiers. :type: list(:py:class:`Identifier`) r,r5rZ memberNameNr@)rrrQrr)rr,rrrrrrr,¤s  zResourceModel.identifierscCs&|j d¡}|dk r"td||jƒ}|S)zy Get the load action for this resource, if it is defined. :type: :py:class:`Action` or ``None`` r4N)rrrr+)rr7rrrr4¶s zResourceModel.loadcCsHg}x>|j di¡ ¡D](\}}| d|¡}| t|||jƒ¡qW|S)zc Get a list of actions for this resource. :type: list(:py:class:`Action`) r6r7)rrrErQrrr+)rr6rrrrrr6Äs  zResourceModel.actionscCsHg}x>|j di¡ ¡D](\}}| d|¡}| t|||jƒ¡qW|S)zi Get a list of batch actions for this resource. :type: list(:py:class:`Action`) Z batchActionsZ batch_action)rrrErQrrr+)rr6rrrrrr0Ós  zResourceModel.batch_actionsc CsÒ|j|jkrÀi}x¼|j ¡D]ž\}}d}|j di¡ ¡}x2|D]*\}}| di¡ d¡|kr@|||<d}q@W|sd|gdœi}x0| dg¡D] } |dd | dd d œ¡qŽW|||<qWn|j di¡}|S) aÑ Get a ``has`` relationship definition from a model, where the service resource model is treated special in that it contains a relationship to every resource defined for the service. This allows things like ``s3.Object('bucket-name', 'key')`` to work even though the JSON doesn't define it explicitly. :rtype: dict :return: Mapping of names to subresource and reference definitions. FZhasrr*T)r*r,r,rÚinput)rr)rr+rErrr) rrrZ resource_defÚfoundZ has_itemsZhas_nameZhas_defZfake_hasr5rrrrDâs&   z!ResourceModel._get_has_definitioncCsžg}x”| ¡ ¡D]„\}}|r0|jd|dd}n | d|¡}t|||jƒ}d}x |jjD]}|jdkrXd}PqXW|r„|s„| |¡q|s|r| |¡qW|S)a Get a list of sub-resources or references. :type subresources: bool :param subresources: ``True`` to get sub-resources, ``False`` to get references. :rtype: list(:py:class:`ResponseResource`) r9F)r:r;r8T) rDrErQrr+rr,rr)rÚ subresourcesÚ resourcesrrr7rJr5rrrÚ_get_related_resources!s    z$ResourceModel._get_related_resourcescCs | d¡S)za Get a list of sub-resources. :type: list(:py:class:`ResponseResource`) T)r\)rrrrrZ@szResourceModel.subresourcescCs | d¡S)zg Get a list of reference resources. :type: list(:py:class:`ResponseResource`) F)r\)rrrrÚ referencesIszResourceModel.referencescCsHg}x>|j di¡ ¡D](\}}| d|¡}| t|||jƒ¡qW|S)zk Get a list of collections for this resource. :type: list(:py:class:`Collection`) r<r=)rrrErQrr/r+)rÚ collectionsrrrrrr^Rs  zResourceModel.collectionscCsJg}x@|j di¡ ¡D]*\}}| dtj|¡}| t||ƒ¡qW|S)zc Get a list of waiters for this resource. :type: list(:py:class:`Waiter`) r>r?)rrrErQr(r)r)rr>rrrrrr>as zResourceModel.waiters)N)T)T)r r r r r rKrCrQrWrr,r4r6r0rDr\rZr]r^r>rrrrr-ís   M     ? r-)r ÚloggingZbotocorerÚ getLoggerr r!Úobjectrrrrrr(rr/r-rrrrÚs   -