
    '                     ~   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S
KJr  S rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS r S r!S r"S r#S  r$S! r%S" r&S# r'S$ r(S% r)S& r*S' r+S( r,S) r-S* r.S+ r/S, r0S- r1S. r2S/ r3S0 r4S1 r5S2 r6S3 r7S4 r8S5 r9S6 r:S7 r;S8 r<S9 r=S: r>S; r?S< r@S= rAS> rBS? rCS@ rDSA rESB rFSC rGSD rHSE rISF rJSG rKSH rLSI rMSJ rNSK rOSL rPSM rQSN rRSO rSSP rTSQ rUSR rVSS rWST rXSU rYSV rZSW r[SX r\SY r]SZ r^S[ r_S\ r`S] raS^ rbS_ rcS` rdSa regb)cz!Flags for commands in cloudasset.    )absolute_import)division)unicode_literals)arg_parsers)base)	yaml_data)common_args)resource_args)concept_parsersc                     U R                    H*  nUR                  (       d  M  UR                  U:X  d  M(  Us  $    U R                  U5      $ )zECreate a new arg group or return existing group with given help text.)	argumentsis_grouphelpadd_argument_group)parser	help_textargs      -lib/googlecloudsdk/command_lib/asset/flags.py_GetOrAddArgGroupr      s>    c
|||I-j  
	"	"9	--    c                     [        U S5      $ )NzThe analysis options.)r   r   s    r   GetOrAddOptionGroupr   %   s    	6#:	;;r   c                 &    U R                  SSUS9  g )Nz--organizationORGANIZATION_IDmetavarr   add_argumentr   r   s     r   AddOrganizationArgsr!   )   s     1	  Cr   c                 &    U R                  SSUS9  g )Nz--folder	FOLDER_IDr   r   r    s     r   AddFolderArgsr$   .   s    j+IFr   c                 &    U R                  SSUS9  g )Nz	--project
