
                             S 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SK	Jr  \R                  " \R                  R                  \R                  R                  \R                  R                   5       " S S	\R"                  5      5       rg
)z7Command for setting metadata on project zonal metadata.    )base_classes) instance_settings_metadata_utils)base)flags)log)
propertiesc                   6    \ rS rSrSrSS0r\S 5       rS rSr	g)	AddMetadata   ab  Add or update project zonal metadata.

*{command}* is used to add or update project zonal metadata for your VM
instances. Project zonal metadata values propagate to all VMs within the
specified zone. Every VM has access to a metadata server that you can use to
query the configured project zonal metadata values. To set metadata for
individual instances, use `gcloud compute instances add-metadata`. For
information about metadata, see
[](https://cloud.google.com/compute/docs/metadata).

Only the metadata keys that you provide in the command get mutated. All other
existing metadata entries remain the same.
EXAMPLESa          To set the project zonal metadata with key=value in the zone ``us-central1-a''
        for the project ``my-gcp-project'', run:

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

        For more information and examples for setting project zonal metadata, see
        [](https://cloud.google.com/compute/docs/metadata/setting-custom-metadata#set-custom-project-zonal-metadata)
      c                 0    [         R                  " U 5        g )N)r   $ProjectZonalMetadataAddMetadataFlags)parsers    1lib/surface/compute/project_zonal_metadata/add.pyArgsAddMetadata.Args8   s    	..v6    c           	      B   [         R                  " U R                  5       5      nUR                  nUR                  R
                  nUR                  R                  [        R                  R                  R                  R                  5       UR                  S9nUR                  USU4/5      S   nUR                  n[         R"                  " UR$                  [         R&                  " UR$                  5      5      (       aD  [(        R*                  R-                  SR/                  UR                  5      5        UR$                  $ UR                  R1                  UR                  R3                  U[         R4                  " UR                  UR$                  5      S9[        R                  R                  R                  R                  5       [         R6                  " UR$                  R9                  5       5      UR                  S9nUR                  USU4/SS	9S   $ )
N)projectzoneGetr   zNNo change requested; skipping update for project zonal metadata in zone [{0}].)fingerprintmetadata)instanceSettingsr   
updateMaskr   PatchT)no_followup)r   ComputeApiHolderReleaseTrackclientapitools_clientr   messages!ComputeInstanceSettingsGetRequestr   VALUEScorer   	GetOrFailr   MakeRequestsr   metadata_utils'IsRequestMetadataSameAsExistingMetadatar   ConstructMetadataDictr   statusPrintformat#ComputeInstanceSettingsPatchRequestInstanceSettings(ConstructInstanceSettingsMetadataMessageConstructUpdateMaskkeys)	selfargsholderr    serviceget_requestexisting_instance_settingsr   requests	            r   RunAddMetadata.Run<   s   **4+<+<+>?F]]F$$55G//CC!!&&..88: D K "(!4!4
5+	&'""	 -88K==,,&//	
  
jj : ? ?@ (000ooAA99##LL : 
 !!&&..88:!55dmm6H6H6JKYY B 
G 
7G	$%   	 	r    N)
__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr   r:   __static_attributes__r<   r   r   r
   r
      s1    
  	 
 	- 7 7%	r   r
   N)rA   googlecloudsdk.api_lib.computer   r   r(   googlecloudsdk.callioper   9googlecloudsdk.command_lib.compute.project_zonal_metadatar   googlecloudsdk.corer   r   ReleaseTracksr   ALPHABETAGAUpdateCommandr
   r<   r   r   <module>rN      sv    > 7 ] ( K # * T..33T5F5F5I5IE	$$$ E	E	r   