3 O4Â\| ã@s ddlmZGdd„deƒZdS)é)Ú string_typesc@s@eZdZdZdd„Zdd„Zdd„Zdd „Zd d „Zd d „Z dS)ÚSupportedResourceReferencesa; Class that contains information about the resource references supported in this SAM template, along with the value they should resolve to. As the translator processes the SAM template, it keeps building up this collection which is finally used to resolve all the references in output CFN template. cCs i|_dS)N)Ú_refs)Úself©rúŽ/Users/sshvans/Documents/Work/Quickstart/python-virtual-environments/env/lib/python3.6/site-packages/samtranslator/intrinsics/resource_refs.pyÚ__init__ sz$SupportedResourceReferences.__init__cCsr| s | rtdƒ‚| s&t|tƒ r.tdƒ‚||jkrBi|j|<||j|kr`tdj||ƒƒ‚||j||<dS)a Add the information that resource with given `logical_id` supports the given `property`, and that a reference to `logical_id.property` resolves to given `value. Example: "MyApi.Deployment" -> "MyApiDeployment1234567890" :param logical_id: Logical ID of the resource (Ex: MyLambdaFunction) :param property: Property on the resource that can be referenced (Ex: Alias) :param value: Value that this reference resolves to. :return: nothing z1LogicalId and property must be a non-empty stringz)Property value must be a non-empty stringz3Cannot add second reference value to {}.{} propertyN)Ú ValueErrorÚ isinstancerrÚformat)rÚ logical_idÚpropertyÚvaluerrrÚadds   zSupportedResourceReferences.addcCs"|j|ƒ}|r|j|dƒSdSdS)ab Returns the value of the reference for given logical_id at given property. Ex: MyFunction.Alias :param logical_id: Logical Id of the resource :param property: Property of the resource you want to resolve. None if you want to get value of all properties :return: Value of this property if present. None otherwise N)Úget_allÚget)rr r Z prop_valuesrrrr.s  zSupportedResourceReferences.getcCs|jj|dƒS)zô Get all properties and their values supported by the resource with given logical ID :param logical_id: Logical ID of the resource :return: Map of property names to values. None, if the logicalId does not exist N)rr)rr rrrr>sz#SupportedResourceReferences.get_allcCs t|jƒS)zh To make len(this_object) work :return: Number of resource references available )Úlenr)rrrrÚ__len__Gsz#SupportedResourceReferences.__len__cCs t|jƒS)N)Ústrr)rrrrÚ__str__Nsz#SupportedResourceReferences.__str__N) Ú__name__Ú __module__Ú __qualname__Ú__doc__rrrrrrrrrrrs rN)ÚsixrÚobjectrrrrrÚs