
    }                     >    d Z ddlmZ ddlmZ d Zd Zd Zd Zd Z	y	)
zDArgument processors for disk/machine image import surface arguments.    )arg_parsers)hooksc                 8    ~  t        j                  d             S )zReturns empty DataDiskImageImport entry.

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

  Returns:
    An empty DataDiskImageImport message.
  DataDiskImageImportr   GetMessageClassvalues    Blib/googlecloudsdk/command_lib/migration/vms/image_import/hooks.pyGetDataDiskImageImportTransformr      s     	5		4	5	77    c                 8    ~  t        j                  d             S )zReturns empty SkipOsAdaptationTransform entry.

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

  Returns:
    An empty SkipOsAdaptation message.
  SkipOsAdaptationr   r	   s    r   GetSkipOsAdaptationTransformr   $   s     	2		1	2	44r   c                 j   |j                   sK|j                  s?|j                  s3|j                  s'|j                  sd|j
                  j                  _        |j                  s)| j                         |j
                  j                  _
        |j                  rt        j                  |j
                  j                  j                        |j
                  j                  _        |j                  |j
                  j                  j                  _        t        j                  |j
                  j                        |j
                  _        |j                  |j
                  j                  _        g }|j                  r|j
                  j                  j                  s3 t        j                   d             |j
                  j                  _        t#        |j                        }t#        |j                        |j
                  j                  j                  _        |j                  r6|j'                   t        j                   d      d|j                               |r%||j
                  j                  j                  _        t        j(                  | ||j
                  j                         |S )zFixes the Create Image Import request for disk image import.

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

  Returns:
    The modified request message.
  N!ImageImportOsAdaptationParametersAdaptationModifierrootfs-uuidmodifierr
   )
generalizelicense_typeboot_conversionadaptation_modifiersrootfs_uuidimageImportdiskImageTargetDefaultsosAdaptationParameters
image_nameName	imageNamekms_keyr   GetEncryptionTransform
encryptionkmsKeyr   ProcessAdaptationModifiersadaptationModifiersappendFixTargetDetailsCommonFieldsrefargsreqr   s       r   FixCreateDiskImageImportRequestr.   2   s    oo								"	"			EICOO++B	8;
COO++5	\\$$OO33>>	
 OO++6
 AECOO++66=!&!=!="""COO )-COO%	??22II
D%

 C
D
F 
oo--D 6d6O6OPYs!!ZCOO++BBV 
323"$*:*:	

  OO++BBV $$	488 
*r   c                 x   |j                   s)| j                         |j                  j                  _        |j
                  sK|j                  s?|j                  s3|j                  s'|j                  sd|j                  j                  _
        |j                  s3|j                  s'|j                  sd|j                  j                  _        |j                  rt!        j"                  |j                  j                  j$                        |j                  j                  _        |j                  |j                  j                  j$                  _        t!        j"                  |j                  j$                        |j                  _        |j                  |j                  j$                  _        g }|j                  rh|j                  j                  j                  s3 t!        j(                  d             |j                  j                  _
        t+        |j                        }|j                  r6|j-                   t!        j(                  d      d|j                               |r%||j                  j                  j                  _        t!        j0                  | ||j                  j                         |S )zFixes the Create Image Import request machine image import.

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

  Returns:
    The modified request message.
  Nr   r   r   r   )machine_image_namer    r   machineImageTargetDefaultsmachineImageNamer   r   r   r   r   r   secure_bootenable_vtpmenable_integrity_monitoringshieldedInstanceConfigr"   r   r#   r$   r%   r   r&   r(   r'   r)   r*   s       r   "FixCreateMachineImageImportRequestr7   q   s    
	 	 BE((*COO..? //""''HLCOO..E 

..HLCOO..E	\\$$OO66AA	
 OO..9
 DH<<COO..99@!&!=!="""COO )-COO%	??55LL
D%

 C
D
F 
oo00G 6d6O6OP	323"$*:*:	

  OO..EEY $$	4;; 
*r   c                    | sg S t        | t              r| j                  d      }n(t        | t              r| }nt	        j
                  d      g }|D ]  }|sd|vr+ t        j                  d      |j                               }nN|j                  dd      \  }} t        j                  d      |j                         |j                               }|j                  |        |S )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.=r   )r      r   )

isinstancestrsplitlistr   ArgumentTypeErrorr   r   stripr(   )r   
flags_listresultflagadaptation_flag_messagekeyr
   s          r   r&   r&      s     
I$c*%++C0J&-%J

'
'E  &d
$ K 5 56J K::<! ::c1%jc5 K 5 56J K99;ekkm! MM)*  
-r   N)
__doc__googlecloudsdk.callioper   (googlecloudsdk.command_lib.migration.vmsr   r   r   r.   r7   r&    r   r   <module>rK      s-    K / :
8
5;~@P$r   