o
    eZ                     @   sx   d Z ddlZdZdZdZdZdZd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 )z*
This module provides models for CFC-SDK.
    NZduedgeZdueroszcfc-crontab-trigger/v1/zcfc-http-trigger/v1/CFCAPIZcdnZbosc                   @   s(   e Zd ZdZdd Zdd Zdd ZdS )	AbstractTriggerDataModelz Base class for all trigger data.c                 C   s2   t | }i }|D ]}|| dur|| ||< q|S )z@
        serialize

        :return
        :rtype dict
        N)vars)selfdretk r   LD:\Projects\ConvertPro\env\Lib\site-packages\baidubce/services/cfc/models.py	serialize"   s   z"AbstractTriggerDataModel.serializec                 C   s   dS )zG
        trigger source

        :return
        :rtype string
         r   r   r   r   r	   get_trigger_source0   s   z+AbstractTriggerDataModel.get_trigger_sourcec                 C   s   dt |   S )Nz%s)jsondumpsr
   r   r   r   r	   __repr__9   s   z!AbstractTriggerDataModel.__repr__N)__name__
__module____qualname____doc__r
   r   r   r   r   r   r	   r      s
    	r   c                   @   ,   e Zd ZdZd
ddZdddZdd	 ZdS )CrontabTriggerDataa_  
    Crontab Trigger Data
    :param brn  (required) The url path.
    :type brn string
    :param name  (required) The trigger name. 1-30 length.Pattern: ^[a-zA-Z0-9-_]+$
    :type name string.The name of the trigger that you are creating or updating
    :param schedule_expression  (required) Schedule expression.The details see
        https://cloud.baidu.com/doc/CFC/s/Zjxl9lbed.
        For example, "cron(0 * * * *)" or "rate(10 minutes)".
    :type schedule_expression string.
    :param enabled.
    :type enabled bool. Enables the trigger.
    :param custom_input.
    :type custom_input json.
    NFc                 C   s6   || _ || _|| _|| _d | _|rd| _d S d| _d S )NEnabledDisabled)ZInputZBrnNameZScheduleExpressionUUIDr   )r   ZbrnnameZschedule_expressionenabledZcustom_inputr   r   r	   __init__N   s   

zCrontabTriggerData.__init__c                 C      |rd| _ dS d| _ dS )z
        set crontab status

        :param enabled.
        :type enabled bool. Enables the trigger.
        :return
        :rtype string
        r   r   N)r   r   r   r   r   r	   
set_statusY      	

zCrontabTriggerData.set_statusc                 C      t S N)CRONTAB_TRIGGERr   r   r   r	   r   g      z%CrontabTriggerData.get_trigger_source)NNNFNFr   r   r   r   r   r    r   r   r   r   r	   r   =   s
    

r   c                   @   s"   e Zd ZdZdddZdd ZdS )HttpTriggerDataa'  
    Http Trigger Data
    :param resource_path  (required) The url path.
    :type resource_path string
    :param method  (required) The http method. eg "GET,HEAD"
    :type method string
    :param auth_type  (required) Authentication type.
    :type auth_type string. eg anonymous | iam
    Nc                 C   s   || _ || _|| _d S r#   )ZResourcePathZMethodZAuthType)r   resource_pathmethodZ	auth_typer   r   r	   r   v   s   
zHttpTriggerData.__init__c                 C   r"   r#   )HTTP_TRIGGERr   r   r   r	   r   {   r%   z"HttpTriggerData.get_trigger_source)NNN)r   r   r   r   r   r   r   r   r   r	   r(   k   s    

r(   c                   @   r   )CdnTriggerDataaq  
    Cdn Trigger Data
    :param event_type  (required) Cdn event type. The details see
        https://cloud.baidu.com/doc/CFC/s/Kjwvz47o9/#relationconfiguration.
    :type event_type string
    :param domains. Domain list.
    :type domains list of string
    :param remark.
    :type remark string.
    :param status. Enables the trigger.
    :type status bool.
    NFc                 C   s*   || _ || _|| _|rd| _d S d| _d S Nr   disabled)	EventTypeZDomainsZRemarkStatus)r   
event_typedomainsZremarkstatusr   r   r	   r      s   

zCdnTriggerData.__init__c                 C   r   )z
        set cdn trigger status

        :param enabled.
        :type enabled bool. Enables the trigger.
        :return
        :rtype string
        r   r.   Nr0   r   r   r   r	   r       r!   zCdnTriggerData.set_statusc                 C   r"   r#   )CDN_TRIGGERr   r   r   r	   r      r%   z!CdnTriggerData.get_trigger_source)NNNFr&   r'   r   r   r   r	   r,      s
    

	r,   c                   @   r   )BOSTriggerDataa  
    BOS Trigger Data
    :param event_type  (required) BOS event type. The details see
        https://cloud.baidu.com/doc/CFC/s/Kjwvz47o9/#relationconfiguration.
    :type event_type list of string
    :param resource. For example, /prefix*suffix  /my.img  /my*img
    :type resource string
    :param name. The name of the trigger that you are creating or updating
    :type name string
    :param status. Enables the trigger.
    :type status bool.
    NFc                 C   s0   || _ || _|| _|| _|rd| _d S d| _d S r-   )Resourcer/   r   Bucketr0   )r   Zbucketr1   resourcer   r3   r   r   r	   r      s   

zBOSTriggerData.__init__c                 C   r   )z
        set bos trigger status

        :param enabled.
        :type enabled bool. Enables the trigger.
        :return
        :rtype string
        r   r.   Nr4   r   r   r   r	   r       r!   zBOSTriggerData.set_statusc                 C   s   t d | j S )N/)BOS_TRIGGERr8   r   r   r   r	   r      s   z!BOSTriggerData.get_trigger_source)NNNNFr&   r'   r   r   r   r	   r6      s
    


r6   )r   r   ZDUEDGE_TRIGGERZDUEROS_TRIGGERr$   r+   r5   r;   objectr   r   r(   r,   r6   r   r   r   r	   <module>   s   .)