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: //lib/google-cloud-sdk/lib/surface/logging/__pycache__/write.cpython-312.pyc
�

�������dZddlmZddlmZddlmZddlmZddlmZddl	m
Z
ddl	mZdd	lm
Z
ejGd
�dej��Zdd
d�e_y)z'logging write' command.�)�absolute_import)�division)�unicode_literals)�encoding)�util)�arg_parsers)�base)�logc�.�eZdZdZdZdZed��Zd�Zy)�WritezWrite a log entry.)	�DEFAULT�DEBUG�INFO�NOTICE�WARNING�ERROR�CRITICAL�ALERT�	EMERGENCY)�text�jsonc��|jdd��|jdd��|jdtjdd�	�|jd
dtjdd
��|jddd��|jdt	j
�did��t
j|d�y)z Register flags for this command.�log_namez4Name of the log where the log entry will be written.)�help�messagezUMessage to put in the log entry. It can be JSON if you include `--payload-type=json`.z--payload-typerzType of the log entry payload.)�choices�defaultrz
--severityFr
z Severity level of the log entry.)�requiredrrrz--monitored-resource-type�globalz-Monitored Resource type to add to the payload)rrz--monitored-resource-labelszKEY=VALUE, ...z/Monitored Resource labels to add to the payload)�type�metavarrrzlog entries to writeN)�add_argumentr�PAYLOAD_TYPE�
SEVERITY_ENUMr�ArgDictr�
AddParentArgs)�parsers �lib/surface/logging/write.py�Argsz
Write.Args&s�������(��*�����F��H������"�"�F�.��1�����u��#�#�Y�
/��1����#��
<���
���%�
�
 �
 �
"� ��
>���	���v�5�6�c��tj�}t|jj|j
j
��}|j|j��}|jr9tj|jj|j�|_
|jtjtj|�|j �||��}|j"dk(r�tj$|j&�}|jj)�}|j*D�cgc]=}|jj(j-|j.|j0����?c}|_||_n|j&|_tj8�j:j=|j?|g���t@jBjEd�ycc}w)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.
    )r )�logName�resource�severityr)�key�value)�entrieszCreated log entry.
N)#r�GetMessages�getattr�LogEntry�SeverityValueValuesEnumr.�upper�MonitoredResource�monitored_resource_type�monitored_resource_labelsr�PyValueToMessage�LabelsValue�labels�CreateLogResourceName�GetParentFromArgsr�payload_type�ConvertToJsonObjectr�JsonPayloadValue�
properties�AdditionalPropertyr/r0�additionalProperties�jsonPayload�textPayload�	GetClientr1r�WriteLogEntriesRequestr
�status�write)	�self�args�messages�severity_value�monitored_resource�entry�json_object�struct�
json_propertys	         r(�Runz	Write.RunFs������!�H��X�.�.�F�F�!�]�]�0�0�2�4�N�"�3�3�
�
)�
)�4����%�%�"*�";�";�
�
$�
$�
0�
0�$�2P�2P�#���
����*�*��"�"�4�(�$�-�-�
�$��
�
�E����F�"��,�,�T�\�\�:�k�� � �1�1�3�f� +�5�5�	%� 6�m��
�
�
,�
,�
?�
?��#�#�!�'�'�@�)� 6�	%�f�!�!�e���,�,�e���N�N����"�"��'�'���'�8�:��J�J���+�,��%s�	AH
N)	�__name__�
__module__�__qualname__�__doc__r$r#�staticmethodr)rT�r*r(rrs*���>�-�"�,��7��7�>.-r*ra�        {index}
        If the destination log does not exist, it will be created.
        By default, all log entries written with this command are written with
        the "global" resource type.

        {command} should be used for simple testing purposes.
        Check Cloud Logging agent for a proper way to send log entries:
        [](https://cloud.google.com/logging/docs/agent/)
    a&        To create a log entry in a given log, run:

          $ {command} LOG_NAME "A simple entry"

        To create a high severity log entry, run:

          $ {command} LOG_NAME "Urgent message" --severity=ALERT

        To create a structured log, run:

          $ {command} LOG_NAME '{"key": "value"}' --payload-type=json

        To create a log entry with a custom resource type, run:

          $ {command} LOG_NAME "A simple entry" --monitored-resource-type=gce_instance --monitored-resource-labels=zone=us-centra1-a,instance_id=1234
    )�DESCRIPTION�EXAMPLESN)rX�
__future__rrr�apitools.base.pyr�googlecloudsdk.api_lib.loggingr�googlecloudsdk.callioperr	�googlecloudsdk.corer
�UniverseCompatible�
SilentCommandr�
detailed_helprZr*r(�<module>resa�� �&��'�%�/�/�(�#����V-�D���V-��V-�r	����r*