
    o                     "   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	r	Sr
\R                  R                  S	\R                  R                  S	\R                  R                  S
0rSS jrSS jrS\R                  R                  4S jrg)z0General utilties for Service Directory commands.    )absolute_import)division)unicode_literals)apis)baseNservicedirectoryv1beta1v1c                    U (       d  g[         R                  " [        [        R	                  [
        R                  R                  5      5      n/ nUS:X  a  UR                  R                  nOUS:X  a  UR                  R                  nOg[        R                  " U 5       H#  u  pVUR                  UR                  XVS95        M%     U" US9$ )a  Parses and creates the annotations object from the parsed arguments.

Args:
  annotations: dict, key-value pairs passed in from the --annotations flag.
  resource_type: string, the type of the resource to be created or updated.

Returns:
  A message object depending on resource_type.

  Service.AnnotationsValue message when resource_type='service' and
  Endpoint.AnnotationsValue message when resource_type='endpoint'.
NendpointservicekeyvalueadditionalProperties)r   GetMessagesModule	_API_NAME_VERSION_MAPgetr   ReleaseTrackGAEndpointAnnotationsValueServicesix	iteritemsappendAdditionalProperty)annotationsresource_typemsgsadditional_propertiesannotations_value_msgr   r   s          8lib/googlecloudsdk/command_lib/service_directory/util.pyParseAnnotationsArgr&   !   s     
				 , 0 01B1B1E1E F
H$ j  MM::	! LL99MM+.jc  00S0FH / 
4I	JJ    c                    U (       d  g[         R                  " [        [        R	                  [
        R                  R                  5      5      n/ nUS:X  a  UR                  R                  nOUS:X  a  UR                  R                  nOg[        R                  " U 5       H#  u  pVUR                  UR                  XVS95        M%     U" US9$ )a  Parses and creates the metadata object from the parsed arguments.

Args:
  metadata: dict, key-value pairs passed in from the --metadata flag.
  resource_type: string, the type of the resource to be created or updated.

Returns:
  A message object depending on resource_type.

  Service.MetadataValue message when resource_type='service' and
  Endpoint.MetadataValue message when resource_type='endpoint'.
Nr   r   r   r   )r   r   r   r   r   r   r   BETAr   MetadataValuer   r   r   r   r   )metadatar!   r"   r#   metadata_value_msgr   r   s          r%   ParseMetadataArgr-   D   s     
				 , 0 01B1B1G1G H
J$ j 44	!33MM(+jc  --#-CE , 
1F	GGr'   c                 $   U (       d  g[         R                  " [        [        R	                  U5      5      n/ nUR
                  R                  n[        R                  " U 5       H#  u  pVUR                  UR                  XVS95        M%     U" US9$ )zParses and creates the labels object from the parsed arguments.

Args:
  labels: dict, key-value pairs passed in from the --labels flag.
  release_track: base.ReleaseTrack value

Returns:
  A message object.
Nr   r   )r   r   r   r   r   	NamespaceLabelsValuer   r   r   r   )labelsrelease_trackr"   r#   labels_value_msgr   r   s          r%   ParseLabelsArgr4   g   s     
				<+;+;M+J	K$ ^^//MM&)jc  +++AC * 
/D	EEr'   )NN)__doc__
__future__r   r   r   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper   r   r   r   ALPHAr)   r   r   r&   r-   r4    r'   r%   <module>r;      s    7 &  ' , ( 
	YI$ KF HF d.?.?.B.B Fr'   