
                         V   d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ dd	l
mZ dd
lmZ ddlmZ dej"                  de	j$                  dej&                  dej&                  fdZdej"                  de	j$                  dej*                  dej*                  fdZd Zy)z#Bigtable schema bundles API helper.    )absolute_import)division)unicode_literals)descriptor_pb2)text_format)parser_extensions)log)	resources)files)bigtableadmin_v2_messages
unused_refargsreqreturnc                     |j                   rYt        j                  |j                         }t        j                  j                  |       ||j                  j                  _        |S )a  Parse argument and construct create schema bundle request.

  This function is used to modify the create schema bundle request to include
  the proto descriptors file content if provided.

  Args:
    unused_ref: the gcloud resource (unused).
    args: input arguments.
    req: the real request to be sent to backend service.

  Returns:
    The modified request to be sent to backend service.

  Raises:
    ValueError: if the proto descriptors file is invalid.
  )	proto_descriptors_filer   ReadBinaryFileContentsr   FileDescriptorSet
FromStringschemaBundleprotoSchemaprotoDescriptorsr   r   r   proto_desc_contents       5lib/googlecloudsdk/api_lib/bigtable/schema_bundles.pyModifyCreateSchemaBundleRequestr      sY    . 
  55## $$//0BC4FC  1
 
*    c                     |j                   rYt        j                  |j                         }t        j                  j                  |       ||j                  j                  _        |j                  rd|_
        |S )a  Parse argument and construct update schema bundle request.

  This function is used to modify the update schema bundle request to include
  the proto descriptors file content if provided.

  Args:
    unused_ref: the gcloud resource (unused).
    args: input arguments.
    req: the real request to be sent to backend service.

  Returns:
    The modified request to be sent to backend service.

  Raises:
    ValueError: if the proto descriptors file is invalid.
  T)r   r   r   r   r   r   r   r   r   ignore_warningsignoreWarningsr   s       r   ModifyUpdateSchemaBundleRequestr!   D   sh    . 
  55## $$//0BC4FC  1	C	*r   c                    | j                   {| j                   j                  et        j                  j	                  | j                   j                        }t
        j                  j                  t        j                  |             | S )zParse the proto descriptors in the Get response and print it.

  Args:
    response: the response from the backend service.
    _: unused.

  Returns:
    The original response.
  )
r   r   r   r   r   r	   statusPrintr   MessageToString)response_descriptorss      r   (PrintParsedProtoDescriptorsInGetResponser)   h   sk     &



/
/
; 22==--K JJ[00=>	/r   N)__doc__
__future__r   r   r   cloudsdk.google.protobufr   r   googlecloudsdk.callioper   googlecloudsdk.corer	   r
   googlecloudsdk.core.utilr   6googlecloudsdk.generated_clients.apis.bigtableadmin.v2r   Resource	Namespace>BigtableadminProjectsInstancesTablesSchemaBundlesCreateRequestr   =BigtableadminProjectsInstancesTablesSchemaBundlesPatchRequestr!   r)    r   r   <module>r6      s     * &  ' 3 0 5 # ) * \""""

%
%" 
#	a	a"
 \\"J!""!

%
%! 
#	`	`!
 [[!Hr   