
                             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  \R                  R                  S0r\R                  R                  4S	 jr " S
 S\5      rg)z+Utilities for Transcoder API Job Templates.    )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   r/   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   4TranscoderProjectsLocationsJobTemplatesDeleteRequestr.   r   Deleter   template_refr5   s      r   r;   TemplatesClient.DeleteC   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.
r8   )r   1TranscoderProjectsLocationsJobTemplatesGetRequestr.   r   Getr<   s      r   rA   TemplatesClient.GetQ   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jobTemplatesrD   )servicerequest
batch_sizefieldbatch_size_attribute)r   2TranscoderProjectsLocationsJobTemplatesListRequestr.   r   YieldFromListr   )r   r0   	page_sizer5   resps        r   ListTemplatesClient.List_   sV     ,,
I
I&&(9 J >C##')D Kr   )r   r   r   r   )d   )__name__
__module____qualname____firstlineno____doc__r   ReleaseTrackGAr    r/   r;   rA   rO   __static_attributes__ r   r   r   r   !   s0    :#'#4#4#7#7 C%2%"r   r   N)rV   apitools.base.pyr   r   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper   %googlecloudsdk.command_lib.transcoderr   $googlecloudsdk.command_lib.util.argsr   rW   rX   r   r   objectr   rZ   r   r   <module>ra      sX    2 & ' , ( 6 <  ##T* &*%6%6%9%9 ;
Rf Rr   