
                            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  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  \R8                  " \R:                  R<                  \R:                  R>                  5       " S S\R@                  5      5       r!\RD                  \R8                  " \R:                  RF                  5       " S S\R@                  5      5       5       r$g)z4Implements command to describe an ops agents policy.    )absolute_import)division)unicode_literals)
exceptions)cloud_ops_agents_util)+guest_policy_to_ops_agents_policy_converter)guest_policy_validator)utils)base)parser_utils)
propertiesc                   8    \ rS rSrSrSSS.r\S 5       rS rSr	g	)
DescribeAlphaBeta"   a  Describe a Google Cloud's operations suite agents (Ops Agents) policy.

*{command}* describes a policy that facilitates agent management across
Compute Engine instances based on user specified instance filters. This policy
installs, specifies versioning, enables autoupgrade, and removes Ops Agents.

The command returns the content of one policy. For instance:

  agent_rules:
  - enable_autoupgrade: true
    package_state: installed
    type: ops-agent
    version: latest
  assignment:
    group_labels:
    - app: myapp
      env: prod
    os_types:
    - short_name: ubuntu
      version: '18.04'
    zones:
    - us-central1-a
  create_time: '2021-02-02T02:10:25.344Z'
  description: A test policy to install agents
  etag: <ETAG>
  id: projects/<PROJECT_NUMBER>/guestPolicies/ops-agents-test-policy
  update_time: '2021-02-02T02:10:25.344Z'

If no policies are found, it returns a ``NOT_FOUND'' error.
{description}z          To describe an Ops Agents policy named ``ops-agents-test-policy'' in
          the current project, run:

            $ {command} ops-agents-test-policy
          DESCRIPTIONEXAMPLESc                 0    [         R                  " U 5        g)See base class.N)r   AddSharedArgsparsers    =lib/surface/compute/instances/ops_agents/policies/describe.pyArgsDescribeAlphaBeta.ArgsM   s     v&    c                    U R                  5       n[        R                  R                  R                  R                  5       n[        R                  " SX1R                  5      n[        R                  " USS9nUR                  n[        R                  " USS9nUR                  US9n UR                  U5      n	[&        R(                  " U	5      (       d  ["        R$                  " UR                  S9e [*        R,                  " U	5      n
U
$ ! [        R                    a    ["        R$                  " UR                  S9ef = f! [.        R0                   a    ["        R2                  " UR                  S9ef = f)r   projectsv1beta)api_version_override)name)	policy_id)ReleaseTrackr   VALUEScoreproject	GetOrFailosconfig_command_utilsGetGuestPolicyUriPath	POLICY_IDosconfig_api_utilsGetClientInstanceprojects_guestPoliciesGetClientMessages'OsconfigProjectsGuestPoliciesGetRequestGetapitools_exceptionsHttpNotFoundErrorops_agents_exceptionsPolicyNotFoundErrorr	   IsOpsAgentPolicyto_ops_agents"ConvertGuestPolicyToOpsAgentPolicycalliope_exceptionsBadArgumentExceptionPolicyMalformedError)selfargsrelease_trackr'   guest_policy_uri_pathclientservicemessagesget_requestget_responseops_agents_policys              r   RunDescribeAlphaBeta.RunR   sW   %%'M$$,,668G2HHG^^  11HF ++G!33HH BB" C KP[[-l "22<@@!55OOQ'JJ

  00 P!55OOP 33 Q!66PPQs   *D 5E 3E 3E6 N
__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr   rF   __static_attributes__rH   r   r   r   r   "   s2    @ %- ' 'r   r   c                   8    \ rS rSrSrSSS.r\S 5       rS rSr	g	)
Describet   a$  Describe a Google Cloud Observability agents policy for the Ops Agent.

*{command}* describes a policy that facilitates agent management across
Compute Engine instances based on user specified instance filters. This policy
installs, specifies versioning, and removes Ops Agents.

The command returns the content of one policy. For instance:

  agentsRule:
    packageState: installed
    version: latest
  instanceFilter:
    inclusionLabels:
    - labels:
        env: prod

If no policies are found, then the command returns a `NOT_FOUND` error.
r   z          To describe an agents policy named `ops-agents-test-policy` in
          the current project, run:

            $ {command} ops-agents-test-policy --zone=ZONE
          r   c                 P    U R                  S[        SS9  U R                  SSSS9  g)	r   r+   z          ID of the policy.

          This ID must contain only lowercase letters,
          numbers, and hyphens, end with a number or a letter, be between 1-63
          characters, and be unique within the project.
          )typehelpz--zoneTz$          Zone of the agents policy.)requiredrW   N)add_argumentstrr   s    r   r   Describe.Args   sB       
 (  r   c                     U R                  5       n[        R                  R                  R                  R                  5       n[        R                  " X!R                  X1R                  5      R                  5       $ )r   )r$   r   r%   r&   r'   r(   r   GetOpsAgentsPolicyFromApir+   zone	ToPyValue)r<   r=   r>   r'   s       r   rF   Describe.Run   sW    %%'M$$,,668G ::~~w		ikr   rH   NrI   rH   r   r   rS   rS   t   s1    ( %-  (r   rS   N)%rN   
__future__r   r   r   apitools.base.pyr   r2   3googlecloudsdk.api_lib.compute.instances.ops_agentsr   r4   >googlecloudsdk.api_lib.compute.instances.ops_agents.convertersr   r7   >googlecloudsdk.api_lib.compute.instances.ops_agents.validatorsr	   (googlecloudsdk.api_lib.compute.os_configr
   r,   googlecloudsdk.callioper   r9   @googlecloudsdk.command_lib.compute.instances.ops_agents.policiesr   ,googlecloudsdk.command_lib.compute.os_configr)   googlecloudsdk.corer   ReleaseTracksr$   BETAALPHADescribeCommandr   UniverseCompatibleGArS   rH   r   r   <module>rq      s    ; &  ' > U c H a P ( E Y X * D%%**D,=,=,C,CDN,, N ENb D%%(():t## : * :r   