
                            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                  5       " S S\R                   5      5       5       5       rg	)
z1Set-policy command for the Resource Settings CLI.    )
completers)service)utils)base)
exceptionsc                   .    \ rS rSrSr\S 5       rS rSrg)Update   zUpdate the value of a resource setting.

Update the value of a resource setting.

## EXAMPLES

To set the resource setting from the file with the path ``./sample_path'',
run:

  $ {command} --setting-from-file="./test_input.json"
c                 F    U R                  SS[        R                  SSS9  g )Nz--setting-from-filezsetting-from-fileTz=Path to JSON or YAML file that contains the resource setting.)metavar	completerrequiredhelp)add_argumentr   FilesCompleter)parsers    /lib/surface/resource_manager/settings/update.pyArgsUpdate.Args*   s+    
#++L  N    c                 r   [         R                  " 5       n[        R                  " UR                  UR
                  5      nUR                  (       d  [        R                  " S5      e[        R                  " UR                  5      (       d  [        R                  " S5      e[        R                  " UR                  5      n[        R                  " U5      nUR                  n[        US5      (       a  UR                  OSn[        R                  " XFUR                   U5      nUR#                  U5      n	U	$ )zCreates or updates a setting from a JSON or YAML file.

Args:
  args: argparse.Namespace, An object that contains the values for the
    arguments specified in the Args method.

Returns:
  The created or updated setting.
z/Name field not present in the resource setting.zName field has invalid syntaxetagN)r   ResourceSettingsMessagesr   GetMessageFromFilesetting_from_fileSettingnamer   InvalidInputErrorValidateSettingPathGetResourceTypeFromString	api_utilsGetServiceFromResourceTypehasattrr   GetPatchRequestFromResourceTypevaluePatch)
selfargssettings_messageinput_settingresource_typesettings_servicesetting_pathr   update_requestupdate_responses
             r   Run
Update.Run3   s    779 ,, 0 8 8:M ((
;= = $$]%7%788(()HII33M4F4FGM ;;MJ !%%L!(!?!?=TD>>]%8%8$@N&,,^<Or    N)	__name__
__module____qualname____firstlineno____doc__staticmethodr   r0   __static_attributes__r2   r   r   r	   r	      s"    
 N N"r   r	   N)r7   argcompleter   0googlecloudsdk.api_lib.resource_manager.settingsr   r   r!   googlecloudsdk.callioper   4googlecloudsdk.command_lib.resource_manager.settingsr   HiddenDefaultUniverseOnlyReleaseTracksReleaseTrackALPHACommandr	   r2   r   r   <module>rD      sn    8 # D O ( K F D%%++,8T\\ 8 -  8r   