o
    ÙKÕi	  ã                   @   sV   d dl Z d dlmZmZ d dlmZmZ G dd„ de jd�ZG dd„ dee jd�Z	dS )	é    N)ÚAnyÚDict)ÚconfigÚcontractc                   @   sj   e Zd Zeejdefdd„ƒƒZejdej	de
fdd„ƒZejdefdd„ƒZejd	edefd
d„ƒZdS )ÚAutoAttachInstanceÚreturnc                 C   ó   dS )z?Return True if the machine is a viable AutoAttachCloudInstance.N© ©Úselfr	   r	   ú:/usr/lib/python3/dist-packages/uaclient/clouds/__init__.pyÚ	is_viable   ó   zAutoAttachInstance.is_viableÚcfgc                 C   r   )ú{
        Cloud-specific implementation of acquiring the pro token using whatever
        method suits the platform
        Nr	   )r   r   r	   r	   r   Úacquire_pro_token   ó   z$AutoAttachInstance.acquire_pro_tokenc                 C   r   )zw
        Cloud-specific checks for whether the daemon should continously poll
        for Ubuntu Pro licenses.
        Nr	   r
   r	   r	   r   Úshould_poll_for_pro_license   r   z.AutoAttachInstance.should_poll_for_pro_licenseÚwait_for_changec                C   r   )z1
        Check for an Ubuntu Pro license
        Nr	   )r   r   r	   r	   r   Úis_pro_license_present   s   z)AutoAttachInstance.is_pro_license_presentN)Ú__name__Ú
__module__Ú__qualname__ÚpropertyÚabcÚabstractmethodÚboolr   r   ÚUAConfigÚstrr   r   r   r	   r	   r	   r   r      s    r   )Ú	metaclassc                   @   sX   e Zd Zeejdeeef fdd„ƒƒZ	eejdefdd„ƒƒZ
dejdefdd„Zd	S )
ÚPublicCloudAutoAttachInstancer   c                 C   r   )z=Return the identity document representing this cloud instanceNr	   r
   r	   r	   r   Úidentity_doc'   r   z*PublicCloudAutoAttachInstance.identity_docc                 C   r   )z=Return a string of the cloud type on which this instance runsNr	   r
   r	   r	   r   Ú
cloud_type-   r   z(PublicCloudAutoAttachInstance.cloud_typer   c                 C   s$   t  |¡}|j| j| jd�}|d S )r   )r"   ÚdataÚcontractToken)r   ÚUAContractClientÚ%get_contract_token_for_cloud_instancer"   r!   )r   r   Úcontract_clientÚtoken_responser	   r	   r   r   3   s
   
ÿz/PublicCloudAutoAttachInstance.acquire_pro_tokenN)r   r   r   r   r   r   r   r   r   r!   r"   r   r   r   r	   r	   r	   r   r    &   s    r    )
r   Útypingr   r   Úuaclientr   r   ÚABCMetar   r    r	   r	   r	   r   Ú<module>   s
    