HEX
Server: Apache/2.4.68 (Debian)
System: Linux as-cs-widget-demo-us-central1 6.1.0-44-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.164-1 (2026-03-09) x86_64
User: root (0)
PHP: 8.2.32
Disabled: NONE
Upload Files
File: //usr/lib/google-cloud-sdk/lib/surface/logging/metrics/__pycache__/update.cpython-312.pyc
�

�����D�dZddlmZddlmZddlmZddlmZddlmZddlm	Z	ddl
mZd	d
d�Ze	je	jje	jj e	jj"�Gd�d
e	j$��Zee_y)z!'logging metrics update' command.�)�absolute_import)�division)�unicode_literals)�util)�arg_parsers)�base)�logzl          Update the description or the filter expression of an existing
          logs-based metric.
      a�          To update the description of a metric called high_severity_count, run:

            $ {command} high_severity_count --description="Count of high-severity log entries."

          To update the filter expression of the metric, run:

            $ {command} high_severity_count --log-filter="severity >= WARNING"

          Detailed information about filters can be found at:
          [](https://cloud.google.com/logging/docs/view/logging-query-language)

          For advanced features such as user-defined labels and distribution
          metrics, update using a config file:

            $ {command} high_severity_count --config-from-file=$PATH_TO_FILE

          The config file should be in YAML format. Detailed information about
          how to configure metrics can be found at: [](https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics#LogMetric).
          Any top-level fields in the LogMetric definition that aren't specified
          in the config file will not be updated in the metric.

          To update the bucket associated with a bucket log-based metric, run:

            $ {command} my-bucket-metric --bucket-name="NEW_BUCKET_NAME"
      )�DESCRIPTION�EXAMPLESc�&�eZdZdZed��Zd�Zy)�Updatez-Update the definition of a logs-based metric.c�8�|jdd��|jddd��}|jd��}|jdd	d
��|jdd	d
��|jddtj���|jdd��y)z Register flags for this command.�metric_namez+The name of the log-based metric to update.)�helpz Data about the metric to update.T)r�mutex�requiredzIArguments to specify information about simple counter logs-based metrics.z
--descriptionFzMA new description for the metric. If omitted, the description is not changed.)rrz--log-filterzJA new filter string for the metric. If omitted, the filter is not changed.z--config-from-filezQA path to a YAML file specifying the updates to be made to the logs-based metric.)r�typez
--bucket-namez4The Log Bucket name which owns the log-based metric.N)�add_argument�add_argument_groupr�FileContents)�parser�config_group�legacy_mode_groups   �%lib/surface/logging/metrics/update.py�ArgszUpdate.ArgsDs�������I��K��,�,�
/�t�d�-�L�L�$�7�7��8�!���"�"���<�#�>�
�"�"���7�#�9�
������
%�
%�
'��)��"�"��
C�#�E�c	���tj�jjtj�jtjtj�d|j����}tj||j|j|j|j��}tj�jjtj�jtjtj�d|j�|���}t!j"|j�|S)z�This is what gets called when the user runs this command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation.

    Returns:
      The updated metric.
    �metrics)�
metricName)�description�
log_filter�bucket_name�data)r�	logMetric)r�	GetClient�projects_metrics�Get�GetMessages� LoggingProjectsMetricsGetRequest�CreateResourceName�GetCurrentProjectParentr�UpdateLogMetricr r!r"�config_from_filer
�#LoggingProjectsMetricsUpdateRequestr	�UpdatedResource)�self�args�metric�updated_metric�results     r�Runz
Update.Runds���^�^�
�
.�
.�
2�
2�����;�;��.�.�t�/K�/K�/M�/8�$�:J�:J�L�	<�	M�N�F�
�)�)���$�$��?�?��$�$�
�
"�
"�$�N��^�^�
�
.�
.�
5�
5�����>�>��.�.�t�/K�/K�/M�/8�$�:J�:J�L�$�	?�	&�'�F�
����(�(�)��MrN)�__name__�
__module__�__qualname__�__doc__�staticmethodrr5�rrr
r
?s ��6��E��E�>rr
N)r9�
__future__rrr�googlecloudsdk.api_lib.loggingr�googlecloudsdk.callioperr�googlecloudsdk.corer	�
DETAILED_HELP�
ReleaseTracks�ReleaseTrack�GA�BETA�ALPHA�
UpdateCommandr
�
detailed_helpr;rr�<module>rHs��� (�&��'�/�/�(�#�	
�
	
�!�
�H����D�%�%�(�(�$�*;�*;�*@�*@��%�%�+�+�-�B�T�
�
�B�-�B�J%��r