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/settings/__pycache__/update.cpython-312.pyc
�

��#��b�dZddlmZddlmZddlmZddlmZddlmZddlm	Z	ddlm
Zdd	lm
Zdd
lmZe	j"e	j$e	j&j(e	j&j*e	j&j,�Gd�de	j.���Zy
)z"'logging settings update' command.�)�absolute_import)�division)�unicode_literals)�util)�arg_parsers)�base)�
exceptions)�
resource_args)�
completersc�&�eZdZdZed��Zd�Zy)�Updatea�Update the settings for the Cloud Logging Logs Router.

  Use this command to update the *--kms-key-name, --storage-location,
  --disable-default-sink* and --analytics-mode associated with the Cloud Logging
  Logs Router.

  The Cloud KMS key must already exist and Cloud Logging must have
  permission to access it.

  The storage location must be allowed by Org Policy.

  Customer-managed encryption keys (CMEK) for the Logs Router can currently
  only be configured at the organization-level and will apply to all projects
  in the organization.

  ## EXAMPLES

  To enable CMEK for the Logs Router for an organization, run:

    $ {command} --organization=[ORGANIZATION_ID]
    --kms-key-name='projects/my-project/locations/my-location/keyRings/my-keyring/cryptoKeys/key'

  To disable CMEK for the Logs Router for an organization, run:

    $ {command} --organization=[ORGANIZATION_ID] --clear-kms-key

  To update storage location for the Logs Router for an organization, run:

    $ {command} --organization=[ORGANIZATION_ID]
    --storage-location=[LOCATION_ID]

  To update storage location for the Logs Router for a folder, run:

    $ {command} --folder=[FOLDER_ID] --storage-location=[LOCATION_ID]

  To disable default sink for the Logs Router for an organization, run:

    $ {command} --organization=[ORGANIZATION_ID] --disable-default-sink=true

  To enable default sink for the Logs Router for an organization, run:

    $ {command} --organization=[ORGANIZATION_ID] --disable-default-sink=false

  To enable analytics for the log buckets under an organization, run:

    $ {command} --organization=[ORGANIZATION_ID] --disable-default-sink=false
    --analytics-mode=required
  c
���|jd��}|jdddtjd��|jddd	d
��|jddd
��|jddd��|jdddgd�t	j
dd����|jd��}t
j|ddd��|jddd��y) z Register flags for this command.T)�requiredz--organizationF�ORGANIZATION_IDz0Organization to update Logs Router settings for.)r�metavar�	completer�helpz--folder�	FOLDER_IDz*Folder to update Logs Router settings for.)rrr�--storage-locationz�Update the storage location for ```_Default``` bucket and ```_Required``` bucket. Note: It only applies to the newly created projects and will not affect the projects created before.)rr�--disable-default-sink�
store_truez�Enable or disable ```_Default``` sink for the ```_Default``` bucket. Specify --no-disable-default-sink to enable a disabled ```_Default``` sink. Note: It only applies to the newly created projects and will not affect the projects created before.)�actionrz--analytics-mode)r�optional�unspecifiedzxUpdate the analytics mode for newly-created project buckets. Changing this setting does not modify any existing buckets.zThis is not available.
)�default�
universe_help)r�hidden�choicesrz5logs being processed by the Cloud Logging Logs RouterzqThe Cloud KMS CryptoKey Encrypter/Decryper role must be assigned to the Cloud Logging Logs Router service accountz--kms-key-name)�resource�permission_info�namez--clear-kms-keyziDisable CMEK for the Logs Router by clearing out Cloud KMS cryptokey in the organization's CMEK settings.N)�add_mutually_exclusive_group�add_argumentr�OrganizationCompleterr�UniverseHelpText�kms_resource_args�AddKmsKeyResourceArg)�parser�parent_group�groups   �&lib/surface/logging/settings/update.py�ArgszUpdate.ArgsVs4���6�6��6�E�L������!��2�2�
?��A�������
9�	�;������D��E���� ��D��E�������7�
�
)�
)�N�5�
���
�/�/��/�?�E��*�*�
�H�#��
�
�����@��B�c
���i}g}gd�}|jd�rF|jjj�j	�|d<|jd�|jd�rd|d<|jd�|jd�r |j|d<|jd�|jd�r |j|d	<|jd�|jd
�r�|jd
�|jdk(r6tj�jjj|d<nz|jd
k(r6tj�jjj|d<n5tj�jjj|d<|st!j"|d��tj$|�}tj&�j(j+tj�j-|tj�jdi|��dj/|����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 settings.
    )z --kms-key-name | --clear-kms-keyrr�kms_key_name�
kmsKeyName�
clear_kms_key��storage_location�storageLocation�disable_default_sink�disableDefaultSink�analytics_moder�
analyticsModerz/Please specify at least one property to update.�,)r!�settings�
updateMask�)�IsSpecified�CONCEPTSr/�Parse�RelativeName�appendr3r5r7r�GetMessages�Settings�AnalyticsModeValueValuesEnum�ANALYTICS_REQUIRED�ANALYTICS_OPTIONAL�ANALYTICS_MODE_UNSPECIFIED�calliope_exceptions�MinimumArgumentException�GetParentFromArgs�	GetClient�v2�UpdateSettings�LoggingUpdateSettingsRequest�join)�self�argsr:�update_mask�parameter_names�parent_names      r+�Runz
Update.Run�s/���H��K��O�
����'�
�-�-�
$�
$�
*�
*�
,�
9�
9�
;��|������(�����(�!�h�|������(����*�+�$(�$9�$9�h� �!����+�,����.�/�'+�'@�'@�h�#�$����/�0����(�)����)�*�	
�	�	�
�	*�����'�'�D�D�W�W�	��!����*�,�����'�'�D�D�W�W�	��!�

����'�'�D�D�_�_�	��!���8�8�
�L�
N�N��(�(��.�K��>�>����-�-�����7�7��0�T�%�%�'�0�0�<�8�<��x�x��,�	8�	.�/�/r-N)�__name__�
__module__�__qualname__�__doc__�staticmethodr,rUr<r-r+r
r
s$��/�b�;B��;B�z:/r-r
N)rY�
__future__rrr�googlecloudsdk.api_lib.loggingr�googlecloudsdk.callioperrr	rH�googlecloudsdk.command_lib.kmsr
r&�+googlecloudsdk.command_lib.resource_managerr�UniverseCompatible�
ReleaseTracks�ReleaseTrack�ALPHA�BETA�GA�Commandr
r<r-r+�<module>rgs��� )�'��'�/�/�(�E�M�B�������������T�.�.�3�3�T�5F�5F�5I�5I��k/�T�\�\�k/���k/r-