
    Vhk                     h    d dl mZmZmZ eZdZdZdZd dl	Z	d dl
mZ d dlmZ d Zed	k(  r e        yy)
    )absolute_importdivisionprint_functionan  
module: github_issue
short_description: View GitHub issue
description:
  - View GitHub issue for a given repository and organization.
extends_documentation_fragment:
  - community.general.attributes
attributes:
  check_mode:
    support: full
  diff_mode:
    support: none
options:
  repo:
    description:
      - Name of repository from which issue needs to be retrieved.
    required: true
    type: str
  organization:
    description:
      - Name of the GitHub organization in which the repository is hosted.
    required: true
    type: str
  issue:
    description:
      - Issue number for which information is required.
    required: true
    type: int
  action:
    description:
      - Get various details about issue depending upon action specified.
    default: 'get_status'
    choices:
      - get_status
    type: str
author:
  - Abhijeet Kasurde (@Akasurde)
zp
issue_status:
  description: State of the GitHub issue.
  type: str
  returned: success
  sample: open, closed
aN  
- name: Check if GitHub issue is closed or not
  community.general.github_issue:
    organization: ansible
    repo: ansible
    issue: 23642
    action: get_status
  register: r

- name: Take action depending upon issue status
  ansible.builtin.debug:
    msg: Do something when issue 23642 is open
  when: r.issue_status == 'open'
N)AnsibleModule)	fetch_urlc                     t        t        t        d      t        d      t        dd      t        dgd            d      } | j                  d	   }| j                  d
   }| j                  d   }| j                  d   }t               }ddd}d|d|d|}t        | ||      \  }}	d|	d   cxk  rdk  s:n |	d   dk(  r| j	                  d|z         | j	                  d|d|	d          t        j                  |j                               }
|dk(  s|5| j                  r|j                  d       n|j                  d|
d           | j                  d i | y )!NT)requiredint)typer	   
get_status)choicesdefault)organizationrepoissueaction)argument_specsupports_check_moder   r   r   r   zapplication/jsonzapplication/vnd.github.v3+json)zContent-TypeAcceptzhttps://api.github.com/repos//z/issues/)headers   statusi  i  zFailed to find issue %s)msgzFailed to send request to z: r   )changedstate)r   issue_status )r   dictparamsr   	fail_jsonjsonloadsread
check_modeupdate	exit_json)moduler   r   r   r   resultr   urlresponseinfogh_objs              r/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/community/general/plugins/modules/github_issue.pymainr/   Q   s]   t,t$ED1E	
 !F ==0L== DMM'"E]]8$FVF +2G
 =I$PU
VCvsG<NHd4>'C'>S !:U!BC3UTUZZ(FMM$M'MM$VG_MEFv    __main__)
__future__r   r   r   r   __metaclass__DOCUMENTATIONRETURNEXAMPLESr"   ansible.module_utils.basicr   ansible.module_utils.urlsr   r/   __name__r   r0   r.   <module>r:      sN    A @%N
  4 /'T zF r0   