o
    #jO                     @   s~  d Z ddlmZmZmZmZ ddlZddlZddlZddl	m
Z
 ddlmZ ddlmZ dZdd	 ZG d
d deZG dd deeZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG d d! d!eZG d"d# d#eZ G d$d% d%eZ!G d&d' d'eZ"G d(d) d)eZ#G d*d+ d+eZ$dS ),zf
cloudflow model module.

This module defines data structures and enumerations for CloudFlow OpenAPI.
    )absolute_importdivisionprint_functionunicode_literalsN)RSA)
PKCS1_v1_5)compats  -----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQChKcFfV3FEDaOv2gTOOlRYm+Yk
fcKUtI81/B/klSidVRBtaL/d8s0nerJFv39gi42U5DFewKEMTJlWboAdvQfLshsH
D++x62x4XCFeFz7Uc4H30AXNVHLhB6S1oFlYWldjK+EQ/jpOFh+ct86cLf4pnMrp
tqG35j6d4hDDOtqY9wIDAQAB
-----END PUBLIC KEY-----c                 C   sF   t | } t |}t| }t|}||}t|}t 	|S )z
    :param public_key_pem: PEM format public key (str or bytes)
    :param text: Original AK/SK (str or unicode)
    :return: Base64 encoded encrypted string (str)
    )
r   Zconvert_to_bytesr   Z	importKeyr   newZencryptbase64	b64encodeZconvert_to_string)public_key_pemtextZ
text_bytesZrsa_keycipherZ	encryptedresult r   l/var/www/html/Deteccion_Ine/venv/lib/python3.10/site-packages/baidubce/services/cloudflow/cloudflow_model.py_encrypt_ak_sk   s   






r   c                   @   s   e Zd ZdZdd ZdS )	_EnumMetaz>
    Metaclass, used to define the enumeration base class
    c                 C   s   || j  v S N)__dict__values)clsitemr   r   r   __contains__*   s   z_EnumMeta.__contains__N)__name__
__module____qualname____doc__r   r   r   r   r   r   &   s    r   c                   @   s   e Zd ZdZdS )BaseEnumz<
    Enumeration base class, supporting member checking
    N)r   r   r   r   r   r   r   r   r   .   s    r   c                   @   s4   e Zd ZdZdZdZdZdZdZdZ	dZ
dZdZd	S )
MigrationInterfacez
    Migration Enumeration
    s	   migrations   migrationFromLists   migrationLists   migrationResults   pauseMigrations   resumeMigrations   retryMigrationN)r   r   r   r   ZPOSTMIGRATIONZPOSTMIGRATIONFROMLISTZGETMIGRATIONZLISTMIGRATIONZGETMIGRATIONRESULTZPAUSEMIGRATIONZRESUMEMIGRATIONZRETRYMIGRATIONZDELETEMIGRATIONr   r   r   r   r   4       r   c                   @   s4   e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdS )RunningStatusz!
    Task Status Enumeration
    WAITINGREADY_FOR_MIGRATION	MIGRATINGPAUSEDFINISHEDPARTIALLY_FAILED_FINISHEDFAILEDINCREMENTAL_MIGRATINGRETRYINGN)r   r   r   r   r"   r#   r$   r%   r&   r'   r(   r)   r*   r   r   r   r   r!   B   r    r!   c                   @      e Zd ZdZdZdZdS )MigrationTypeValuez$
    Migration Type Enumeration
    STOCKINCREMENTALN)r   r   r   r   r-   r.   r   r   r   r   r,   Q       r,   c                   @   r+   )MigrationModez$
    Migration Mode Enumeration
    FULLY_MANAGEDSEMI_MANAGEDN)r   r   r   r   r1   r2   r   r   r   r   r0   Y   r/   r0   c                   @   r+   )StrategyzD
    Enumeration of file processing policies with the same name
    FORCE_OVERWRITEKEEP_DESTINATIONN)r   r   r   r   r4   r5   r   r   r   r   r3   a   r/   r3   c                   @   s,   e Zd ZdZdZdZdZdZdZdZ	dZ
d	S )
StorageClassz"
    Storage Type Enumeration
    STANDARDSTANDARD_IACOLDARCHIVEMAZ_STANDARDMAZ_STANDARD_IASAME_AS_SOURCEN)r   r   r   r   r7   r8   r9   r:   r;   r<   r=   r   r   r   r   r6   i   s    r6   c                   @   r+   )Aclz
    Access enumeration
    KEEP_BUCKETr=   N)r   r   r   r   r?   r=   r   r   r   r   r>   v   r/   r>   c                   @   6   e Zd ZdZdZdddZdd Zdd	 Zd
d ZdS )DailySchedulez'
    Daily execution time interval
    startendNc                 C      || _ || _d S r   rB   )selfrC   rD   r   r   r   __init__      
