
                             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	Z G d
 dej                        Zy)z2The command to update Fleet Observability Feature.    )absolute_import)division)unicode_literals)messages)arg_parsers)
exceptions)basea    Path of the YAML(or JSON) file that contains the logging configurations.

  The JSON file is formatted as follows, with camelCase field naming:

  ```
  {
      "loggingConfig": {
          "defaultConfig": {
              "mode": "COPY"
          },
          "fleetScopeLogsConfig": {
              "mode": "MOVE"
          }
      }
  }
  ```

  The YAML file is formatted as follows, with camelCase field naming:

  ```
  ---
  loggingConfig:
    defaultConfig:
      mode: COPY
    fleetScopeLogsConfig:
      mode: MOVE
  ```
c                   *    e Zd ZdZdZed        Zd Zy)UpdatezUpdates the Fleet Observability Feature resource.

  This command updates the Fleet Observability Feature in a fleet.

  ## EXAMPLES

  To describe the Fleet Observability Feature, run:

    $ {command} --logging-config=LOGGING-CONFIG
  fleetobservabilityc                 X    |j                  dt        j                         t               y )N--logging-config)typehelp)add_argumentr   YAMLFileContents!_UPDATE_LOGGING_CONFIG_HELPF_TEXT)clsparsers     8lib/surface/container/fleet/fleetobservability/update.pyArgszUpdate.ArgsG   s'    
))+.      c                 l   |j                   }d|vrt        j                  dd      |j                  dd       }	 t	        j
                  || j                  j                        }| j                  j                  | j                  j                  | j                  j                  |                  }| j!                  d	g|       y # t        j                  t        t        f$ rM}t        j                  ddj                  |j                  r|j                  d               |            d }~ww xY w)
NloggingConfigr   z;Missing field [loggingConfig] in logging configuration filez'{}'r   )r   )r   )specz&spec.fleetobservability.logging_config)logging_configr   InvalidArgumentExceptiongetmessages_utilDictToMessageWithErrorCheckr   FleetObservabilityLoggingConfigDecodeErrorAttributeErrorKeyErrorformatargsFeatureCommonFeatureSpecFleetObservabilityFeatureSpecr   )selfr&   file_contentlogging_config_from_filer   errfs          r   Runz
Update.RunO   s*   &&Ll*//

GI I  ,//F;$@@
"
--
7
79n 	]],,#}}JJ,  K   -  	 	A
 	KK9:A> %%~x@ ;//

--sxx
9; ;58
9; ;;s   *C D3&AD..D3N)__name__
__module____qualname____doc__feature_nameclassmethodr   r/    r   r   r   r   9   s%    	 &, ?r   r   N)r3   
__future__r   r   r   googlecloudsdk.api_lib.utilr   r   googlecloudsdk.callioper   r   3googlecloudsdk.command_lib.container.fleet.featuresr	   r   UpdateCommandr   r6   r   r   <module>r<      s9    9 &  ' A / . D% !>+?T +?r   