
    ZThd                     (   d dl mZmZmZmZ d dlZd dlmZmZm	Z	m
Z
mZmZmZmZmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ ded	ed
ee   fdZdededee   d	edee   d
efdZdeded
ee   fdZ	 ddededed
ee   fdZdededee   fdZy)    )ListOptionalSequencecastN)	!CreateIngestionConfigFlowsRequest"CreateIngestionConfigFlowsResponseCreateIngestionConfigRequestCreateIngestionConfigResponseIngestionConfigListIngestionConfigFlowsRequest ListIngestionConfigFlowsResponseListIngestionConfigsRequestListIngestionConfigsResponse)
FlowConfig)IngestionConfigServiceStub)raise_if_too_large)SiftChannelchannel
client_keyreturnc                     t        |       }t        d| ddd      }t        t        |j	                  |            }t        |j                        dk(  ry|j                  d   S )z]
    Returns `None` if no ingestion config can be matched with the provided `client_key`
    zclient_key==""    )filter
page_token	page_sizer   N)r   r   r   r   ListIngestionConfigsleningestion_configs)r   r   svcreqress        q/home/www/backend.miabetepe.com/venv/lib/python3.12/site-packages/sift_py/ingestion/_internal/ingestion_config.py"get_ingestion_config_by_client_keyr%      sk     %W
-C
%zl!,C
 +S-E-Ec-J
KC
3  !Q&$$Q''    
asset_nameflowsorganization_idc                     t        |       }t        |||xs d|D cg c]  }|j                  t               c}      }t	        |       t        t        |j                  |            }|j                  S c c}w )zv
    Creates a new ingestion config
    Will raise `ProtobufMaxSizeExceeded` if message size is too large to send
    r   )r'   r   r)   r(   )	r   r	   as_pbFlowConfigPbr   r   r
   CreateIngestionConfigingestion_config)	r   r'   r(   r   r)   r!   flowr"   r#   s	            r$   create_ingestion_configr0   1   sp     %W
-C
&'-249:Dtzz,':	C s
,c.G.G.L
MC ;s   A6ingestion_config_idc                 X    t        | |      }|D cg c]  }|j                   c}S c c}w )z@
    Gets all names of flow configs of an ingestion config.
    )get_ingestion_config_flowsname)r   r1   r(   r/   s       r$   get_ingestion_config_flow_namesr5   K   s)     'w0CDE"'($DII(((s   'r   c                    t        |       }g }t        ||d      }	 t        t        |j	                  |            }|j                  D ]  }|j                  |        |j                  }	t        |	      dkD  rkt        ||d|	      }t        t        |j	                  |            }|j                  D ]  }|j                  |        |j                  }	t        |	      dkD  rk|S # t
        j                  $ rI}|j                         t
        j                  j                  k7  s|dk(  r t        | |d      cY d }~S d }~ww xY w)Nr   )r1   r   r   r   )r   r   )r1   r   r   r   )r   r   r   r   ListIngestionConfigFlowsgrpcRpcErrorcode
StatusCodeRESOURCE_EXHAUSTEDr3   r(   appendnext_page_tokenr   )
r   r1   r   r!   r(   r"   r#   er/   r   s
             r$   r3   r3   V   s;   
 %W
-C "E
)/C
U3S5Q5QRU5VW 		 T $$J
j/A
- 3!	
 3S5Q5QRU5VWII 	DLL	 ((
 j/A
 L1 == U668t999Y!^)'3FRSTTUs   C% %E8>D<6E<Eflow_configsc           	          t        |       }t        ||D cg c]  }|j                  t               c}      }t	        |       t        t        |j                  |            }yc c}w )z
    Adds flow configs to an existing ingestion config.
    Will raise `ProtobufMaxSizeExceeded` if message size is too large to send
    )r1   r(   N)r   r   r+   r,   r   r   r   CreateIngestionConfigFlows)r   r1   r@   r!   fr"   _s          r$   create_flow_configsrE      sZ     %W
-C
+/.:;qww|$;C
 s/1O1OPS1TUA <s   A%
)i  ) typingr   r   r   r   r8   /sift.ingestion_configs.v2.ingestion_configs_pb2r   r   r	   r
   r   r   r   r   r   r   r,   4sift.ingestion_configs.v2.ingestion_configs_pb2_grpcr   sift_py.errorr   sift_py.grpc.transportr   sift_py.ingestion.flowstrr%   r0   r5   intr3   rE    r&   r$   <module>rO      s   1 1 
 
 
 - . -((( o(,    
  	 
 c]   4))) 
#Y) ((( ( 
,	(VVVV :&Vr&   