
                         D   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 dd
lmZ  e
j                   e
j"                  j$                  e
j"                  j&                  e
j"                  j(                         G d de
j*                               Zy)z7Command for setting metadata on project zonal metadata.    )absolute_import)division)unicode_literals)base_classes) instance_settings_metadata_utils)base)flags)log)
propertiesc                   .    e Zd ZdZddiZed        Zd Zy)RemoveMetadataa   Remove project zonal metadata.

  *{command}* is used to remove project zonal metadata from all VMs within the
  specified zone. For information about metadata, see
  [](https://cloud.google.com/compute/docs/metadata).

  Only the metadata keys that you provide in the command get removed. All other
  existing metadata entries remain the same.

  After you remove a specific project zonal metadata entry, if that metadata key
  has any project-wide value configured, then the VMs in the zone automatically
  inherit that project-wide value.
  EXAMPLESa          To remove the project zonal metadata with key=value in the zone ``us-central1-a''
        for the project ``my-gcp-project'', run:

        $ {command} --keys=key --zone=us-central1-a --project=my-gcp-project

        For more information and examples about how to remove project zonal
        metadata, see [](https://cloud.google.com/compute/docs/metadata/setting-custom-metadata#remove-custom-project-zonal-metadata)
      c                 .    t        j                  |        y )N)r	   'ProjectZonalMetadataRemoveMetadataFlags)parsers    4lib/surface/compute/project_zonal_metadata/remove.pyArgszRemoveMetadata.Args:   s    	11&9    c           	      |   t        j                  | j                               }|j                  }|j                  j
                  }|j                  j                  t        j                  j                  j                  j                         |j                        }|j                  |d|fg      d   }|j                  }t!        j"                  |j$                        }t'        |j(                        t'        |j)                               z
  }	|	rEt*        j,                  j/                  dj1                  |j                  |	             |j$                  S |j                  j3                  |j                  j5                  ||j                  j7                               t        j                  j                  j                  j                         t!        j8                  |j:                  r|j)                         nt'        |j(                              |j                        }
|j                  |d|
fgd	      d   S )
N)projectzoneGetr   zhProvide only valid keys. Keys that do not exist in current project zonal metadata in zone [{0}] are {1}.)fingerprintmetadata)instanceSettingsr   
updateMaskr   PatchT)no_followup)r   ComputeApiHolderReleaseTrackclientapitools_clientr   messages!ComputeInstanceSettingsGetRequestr   VALUEScorer   	GetOrFailr   MakeRequestsr   metadata_utilsConstructMetadataDictr   setkeysr
   statusPrintformat#ComputeInstanceSettingsPatchRequestInstanceSettingsInstanceSettingsMetadataConstructUpdateMaskall)selfargsholderr!   serviceget_requestexisting_instance_settingsr   existing_metadatakeys_not_in_existing_metadatarequests              r   RunzRemoveMetadata.Run>   s   **4+<+<+>?F]]F$$55G//CC!!&&..88: D K "(!4!4
5+	&'""	 -88K&<<"++ %(		NS 6 %! %	jj3396(--/L4 (000ooAA99#__==? : 
 !!&&..88:!55(,""$c$))n
 YY B 
G 
7G	$%   	 	r   N)__name__
__module____qualname____doc__detailed_helpstaticmethodr   r>    r   r   r   r      s1    
   
 - : :'	r   r   N)rB   
__future__r   r   r   googlecloudsdk.api_lib.computer   r   r)   googlecloudsdk.callioper   9googlecloudsdk.command_lib.compute.project_zonal_metadatar	   googlecloudsdk.corer
   r   ReleaseTracksr    ALPHABETAGAUpdateCommandr   rE   r   r   <module>rP      s    > &  ' 7 ] ( K # * T..33T5F5F5I5IF	T'' F	F	r   