
    #                         S r SSKJr  SSKJr  SSKJr  SSKrSSKJr  SSKJr  SSK	J
r
  SS	K	Jr  SS
KJr  S rS rS rg)zDUtilities for AI Platform model deployment monitoring jobs commands.    )absolute_import)division)unicode_literalsN)	constants)errors)	resources)yaml)
console_ioc                 v    [         R                  R                  U [        R                  S9R                  5       $ )N
collection)r   REGISTRYParser    MODEL_MONITORING_JOBS_COLLECTIONName)names    ?lib/googlecloudsdk/command_lib/ai/model_monitoring_jobs_util.pyParseJobNamer      s4    				!	!
yAA 
" 
CCG46J    c                 ^   [         R                  " U SS9n[        R                  " U5       n [        R
                  " U5      n[        U[        5      (       d  [        R                  " S5      eUsSSS5        $ ! [         a    [        R                  " S5      ef = f! , (       d  f       g= f)aj  Reads the instance from the given file path ('-' for stdin).

Args:
  path: str or None, a path to a file ('-' for stdin) containing the JSON
    body.

Returns:
  A instance.

Raises:
  InvalidInstancesFileError: If the input file is invalid (invalid format or
      contains too many/zero instances), or an improper combination of input
      files was given.
T)binaryzgInput instance are not in JSON format. See `gcloud ai model-monitoring-jobs create --help` for details.N)r
   ReadFromFileOrStdinioBytesIOr	   load
ValueErrorr   InvalidInstancesFileError
isinstancedict)pathdatafinstances       r   ReadInstanceFromArgsr$   #   s     
	'	'T	:$	zz$1N1h h%%,,MN N    N,,MN NN s"   BA:,B:!BB
B,c                     SU ;   a   [         R                  R                  U SS9$ [         R                  R                  U SS9$ ! [         R                   a     N4f = f)zParse operation relative resource name to the operation reference object.

Args:
  operation_name: The operation resource name

Returns:
  The operation reference object
z/modelDeploymentMonitoringJobs/zFaiplatform.projects.locations.modelDeploymentMonitoringJobs.operationsr   z(aiplatform.projects.locations.operations)r   r   ParseRelativeName WrongResourceCollectionException)operation_names    r   ParseMonitoringJobOperationr)   C   sw     '.811
] 2   
			-	-!K 
. 
M M 55 
s   A AA)__doc__
__future__r   r   r   r   googlecloudsdk.command_lib.air   r   googlecloudsdk.corer   r	   googlecloudsdk.core.consoler
   r   r$   r)    r   r   <module>r0      s8    K &  ' 	 3 0 ) $ 2J
@Mr   