| Server IP : 35.236.43.222 / Your IP : 216.73.216.143 Web Server : Apache System : Linux order-form-vm-001 5.10.0-37-cloud-amd64 #1 SMP Debian 5.10.247-1 (2025-12-11) x86_64 User : deploy ( 1002) PHP Version : 8.1.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /usr/lib/google-cloud-sdk/lib/surface/dataplex/assets/__pycache__/ |
Upload File : |
�
��k � �n � d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl m
Z ddlm
Z
ddlm
Z
dd lmZ dd
lmZ ddlmZ ddlmZ dd
lmZ d� Z e
j e
j j � � G d� de
j � � � � Z e
j e
j j � � G d� de� � � � ZdS )z,Command to update a Dataplex asset resource.� )�absolute_import)�division)�unicode_literals)�asset)�util)�
exceptions)�base)�flags)�
resource_args)� arg_utils)�labels_util)�logc �L � t j | d� � | � dddd�� � | � dd� � � | � d
d� � � t j | � � t
j � | � � t j | � � dS )
zCreate a common args.z
to update.z--validate-only�
store_trueFz:Validate the update action, but don't actually perform it.)�action�default�helpz
--descriptionzDescription of the asset)r z--display-namezDisplay NameN)
r �AddAssetResourceArg�add_argumentr
�AddDiscoveryArgsr �
ASYNC_FLAG�AddToParserr
�AddCreateLabelsFlags)�parsers �%lib/surface/dataplex/assets/update.py�_CommonArgsr ! s� � ��#�F�L�9�9�9�����
��G� � � � � ���o�,F��G�G�G����&�^��<�<�<���� � � ��/���f�%�%�%�
�"�6�*�*�*�*�*� c �n � e Zd ZdZddiZed� � � Zd� Zd� Z e j
d� � d� � � Zd S )
�Update�!Update a Dataplex asset resource.�EXAMPLES� To update a Dataplex asset `test-asset` in zone `test-zone` in lake
`test-lake` in location `us-central1` to have the display name
`first-dataplex-asset` and discovery include patterns `abc`, `def`,
run:
$ {command} test-asset --location=us-central1 --lake=test-lake --zone=test-zone --display-name="first-dataplex-asset" --discovery-include-patterns=abc,def
c � � t | � � | � dd�� � }|� ddddd�t j d� � � d S �
NFz?Specification of the resource that is referenced by this asset.)�requiredr z--resource-read-access-modez,Data is accessed directly using storage APIszAData is accessed through a managed interface using BigQuery APIs.)�DIRECT�MANAGEDzRead access mode)r% �choices�typer �r � add_groupr r �ChoiceToEnumName�r �
resource_specs r �ArgszUpdate.ArgsA �| � �������$�$��
N� %� � �M� ���%��D��
�
� �
'�
� � � � � � r c �* � t j |� � S �N)r �GenerateUpdateMask��self�argss r r3 zUpdate.GenerateUpdateMaskV s � ��#�D�)�)�)r c �* � t j |� � S r2 )r �GenerateAssetForUpdateRequestr4 s r �GenerateUpdateRequestzUpdate.GenerateUpdateRequestY s � ��.�t�4�4�4r z-Status code: {status_code}. {status_message}.c
�8 � | � |� � }t |� � dk rt j d� � �|j j � � � }t j � � }t j � � }|j
� |� |�
� � |j d� |� � | � |� � �� � � � }t# |dd� � }|r!t$ j � d� � d S t# |dd� � }|s,t j |� � t% j |d �
� � d S t$ j � d� ||j � � � � d S )N� zIUpdate commands must specify at least one additional parameter to change.�,)�name�validateOnly�
updateMask�googleCloudDataplexV1Asset�
validate_onlyFzValidation complete.�async_zOperation was sucessful.)�detailsz$Updating [{0}] with operation [{1}].)r3 �lenr �
HttpException�CONCEPTSr �Parse�
dataplex_util�GetClientInstance�GetMessageModule�%projects_locations_lakes_zones_assets�Patch�5DataplexProjectsLocationsLakesZonesAssetsPatchRequest�RelativeNamerA �joinr9 �getattrr �status�Print�WaitForOperation�UpdatedResource�formatr= ) r5 r6 �update_mask� asset_ref�dataplex_client�message�
update_req_oprA rB s r �Runz
Update.Run\ s� � � �)�)�$�/�/�K�
�;���!����$��
�
� �
�
�#�)�)�+�+�I�#�5�7�7�O��,�.�.�G�#�I�O�O��E�E��'�'�)�)��+��x�x��,�,�'+�'A�'A�$�'G�'G� F�
�
�� �M� �D�/�5�9�9�M��
� �j���-�.�.�.��f�
�T�8�U�
+�
+�F��
���]�+�+�+� ��)�-G�H�H�H�H��f��J���;�B�B��=�%�'� '� (� (� (� (� (r N)�__name__�
__module__�__qualname__�__doc__�
detailed_help�staticmethodr/ r3 r9 �gcloud_exception� CatchHTTPErrorRaiseHTTPExceptionr[ � r r r r 1 s� � � � � � �)�)� ��
�-� �� � �<��(*� *� *�5� 5� 5� 5��4�5�� �(� (�� �(� (� (r r c �<