zDailySchedule.__init__c                 C   0   | ds|| jjv r|| j|< d S td| N_z,'DailySchedule' object has no attribute '%s'
startswith	__class___fieldsr   AttributeErrorrF   namevaluer   r   r   __setattr__      zDailySchedule.__setattr__c                 C   .   | ds|| jjv r| j|= d S td| rJ   rL   rF   rR   r   r   r   __delattr__      zDailySchedule.__delattr__c                    s    fdd j jD S )&
        convert self to dict
        c                    s&   i | ]}t  |d ur|t  |qS r   )getattr).0krF   r   r   
<dictcomp>   s   & z)DailySchedule.to_dict.<locals>.<dictcomp>)rN   rO   r^   r   r^   r   to_dict   s   zDailySchedule.to_dictNN	r   r   r   r   rO   rG   rT   rX   r`   r   r   r   r   rA   ~       
rA   c                   @   s<   e Zd ZdZdZ			dddZdd Zd	d
 Zdd ZdS )SourceConfigz#
    Source side configuration
    )providerendpointbucketakskprefixesobject_begin_timeobject_end_timelist_file_urlobject_list_locationregionNc                 C   st   || _ || _|| _tt|| _tt|| _|pg | _|| _|| _	|	| _
|
| _|| _|d ur6t|ts8tdd S d S )Nzprefixes must be a list)re   rf   rg   r   r   rh   ri   rj   rk   rl   rm   rn   ro   
isinstancelist
ValueError)rF   re   rf   rg   rh   ri   rj   rk   rl   rm   rn   ro   r   r   r   rG      s   
zSourceConfig.__init__c                 C   rI   NrK   z+'SourceConfig' object has no attribute '%s'rL   rQ   r   r   r   rT      rU   zSourceConfig.__setattr__c                 C   rV   rt   rL   rW   r   r   r   rX      rY   zSourceConfig.__delattr__c                 C   sl   i }| j jD ]-}t| |}|dur3|dkrd}n|dkrd}n|dkr&d}n	|dkr-d	}n|}|||< q|S )
rZ   Nrk   ZobjectBeginTimerl   ZobjectEndTimerm   ZlistFileURLrn   ZobjectListLocationrN   rO   r[   rF   dr]   vkeyr   r   r   r`      s    
zSourceConfig.to_dict)Nrp   rp   NNNrb   r   r   r   r   rd      s    
rd   c                   @   s8   e Zd ZdZdZ	dddZdd Zdd	 Zd
d ZdS )DestinationConfigz#
    Destination configuration
    )	re   rf   rg   rh   ri   prefixro   storage_classaclNc
           
      C   s   || _ || _|| _tt|| _tt|| _|	| _|| _|| _	|| _
|tvr0tdtj |f |tvr?tdtj |f d S )Nz'storage_class must be one of %s, got %szacl must be one of %s, got %s)re   rf   rg   r   r   rh   ri   r{   ro   r|   r}   r6   rs   r   keysr>   )
rF   re   rf   rg   rh   ri   ro   r|   r}   r{   r   r   r   rG      s$   zDestinationConfig.__init__c                 C   rI   NrK   z0'DestinationConfig' object has no attribute '%s'rL   rQ   r   r   r   rT      rU   zDestinationConfig.__setattr__c                 C   rV   r   rL   rW   r   r   r   rX      rY   zDestinationConfig.__delattr__c                 C   sB   i }| j jD ]}t| |}|dur|dkrd}n|}|||< q|S )rZ   Nr|   ZstorageClassru   rv   r   r   r   r`      s   
zDestinationConfig.to_dictr   rb   r   r   r   r   rz      s    
rz   c                   @   r@   )MigrationTypez&
    Migration Type Configuration
    typeincrease_scan_interval_in_hoursincrease_timesNc                 C   s4   || _ || _|| _|tvrtdtj |f d S )Nztype must be one of %s, got %s)r   r   r   r,   rs   r   r~   )rF   r   r   r   r   r   r   rG     s   zMigrationType.__init__c                 C   rI   NrK   z,'MigrationType' object has no attribute '%s'rL   rQ   r   r   r   rT     rU   zMigrationType.__setattr__c                 C   rV   r   rL   rW   r   r   r   rX   #  rY   zMigrationType.__delattr__c                 C   s6   d| j i}| jdur| j|d< | jdur| j|d< |S )(
        convert object to dict
        r   NZincreaseScanIntervalInHoursZincreaseTimesr   rF   rw   r   r   r   r`   )  s   




zMigrationType.to_dictra   rb   r   r   r   r   r     s    
	r   c                   @   r@   )PerformanceSettingz/
    Time phased performance configuration
    