PROJECT_IDr   r   r    s     r   AddProjectArgsr'   2   s    k<iHr   c                     U R                  SS9n[        R                  " US9R                  U5        [	        XB5        [        XC5        g )NTrequired)help_text_to_prepend)add_mutually_exclusive_groupr	   ProjectArgumentAddToParserr!   r$   )r   project_help_textorg_help_textfolder_help_textparent_groups        r   AddParentArgsr3   6   s@    44d4C,,..9k,.Gl2/r   c                 j    U R                  SS9n[        US5        [        US5        [        US5        g)z)Adds analysis parent(aka scope) argument.Tr)   zOrganization ID on which to perform the analysis. Only policies defined at or below this organization  will be targeted in the analysis.z|Folder ID on which to perform the analysis. Only policies defined at or below this folder will be  targeted in the analysis.zProject ID or number on which to perform the analysis. Only policies defined at or below this project will be  targeted in the analysis.N)r,   r!   r$   r'   r   r2   s     r   AddAnalyzerParentArgsr6   >   sI    44d4C, +,  #$  #$r   c                 V    U R                  S[        R                  R                  SS9  g )Nz--snapshot-timeag  Timestamp to take a snapshot on assets. This can only be a current or past time. If not specified, the current time will be used. Due to delays in resource data collection and indexing, there is a volatile window during which running the same query at different times may return different results. See $ gcloud topic datetimes for information on time formats.typer   r   r   DatetimeParser   s    r   AddSnapshotTimeArgsr=   O   s.    %%L  Nr   c                 P    U R                  SS[        R                  " 5       / SS9  g )N--asset-typesASSET_TYPESa  A list of asset types (i.e., "compute.googleapis.com/Disk") to take a snapshot. If specified and non-empty, only assets matching the specified types will be returned. See http://cloud.google.com/asset-inventory/docs/supported-asset-types for supported asset types.r   r9   defaultr   r   r   ArgListr   s    r   AddAssetTypesArgsrE   [   s/     (  
*r   c                 P    U R                  SS[        R                  " 5       / SS9  g )N--relationship-typesRELATIONSHIP_TYPESa]  A list of relationship types (i.e., "INSTANCE_TO_INSTANCEGROUP") to take a snapshot. This argument will only be honoured if content_type=RELATIONSHIP. If specified and non-empty, only relationships matching the specified types will be returned. See http://cloud.google.com/asset-inventory/docs/supported-asset-types for supported relationship types.rA   rC   r   s    r   AddRelationshipTypesArgsrI   i   s/    " /  1r   c                 N    U(       a  SnOSnUS-  nU R                  SU/ SQUS9  g)z9--content-type argument for asset export and get-history.zAsset content type.zAsset content type. If specified, only content matching the specified type will be returned. Otherwise, no content but the asset name will be returned.a   Specifying `resource` will export resource metadata, specifying `iam-policy` will export the IAM policy for each child asset, specifying `org-policy` will export the Org Policy set on child assets, specifying `access-policy` will export the Access Policy set on child assets, specifying `os-inventory` will export the OS inventory of VM instances, and specifying `relationship` will export relationships of the assets.--content-typeresourcez
iam-policyz
org-policyzaccess-policyzos-inventoryrelationship)r*   choicesr   Nr   )r   r*   r   s      r   AddContentTypeArgsrP   x   sJ    &I	'  ) 	   r   c           	      T    U R                  SSU[        R                  " SS5      SS9  g )Nz--output-pathOUTPUT_PATH^gs://.*zs--output-path must be a Google Cloud Storage URI starting with "gs://". For example, "gs://bucket_name/object_name"z|Google Cloud Storage URI where the results will go. URI must start with "gs://". For example, "gs://bucket_name/object_name"r   r*   r9   r   r   r   RegexpValidatorr   r*   s     r   AddOutputPathArgsrX      s<    &&
ABQ  
r   c                 P    U R                  S[        R                  " SS5      SS9  g )Nz--output-path-prefixz^gs://.*/.*z--output-path-prefix must be a Google Cloud Storage URI starting with "gs://". For example, "gs://bucket_name/object_name_prefix"a&  Google Cloud Storage URI where the results will go. URI must start with "gs://". For example, "gs://bucket_name/object_name_prefix", in which case each exported object uri is in format: "gs://bucket_name/object_name_prefix/<asset type>/<shard number>" and it only contains assets for that type.r8   rU   r   s    r   AddOutputPathPrefixArgsrZ      s5    &&
MN
7  9r   c           	      .   U R                  SSSS9n[        R                  R                  S5      nUR	                  5       nUS   nU H  nUS   S:X  d  M  SUS'   M     [
        R                  " S	S
SSSUS9/n[        R                  " U5      R                  U5        [        R                  " SSSSSSS9R                  U5        [        R                  " SSSSSSS9R                  U5        [        R                  " SSSS/SS9R                  U5        g)z/Add BigQuery destination args to argument list.Fz.The BigQuery destination for exporting assets.mutexr*   r   bq.table
attributesattribute_namedatasetbigquery-datasetz	export tobigquery-tableTverbnamer*   prefixes
positionalresource_dataz--output-bigquery-force
store_trueforce_zIf the destination table already exists and this flag is specified, the table will be overwritten by the contents of assets snapshot. If the flag is not specified and the destination table already exists, the export call returns an error.)actiondestrB   r*   r   z--per-asset-type	per_type_zIf the flag is specified, the snapshot results will be written to one or more tables, each of which contains results of one asset type.z--partition-keyz	read-timezrequest-timezIf specified. the snapshot results will be written to partitioned table(s) with two additional timestamp columns, readTime and requestTime, one of which will be the partition key.)r*   rO   help_strN)	add_groupr   ResourceYAMLDataFromPathGetDatar
   GetResourcePresentationSpecr   ConceptParserr.   r   ArgumentChoiceArgumentr   bigquery_grouprM   	table_dicr_   attr	arg_specss          r   AddOutputPathBigQueryArgsr}      s=   ##; $ =. ''00<( )&*d*1d  //!#) 	*66~F--.
