
    K                         S r SSKJr  SSKJr  SSKJr  \R                  R                  R                  r
S rS rS rS rS	 rS
 rS rg)zHArgument processors for migration vms disk-migrations surface arguments.    )arg_parsers)hooks)vmmigration_v1_messagesc                 :    A [         R                  " S5      " 5       $ )zReturns empty DiskMigrationJobTargetDetails entry.

Args:
  value: A pointer to the DiskMigrationJobTargetDetails field in the request.

Returns:
  An empty DiskMigrationJobTargetDetails entry.
DiskMigrationJobTargetDetailsr   GetMessageClassvalues    Dlib/googlecloudsdk/command_lib/migration/vms/disk_migration/hooks.py GetDiskMigrationJobTargetDetailsr      s"     			%
 
     c                 :    A [         R                  " S5      " 5       $ )zReturns empty ComputeEngineDisk entry.

Args:
  value: A pointer to the ComputeEngineDisk field in the request.

Returns:
  An empty ComputeEngineDisk entry.
ComputeEngineDiskr   r
   s    r   GetComputeEngineDiskTransformr   *   s     			2	3	55r   c                     [        U 5      S-   $ )zReturns the default zone for the given resource reference.

Args:
  ref: The resource reference.

Returns:
  The default zone for the given resource reference.
z-a)ExtractLocationrefs    r   GetDefaultZoner   7   s     
		$$r   c                 Z    U R                  5       R                  5       R                  5       $ )zExtracts the location from the resource reference.

Args:
  ref: The resource reference.

Returns:
  The location of the resource reference.
)ParentNamer   s    r   r   r   C   s"     
				#	#	%%r   c                 Z    U R                  5       R                  5       R                  5       $ )zReturns the project name for the given resource reference.

Args:
  ref: The resource reference.

Returns:
  The project name for the given resource reference.
)r   r   s    r   
GetProjectr   O   s"     
				%	%	''r   c                 <   [        UR                  SS5      c.  [        UR                  R                  5      UR                  l        [        UR                  R                  SS5      cB  [	        UR                  R                  R
                  5      UR                  R                  l        UR                  (       d3  U R                  5       UR                  R                  R
                  l        UR                  (       d.  [        U 5      UR                  R                  R
                  l	        UR                  (       d)  [        UR                  R                  R
                  l        [        R                  " [!        U 5      XR                  R                  5        U$ )zFixes the Create Disk Migration request.

Args:
  ref: The resource reference.
  args: The parsed arguments.
  req: The request message.

Returns:
  The modified request message.
targetDetailsN
targetDisk)getattrdiskMigrationJobr   r   r   r   disk_idr   diskIdzoner   	disk_typedefault_disk_typediskTyper   FixTargetDetailsCommonFieldsr   )r   argsreqs      r   FixCreateDiskMigrationsRequestr*   \   s&    S!!?D9A(  ..	
 & S!!//tDL%  ..99	
 &&1 
;>88:C&&118	9G9LC&&116	=NC&&11:$$ot11?? 
*r   c                     U (       d  / $ [        U [        5      (       a  U R                  S5      nO.[        U [        5      (       a  U nO[        R
                  " S5      e/ nU H  nU(       d  M  SU;  a)  [        R                  " S5      " UR                  5       S9nOKUR                  SS5      u  pV[        R                  " S5      " UR                  5       UR                  5       S9nUR                  U5        M     U$ )a  Processes the adaptation modifiers to match the API format.

Args:
  adaptation_modifiers: A string or a list of strings representing the
    adaptation flags.

Returns:
  A list of dictionaries, where each dictionary represents a key-value
  pair with 'key' and 'value' fields.
,z;adaptation-modifiers must be a string or a list of strings.=AdaptationModifier)modifier   )r/   r   )

isinstancestrsplitlistr   ArgumentTypeErrorr   r	   stripappend)adaptation_modifiers
flags_listresultflagadaptation_flag_messagekeyr   s          r   ProcessAdaptationModifiersr>      s     
I$c**%++C0J&--%J

'
'E  &d
$ % 5 56J K::<! ::c1%jc % 5 56J K99;ekkm! MM)*  
-r   N)__doc__googlecloudsdk.callioper   (googlecloudsdk.command_lib.migration.vmsr   4googlecloudsdk.generated_clients.apis.vmmigration.v1r   r   DiskTypeValueValuesEnum!COMPUTE_ENGINE_DISK_TYPE_STANDARDr%   r   r   r   r   r   r*   r>    r   r   <module>rF      sT    O / : X --EEgg 

6	%	&	(&\$r   