
    .                        S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSK	J
r  SS	KJr  S
 r    SS jrSSSS.       SS jjrg)z.Shared resource args for the Dataplex surface.    )absolute_import)annotations)division)unicode_literals)arg_parsers)parser_arguments)parsers)labels_utilc                   U R                  SS9nUR                  S[        R                  SS9  UR                  S/ [        R                  " 5       SSS	9  UR                  S
/ [        R                  " 5       SSS	9  UR                  SS9nUR                  SSS9  UR                  SS9nUR                  SS9nUR                  S[
        SS9  UR                  SSS9  UR                  SSS9  UR                  S[        R                  SS9  UR                  SS9nUR                  SSS9  UR                  S[        R                  SS9  U$ )zAdds Discovery Args to parser.z9Settings to manage the metadata discovery and publishing.helpz--discovery-enabledzWhether discovery is enabled.actionr   z--discovery-include-patternsINCLUDE_PATTERNSaU  The list of patterns to apply for selecting data to include
        during discovery if only a subset of the data should considered. For
        Cloud Storage bucket assets, these are interpreted as glob patterns
        used to match object names. For BigQuery dataset assets, these are
        interpreted as patterns to match table names.)defaulttypemetavarr   z--discovery-exclude-patternsEXCLUDE_PATTERNSa  The list of patterns to apply for selecting data to exclude
        during discovery. For Cloud Storage bucket assets, these are interpreted
        as glob patterns used to match object names. For BigQuery dataset
        assets, these are interpreted as patterns to match table names.z-Determines when discovery jobs are triggered.z--discovery-schedulez[Cron schedule](https://en.wikipedia.org/wiki/Cron) for running
                discovery jobs periodically. Discovery jobs must be scheduled at
                least 30 minutes apart.zDescribe data formats.z6Describe CSV and similar semi-structured data formats.z--csv-header-rowsz]The number of rows to interpret as header rows that should be skipped when reading data rows.)r   r   z--csv-delimiterzBThe delimiter being used to separate values. This defaults to ','.z--csv-encodingz9The character encoding of the data. The default is UTF-8.z--csv-disable-type-inferencezoWhether to disable the inference of data type for CSV data. If true, all columns will be registered as strings.zDescribe JSON data format.z--json-encodingz--json-disable-type-inferencez Whether to disable the inference of data type for Json data. If true, all columns will be registered as their primitive types (strings, number or boolean).)	add_groupadd_argumentr   StoreTrueFalseActionArgListint)parserdiscovery_spectriggerdiscovery_prefix
csv_optionjson_options         0lib/googlecloudsdk/command_lib/dataplex/flags.pyAddDiscoveryArgsr!      s   ##F $ . --*  
 $  9  
 $  K  	 $$: % ' 
+   $--3K-L))C * * -	   O   F   $--8	   !**0L*M+F   %--+	   
    c                  ^^ U R                  SS9mS$UU4S jjnU" SSSS9  U" SS	S
