
    
                     v   d 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dl	m
Z
 ddl	mZ dd	l	mZ  ej                  ej                  j                         G d
 dej                                Z ej                  ej                  j$                  ej                  j&                         G d de             Zy)z,Vertex AI indexes upsert datapoints command.    )absolute_import)division)unicode_literals)client)base)	constants)endpoint_util)flagsc                   ,    e Zd ZdZed        Zd Zd Zy)UpsertDatapointsV1zUpsert data points into the specified index.

  ## EXAMPLES

  To upsert datapoints into an index '123', run:

    $ {command} 123 --datapoints-from-file=example.json
    --project=example --region=us-central1
  c                     t        j                  | d       t        j                  dd      j                  |        t        j                  d      j                  |        y )Nzto upsert data points fromindexT)requiredF)r
   AddIndexResourceArgGetDatapointsFilePathArgAddToParserGetDynamicMetadataUpdateMaskArg)parsers    +lib/surface/ai/indexes/upsert_datapoints.pyArgszUpsertDatapointsV1.Args(   sG    	f&BC	""7T:FFvN	))59EEfM    c                 j   |j                   j                  j                         }|j                         d   }t	        j
                  ||      5  t        j                  |      }|t        j                  k(  r|j                  ||      }n|j                  ||      }|cd d d        S # 1 sw Y   y xY w)NlocationsId)region)version)CONCEPTSr   ParseAsDictr	   AiplatformEndpointOverridesr   IndexesClientr   
GA_VERSIONUpsertDatapointsUpsertDatapointsBeta)selfargsr   	index_refr   index_client	operations          r   _RunzUpsertDatapointsV1._Run.   s    ##))+I.F		2	276	J))':l	I((	( 11)TB	 55iF	 
K	J	Js   AB))B2c                 B    | j                  |t        j                        S N)r)   r   r!   r$   r%   s     r   RunzUpsertDatapointsV1.Run9   s    99T9//00r   N)__name__
__module____qualname____doc__staticmethodr   r)   r-    r   r   r   r      s'     N N
	1r   r   c                       e Zd ZdZd Zy)UpsertDatapointsV1Beta1zUpsert data points into the specified index.

  ## EXAMPLES

  To upsert datapoints into an index `123`, run:

    $ {command} 123 --datapoints-from-file=example.json
    --project=example --region=us-central1
  c                 B    | j                  |t        j                        S r+   )r)   r   BETA_VERSIONr,   s     r   r-   zUpsertDatapointsV1Beta1.RunI   s    99T91122r   N)r.   r/   r0   r1   r-   r3   r   r   r5   r5   =   s    3r   r5   N)r1   
__future__r   r   r   !googlecloudsdk.api_lib.ai.indexesr   googlecloudsdk.callioper   googlecloudsdk.command_lib.air   r	   r
   ReleaseTracksReleaseTrackGACreateCommandr   ALPHABETAr5   r3   r   r   <module>rB      s    3 &  ' 4 ( 3 7 / D%%(()1++ 1 *1@ D%%++T->->-C-CD30 3 E3r   