
                             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S	KJr  \R"                  \R$                  " \R&                  R(                  5       " S
 S\R*                  5      5       5       rSS0\l        g)z1Command for creating network policy associations.    )absolute_import)division)unicode_literals)ClassVar)base_classes)client)base)flagsc                   T    \ rS rSr% Sr\\R                     \S'   \	S 5       r
S rSrg)Create   zCreate a new association between a network policy and a network.

*{command}* is used to create network policy associations. A network policy is
a set of rules that controls access to various resources.
NETWORK_POLICY_ARGc                     [         R                  " SSS9U l        U R                  R                  USS9  [         R                  " U5        UR
                  R                  [         R                  5        g )NTzcreate association for)required	operationcreate)operation_type)r
    NetworkPolicyAssociationArgumentr   AddArgumentAddArgsCreateAssociationdisplay_infoAddCacheUpdaterNetworkPoliciesCompleter)clsparsers     ;lib/surface/compute/network_policies/associations/create.pyArgsCreate.Args)   s^    "CC!9C &&vh&G	""6*
''(F(FG    c                    [         R                  " U R                  5       5      nU R                  R	                  XR
                  5      n[        R                  " X2R                  S9n[        R                  " S5      R	                  XR
                  5      nUR                  =(       d    SUR                  5       -   nUR                  5       nUR                  R                  R                  UUS9nUR                  UUR                   S9$ )N)compute_clientz1The network to which the network policy attaches.znetwork-)attachmentTargetname)associationnetwork_policy)r   ComputeApiHolderReleaseTrackr   ResolveAsResource	resourcesr   NetworkPolicyr
   NetworkArgumentForOtherResourcer#   NameSelfLinkmessagesNetworkPolicyAssociationAddAssociationr%   )	selfargsholderrefnetwork_policy_clientnetwork_refr#   attachment_targetr$   s	            r   Run
Create.Run2   s    **4+<+<+>?F

!
!
3
3D:J:J
KC"00MM 77;../  997
[%5%5%77D#,,.--((AA* B K
 !//** 0  r    N)__name__
__module____qualname____firstlineno____doc__r   compute_flagsResourceArgument__annotations__classmethodr   r8   __static_attributes__r:   r   r   r   r      s3     }==>>H Hr   r   EXAMPLESaS      To associate a network policy with name ``my-region-policy'' in
    region ``region-a'' to network ``my-network'' with an association
    named ``my-association'', run:

      $ {command}
          --network-policy=my-policy
          --network-policy-region=region-a
          --network=my-network
          --name=my-association
    N)r?   
__future__r   r   r   typingr   googlecloudsdk.api_lib.computer   /googlecloudsdk.api_lib.compute.network_policiesr   googlecloudsdk.callioper	   "googlecloudsdk.command_lib.computer
   r@   3googlecloudsdk.command_lib.compute.network_policiesUniverseCompatibleReleaseTracksr'   ALPHACreateCommandr   detailed_helpr:   r   r   <module>rR      s    8 &  '  7 B ( E E D%%++,)T ) - )Z  
 r   