3 \�me�2 � @ s. d dl Z d dlZd dlZd dlmZ d dlmZ d dlm Z d dl mZmZm Z mZ d dlmZmZmZ d dlmZmZ d dlmZ d d lmZmZmZ eje�Zd dd�d ddd�ddddddgd�ZG dd� de �Z G dd� dej!�Z"G dd� de"�Z#e#ej$ffe"ej$ej%ffgZ&eej! d�dd�Z'dS )� N)� b64decode)�suppress)�Enum)�Any�List�Tuple�Union)�sources� url_helper�util)�find_fallback_nic�get_interfaces_by_mac)�EphemeralIPNetwork)�get_dmi_config�get_local_instance_id�is_on_akamaizhttp://169.254.169.254zhttp://[fd00:a9fe:a9fe::1])�ipv4�ipv6z /v1/tokenz/v1/instancez /v1/user-data)�token�metadata�userdataTzf2:3)� base_urls�paths�allow_local_stage�allow_init_stage� allow_dhcp� allow_ipv4� allow_ipv6�preferred_mac_prefixesc @ s e Zd ZdZdZdZdZdS )�MetadataAvailabilityResultzj Used to indicate how this instance should behave based on the availability of metadata to it r � � N)�__name__� __module__�__qualname__�__doc__� NOT_AVAILABLE� AVAILABLE�DEFER� r) r) �&/usr/lib/python3.6/DataSourceAkamai.pyr - s r c @ s� e Zd ZdZdZdd� Zdeeed�dd�Ze d�d d �Z e d�dd�Ze d�d d�Ze eeeef ef d�dd�Zdeed�dd�Zed�dd�Zed�dd�ZdS )�DataSourceAkamai�AkamaiFc C sJ t jd� tjj| |||� t� | _tjt � tj |ddgi �tg�| _d S )NzSetting up Akamai DataSourceZ datasourcer, ) �LOG�debugr � DataSource�__init__�dictr r Z mergemanydictr Zget_cfg_by_path�BUILTIN_DS_CONFIG�ds_cfg)�self�sys_cfg�distror r) r) r* r0 <