
                            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  ej$                  ej&                  j(                        ej*                   G d dej,                                      Z ej$                  ej&                  j0                        ej*                   G d dej,                                      Zy)z6Command for listing an organization posture templates.    )absolute_import)division)print_function)unicode_literals)
list_pager)util)base)errors)flagsc                   2    e Zd ZdZddddZed        Zd Zy)	ListNList the details of the Cloud Security Command Center (SCC) posture templates.
          List the details of the Cloud Security Command Center (SCC) posture
          templates for the specified organization.  
          To list Cloud Security Command Center posture templates for organization `123` and in the `global` location, run:

            $ {command} organizations/123/locations/global

            $ {command} --organization=123 --location=global

            z
      This command uses the securityposture/v1 API. The full documentation for
    this API can be found at: https://cloud.google.com/security-command-centerDESCRIPTIONEXAMPLESzAPI REFERENCEc                 l    t         j                  j                  |        t        j                  |        y Nr	   URI_FLAGRemoveFromParserr   AddParentOrFlagsGroupparsers    )lib/surface/scc/posture_templates/list.pyArgsz	List.Args6   &     	MM""6* 
'    c           	      0   t        j                  |d      }t        j                  t        j
                  j                        }t        j                  t        j
                  j                        }t        j                  ||      }|j                  d      r7|j                  d      r&|j                  d      rt        j                  d      |j                  d      r|j                  }nR|j                  d      r,|j                  d      rt        j                  |       d| }nt        j                  d      |j                  |t!        |d	d       t!        |d
d             }t#        j$                  |j&                  |d|j(                  d      S NT)"version_specific_existing_resourcePARENTorganizationlocationz^Cannot provide both a positional `PARENT` and argument (`--organization`, `--location`) flags.z/locations/zXMust provide either positional `PARENT` or both `--organization` and `--location` flags.filter	page_size)parentr&   pageSizer)   postureTemplates)batch_size_attribute
batch_sizefield)scc_utilGetVersionFromArgumentssecurityposture_clientGetMessagesModuler	   ReleaseTrackGAGetClientInstanceValidateAndGetLocationIsKnownAndSpecifiedIsSpecifiedr
   InvalidSCCInputErrorr#    GetParentFromPositionalArguments@SecuritypostureOrganizationsLocationsPostureTemplatesListRequestgetattrr   YieldFromList(organizations_locations_postureTemplatesr'   selfargsversionmessagesclientr%   r(   requests           r   RunzList.Run>   sm   ..G &778I8I8L8LMH#55d6G6G6J6JKF..tW=H  *(T-=-=j-I''4 
 	  *{{f


>
*t/?/?
/K;;DAB+hZXf''$  WWtXt,{D1 X G ##77'>>  r   N__name__
__module____qualname____doc__detailed_helpstaticmethodr   rE    r   r   r   r      s8     W7R-& ( ()r   r   c                   2    e Zd ZdZddddZed        Zd Zy)		ListAlphar   r   r   z
      This command uses the securityposture/v1alpha API. The full documentation for this API can be found at:
      https://cloud.google.com/security-command-centerr   c                 l    t         j                  j                  |        t        j                  |        y r   r   r   s    r   r   zListAlpha.Args   r   r   c           	      0   t        j                  |d      }t        j                  t        j
                  j                        }t        j                  t        j
                  j                        }t        j                  ||      }|j                  d      r7|j                  d      r&|j                  d      rt        j                  d      |j                  d      r|j                  }nR|j                  d      r,|j                  d      rt        j                  |       d| }nt        j                  d      |j                  |t!        |d	d       t!        |d
d             }t#        j$                  |j&                  |d|j(                  d      S r!   )r.   r/   r0   r1   r	   r2   ALPHAr4   r5   r6   r7   r
   r8   r#   r9   r:   r;   r   r<   r=   r'   r>   s           r   rE   zListAlpha.Run   sm   ..G &778I8I8O8OPH#55d6G6G6M6MNF..tW=H  *(T-=-=j-I''4 
 	  *{{f


>
*t/?/?
/K;;DAB+hZXf''$  WWtXt,{D1 X G ##77'>>  r   NrF   rM   r   r   rO   rO   j   s7     W7:-" ( ()r   rO   N)rJ   
__future__r   r   r   r   apitools.base.pyr   #googlecloudsdk.api_lib.scc.posturesr   r0   googlecloudsdk.callioper	   googlecloudsdk.command_lib.sccr
   r.   0googlecloudsdk.command_lib.scc.posture_templatesr   ReleaseTracksr2   r3   DefaultUniverseOnlyListCommandr   rR   rO   rM   r   r   <module>r\      s    = &  % ' ' N ( 1 ; B D%%(()G4 G  *GT D%%++,E   E  -Er   