B v޲_P@sdZddlZddlmZeeZGdddeZGdddeZ Gdd d eZ Gd d d eZ Gd d d e Z Gddde Z GdddeZGddde ZGdddeZdS)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@seZdZdZdddZdS) Identifierzw A resource identifier, given by its name. :type name: string :param name: The name of the identifier NcCs||_||_dS)N)name member_name)selfrrr) } :type shape: botocore.model.Shape :param shape: The underlying shape for this resource. :rtype: dict :return: Mapping of resource attributes. cSsg|] }|jqSr)r).0irrr sz0ResourceModel.get_attributes..r@F)r:)r,rFrErrQ)rr1 attributesZidentifier_namesrmemberZ snake_casedrrrget_attributesszResourceModel.get_attributescCs\g}xR|jdgD]@}|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&|jd}|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+)rr7rrrr4s zResourceModel.loadcCsHg}x>|jdiD](\}}|d|}|t|||jqW|S)zc Get a list of actions for this resource. :type: list(:py:class:`Action`) r6r7)rrrErQrrr+)rr6rrrrrr6s  zResourceModel.actionscCsHg}x>|jdiD](\}}|d|}|t|||jqW|S)zi Get a list of batch actions for this resource. :type: list(:py:class:`Action`) Z batchActionsZ batch_action)rrrErQrrr+)rr6rrrrrr0s  zResourceModel.batch_actionsc Cs|j|jkri}x|jD]\}}d}|jdi}x2|D]*\}}|did|kr@|||<d}q@W|sd|gdi}x0|dgD] } |dd| dd d qW|||<qWn|jdi}|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,rinput)rr)rr+rErrr) rrrZ resource_deffoundZ has_itemsZhas_nameZhas_defZfake_hasr5rrrrDs&   z!ResourceModel._get_has_definitioncCsg}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 |dS)za Get a list of sub-resources. :type: list(:py:class:`ResponseResource`) T)r\)rrrrrZ@szResourceModel.subresourcescCs |dS)zg Get a list of reference resources. :type: list(:py:class:`ResponseResource`) F)r\)rrrr referencesIszResourceModel.referencescCsHg}x>|jdiD](\}}|d|}|t|||jqW|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@|jdiD]*\}}|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-rrrrs   -