
    >
                     2    S r SSKrSSKJr   " S S\5      rg)z9Utility classes for interacting with the Cloud Build API.    N)buildc                       \ rS rSrSr " S S\R                  5      rSS jrS r	S r
S	 r\S
 5       r\S 5       r\S 5       r\S 5       r\S 5       rSrg)BuildArtifact   zRepresents a build of a flex container, either in-progress or completed.

A build artifact is either a build_id for an in-progress build, the image
name for a completed container build, or options for the build to be created
elsewhere.
c                        \ rS rSrSrSrSrSrg)BuildArtifact.BuildType             N)__name__
__module____qualname____firstlineno__IMAGEBUILD_IDBUILD_OPTIONS__static_attributes__r       'lib/googlecloudsdk/api_lib/app/build.py	BuildTyper      s    EHMr   r   Nc                 (    Xl         X l        X0l        g N)
build_type
identifierbuild_op)selfr   r   r   s       r   __init__BuildArtifact.__init__#   s     O OMr   c                 H    U R                   U R                  R                  :H  $ r   )r   r   r   r   s    r   IsImageBuildArtifact.IsImage(   s    ??dnn2222r   c                 H    U R                   U R                  R                  :H  $ r   )r   r   r   r"   s    r   	IsBuildIdBuildArtifact.IsBuildId+   s    ??dnn5555r   c                 H    U R                   U R                  R                  :H  $ r   )r   r   r   r"   s    r   IsBuildOptionsBuildArtifact.IsBuildOptions.   s    ??dnn::::r   c                 <    U " U R                   R                  U5      $ r   )r   r   )clsbuild_ids     r   MakeBuildIdArtifact!BuildArtifact.MakeBuildIdArtifact1   s    s}}%%x00r   c                 <    U " U R                   R                  U5      $ r   )r   r   )r,   
image_names     r   MakeImageArtifactBuildArtifact.MakeImageArtifact5   s    s}}""J//r   c                 <    U " U R                   R                  U5      $ r   )r   r   )r,   build_optionss     r   MakeBuildOptionsArtifact&BuildArtifact.MakeBuildOptionsArtifact9   s    s}}**M::r   c                 h    [         R                  " USSS9nU " U R                  R                  X!5      $ )NidT)required)r   GetBuildPropr   r   )r,   r   r-   s      r   MakeBuildIdArtifactFromOp'BuildArtifact.MakeBuildIdArtifactFromOp=   s-    !!(D4@Hs}}%%x::r   c                    [         R                  " US5      nUR                  R                   Hd  nUR                  S:X  d  M  UR
                  R                  R                   H+  nUR                  S:X  d  M  UR
                  R                  nM-     Mf     Wc  [         R                  " S5      eU " U R                  R                  XQ5      $ )z0Create Image BuildArtifact from build operation.sourcestorageSourceobjectzCould not determine image name)
r   r;   object_value
propertieskeyvaluestring_valueBuildFailedErrorr   r   )r,   r   r?   propstorage_propr1   s         r   MakeImageArtifactFromOp%BuildArtifact.MakeImageArtifactFromOpB   s     (3F##..	_	$ JJ33>>L)%++88J ? / ""#CDDs}}""J99r   )r   r   r   r   )r   r   r   r   __doc__enumEnumr   r   r#   r&   r)   classmethodr.   r2   r6   r<   rJ   r   r   r   r   r   r      s    $)) 

36; 1 1 0 0 ; ; ; ; : :r   r   )rL   rM   !googlecloudsdk.api_lib.cloudbuildr   rA   r   r   r   r   <module>rQ      s    @  39:F 9:r   