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/sql/databases/__pycache__/patch.cpython-312.pyc
�

��l��Z�dZddlmZddlmZddlmZddlmZddlmZddlm	Z	ddl
mZdd	lm
Z
dd
lmZGd�de�Ze	j"e	j$j&e	j$j(e	j$j*�Gd
�de	j,��Zy)�-Patches the settings of a Cloud SQL database.�)�absolute_import)�division)�unicode_literals)�api_util)�
operations)�base)�flags)�log)�
propertiesc��eZdZdZd�Zy)�_ResultzRun() method result object.c� �||_||_y)N)�new�old)�selfrrs   �"lib/surface/sql/databases/patch.py�__init__z_Result.__init__ s���D�H��D�H�N)�__name__�
__module__�__qualname__�__doc__r�rrrrs
��#�rrc�&�eZdZdZed��Zd�Zy)�Patchrc��tj|�d}tj||�tj|�tj|�|jddd��|jjd�y)a�Args is called by calliope to gather arguments for this command.

    Please add arguments in alphabetical order except for no- or a clear-
    pair for that argument which can follow the argument itself.
    Args:
      parser: An argparse parser that you can use to add arguments that go
          on the command line after this command. Positional arguments are
          allowed.
    z�Cloud SQL database collation setting, which specifies the set of rules for comparing characters in a character set. Each database version may support a different set of collations. This flag can't be used with PostgreSQL instances.z--diff�
store_truez+Show what changed as a result of the patch.)�action�helpztable(new:format="default")N)r
�
AddCharset�AddCollation�AddDatabaseName�AddInstance�add_argument�display_info�	AddFormat)�parser�custom_helps  r�Argsz
Patch.Args*s}��
���V��	5��

���v�{�+�	���&�!�	���f��
�����
:��<����!�!�"?�@rc��|jr|j�jd�tjtj
�}|j}|j}|jj|jdtjjjjid��}|j j#|j%|j&|j|j���}|j)d|j|j|j&��}t+|d�r|j,|_t+|d	�r|j.|_d
}|j j1|j3|j&||j|j���}	|jj5d|	j6|j�
�}t8j:j=||d�t?j@|j&d�|j j#|j%|j&|j|j���}
tC|
|�S)a9Patches settings of a Cloud SQL database using the patch api method.

    Args:
      args: argparse.Namespace, The arguments that this command was invoked
          with.

    Returns:
      A dict object representing the operations resource describing the patch
      operation if the patch was successful.
    zdiff(old, new)�projectz
sql.instances)�params�
collection)�databaser,�instancezsql#database)�kindr,r0�name�	collation�charsetN)r/�databaseResourcer,r0zsql.operations)�	operationr,zPatching Cloud SQL databaser/)"�diff�GetDisplayInfor'r�	SqlClient�API_VERSION_DEFAULT�
sql_client�sql_messages�resource_parser�Parser0r�VALUES�corer,�	GetOrFail�	databases�Get�SqlDatabasesGetRequestr/�Database�hasattrr3r4r�SqlDatabasesPatchRequest�Creater2r�OperationsV1Beta4�WaitForOperationr�UpdatedResourcer)r�args�clientr;r<�instance_ref�original_database_resource�patch_database�
operation_ref�result_operation�changed_database_resources           r�Runz	Patch.RunEs?���y�y�
����%�%�&6�7�
�
�
�� <� <�
=�F��"�"�J��&�&�L��)�)�/�/��
�
��:�,�,�1�1�9�9�C�C�D�"�0�$�L�
",�!5�!5�!9�!9��+�+��]�]� �(�(�!�*�*�	,�	,�"-��"�*�*�
��$�$��&�&�
�]�]�	+��N��t�[�!�!%���n���t�Y��#�|�|�n���M�!�+�+�1�1��-�-��]�]�+� �(�(�!�*�*�		.�	,�-���*�*�1�1��"�'�'��$�$�2�&�M�
� � �1�1�*�m�2O�Q�����
�
�z�2� *� 4� 4� 8� 8��+�+��]�]� �(�(�!�*�*�	,�	,�!-��
�,�.H�I�IrN)rrrr�staticmethodr*rTrrrrr%s"��6��A��A�4@JrrN)r�
__future__rrr�googlecloudsdk.api_lib.sqlrr�googlecloudsdk.callioper	�googlecloudsdk.command_lib.sqlr
�googlecloudsdk.corerr�objectr�
ReleaseTracks�ReleaseTrack�GA�BETA�ALPHA�Commandrrrr�<module>rbs���4�&��'�/�1�(�0�#�*��f������D�%�%�(�(�$�*;�*;�*@�*@��%�%�+�+�-�^J�D�L�L�^J�-�^Jr