
                             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SKJr  SSKJr  SSKJr  \	R*                  " \	R,                  R.                  5       " S S\	R0                  5      5       rS rS rg)zECommand for creating a Cloud Security Command Center BigQuery export.    )absolute_import)division)print_function)unicode_literals)securitycenter_client)base)flags)util)bqexport_util)log)
propertiesc                   :    \ rS rSrSrSSSS.r\S 5       rS rS	r	g
)Create!   z1Create a Security Command Center BigQuery export.a        Create a Security Command Center BigQuery export.

      BigQuery exports that are created with Security Command Center API V2 and
      later include a `location` attribute. If a location is not specified, the
      default `global` location is used. For example, the following BigQuery
      export name has `location=global` attribute:
      `organizations/123/locations/global/bigQueryExports/test-bq-export`.
      a        To create a BigQuery export `test-bq-export` given organization `123` with a
      dataset `abc` in project `234` and filter on category that equals to
      `XSS_SCRIPTING`, run:

        $ gcloud scc bqexports create test-bq-export           --organization=123           --dataset=projects/234/datasets/abc           --description="This is a test BigQuery export"           --filter="category=\"XSS_SCRIPTING\""

      To create a BigQuery export `test-bq-export` given folder `456` with a
      dataset `abc` in project `234` and filter on category that equals to
      `XSS_SCRIPTING`, run:

        $ gcloud scc bqexports create test-bq-export --folder=456           --dataset=projects/234/datasets/abc           --description="This is a test BigQuery export"           --filter="category=\"XSS_SCRIPTING\""

      To create a BigQuery export test-bq-export given project `789` with a
      dataset `abc` in project `234` and filter on category that equals to
      `XSS_SCRIPTING`, run:

        $ gcloud scc bqexports create test-bq-export --project=789           --dataset=projects/234/datasets/abc           --description="This is a test BigQuery export"           --filter="category=\"XSS_SCRIPTING\""

      To create a BigQuery export `test-bq-export` given organization `123` and
      `location=global` to send findings with `category=XSS_SCRIPTING` to the
      BigQuery dataset `abc` in project `234`, run:

        $ gcloud scc bqexports create test-bq-export           --organization=123           --dataset=projects/234/datasets/abc           --description="This is a test BigQuery export"           --filter="category=\"XSS_SCRIPTING\""
          --location=global
      z      This command uses the Security Command Center API. For more information,
      see [Security Command Center API.](https://cloud.google.com/security-command-center/docs/reference/rest)
      )DESCRIPTIONEXAMPLESzAPI REFERENCEc                 (   [         R                  R                  U 5        [         R                  R                  U 5        [         R                  R                  U 5        [         R
                  " U 5        [         R                  " U 5        U R                  R                  [        R                  R                  R                  R                  5       5        [        R                  R                  U 5        [        R                   R                  U 5        g )N)bqexports_flagsDATASET_FLAG_REQUIREDAddToParserDESCRIPTION_FLAGFILTER_FLAGAddBigQueryPositionalArgumentAddParentGroupdisplay_info	AddFormatr   VALUEScoredefault_formatGet	scc_flagsAPI_VERSION_FLAGLOCATION_FLAG)parsers    #lib/surface/scc/bqexports/create.pyArgsCreate.Args]   s    ))55f=$$008++F311&9""6*
!!*"3"3"8"8"G"G"K"K"MN**62''/    c                    [         R                  " XR                  SS9n[        R                  " U5      n[        R
                  " U5      nUS:X  aI  UR                  5       n[        R                  " U5      nUR                  5       nXul
        UR                  nOHUR                  5       n[        R                  " U5      nUR                  5       nXul        UR                   n[#        U5      Ul        ['        U5      Ul        UR*                  Ul        UR,                  Ul        UR.                  Ul        S Ul        UR1                  U5      n	[2        R4                  R7                  S5        U	$ )NT)"version_specific_existing_resourcev1zCreated.)scc_utilGetVersionFromArgumentsBIG_QUERY_EXPORTr   GetMessages	GetClient7SecuritycenterOrganizationsBigQueryExportsCreateRequestr   "ValidateAndGetBigQueryExportV1Name)GoogleCloudSecuritycenterV1BigQueryExport)googleCloudSecuritycenterV1BigQueryExportorganizations_bigQueryExports@SecuritycenterOrganizationsLocationsBigQueryExportsCreateRequest"ValidateAndGetBigQueryExportV2Name)GoogleCloudSecuritycenterV2BigQueryExport)googleCloudSecuritycenterV2BigQueryExport'organizations_locations_bigQueryExports(_GetBigQueryExportIdFromFullResourceNamebigQueryExportId_GetParentFromFullResourceNameparentdatasetdescriptionfilterr   r   statusPrint)
selfargsversionmessagesclientreqconfig_nameexportendpointbq_export_responses
             r%   Run
Create.Runk   s8    ..##G %009H",,W5F $LLNc!DDTJkAACf6<355h 
S
S
U 
 "DDTJkAACf6<3??hCKPC/<CJ\\FN))FKKFM DK!-JJZ r(    N)
__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr&   rN   __static_attributes__rP   r(   r%   r   r   !   s7    9
'
P
e6-p 0 0%r(   r   c                 F    U R                  S5      nU[        U5      S-
     $ )z4Gets BigQuery export id from the full resource name./   )splitlen)rJ   bq_export_componentss     r%   r;   r;      s)    $**3/	c"67!;	<<r(   c                 H    SR                  U R                  S5      SS 5      $ )zHReturns the parts of the BigQuery export name before "/bigQueryExports".rZ   N)joinr\   )rJ   s    r%   r=   r=      s#    	+##C("-	..r(   N)rU   
__future__r   r   r   r   googlecloudsdk.api_lib.sccr   googlecloudsdk.callioper   googlecloudsdk.command_lib.sccr	   r!   r
   r,   (googlecloudsdk.command_lib.scc.bqexportsr   r   googlecloudsdk.corer   r   ReleaseTracksReleaseTrackGACreateCommandr   r;   r=   rP   r(   r%   <module>rl      su     L &  % ' < ( = ; B M # * D%%(()nT n *nb=/r(   