
                            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dlmZ ddlmZ  e	j*                  e	j,                  j.                         G d de	j0                               Zy)zECommand for updating a Cloud Security Command Center BigQuery export.    )absolute_import)division)print_function)unicode_literals)securitycenter_client)base)flags)util)bqexport_util)log)
propertiesc                   2    e Zd ZdZddddZed        Zd Zy)	Updatez1Update a Security Command Center BigQuery export.a        Update a Security Command Center BigQuery export.

      BigQuery exports that are created with Security Command Center API V2 and
      later include a `location` attribute. If the `location` attribute is
      included in the resource name of a BigQuery export, you must specify it
      when referencing the export. For example, the following BigQuery export
      name has `location=eu`:
      `organizations/123/locations/eu/bigQueryExports/test-bq-export`.
      a        Update a BigQuery export with id `test-bq-export` under organization `123`
      with a dataset `abc` in project `234` and a filter on category that equals
      to `XSS_SCRIPTING`:

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

      Update a BigQuery export with id `test-bq-export` under folder `456` with
      a dataset `abc` in project `234` and a filter on category that equals to
      `XSS_SCRIPTING`:

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

      Update a BigQuery export with id `test-bq-export` under project `789` with
      a dataset `abc` in project `234` and a filter on category that equals to
      `XSS_SCRIPTING`:

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

      Update a BigQuery export `test-bq-export` in organization `123` and
      `location=global`. This command updates the target dataset to
      `projects/234/datasets/abc`, the export description to `This is a test
      BigQuery export` and the export filter to `XSS_SCRIPTING`:

        $ gcloud scc bqexports update 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                 b   t         j                  j                  |        t         j                  j                  |        t         j                  j                  |        t         j
                  j                  |        t        j                  |        t        j                  |        | j                  j                  t        j                  j                  j                  j                                t        j                   j                  |        t        j"                  j                  |        y )N)bqexport_flagsDATASET_FLAG_OPTIONALAddToParserDESCRIPTION_FLAGFILTER_FLAGUPDATE_MASK_FLAGAddBigQueryPositionalArgumentAddParentGroupdisplay_info	AddFormatr   VALUEScoredefault_formatGet	scc_flagsAPI_VERSION_FLAGLOCATION_FLAG)parsers    #lib/surface/scc/bqexports/update.pyArgszUpdate.Args_   s    ((44V<##//7**62##//7008!!&)
!!*"3"3"8"8"G"G"K"K"MN**62''/    c                    t        j                  ||j                  d      }t        j                  |      }t        j
                  |      }|dk(  rN|j                         }t        j                  |      |_	        |j                         }||_        |j                  }nM|j                         }t        j                  |      |_	        |j                         }||_        |j"                  }g }|j%                  d      r"|j'                  d       |j(                  |_        |j%                  d      r"|j'                  d       |j*                  |_        |j%                  d      r"|j'                  d       |j,                  |_        |j%                  d      r|j.                  |_        ndj3                  |      |_        d |_        |j5                  |      }	t6        j8                  j;                  d	       |	S )
NT)"version_specific_existing_resourcev1datasetdescriptionfilterupdate_mask,zUpdated.)scc_utilGetVersionFromArgumentsBIG_QUERY_EXPORTr   GetMessages	GetClient6SecuritycenterOrganizationsBigQueryExportsPatchRequestr   "ValidateAndGetBigQueryExportV1Namename)GoogleCloudSecuritycenterV1BigQueryExport)googleCloudSecuritycenterV1BigQueryExportorganizations_bigQueryExports?SecuritycenterOrganizationsLocationsBigQueryExportsPatchRequest"ValidateAndGetBigQueryExportV2Name)GoogleCloudSecuritycenterV2BigQueryExport)googleCloudSecuritycenterV2BigQueryExport'organizations_locations_bigQueryExportsIsKnownAndSpecifiedappendr+   r,   r-   r.   
updateMaskjoinPatchr   statusPrint)
selfargsversionmessagesclientreqexportendpointcomputed_update_maskbq_export_responses
             r%   Runz
Update.Runn   s   
 ..d##G %009H",,W5F$KKMcAA$GchAACf6<c355h 
R
R
T 
 AA$GchAACf6<c3??h	*!!),||fn.!!-0++f)!!(+kkfm .''cnxx 45cn DK!,JJZ r'   N)__name__
__module____qualname____doc__detailed_helpstaticmethodr&   rQ    r'   r%   r   r   !   s7    9	
(
R
i8-t 0 02r'   r   N)rU   
__future__r   r   r   r   googlecloudsdk.api_lib.sccr   googlecloudsdk.callioper   googlecloudsdk.command_lib.sccr	   r!   r
   r0   (googlecloudsdk.command_lib.scc.bqexportsr   r   googlecloudsdk.corer   r   ReleaseTracksReleaseTrackGAUpdateCommandr   rX   r'   r%   <module>rc      sl     L &  % ' < ( = ; B L # * D%%(()~T ~ *~r'   