0 1<N0K-- (K7N+A	 
^	$r   c                 f    U R                  SSSS9n[        USS9  [        U5        [        U5        g )NTz*The destination path for exporting assets.r\   Fr)   )rp   rX   rZ   r}   r   destination_groups     r   AddDestinationArgsr      s@    &&7 ' 9 %6+,-.r   c                 P    U R                  SSS[        R                  " 5       SS9  g )N--asset-namesASSET_NAMESTzA list of full names of the assets to get the history for. For more information, see: https://cloud.google.com/apis/design/resource_names#full_resource_name rT   rC   r   s    r   AddAssetNamesArgsr      s0     T  		r   c                 X    U R                  SS[        R                  R                  SS9  g )Nz--start-timeTzStart time of the time window (inclusive) for the asset history. Must be after the current time minus 35 days. See $ gcloud topic datetimes for information on time formats.r*   r9   r   r:   r   s    r   AddStartTimeArgsr      s/    %%9	  ;r   c                 X    U R                  SS[        R                  R                  SS9  g )Nz
--end-timeFzEnd time of the time window (exclusive) for the asset history. Defaults to current time if not specified. See $ gcloud topic datetimes for information on time formats.r   r:   r   s    r   AddEndTimeArgsr     s1    %%L	  Nr   c                 &    U R                  SSSS9  g )NidOPERATION_NAMEz"Name of the operation to describe.r   r   r   s    r   AddOperationArgsr     s    
$+O  Qr   c                 .    SnU R                  S/ SQUS9  g )NzAsset content type. If not specified, no content but the asset name and type will be returned in the feed. For more information, see https://cloud.google.com/asset-inventory/docs/reference/rest/v1/feeds#ContentTyperK   rL   rO   r   r   r    s     r   AddListContentTypeArgsr     s/    Z 
 	   r   c                 &    U R                  SSUS9  g )Nquery_idQUERY_IDr   r   )r   query_id_help_texts     r   AddSavedQueriesQueryIdr   &  s    *+=  ?r   c                 (    SnU R                  SXS9  g )Nz2Path to JSON or YAML file that contains the query.z--query-file-path)r*   r   r   )r   is_requiredquery_file_path_help_texts      r   AddSavedQueriesQueryFilePathr   +  s#    : K  Qr   c                 (    SnU R                  SUS9  g )NzA string describing the query.z--descriptionr   r   )r   description_help_texts     r   AddSavedQueriesQueryDescriptionr   2  s     &  	o,ABr   c                 &    U R                  SSUS9  g )NfeedFEED_IDr   r   r    s     r   AddFeedIdArgsr   9  s    fii@r   c                 $    U R                  SUS9  g )Nrf   r   r   r    s     r   AddFeedNameArgsr   =  s    f9-r   c                 P    U R                  SS[        R                  " 5       / SS9  g )Nr?   r@   aO  A comma-separated list of types of the assets types to receive updates. For example: `compute.googleapis.com/Disk,compute.googleapis.com/Network`. Regular expressions (https://github.com/google/re2/wiki/Syntax) are also supported. For more information, see: https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overviewrA   rC   r   s    r   AddFeedAssetTypesArgsr   A  s0     Z  	r   c                 P    U R                  SS[        R                  " 5       / SS9  g )NrG   rH   a  A comma-separated list of the relationship types (i.e., "INSTANCE_TO_INSTANCEGROUP") to receive updates. This argument will only be honoured if content_type=RELATIONSHIP.See http://cloud.google.com/asset-inventory/docs/supported-asset-types for supported relationship types.rA   rC   r   s    r   AddFeedRelationshipTypesArgsr   Q  s/    " /  