S9  U" SSSS9  U" SSSS9  U" SSSS9  U" SS[        R                  SS9  TnT(       a:  TR                  5       n[        R
                  " SS9R                  U5      nSUl        [        R                  " SS9R                  U5        T(       d$  TR                  SS[        R                  " SS9SS9  TR                  S S![        R                  TSS"9  g#)%aC  Add entry source update args.

Args:
  parser: The arg parser to add flags to.
  for_update: If True, then indicates that arguments are intended for Update
    command. In such case for each clearable argument there will be also
    `--clear-...` flag added in a mutually exclusive group to support clearing
    the field.
zSource system related information for an entry. If any of the entry source fields are specified, then ``--entry-source-update-time` must be specified as well.r   c           	        > TnT(       a8  TR                  5       nUR                  SU -   SSU R                  SS5       S3S9  UR                  " SU -   40 UD6  g )	Nz--clear-entry-source-
store_truezClear the value for the -_z field in the Entry Source.r   z--entry-source-)add_mutually_exclusive_groupr   replace)namekwargsparser_to_addentry_source
for_updates      r    AddArgument'AddEntrySourceArgs.<locals>.AddArgument   sr     M "??Am  
!D
((c3)?(@ A 	 !  047B6Br"   resourcez.The name of the resource in the source system.RESOURCE)r   r   systemzThe name of the source system.SYSTEM_NAMEplatformz*The platform containing the source system.PLATFORM_NAMEzdisplay-namezUser friendly display name.DISPLAY_NAMEdescriptionzDescription of the Entry.DESCRIPTIONzcreate-timez@The creation date and time of the resource in the source system.	DATE_TIME)r   r   r   zentry-source-labels)labels_namez&Clear the labels for the Entry Source.z--entry-source-ancestorsz@Information about individual items in the hierarchy of an Entry.T)includes_json	ANCESTORSz--entry-source-update-timez>The update date and time of the resource in the source system.)r   r   requiredr   N)r*   str)r   dataplex_parsersIsoDateTimer(   r
   GetClearLabelsFlagAddToParserr   GetCreateLabelsFlagr   r   r   )r   r.   r/   entry_source_labels_container
clear_flagr-   s    `   @r    AddEntrySourceArgsrG   r   s]    !!( " ,C C$ ;
 +
 7
 (
 &
 M''	 #/$0$M$M$O!//)k/0  ?JO!!'K-.	"O  t4	   "K''  r"   zupdate-aspectszremove-aspectsF)update_aspects_nameremove_aspects_namer>   c                   SnUb  Ub  SU SU SU S3nUb'  U R                  SU 3SU-   [        R                  S	US
9  Ub-  U R                  SU 3SU-   [        R                  " 5       SUS
9  gg)as  Adds flags for updating and removing Aspects.

Args:
  parser: The arg parser to add flags to.
  update_aspects_name: Name of the flag to add for updating Aspects or None if
    no flag should be added.
  remove_aspects_name: Name of the flag to add for removing Aspects or None if
    no flag should be added.
  required: If True, then flags will be marked as required.
 Nz

        If both `--z	` and `--z^` flags
        are specified, and the same aspect key is used in both flags, then
        `--zT` takes precedence, and such an aspect will be
        updated and not removed.
    z--a%  
        Path to a YAML or JSON file containing Aspects to add or update.

        When this flag is specified, only Aspects referenced in the file are
        going to be added or updated. Specifying this flag does not remove any
        Aspects from the entry. In other words, specifying this flag will not
        lead to a full replacement of Aspects with a contents of the provided
        file.

        Content of the file contains a map, where keys are in the format
        ``ASPECT_TYPE@PATH'', or just ``ASPECT_TYPE'', if the Aspect is attached
        to an entry itself rather than to a specific column defined in the
        schema.

        Values in the map represent Aspect's content, which must conform to a
        template defined for a given ``ASPECT_TYPE''. Each Aspect will be replaced
        fully by the provided content. That means data in the Aspect will be
        replaced and not merged with existing contents of that Aspect in the Entry.

        ``ASPECT_TYPE'' is expected to be in a format
        ``PROJECT_ID.LOCATION.ASPECT_TYPE_ID''.

        ``PATH'' can be either empty (which means a 'root' path, such that Aspect
        is attached to the entry itself) or point to a specific column defined
        in the schema. For example: `Schema.some_column`.

        Example YAML format:

        ```
          project-id1.us-central1.my-aspect-type1:
            data:
              aspectField1: someValue
              aspectField2: someOtherValue
          project-id2.us-central1.my-aspect-type2@Schema.column1:
            data:
              aspectField3: someValue3
        ```

        Example JSON format:

        ```
          {
            "project-id1.us-central1.my-aspect-type1": {
              "data": {
                "aspectField1": "someValue",
                "aspectField2": "someOtherValue"
              }
            },
            "project-id2.us-central1.my-aspect-type2@Schema.column1": {
              "data": {
                "aspectField3": "someValue3"
              }
            }
          }
        ```
        YAML_OR_JSON_FILE)r   r   r   r>   a	  
        List of Aspect keys, identifying Aspects to remove from the entry.

        Keys are in the format ``ASPECT_TYPE@PATH'', or just ``ASPECT_TYPE'', if
        the Aspect is attached to an entry itself rather than to a specific
        column defined in the schema.

        ``ASPECT_TYPE'' is expected to be in a format
        ``PROJECT_ID.LOCATION.ASPECT_TYPE_ID'' or a wildcard `*`, which targets
        all aspect types.

        ``PATH'' can be either empty (which means a 'root' path, such that
        Aspect is attached to the entry itself), point to a specific column
        defined in the schema (for example: `Schema.some_column`) or a wildcard
        `*` (target all paths).

        ``ASPECT_TYPE'' and ``PATH'' cannot be both specified as wildcards `*`.zASPECT_TYPE@PATH)r   r@   ParseAspectsr   r   )r   rH   rI   r>   combination_help_texts        r    AddAspectFlagsrO      s    " $)<)H!'(	2E1F G  !	 $

 !"7n $o7$p **#y  =~ $

 !"S"  # $   ""-   %r"   N)r   $parser_arguments.ArgumentInterceptorr.   bool)r   rP   rH   
str | NonerI   rR   r>   rQ   )__doc__
__future__r   r   r   r   googlecloudsdk.callioper   r   #googlecloudsdk.command_lib.dataplexr	   r@   $googlecloudsdk.command_lib.util.argsr
   r!   rG   rO    r"   r    <module>rY      s}    5 & "  ' / 4 K <Rld0d>BdT '7&6s0s $s $	s
 sr"   