
    '                         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
 rS r    SS jrS r    SS jrS r    SS jrS rSS jrS rS rS rS rS rS rS rS r g) z!Flags for binauthz command group.    )absolute_import)division)unicode_literals)concepts)arg_parsers)flags)concept_parsers)presentation_specsc            
      |    [         R                  " SS[         R                  " SSS9[         R                  " SSS9S9$ )Nz containeranalysis.projects.notesnoteprojectz2The Container Analysis project for the {resource}.name	help_textz2The Container Analysis Note ID for the {resource}.)resource_name
projectsIdnotesId)r   ResourceSpec ResourceParameterAttributeConfig     :lib/googlecloudsdk/command_lib/container/binauthz/flags.py_GetNoteResourceSpecr      sE    			(::H 77H
 r   c                     U(       a   U R                  SS5      R                  5       $ SU R                  SS5      R                  5       -   $ )N-_z--)replaceupperlower)	base_name
positionals     r   _FormatArgNamer"   +   sB    S#&,,..)##C-33555r   c                     SnU(       d  S[        SR                  U5      U5      0n[        R                  " [        X5      [	        5       U UUS9$ )z=Construct a resource spec for a Container Analysis note flag.Nr   
{}-projectr   concept_spec
group_helprequiredflag_name_overrides)r"   formatpresentation_specs_libResourcePresentationSpecr   r'   r    r(   r!   use_global_project_flagflag_overridess         r   GetNotePresentationSpecr0   2   sV     .	 >,"5"5i"@*MN 
 	8	8)0')(
 r   c            
      r    [         R                  " SS[         R                  [         R                  " SSS9S9$ )Nz&binaryauthorization.projects.attestorsattestorr   The ID of the {resource}.r   )r   r   attestorsIdr   r    DEFAULT_PROJECT_ATTRIBUTE_CONFIGr   r   r   r   _GetAttestorResourceSpecr7   H   s8    			.::;;/	
 r   c                     SnU(       d  S[        SR                  U5      U5      0n[        R                  " [        X5      [	        5       U UUS9$ )z/Construct a resource spec for an attestor flag.Nr   r$   r%   )r"   r*   r+   r,   r7   r-   s         r   GetAttestorPresentationSpecr9   T   sV     .	 >,"5"5i"@*MN 
 	8	8)0+-(
 r   c                     [         R                  " [        R                  S[         R                  [         R
                  " SSS9[         R
                  " SSS9[         R
                  " SSS9[         R
                  " S	S
S9S9$ )NCryptoKeyVersionlocationzThe location of the {resource}.r   keyringzThe keyring of the {resource}.keyzThe key of the {resource}.versionz"The key version of the {resource}.)r   r   locationsId
keyRingsIdcryptoKeysIdcryptoKeyVersionsId)r   r   	kms_flagsCRYPTO_KEY_VERSION_COLLECTIONr6   r   r   r   r    _GetCryptoKeyVersionResourceSpecrF   j   s    			--&::;;5 ::4 <<0 #CC8!
 r   c           	          SnU(       d  S[        SR                  U5      U5      0n[        R                  " [        X5      [	        5       U UU(       + US9$ )z6Construct a resource spec for a CryptoKeyVersion flag.Nr   r$   )r   r&   r'   r(   prefixesr)   )r"   r*   r+   r,   rF   r-   s         r   #GetCryptoKeyVersionPresentationSpecrI      s\     .	 >,"5"5i"@*MN 
 	8	8)035**(
 r   c                 N    [         R                  " U5      R                  U 5        g )N)r	   ConceptParserAddToParser)parserr
   s     r   AddConceptsrN      s     23??Gr   c                 0    U R                  SU[        SS9  g )Nz--artifact-urlzuContainer URL. May be in the `gcr.io/repository/image` format, or may optionally contain the `http` or `https` schemer(   typehelp)add_argumentstr)rM   r(   s     r   AddArtifactUrlFlagrU      s$    D  r   c                  t    [         R                  " SSS[         R                  [         R                  " SSS9S9$ )Nz&binaryauthorization.projects.platformsplatformv1zThe platform.r   )r   api_versionr   platformsIdr5   r   r   r   _GetPlatformResourceSpecr[      s:    			.::;;_
 r   c                     [         R                  R                  S[        5       SR	                  U5      SS9R                  U 5        g)zAdd a resource argument for a platform (containing platform policies).

Args:
  parser: the parser for the command.
  verb: str, the verb to describe the resource, such as 'to list'. (No other
    values besides 'to list' are expected.)
platform_resource_namezThe platform whose policies {}.Tr(   N)r	   rK   ForResourcer[   r*   rL   rM   verbs     r   AddPlatformResourceArgrb      sC     ++ '..t4	 , 
 Kr   c                      [         R                  " SSS[         R                  [         R                  " SSS9[         R                  " SSS9S9$ )	Nz/binaryauthorization.projects.platforms.policiespolicyrX   rW   zbThe platform that the {resource} belongs to. PLATFORM must be one of the following: cloudRun, gke.r   r3   )r   rY   r   rZ   policyIdr5   r   r   r   _GetPlatformPolicyResourceSpecrf      sT    			7::;;F 88#>
 r   c                     [         R                  R                  S[        5       SR	                  U5      SS9R                  U 5        g)zAdd a resource argument for a policy.

Args:
  parser: the parser for the command.
  verb: str, the verb to describe the resource, such as 'to update'.
policy_resource_namez#The resource name of the policy {}.Tr^   N)r	   rK   r_   rf   r*   rL   r`   s     r   AddPlatformPolicyResourceArgri      sC     ++$&+2248	 , 
 Kr   c                     U R                  SSS9nUR                  SS[        R                  SS9  UR                  SSSS	S
9  g)z>Adds a resource argument from file or from one or more images.Tmutexr(   z
--resourceFzEThe JSON or YAML file containing the Kubernetes resource to evaluate.rP   z--imageappendzThe image to evaluate. If the policy being evaluated has scoped checksets, this mode of evaluation will always use the default (unscoped) checkset.)r(   actionrR   N)	add_grouprS   r   ResourceFileName)rM   evaluation_unit_groups     r   AddEvaluationUnitArgrr      sb     ***E$$'' %  $$" % 	r   c                 (    U R                  SSSSS9  g)z"Adds a --no-upload flag to parser.z--no-upload
store_trueFzDo not upload the generated attestations to the image registry (using Sigstore tag conventions). Note, attestations are never uploaded to the transparency log.)rn   defaultrR   NrS   rM   s    r   AddNoUploadArgrx     s#    /  	r   c                 $    U R                  SSS9  g)z(Adds the output file argument to parser.z--output-filezIf a resource is provided and deemed to be conformant, attestations will be added as annotations on the resource and writen back to this file path in the same format as the input file.)rR   Nrv   rw   s    r   AddOutputFileArgrz     s    B  r   c                 l    U R                  SSS9nUR                  SSSSSS9  UR                  SSSS	9  g
)z%Adds the docker creds args to parser.Frk   z--use-docker-credsrt   aW  Whether to use the configuration file where Docker saves authentication credentials when uploading attestations to the registry. If this flag is not passed, or valid credentials are not found, an OAuth2 token for the active gcloud account is used. See https://cloud.google.com/artifact-registry/docs/docker/authentication for more information.)r(   rn   ru   rR   z--docker-config-dirzOverride the directory where the Docker configuration file is searched for. Credentials are pulled from the config.json file under this directory. Defaults to $HOME/.docker.)r(   rR   N)ro   rS   )rM   docker_args_groups     r   AddDockerCredsArgsr}     s\    &&UU&C  # !    >	 ! r   N)r   TTF)r2   TTT)
keyversionTTT)T)!__doc__
__future__r   r   r    googlecloudsdk.calliope.conceptsr   -googlecloudsdk.command_lib.container.binauthzr   googlecloudsdk.command_lib.kmsr   rD   (googlecloudsdk.command_lib.util.conceptsr	   r
   r+   r   r"   r0   r7   r9   rF   rI   rN   rU   r[   rb   rf   ri   rr   rx   rz   r}   r   r   r   <module>r      s    ( &  ' 5 E = D a6 !,	  ,4  .H		(&0	r   