1r   c                 P    U R                  SS[        R                  " 5       / SS9  g )Nr   r   a  A comma-separated list of the full names of the assets to receive updates. For example: `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. For more information, see: https://cloud.google.com/apis/design/resource_names#full_resource_namerA   rC   r   s    r   AddFeedAssetNamesArgsr   _  s0     o  
	r   c                 f    U R                  SSS9n[        U5        [        U5        [        U5        g )NFT)r]   r*   )rp   r   r   r   r5   s     r   AddFeedCriteriaArgsr   m  s/    !!!=,%%|,r   c                 *    U R                  S/ SQUS9  g )NrK   rL   r   r   r    s     r   FeedContentTypeArgsr   t  s"       r   c                     Sn[        X5        g )NzAsset content type. If not specified, no content but the asset name and type will be returned in the feed. For more information, see https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview#asset_content_typer   r    s     r   AddFeedContentTypeArgsr   ~      i  f(r   c                 (    U R                  SSUSS9  g )Nz--pubsub-topicPUBSUB_TOPICzName of the Cloud Pub/Sub topic to publish to, of the form `projects/PROJECT_ID/topics/TOPIC_ID`. You can list existing topics with `gcloud pubsub topics list --format="text(name)"`)r   r*   r   r   rW   s     r   AddFeedPubSubTopicArgsr     s%    @	  Br   c                     Sn[        X5        g )NzAsset content type to overwrite the existing one. For more information, see: https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview#asset_content_typer   r    s     r   AddChangeFeedContentTypeArgsr     r   r   c                 &    U R                  SSSS9  g )Nz--clear-content-typerj   zClear any existing content type setting on the feed. Content type will be unspecified, no content but the asset name and type will be returned in the feed.rl   r   r   r   s    r   AddClearFeedContentTypeArgsr     s"    E  Gr   c                 N    U R                  SS9n[        U5        [        U5        g NT)r]   )rp   r   r   r5   s     r   AddUpdateFeedContentTypeArgsr     s%    !!!-,|,l+r   c                 $    U R                  SUS9  g )Nz--condition-expressionr   r   r    s     r   FeedConditionExpressionArgsr     s    .Y?r   c                     Sn[        X5        g )NzFeed condition expression. If not specified, no condition will be applied to feed. For more information, see: https://cloud.google.com/asset-inventory/docs/monitoring-asset-changes#feed_with_conditionr   r    s     r   AddFeedConditionExpressionArgsr         c  f0r   c                     Sn[        X5        g )NzCondition expression to overwrite the existing one. For more information, see: https://cloud.google.com/asset-inventory/docs/monitoring-asset-changes#feed_with_conditionr   r    s     r   $AddChangeFeedConditionExpressionArgsr     r   r   c                 &    U R                  SSSS9  g )Nz--clear-condition-expressionrj   zbClear any existing condition expression setting on the feed. No condition will be applied to feed.r   r   r   s    r   #AddClearFeedConditionExpressionArgsr     s     $4  6r   c                 N    U R                  SS9n[        U5        [        U5        g r   )rp   r   r   r5   s     r   $AddUpdateFeedConditionExpressionArgsr     s%    !!!-,&|4%l3r   c                 $    U R                  SUS9  g )Nz--condition-titler   r   r    s     r   FeedConditionTitleArgsr     s    )	:r   c                     Sn[        X5        g )Nz0Title of the feed condition. For reference only.r   r    s     r   AddFeedConditionTitleArgsr     s    A)+r   c                     Sn[        X5        g )Nz.Condition title to overwrite the existing one.r   r    s     r   AddChangeFeedConditionTitleArgsr     s    ?)+r   c                 &    U R                  SSSS9  g )Nz--clear-condition-titlerj   zVClear any existing condition title setting on the feed. Condition title will be empty.r   r   r   s    r   AddClearFeedConditionTitleArgsr     s     -  /r   c                 N    U R                  SS9n[        U5        [        U5        g r   )rp   r   r   r5   s     r   AddUpdateFeedConditionTitleArgsr     s%    !!!-,!,/ .r   c                 $    U R                  SUS9  g )Nz--condition-descriptionr   r   r    s     r   FeedConditionDescriptionArgsr     s    /i@r   c                     Sn[        X5        g )Nz6Description of the feed condition. For reference only.r   r    s     r   AddFeedConditionDescriptionArgsr     s    G)v1r   c                     Sn[        X5        g )Nz4Condition description to overwrite the existing one.r   r    s     r   %AddChangeFeedConditionDescriptionArgsr     s    E)v1r   c                 &    U R                  SSSS9  g )Nz--clear-condition-descriptionrj   zbClear any existing condition description setting on the feed. Condition description will be empty.r   r   r   s    r   $AddClearFeedConditionDescriptionArgsr      s     %3  5r   c                 N    U R                  SS9n[        U5        [        U5        g r   )rp   r   r   r5   s     r   %AddUpdateFeedConditionDescriptionArgsr     s%    !!!-,'5&|4r   c                 $    U R                  SSS9  g )Nz--full-resource-namezThe full resource name.r   r   r   s    r   AddAnalyzerFullResourceNameArgsr     s    ,3LMr   c                 <    U R                  SSSS9n[        U5        g )NFz>Specifies a resource for analysis. Leaving it empty means ANY.r\   )rp   r   )r   resource_selector_groups     r    AddAnalyzerResourceSelectorGroupr     s-    ",,K - M ""9:r   c                 $    U R                  SSS9  g )Nz
