
    q                         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  \R                   R"                  S0r\R                   R"                  4S jr " S S\5      rg)z+Utilities for Transcoder API Job Templates.    )absolute_import)division)unicode_literals)encoding)
list_pager)apis)base)util)labels_utilv1c                 Z    [         R                  U 5      n[        R                  " SU5      $ )N
transcoder)VERSION_MAPgetr   GetClientInstance)release_trackapi_versions     2lib/googlecloudsdk/api_lib/transcoder/templates.py_GetClientInstancer      s#    .+			k	::    c                   j    \ rS rSrSr\R                  R                  S4S jrS r	S r
S rS
S jrS	rg)TemplatesClient$   z2Client for template service in the Transcoder API.Nc                     U=(       d    [        U5      U l        U R                  R                  U l        U R                  R                  U l        U R                  R                  R                  U l        g )N)r   clientMESSAGES_MODULEmessageprojects_locations_jobTemplates_serviceJobTemplate_template_class)selfr   r   s      r   __init__TemplatesClient.__init__'   sN    =.}=DK;;..DLKK??DM;;66BBDr   c                    [         R                  " UR                  UR                  5      n[        R
                  " UU R                  R                  R                  5      n[        R                  " U R                  U5      nU=(       d    UR                  Ul        U R                  R                  UR                  5       UUS9nU R                  R!                  U5      $ )a  Create a job template.

Args:
  parent_ref: a Resource reference to a transcoder.projects.locations
    resource for the parent of this template.
  template_id: the ID of the resource to create.
  args: arguments to create a job template.

Returns:
  JobTemplate: Template created
)parentjobTemplateIdjobTemplate)r
   
GetContentfilejsonr   ParseCreateArgsr   r    LabelsValuer   JsonToMessager!   labels4TranscoderProjectsLocationsJobTemplatesCreateRequestRelativeNamer   Create)r"   
parent_reftemplate_idargstemplate_jsonr/   job_templatereqs           r   r2   TemplatesClient.Create-   s     OODIItyy9M(()-)A)A)M)MOF))$*>*>NL 7L$7$7L
,,
K
K&&(!  L "C
 ==$$r   c                     U R                   R                  UR                  5       S9nU R                  R	                  U5      $ )zDelete a job template.

Args:
  template_ref: a resource reference to a
    transcoder.projects.locations.templates resource to delete

Returns:
  Empty: An empty response message.
name)r   4TranscoderProjectsLocationsJobTemplatesDeleteRequestr1   r   Deleter"   template_refr8   s      r   r>   TemplatesClient.DeleteF   s?     ,,
K
K&&( L *C==$$r   c                     U R                   R                  UR                  5       S9nU R                  R	                  U5      $ )zGet a job template.

Args:
  template_ref: a resource reference to a
    transcoder.projects.locations.templates resource to get

Returns:
  JobTemplate: if available, return the full template information.
r;   )r   1TranscoderProjectsLocationsJobTemplatesGetRequestr1   r   Getr?   s      r   rD   TemplatesClient.GetT   s?     ,,
H
H&&( I *C==S!!r   c                     U R                   R                  UR                  5       US9n[        R                  " U R
                  UUSSS9nU$ )aY  List jobs templates.

Args:
  parent_ref: a Resource reference to a transcoder.projects.locations
    resource to list templates for.
  page_size (optional): the number of job templates to fetch in each request
    (affects requests made, but not the yielded results).

Returns:
  JobTemplates: a list of job templates in the specified location
)r&   pageSizejobTemplatesrG   )servicerequest
batch_sizefieldbatch_size_attribute)r   2TranscoderProjectsLocationsJobTemplatesListRequestr1   r   YieldFromListr   )r"   r3   	page_sizer8   resps        r   ListTemplatesClient.Listb   sV     ,,
I
I&&(9 J >C##')D Kr   )r   r!   r   r   )d   )__name__
__module____qualname____firstlineno____doc__r	   ReleaseTrackGAr#   r2   r>   rD   rR   __static_attributes__ r   r   r   r   $   s0    :#'#4#4#7#7 C%2%"r   r   N)rY   
__future__r   r   r   apitools.base.pyr   r   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper	   %googlecloudsdk.command_lib.transcoderr
   $googlecloudsdk.command_lib.util.argsr   rZ   r[   r   r   objectr   r]   r   r   <module>re      s_    2 &  ' % ' , ( 6 <  ##T* &*%6%6%9%9 ;
Rf Rr   