start_timeend_timeband_width_in_mbNc                 C   s   || _ || _|| _d S r   r   )rF   r   r   r   r   r   r   rG   ;  s   
zPerformanceSetting.__init__c                 C   rI   NrK   z1'PerformanceSetting' object has no attribute '%s'rL   rQ   r   r   r   rT   @  rU   zPerformanceSetting.__setattr__c                 C   rV   r   rL   rW   r   r   r   rX   F  rY   zPerformanceSetting.__delattr__c                 C   sD   i }| j dur| j |d< | jdur| j|d< | jdur | j|d< |S )r   NZ	startTimeZendTimeZbandWidthInMBr   r   r   r   r   r`   L  s   





zPerformanceSetting.to_dictNNNrb   r   r   r   r   r   5  s    
r   c                   @   r@   )ValidationMethodConfigz$
    Verification configuration
    enable_crc64_ecma_validationenable_md5_validationNc                 C   rE   r   r   )rF   r   r   r   r   r   rG   `  rH   zValidationMethodConfig.__init__c                 C   rI   NrK   z5'ValidationMethodConfig' object has no attribute '%s'rL   rQ   r   r   r   rT   d  rU   z"ValidationMethodConfig.__setattr__c                 C   rV   r   rL   rW   r   r   r   rX   j  rY   z"ValidationMethodConfig.__delattr__c                 C   s0   i }| j dur| j |d< | jdur| j|d< |S )r   NZenableCRC64ECMAValidationZenableMD5Validationr   r   r   r   r   r`   p  s   



zValidationMethodConfig.to_dictra   rb   r   r   r   r   r   Z  rc   r   c                   @   sD   e Zd ZdZdZ			dddZdd Zdd	 Zd
d Zdd Z	dS )CreateTaskInfoz+
    Create task parameter information
    )	task_nameschedule_start_timedaily_schedulesource_configdestination_configstrategymigration_typemigration_modeqpsperformance_settingnot_include_contentvalidation_method_configNc                 C   st   || _ || _|| _|| _|| _|| _|| _|| _|	| _|
| _	|| _
|| _| jjd ur.td| jjd ur8tdd S )NzKsource_config.region is the parameter of create_task_list, it must be emptyzPsource_config.listFileUrl is the parameter of create_task_list, it must be empty)r   r   r   r   r   r   r   r   r   r   r   r   ro   rs   rm   )rF   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rG     s"   zCreateTaskInfo.__init__c                 C   rI   NrK   z-'CreateTaskInfo' object has no attribute '%s'rL   rQ   r   r   r   rT     rU   zCreateTaskInfo.__setattr__c                 C   rV   r   rL   rW   r   r   r   rX     rY   zCreateTaskInfo.__delattr__c                 C   s   | j | j| j | j | j| j | jd}| jdur#| j |d< | j	dur-| j	|d< | j
dur<dd | j
D |d< | jdurF| j|d< | jdurR| j |d	< |S )
r   rR   ZscheduleStartTimeZsourceConfigZdestinationConfigr   ZmigrationTypeZmigrationModeNdailyScheduler   c                 S   s   g | ]}|  qS r   )r`   )r\   Zperfr   r   r   
<listcomp>  s    z+CreateTaskInfo._to_dict.<locals>.<listcomp>ZperformanceSettingZnotIncludeContentvalidationMethodConfig)r   r   r   r`   r   r   r   r   r   r   r   r   r   r   r   r   r   _to_dict  s&   
	





zCreateTaskInfo._to_dictc                 C      t |  S z/
        Convert object to json string
        jsondumpsr   r^   r   r   r   to_json_string     zCreateTaskInfo.to_json_string)NNNNN
r   r   r   r   rO   rG   rT   rX   r   r   r   r   r   r   r   |  s    
r   c                   @   sB   e Zd ZdZdZ		dddZdd Zdd	 Zd
d Zdd Z	dS )CreateTaskListInfoz5
    Create task parameter information from list
    )
r   r   r   r   r   r   r   r   r   r   Nc                 C   sx   || _ || _|| _|| _|| _|| _|| _|| _|	| _|
| _	| jj
r&td| jjdkr0td| jjdkr:tdd S )NzHsource_config.prefixes is the parameter of create_task, it must be emptyrp   zQsource_config.object_begin_time is the parameter of create_task, it must be emptyzOsource_config.object_end_time is the parameter of create_task, it must be empty)r   r   r   r   r   r   r   r   r   r   rj   rs   rk   rl   )rF   r   r   r   r   r   r   r   r   r   r   r   r   r   rG     s"   zCreateTaskListInfo.__init__c                 C   rI   NrK   z1'CreateTaskListInfo' object has no attribute '%s'rL   rQ   r   r   r   rT     rU   zCreateTaskListInfo.__setattr__c                 C   rV   r   rL   rW   r   r   r   rX     rY   zCreateTaskListInfo.__delattr__c                 C   sv   | j | j| j | j | j| j | jd}| jdur#| j |d< | j	dur-| j	|d< | j
dur9| j
 |d< |S )r   r   Nr   r   r   )r   r   r   r`   r   r   r   r   r   r   r   r   r   r   r   r     s   
	


zCreateTaskListInfo._to_dictc                 C   r   r   r   r^   r   r   r   r     r   z!CreateTaskListInfo.to_json_stringr   r   r   r   r   r   r     s    
r   )%r   
__future__r   r   r   r   r   sixr
   ZCrypto.PublicKeyr   ZCrypto.Cipherr   Zbaidubcer   r   r   r   r   Zwith_metaclassr   r   r!   r,   r0   r3   r6   r>   objectrA   rd   rz   r   r   r   r   r   r   r   r   r   <module>   s6   =6'%"M