--identityzKThe identity appearing in the form of principals in the IAM policy binding.r   r   r   s    r   AddAnalyzerIdentityArgsr     s      r   c                 <    U R                  SSSS9n[        U5        g )NFz?Specifies an identity for analysis. Leaving it empty means ANY.r\   )rp   r   )r   identity_selector_groups     r    AddAnalyzerIdentitySelectorGroupr   "  s-    ",,L - N 12r   c                 N    U R                  SS[        R                  " 5       SS9  g )Nz--rolesROLESz"The roles to appear in the result.r   r9   r   rC   r   s    r   AddAnalyzerRolesArgsr   *  s*     /	  1r   c                 N    U R                  SS[        R                  " 5       SS9  g )Nz--permissionsPERMISSIONSz(The permissions to appear in the result.r   rC   r   s    r   AddAnalyzerPermissionsArgsr   2  s*     5	  7r   c                 R    U R                  SSSS9n[        U5        [        U5        g )NFzHSpecifies roles or permissions for analysis. Leaving it empty means ANY.r\   )rp   r   r   )r   access_selector_groups     r   AddAnalyzerAccessSelectorGroupr   :  s7     ** + 
 ,-23r   c                 F    [        U 5        [        U 5        [        U 5        g )N)r   r   r   r   s    r   AddAnalyzerSelectorsGroupr   D  s    "6*"6* (r   c                 D    U R                  SSSS9  U R                  SS9  g )Nz--expand-groupsrj   zIf true, the identities section of the result will expand any Google groups appearing in an IAM policy binding. Default is false.r   F)expand_groupsr   set_defaultsr   s    r   AddAnalyzerExpandGroupsArgsr   J  s4    P	  	 	E*r   c                 D    U R                  SSSS9  U R                  SS9  g )Nz--expand-rolesrj   zIf true, the access section of result will expand any roles appearing in IAM policy bindings to include their permissions. Default is false.r   F)expand_rolesr   r   s    r   AddAnalyzerExpandRolesArgsr   U  s3       " 	5)r   c                 D    U R                  SSSS9  U R                  SS9  g )Nz--expand-resourcesrj   zIf true, the resource section of the result will expand any resource attached to an IAM policy to include resources lower in the resource hierarchy. Default is false.r   F)expand_resourcesr   r   s    r   AddAnalyzerExpandResourcesArgsr   _  s3    8  : 	u-r   c                 D    U R                  SSSS9  U R                  SS9  g )Nz--output-resource-edgesrj   zlIf true, the result will output the relevant parent/child relationships between resources. Default is false.r   F)output_resource_edgesr   r   s    r   "AddAnalyzerOutputResourceEdgesArgsr  i  s3       " 	E2r   c                 D    U R                  SSSS9  U R                  SS9  g )Nz--output-group-edgesrj   zgIf true, the result will output the relevant membership relationships between groups. Default is false.r   F)output_group_edgesr   r   s    r   AddAnalyzerOutputGroupEdgesArgsr  s  s3       " 	/r   c                 L    U R                  S[        R                  " 5       SS9  g )Nz--execution-timeoutzThe amount of time the executable has to complete. See JSON representation of [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json). Deafult is empty. r8   r   r   Durationr   s    r   AddAnalyzerExecutionTimeoutr
  }  s)    !	  !r   c                 D    U R                  SSSS9  U R                  SS9  g )Nz--show-responserj   zAIf true, the response will be showed as-is in the command output.r   F)show_responser   r   s    r   #AddAnalyzerShowAccessControlEntriesr    s2    
