
    4                        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  ej                   ej"                  j$                  ej"                  j&                         G d dej(                               Zy)z,Cloud Pub/Sub topics set-iam-policy command.    )absolute_import)division)unicode_literals)topics)base)iam_util)flags)resource_args)logc                   L    e Zd ZdZ ej
                  dd      Zed        Zd Z	y)SetIamPolicyz-Set the IAM policy for a Cloud Pub/Sub Topic.topiczmy-topicc                 Z    t        j                  | d       t        j                  |        y )Nzto set an IAM policy on.)r
   AddTopicResourceArgr	   AddIamPolicyFileFlag)parsers    +lib/surface/pubsub/topics/set_iam_policy.pyArgszSetIamPolicy.Args#   s!    %%f.HI	v&    c                    t        j                         }|j                  }|j                  j                  j                         }t        j                  |j                  |j                        }|j                  ||      }t        j                  j                  dj                  |j                                      |S )N)policyz"Updated IAM policy for topic [{}].)r   TopicsClientmessagesCONCEPTSr   Parser   ParsePolicyFilepolicy_filePolicyr   r   statusPrintformatName)selfargsclientr   	topic_refr   responses          r   RunzSetIamPolicy.Run(   s      "FH##))+I%%d&6&6HF""9V"<HJJ9@@ Or   N)
__name__
__module____qualname____doc__r   GetDetailedHelpForSetIamPolicydetailed_helpstaticmethodr   r(    r   r   r   r      s0    59(99':N-' '
r   r   N)r,   
__future__r   r   r   googlecloudsdk.api_lib.pubsubr   googlecloudsdk.callioper   googlecloudsdk.command_lib.iamr   !googlecloudsdk.command_lib.pubsubr	   r
   googlecloudsdk.corer   ReleaseTracksReleaseTrackGABETACommandr   r0   r   r   <module>r<      sl    3 &  ' 0 ( 3 3 ; # D%%(($*;*;*@*@A4<<  Br   