
                             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
 Ze
j                   G d de
j                                Zy)z Command to update transfer jobs.    )absolute_import)division)unicode_literals)	jobs_util)apis)base)jobs_apitools_util)jobs_flag_utilc                 	   | j                   rd|_        | j                  rt        |j                  dd      r6d|j                  j
                  _        d|j                  j
                  _        t        |j                  dd      rd|j                  j                  _	        | j                  r|j                  rt        d      d|_        | j                  rd|_        | j                   rd|j                  _        | j$                  rd|j                  _        | j(                  rd|j                  _        | j,                  rd|j                  _        t        |j                  dd      r(t        | dd      rd|j                  j
                  _        t        |j                  dd      r|j                  j2                  }| j4                  rg |_        | j8                  rg |_        | j<                  rd|_        | j@                  rd|_!        | jD                  rd|_#        | jH                  rd|_%        ||jM                         k(  rd|j                  _        t        |j                  dd      r|j                  jN                  }| jP                  rd|_)        d|_*        | jP                  rd|_)        d|_*        |jV                  r|jV                  }|}| jX                  rN|j[                         }|j\                  |jZ                  j^                  j`                  k7  r|j\                  |_.        | jb                  rd|_.        ||j[                         k(  rd|_+        n||_+        ||je                         k(  rd|j                  _'        | jf                  rd|_4        | jj                  rg |jh                  _6        | jn                  rd|_8        t        |j                  dd      r| jr                  rd|j                  jt                  _;        | jx                  rd|j                  jt                  _=        t        |j                  jt                  d	d      }|rL| j|                  rd|_?        | j                  rd|_A        | j                  rd|_C        | j                  rd|_E        ||j                         k(  rd|j                  jt                  _G        yyy)
z5Removes fields from TransferJob based on clear flags.NawsS3DataSourceazureBlobStorageDataSourcez.Cannot clear event stream for replication job.clear_s3_cloudfront_domainobjectConditionstransferOptionsawsS3CompatibleDataSource
s3Metadata)Hclear_descriptiondescriptionclear_source_creds_filegetattrtransferSpecr   awsAccessKeyroleArnr   azureCredentialsclear_event_streamreplicationSpec
ValueErroreventStreamclear_schedulescheduleclear_source_agent_poolsourceAgentPoolNameclear_destination_agent_poolsinkAgentPoolNameclear_intermediate_storage_pathgcsIntermediateDataLocationclear_manifest_filetransferManifestcloudfrontDomainr   clear_include_prefixesincludePrefixesclear_exclude_prefixesexcludePrefixes&clear_include_modified_before_absolutelastModifiedBefore%clear_include_modified_after_absolutelastModifiedSince&clear_include_modified_before_relative#minTimeElapsedSinceLastModification%clear_include_modified_after_relative#maxTimeElapsedSinceLastModificationObjectConditionsr   clear_delete_from$deleteObjectsFromSourceAfterTransferdeleteObjectsUniqueInSinkmetadataOptionsclear_preserve_metadataMetadataOptionsstorageClassStorageClassValueValuesEnumSTORAGE_CLASS_PRESERVEclear_custom_storage_classTransferOptionsclear_notification_confignotificationConfigclear_notification_event_types
eventTypesclear_log_configloggingConfigclear_source_endpointr   endpointclear_source_signing_regionregionclear_source_auth_method
authMethodclear_source_list_apilistApiclear_source_network_protocolprotocolclear_source_request_modelrequestModelS3CompatibleMetadatar   )argsmessagesjobobject_conditionstransfer_optionsexisting_metadata_optionsnew_metadata_optionss3_compatible_metadatas           #lib/surface/transfer/jobs/update.py_clear_fieldsr^      s,   	CO	!!s!2D96:c&&315c&&.s!=tDEIc11B	
GHHCO	CL	!!+/C(	&&)-C&	))37C0	(,C%S0$7t148:>c&&7S148((99""*,'""*,'22-1*11,0)22>B;11>B;H5577*.c'S0$7''77>B;370>B;370''"2"B"B6		%	%'779%22h6N6N(()?)?@ (44 
+ 
	(	(,0)	!9!9!;	;+/(+?(83355)-c&	##!C	(((*C%	CS:DA!!<@c009'':>c007$S%5%5%O%O%149		&	&,0)		#	#)-&		+	+*.'		(	(.2+!>!>!@@>Bc00; A% B    c                   0    e Zd ZdZdddZed        Zd Zy)Updatez'Update a Transfer Service transfer job.z4      Update a Transfer Service transfer job.
      a        To disable transfer job 'foo', run:

        $ {command} foo --status=disabled

      To remove the schedule for transfer job 'foo' so that it will only run
      when you manually start it, run:

        $ {command} foo --clear-schedule

      To clear the values from the `include=prefixes` object condition in
      transfer job 'foo', run:

        $ {command} foo --clear-include-prefixes
      )DESCRIPTIONEXAMPLESc                 P    t        j                  |d| j                                y )NT)	is_updaterelease_track)r
   setup_parserReleaseTrack)clsparsers     r]   ArgszUpdate.Args   s     $c.>.>.@r_   c                    t        j                  dd      }t        j                  dd      }t        j                  |j
                        }t        |||       |j                  j                  t        j                  |||            S )Ntransferv1)existing_job)r   GetClientInstanceGetMessagesModuler   api_getnamer^   transferJobsPatchr	   generate_transfer_job_message)selfrU   clientrV   ro   s        r]   Runz
Update.Run   st    ##J5F%%j$7H$$TYY/L$,/$$88(	78 8r_   N)__name__
__module____qualname____doc__detailed_helpclassmethodrk   ry    r_   r]   ra   ra      s/    /


-.  
	8r_   ra   N)r}   
__future__r   r   r   googlecloudsdk.api_lib.transferr   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper   #googlecloudsdk.command_lib.transferr	   r
   r^   UniverseCompatibleCommandra   r   r_   r]   <module>r      sO    ' &  ' 5 , ( B >jCZ *8T\\ *8 *8r_   