M	  P
 	E*r   c                 D    U R                  SSSS9  U R                  SS9  g)z`Adds analyze service account impersonation arg into options.

Args:
  parser: the option group.
z'--analyze-service-account-impersonationrj   a  If true, the response will include access analysis from identities to resources via service account impersonation. This is a very expensive operation, because many derived queries will be executed. We highly recommend you use AnalyzeIamPolicyLongrunning rpc instead. Default is false.r   F)%analyze_service_account_impersonationNr   r   s    r   1AddAnalyzerAnalyzeServiceAccountImpersonationArgsr    s5     	/	  ! 	EBr   c                 D    U R                  SSSS9  U R                  SS9  g)zWAdds include deny policy analysis arg into options.

Args:
  parser: the option group.
z--include-deny-policy-analysisrj   zIf true, the response will include analysis for deny policies.This is a very expensive operation, because many derived queries will be executed.r   F)include_deny_policy_analysisNr   r   s    r   (AddAnalyzerIncludeDenyPolicyAnalysisArgsr    s5     	&	   	59r   c                     [        U 5      n[        U5        [        U5        [        U5        [	        U5        [        U5        [        U5        U(       a  [        U5        [        U5        gg)Adds a group of options.N)	r   r   r   r   r  r  r  r
  r  )r   is_syncoptions_groups      r   AddAnalyzerOptionsGroupr    sT    %f--m,]+ /$]3!-03MB.'6 r   c                 V    U R                  S[        R                  R                  SS9  g )Nz--access-timez=The hypothetical access timestamp to evaluate IAM conditions.r8   r:   r   s    r   AddAnalyzerAccessTimeArgsr    s+    %%K  Nr   c                 J    U R                  SSSS9nSnUR                  SUS9  g)zAdds a saved analysis query.Fz-Specifies the name of a saved analysis query.r\   a  The name of a saved query. 
When a `saved_analysis_query` is provided, its query content will be used as the base query. Other flags' values will override the base query to compose the final query to run. IDs might be in one of the following formats:
* projects/project_number/savedQueries/saved_query_id* folders/folder_number/savedQueries/saved_query_id* organizations/organization_number/savedQueries/saved_query_idz--saved-analysis-queryr   N)rp   r   )r   r   texts      r   !AddAnalyzerSavedAnalysisQueryArgsr    sB    ",,: - <
H  &&'?d&Kr   c                 <    U R                  SSSS9n[        U5        g)r  Fz4The hypothetical context to evaluate IAM conditions.r\   N)rp   r  )r   condition_context_groups     r    AddAnalyzerConditionContextGroupr     s-    ",,A - C 34r   c                 $    U R                  SSS9  g)zAdds the sql statement.z--statementa  A BigQuery Standard SQL compatible statement. If the query execution finishes within timeout and there is no pagination, the full query results will be returned. Otherwise, pass job_reference from previous call as `--job-reference` to obtain the full results.r   Nr   r   s    r   AddStatementArgsr"    s    K  Mr   c                 $    U R                  SSS9  g)z Adds the previous job reference.z--job-referencez<Reference to the query job, which is from the previous call.r   Nr   r   s    r   AddJobReferenceArgsr$    s    J  Mr   c                 R    U R                  SSSS9n[        U5        [        U5        g)zAdds query args.Tz0The query or job reference of the query request.r\   N)rp   r"  r$  )r   query_groups     r   AddQueryArgsr'    s2      = ! ?+ ;k"r   c                 .    U R                  S[        SS9  g)zAdds page size.z--page-sizezWThe maximum number of rows to return in the results. One page is also limited to 10 MB.r8   N)r   intr   s    r   AddPageSizer*    s    
c	  	r   c                 $    U R                  SSS9  g)zAdds page token.z--page-tokenz)A page token received from previous call.r   Nr   r   s    r   AddPageTokenr,    s    G  Jr   c                 L    U R                  S[        R                  " 5       SS9  g)zAdds timeout.z	--timeoutzKMaximum amount of time that the client will wait for the query to complete.r8   Nr  r   s    r   
AddTimeoutr.    s'    !
W	  	r   c                 R    U R                  SSSS9n[        U5        [        U5        g)zAdds read time window.FGSpecifies what time period or point in time to query asset metadata at.r\   N)rp   r   r   )r   time_window_groups     r   AddReadTimeWindowArgsr2    s5    &&T ' 
 $%"#r   c                 R    U R                  SSSS9n[        U5        [        U5        g)zAdds read time.TFr0  r\   N)rp   r=   r2  )r   
time_groups     r   AddTimeArgsr5  )  s2    T   *
 j!
#r   c           	         U R                  SSSS9n[        R                  R                  S5      nUR	                  5       nUS   nU H  nUS   S:X  d  M  SUS'   M     [
        R                  " S	S
SSSUS9/nU(       a%  [        R                  " U5      R                  U5        [        R                  " SSSSSS.S9R                  U5        g)z@Add BigQuery destination args to argument list for query system.Fz*The BigQuery destination for query system.r\   r^   r_   r`   ra   rb   zfor the exportrc   rd   z--write-dispositionzVSpecifies the action that occurs if the destination table or partition already exists.zyIf the table or partition already exists, BigQuery overwrites
              the entire table or all the partition's data.zwIf the table or partition already exists, BigQuery appends the
              data to the table or the latest partition.zRIf the table already exists and contains data, an error is
              returned.)zwrite-truncatezwrite-appendzwrite-empty)ro   rO   N)rp   r   rq   rr   rs   r
   rt   r   ru   r.   r   rw   rx   s          r   AddQuerySystemBigQueryArgsr7  4  s    ##7 $ 9. ''00<( )&*d*1d  //!#) !!),88Hg@<
 Kr   c                 R    U R                  SSSS9n[        U5        [        U5        g )NTz=The destination path for writing IAM policy analysis results.r\   )rp   AddGcsOutputPathArgsAddBigQueryDestinationGroupr   s     r   AddDestinationGroupr;  ]  s5    &&J ' 
 ()/0r   c           	      T    U R                  SSS[        R                  " SS5      SS9  g )Nz--gcs-output-pathGCS_OUTPUT_PATHFrS   zx--gcs-output-path must be a Google Cloud Storage URI starting with "gs://". For example, "gs://bucket_name/object_name".zGoogle Cloud Storage URI where the results will be written. URI must start with "gs://". For example, "gs://bucket_name/object_name".rT   rU   r   s    r   r9  r9  g  s;    &&
BN  r   c                 ~    U R                  SSSS9n[        U5        [        U5        [        U5        [	        U5        g )NFz/BigQuery destination where the results will go.r\   )rp   AddBigQueryDatasetArgsAddBigQueryTablePrefixArgsAddBigQueryPartitionKeyArgsAddBigQueryWriteDispositionArgs)r   bigquery_destination_groups     r   r:  r:  x  sG    %//<  0  
 347889!"<=r   c           	      T    U R                  SSS[        R                  " SS5      SS9  g )Nz--bigquery-datasetBIGQUERY_DATASETTz'^projects/[A-Za-z0-9\-]+/datasets/[\w]+z--bigquery-dataset must be a dataset relative name starting with "projects/". For example, "projects/project_id/datasets/dataset_id".zBigQuery dataset where the results will be written. Must be a dataset relative name starting with "projects/". For example, "projects/project_id/datasets/dataset_id".rT   rU   r   s    r   r?  r?    s9     &&
477  r   c           	      T    U R                  SSS[        R                  " SS5      SS9  g )Nz--bigquery-table-prefixBIGQUERY_TABLE_PREFIXTz[\w]+zd--bigquery-table-prefix must be a BigQuery table name consists of letters, numbers and underscores".zThe prefix of the BigQuery tables to which the analysis results will be written. A table name consists of letters, numbers and underscores".rT   rU   r   s    r   r@  r@    s9    %&&
/  r   c                 *    U R                  SSS/SS9  g )Nz--bigquery-partition-keyPARTITION_KEY_UNSPECIFIEDREQUEST_TIMEzThis enum determines the partition key column for the bigquery tables. Partitioning can improve query performance and reduce query cost by filtering partitions. Refer to https://cloud.google.com/bigquery/docs/partitioned-tables for details.r   r   r   s    r   rA  rA    s%     *N;	  
r   c                 &    U R                  SSSS9  g )Nz--bigquery-write-dispositionBIGQUERY_WRITE_DISPOSITIONzSpecifies the action that occurs if the destination table or partition already exists. The following values are supported: WRITE_TRUNCATE, WRITE_APPEND and WRITE_EMPTY. The default value is WRITE_APPEND.r   r   r   s    r   rB  rB    s     $*	  	r   N)f__doc__
__future__r   r   r   googlecloudsdk.callioper   r   $googlecloudsdk.command_lib.util.apisr   $googlecloudsdk.command_lib.util.argsr	   r
   (googlecloudsdk.command_lib.util.conceptsr   r   r   r!   r$   r'   r3   r6   r=   rE   rI   rP   rX   rZ   r}   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r
  r  r  r  r  r  r  r   r"  r$  r'  r*  r,  r.  r2  r5  r7  r;  r9  r:  r?  r@  rA  rB   r   r   <module>rT     s   ( &  ' / ( : < > D.<C
GI0$"	N*169 3%l/
	;NQ
?
QCA.	 1	-)B)G,@1164;,,//A2255N;3174)+*.30!+C&:&7NL$5MM#	J	$$& R1"	>&$
r   