We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
The cloudwatchlogs_log_group_info module generates throttling exceptions
### Summary

When running the amazon.aws.cloudwatchlogs_log_group_info module on AWS accounts having more than (roughly) 50 log groups we get ThrottlingExceptions once every 20 calls or so. I noticed that both the describe and the list-tags boto calls in the cloudwatchlogs_log_group_info module have no throttling handling configured and use the default throttling handling policy, ie. none. 

### Issue Type

Bug Report

### Component Name

amazon.aws.cloudwatchlogs_log_group_info

### Ansible Version

```console (paste below)
ansible [core 2.13.13]
  config file = None
  configured module search path = ['/home/rundeck/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.8/dist-packages/ansible
  ansible collection location = /home/rundeck/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.8.10 (default, Nov 22 2023, 10:22:35) [GCC 9.4.0]
  jinja version = 3.1.3
  libyaml = True

```


### Collection Versions

```console (paste below)
Collection            Version
--------------------- -------
amazon.aws            7.3.0
community.general     8.3.0
nutanix.ncp           1.7.0
servicenow.servicenow 1.0.6

# /usr/local/lib/python3.8/dist-packages/ansible_collections
Collection                    Version
----------------------------- -------
amazon.aws                    3.5.0
ansible.netcommon             3.1.3
ansible.posix                 1.4.0
ansible.utils                 2.8.0
ansible.windows               1.12.0
arista.eos                    5.0.1
awx.awx                       21.10.0
azure.azcollection            1.14.0
check_point.mgmt              2.3.0
chocolatey.chocolatey         1.3.1
cisco.aci                     2.3.0
cisco.asa                     3.1.0
cisco.dnac                    6.6.1
cisco.intersight              1.0.22
cisco.ios                     3.3.2
cisco.iosxr                   3.3.1
cisco.ise                     2.5.9
cisco.meraki                  2.13.0
cisco.mso                     2.1.0
cisco.nso                     1.0.3
cisco.nxos                    3.2.0
cisco.ucs                     1.8.0
cloud.common                  2.1.2
cloudscale_ch.cloud           2.2.3
community.aws                 3.6.0
[...]
```


### AWS SDK versions

```console (paste below)
WARNING: Package(s) not found: boto
Name: boto3
Version: 1.34.45
Summary: The AWS SDK for Python
Home-page: https://github.com/boto/boto3
Author: Amazon Web Services
Author-email: None
License: Apache License 2.0
Location: /usr/local/lib/python3.8/dist-packages
Requires: botocore, jmespath, s3transfer
Required-by:
---
Name: botocore
Version: 1.34.45
Summary: Low-level, data-driven core of boto 3.
Home-page: https://github.com/boto/botocore
Author: Amazon Web Services
Author-email: None
License: Apache License 2.0
Location: /usr/local/lib/python3.8/dist-packages
Requires: python-dateutil, jmespath, urllib3
Required-by: s3transfer, boto3, awscli
```


### Configuration

```console (paste below)
(no Ansible configuration)
```


### OS / Environment

NAME="Ubuntu"
VERSION="20.04.6 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.6 LTS"

### Steps to Reproduce

```yaml 
- name: "Role based get all log groups in {{ selected_region }}"
  amazon.aws.cloudwatchlogs_log_group_info:
    region: "{{ selected_region }}"
    aws_access_key: "{{ aws_access_key }}"
    aws_secret_key: "{{ aws_secret_key }}"
    aws_session_token: "{{ aws_session_token }}"
    log_group_name: "{{ log_group_prefix }}"
  register: log_groups
```


### Expected Results

Should get all log group information and tags without error. Optionally, allow us to add an option to skip getting the tags for each log group would allow engineers to work around this issue. 

### Actual Results

```console (paste below)
fatal: [127.0.0.1]: FAILED! => {"boto3_version": "1.34.45", "botocore_version": "1.34.45", "changed": false, "error": {"code": "ThrottlingException", "message": "Rate exceeded"}, "msg": "Unable to describe tags for log group /aws/codebuild/tankmaintenanceplanning-pipeline-tsa: An error occurred (ThrottlingException) when calling the ListTagsLogGroup operation (reached max retries: 4): Rate exceeded"
```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `plugins/modules/cloudwatchlogs_log_group_info.py`
Content:
```
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 
4 # Copyright: Ansible Project
5 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
6 
7 DOCUMENTATION = r"""
8 ---
9 module: cloudwatchlogs_log_group_info
10 version_added: 5.0.0
11 short_description: Get information about log_group in CloudWatchLogs
12 description:
13   - Lists the specified log groups. You can list all your log groups or filter the results by prefix.
14   - This module was originally added to C(community.aws) in release 1.0.0.
15 author:
16   - Willian Ricardo (@willricardo) <willricardo@gmail.com>
17 options:
18   log_group_name:
19     description:
20       - The name or prefix of the log group to filter by.
21     type: str
22 extends_documentation_fragment:
23   - amazon.aws.common.modules
24   - amazon.aws.region.modules
25   - amazon.aws.boto3
26 """
27 
28 EXAMPLES = r"""
29 # Note: These examples do not set authentication details, see the AWS Guide for details.
30 - amazon.aws.cloudwatchlogs_log_group_info:
31     log_group_name: test-log-group
32 """
33 
34 RETURN = r"""
35 log_groups:
36     description: Return the list of complex objects representing log groups
37     returned: success
38     type: complex
39     contains:
40         log_group_name:
41             description: The name of the log group.
42             returned: always
43             type: str
44         creation_time:
45             description: The creation time of the log group.
46             returned: always
47             type: int
48         retention_in_days:
49             description: The number of days to retain the log events in the specified log group.
50             returned: always
51             type: int
52         metric_filter_count:
53             description: The number of metric filters.
54             returned: always
55             type: int
56         arn:
57             description: The Amazon Resource Name (ARN) of the log group.
58             returned: always
59             type: str
60         stored_bytes:
61             description: The number of bytes stored.
62             returned: always
63             type: str
64         kms_key_id:
65             description: The Amazon Resource Name (ARN) of the CMK to use when encrypting log data.
66             returned: always
67             type: str
68         tags:
69             description: A dictionary representing the tags on the log group.
70             returned: always
71             type: dict
72             version_added: 4.0.0
73             version_added_collection: community.aws
74 """
75 
76 try:
77     import botocore
78 except ImportError:
79     pass  # Handled by AnsibleAWSModule
80 
81 from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict
82 
83 from ansible_collections.amazon.aws.plugins.module_utils.botocore import is_boto3_error_code
84 from ansible_collections.amazon.aws.plugins.module_utils.modules import AnsibleAWSModule
85 
86 
87 def describe_log_group(client, log_group_name, module):
88     params = {}
89     if log_group_name:
90         params["logGroupNamePrefix"] = log_group_name
91     try:
92         paginator = client.get_paginator("describe_log_groups")
93         desc_log_group = paginator.paginate(**params).build_full_result()
94     except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e:
95         module.fail_json_aws(e, msg=f"Unable to describe log group {log_group_name}")
96 
97     for log_group in desc_log_group["logGroups"]:
98         log_group_name = log_group["logGroupName"]
99         try:
100             tags = client.list_tags_log_group(logGroupName=log_group_name)
101         except is_boto3_error_code("AccessDeniedException"):
102             tags = {}
103             module.warn(f"Permission denied listing tags for log group {log_group_name}")
104         except (
105             botocore.exceptions.ClientError,
106             botocore.exceptions.BotoCoreError,
107         ) as e:  # pylint: disable=duplicate-except
108             module.fail_json_aws(e, msg=f"Unable to describe tags for log group {log_group_name}")
109         log_group["tags"] = tags.get("tags", {})
110 
111     return desc_log_group
112 
113 
114 def main():
115     argument_spec = dict(
116         log_group_name=dict(),
117     )
118 
119     module = AnsibleAWSModule(argument_spec=argument_spec, supports_check_mode=True)
120 
121     try:
122         logs = module.client("logs")
123     except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e:
124         module.fail_json_aws(e, msg="Failed to connect to AWS")
125 
126     desc_log_group = describe_log_group(client=logs, log_group_name=module.params["log_group_name"], module=module)
127     final_log_group_snake = []
128 
129     for log_group in desc_log_group["logGroups"]:
130         final_log_group_snake.append(camel_dict_to_snake_dict(log_group, ignore_list=["tags"]))
131 
132     desc_log_group_result = dict(changed=False, log_groups=final_log_group_snake)
133     module.exit_json(**desc_log_group_result)
134 
135 
136 if __name__ == "__main__":
137     main()
138
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/plugins/modules/cloudwatchlogs_log_group_info.py b/plugins/modules/cloudwatchlogs_log_group_info.py
--- a/plugins/modules/cloudwatchlogs_log_group_info.py
+++ b/plugins/modules/cloudwatchlogs_log_group_info.py
@@ -82,6 +82,18 @@
 
 from ansible_collections.amazon.aws.plugins.module_utils.botocore import is_boto3_error_code
 from ansible_collections.amazon.aws.plugins.module_utils.modules import AnsibleAWSModule
+from ansible_collections.amazon.aws.plugins.module_utils.retries import AWSRetry
+
+
+@AWSRetry.exponential_backoff()
+def list_tags_log_group_with_backoff(client, log_group_name):
+    return client.list_tags_log_group(logGroupName=log_group_name)
+
+
+@AWSRetry.exponential_backoff()
+def describe_log_groups_with_backoff(client, **kwargs):
+    paginator = client.get_paginator("describe_log_groups")
+    return paginator.paginate(**kwargs).build_full_result()
 
 
 def describe_log_group(client, log_group_name, module):
@@ -89,15 +101,14 @@
     if log_group_name:
         params["logGroupNamePrefix"] = log_group_name
     try:
-        paginator = client.get_paginator("describe_log_groups")
-        desc_log_group = paginator.paginate(**params).build_full_result()
+        desc_log_group = describe_log_groups_with_backoff(client, **params)
     except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e:
         module.fail_json_aws(e, msg=f"Unable to describe log group {log_group_name}")
 
     for log_group in desc_log_group["logGroups"]:
         log_group_name = log_group["logGroupName"]
         try:
-            tags = client.list_tags_log_group(logGroupName=log_group_name)
+            tags = list_tags_log_group_with_backoff(client, log_group_name)
         except is_boto3_error_code("AccessDeniedException"):
             tags = {}
             module.warn(f"Permission denied listing tags for log group {log_group_name}")

{"golden_diff": "diff --git a/plugins/modules/cloudwatchlogs_log_group_info.py b/plugins/modules/cloudwatchlogs_log_group_info.py\n--- a/plugins/modules/cloudwatchlogs_log_group_info.py\n+++ b/plugins/modules/cloudwatchlogs_log_group_info.py\n@@ -82,6 +82,18 @@\n \n from ansible_collections.amazon.aws.plugins.module_utils.botocore import is_boto3_error_code\n from ansible_collections.amazon.aws.plugins.module_utils.modules import AnsibleAWSModule\n+from ansible_collections.amazon.aws.plugins.module_utils.retries import AWSRetry\n+\n+\n+@AWSRetry.exponential_backoff()\n+def list_tags_log_group_with_backoff(client, log_group_name):\n+    return client.list_tags_log_group(logGroupName=log_group_name)\n+\n+\n+@AWSRetry.exponential_backoff()\n+def describe_log_groups_with_backoff(client, **kwargs):\n+    paginator = client.get_paginator(\"describe_log_groups\")\n+    return paginator.paginate(**kwargs).build_full_result()\n \n \n def describe_log_group(client, log_group_name, module):\n@@ -89,15 +101,14 @@\n     if log_group_name:\n         params[\"logGroupNamePrefix\"] = log_group_name\n     try:\n-        paginator = client.get_paginator(\"describe_log_groups\")\n-        desc_log_group = paginator.paginate(**params).build_full_result()\n+        desc_log_group = describe_log_groups_with_backoff(client, **params)\n     except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e:\n         module.fail_json_aws(e, msg=f\"Unable to describe log group {log_group_name}\")\n \n     for log_group in desc_log_group[\"logGroups\"]:\n         log_group_name = log_group[\"logGroupName\"]\n         try:\n-            tags = client.list_tags_log_group(logGroupName=log_group_name)\n+            tags = list_tags_log_group_with_backoff(client, log_group_name)\n         except is_boto3_error_code(\"AccessDeniedException\"):\n             tags = {}\n             module.warn(f\"Permission denied listing tags for log group {log_group_name}\")\n", "issue": "The cloudwatchlogs_log_group_info module generates throttling exceptions\n### Summary\n\nWhen running the amazon.aws.cloudwatchlogs_log_group_info module on AWS accounts having more than (roughly) 50 log groups we get ThrottlingExceptions once every 20 calls or so. I noticed that both the describe and the list-tags boto calls in the cloudwatchlogs_log_group_info module have no throttling handling configured and use the default throttling handling policy, ie. none. \n\n### Issue Type\n\nBug Report\n\n### Component Name\n\namazon.aws.cloudwatchlogs_log_group_info\n\n### Ansible Version\n\n```console (paste below)\r\nansible [core 2.13.13]\r\n  config file = None\r\n  configured module search path = ['/home/rundeck/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']\r\n  ansible python module location = /usr/local/lib/python3.8/dist-packages/ansible\r\n  ansible collection location = /home/rundeck/.ansible/collections:/usr/share/ansible/collections\r\n  executable location = /usr/local/bin/ansible\r\n  python version = 3.8.10 (default, Nov 22 2023, 10:22:35) [GCC 9.4.0]\r\n  jinja version = 3.1.3\r\n  libyaml = True\r\n\r\n```\r\n\n\n### Collection Versions\n\n```console (paste below)\r\nCollection            Version\r\n--------------------- -------\r\namazon.aws            7.3.0\r\ncommunity.general     8.3.0\r\nnutanix.ncp           1.7.0\r\nservicenow.servicenow 1.0.6\r\n\r\n# /usr/local/lib/python3.8/dist-packages/ansible_collections\r\nCollection                    Version\r\n----------------------------- -------\r\namazon.aws                    3.5.0\r\nansible.netcommon             3.1.3\r\nansible.posix                 1.4.0\r\nansible.utils                 2.8.0\r\nansible.windows               1.12.0\r\narista.eos                    5.0.1\r\nawx.awx                       21.10.0\r\nazure.azcollection            1.14.0\r\ncheck_point.mgmt              2.3.0\r\nchocolatey.chocolatey         1.3.1\r\ncisco.aci                     2.3.0\r\ncisco.asa                     3.1.0\r\ncisco.dnac                    6.6.1\r\ncisco.intersight              1.0.22\r\ncisco.ios                     3.3.2\r\ncisco.iosxr                   3.3.1\r\ncisco.ise                     2.5.9\r\ncisco.meraki                  2.13.0\r\ncisco.mso                     2.1.0\r\ncisco.nso                     1.0.3\r\ncisco.nxos                    3.2.0\r\ncisco.ucs                     1.8.0\r\ncloud.common                  2.1.2\r\ncloudscale_ch.cloud           2.2.3\r\ncommunity.aws                 3.6.0\r\n[...]\r\n```\r\n\n\n### AWS SDK versions\n\n```console (paste below)\r\nWARNING: Package(s) not found: boto\r\nName: boto3\r\nVersion: 1.34.45\r\nSummary: The AWS SDK for Python\r\nHome-page: https://github.com/boto/boto3\r\nAuthor: Amazon Web Services\r\nAuthor-email: None\r\nLicense: Apache License 2.0\r\nLocation: /usr/local/lib/python3.8/dist-packages\r\nRequires: botocore, jmespath, s3transfer\r\nRequired-by:\r\n---\r\nName: botocore\r\nVersion: 1.34.45\r\nSummary: Low-level, data-driven core of boto 3.\r\nHome-page: https://github.com/boto/botocore\r\nAuthor: Amazon Web Services\r\nAuthor-email: None\r\nLicense: Apache License 2.0\r\nLocation: /usr/local/lib/python3.8/dist-packages\r\nRequires: python-dateutil, jmespath, urllib3\r\nRequired-by: s3transfer, boto3, awscli\r\n```\r\n\n\n### Configuration\n\n```console (paste below)\r\n(no Ansible configuration)\r\n```\r\n\n\n### OS / Environment\n\nNAME=\"Ubuntu\"\r\nVERSION=\"20.04.6 LTS (Focal Fossa)\"\r\nID=ubuntu\r\nID_LIKE=debian\r\nPRETTY_NAME=\"Ubuntu 20.04.6 LTS\"\n\n### Steps to Reproduce\n\n```yaml \r\n- name: \"Role based get all log groups in {{ selected_region }}\"\r\n  amazon.aws.cloudwatchlogs_log_group_info:\r\n    region: \"{{ selected_region }}\"\r\n    aws_access_key: \"{{ aws_access_key }}\"\r\n    aws_secret_key: \"{{ aws_secret_key }}\"\r\n    aws_session_token: \"{{ aws_session_token }}\"\r\n    log_group_name: \"{{ log_group_prefix }}\"\r\n  register: log_groups\r\n```\r\n\n\n### Expected Results\n\nShould get all log group information and tags without error. Optionally, allow us to add an option to skip getting the tags for each log group would allow engineers to work around this issue. \n\n### Actual Results\n\n```console (paste below)\r\nfatal: [127.0.0.1]: FAILED! => {\"boto3_version\": \"1.34.45\", \"botocore_version\": \"1.34.45\", \"changed\": false, \"error\": {\"code\": \"ThrottlingException\", \"message\": \"Rate exceeded\"}, \"msg\": \"Unable to describe tags for log group /aws/codebuild/tankmaintenanceplanning-pipeline-tsa: An error occurred (ThrottlingException) when calling the ListTagsLogGroup operation (reached max retries: 4): Rate exceeded\"\r\n```\r\n\n\n### Code of Conduct\n\n- [X] I agree to follow the Ansible Code of Conduct\n", "before_files": [{"content": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\n# Copyright: Ansible Project\n# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)\n\nDOCUMENTATION = r\"\"\"\n---\nmodule: cloudwatchlogs_log_group_info\nversion_added: 5.0.0\nshort_description: Get information about log_group in CloudWatchLogs\ndescription:\n  - Lists the specified log groups. You can list all your log groups or filter the results by prefix.\n  - This module was originally added to C(community.aws) in release 1.0.0.\nauthor:\n  - Willian Ricardo (@willricardo) <willricardo@gmail.com>\noptions:\n  log_group_name:\n    description:\n      - The name or prefix of the log group to filter by.\n    type: str\nextends_documentation_fragment:\n  - amazon.aws.common.modules\n  - amazon.aws.region.modules\n  - amazon.aws.boto3\n\"\"\"\n\nEXAMPLES = r\"\"\"\n# Note: These examples do not set authentication details, see the AWS Guide for details.\n- amazon.aws.cloudwatchlogs_log_group_info:\n    log_group_name: test-log-group\n\"\"\"\n\nRETURN = r\"\"\"\nlog_groups:\n    description: Return the list of complex objects representing log groups\n    returned: success\n    type: complex\n    contains:\n        log_group_name:\n            description: The name of the log group.\n            returned: always\n            type: str\n        creation_time:\n            description: The creation time of the log group.\n            returned: always\n            type: int\n        retention_in_days:\n            description: The number of days to retain the log events in the specified log group.\n            returned: always\n            type: int\n        metric_filter_count:\n            description: The number of metric filters.\n            returned: always\n            type: int\n        arn:\n            description: The Amazon Resource Name (ARN) of the log group.\n            returned: always\n            type: str\n        stored_bytes:\n            description: The number of bytes stored.\n            returned: always\n            type: str\n        kms_key_id:\n            description: The Amazon Resource Name (ARN) of the CMK to use when encrypting log data.\n            returned: always\n            type: str\n        tags:\n            description: A dictionary representing the tags on the log group.\n            returned: always\n            type: dict\n            version_added: 4.0.0\n            version_added_collection: community.aws\n\"\"\"\n\ntry:\n    import botocore\nexcept ImportError:\n    pass  # Handled by AnsibleAWSModule\n\nfrom ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict\n\nfrom ansible_collections.amazon.aws.plugins.module_utils.botocore import is_boto3_error_code\nfrom ansible_collections.amazon.aws.plugins.module_utils.modules import AnsibleAWSModule\n\n\ndef describe_log_group(client, log_group_name, module):\n    params = {}\n    if log_group_name:\n        params[\"logGroupNamePrefix\"] = log_group_name\n    try:\n        paginator = client.get_paginator(\"describe_log_groups\")\n        desc_log_group = paginator.paginate(**params).build_full_result()\n    except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e:\n        module.fail_json_aws(e, msg=f\"Unable to describe log group {log_group_name}\")\n\n    for log_group in desc_log_group[\"logGroups\"]:\n        log_group_name = log_group[\"logGroupName\"]\n        try:\n            tags = client.list_tags_log_group(logGroupName=log_group_name)\n        except is_boto3_error_code(\"AccessDeniedException\"):\n            tags = {}\n            module.warn(f\"Permission denied listing tags for log group {log_group_name}\")\n        except (\n            botocore.exceptions.ClientError,\n            botocore.exceptions.BotoCoreError,\n        ) as e:  # pylint: disable=duplicate-except\n            module.fail_json_aws(e, msg=f\"Unable to describe tags for log group {log_group_name}\")\n        log_group[\"tags\"] = tags.get(\"tags\", {})\n\n    return desc_log_group\n\n\ndef main():\n    argument_spec = dict(\n        log_group_name=dict(),\n    )\n\n    module = AnsibleAWSModule(argument_spec=argument_spec, supports_check_mode=True)\n\n    try:\n        logs = module.client(\"logs\")\n    except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e:\n        module.fail_json_aws(e, msg=\"Failed to connect to AWS\")\n\n    desc_log_group = describe_log_group(client=logs, log_group_name=module.params[\"log_group_name\"], module=module)\n    final_log_group_snake = []\n\n    for log_group in desc_log_group[\"logGroups\"]:\n        final_log_group_snake.append(camel_dict_to_snake_dict(log_group, ignore_list=[\"tags\"]))\n\n    desc_log_group_result = dict(changed=False, log_groups=final_log_group_snake)\n    module.exit_json(**desc_log_group_result)\n\n\nif __name__ == \"__main__\":\n    main()\n", "path": "plugins/modules/cloudwatchlogs_log_group_info.py"}], "after_files": [{"content": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\n# Copyright: Ansible Project\n# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)\n\nDOCUMENTATION = r\"\"\"\n---\nmodule: cloudwatchlogs_log_group_info\nversion_added: 5.0.0\nshort_description: Get information about log_group in CloudWatchLogs\ndescription:\n  - Lists the specified log groups. You can list all your log groups or filter the results by prefix.\n  - This module was originally added to C(community.aws) in release 1.0.0.\nauthor:\n  - Willian Ricardo (@willricardo) <willricardo@gmail.com>\noptions:\n  log_group_name:\n    description:\n      - The name or prefix of the log group to filter by.\n    type: str\nextends_documentation_fragment:\n  - amazon.aws.common.modules\n  - amazon.aws.region.modules\n  - amazon.aws.boto3\n\"\"\"\n\nEXAMPLES = r\"\"\"\n# Note: These examples do not set authentication details, see the AWS Guide for details.\n- amazon.aws.cloudwatchlogs_log_group_info:\n    log_group_name: test-log-group\n\"\"\"\n\nRETURN = r\"\"\"\nlog_groups:\n    description: Return the list of complex objects representing log groups\n    returned: success\n    type: complex\n    contains:\n        log_group_name:\n            description: The name of the log group.\n            returned: always\n            type: str\n        creation_time:\n            description: The creation time of the log group.\n            returned: always\n            type: int\n        retention_in_days:\n            description: The number of days to retain the log events in the specified log group.\n            returned: always\n            type: int\n        metric_filter_count:\n            description: The number of metric filters.\n            returned: always\n            type: int\n        arn:\n            description: The Amazon Resource Name (ARN) of the log group.\n            returned: always\n            type: str\n        stored_bytes:\n            description: The number of bytes stored.\n            returned: always\n            type: str\n        kms_key_id:\n            description: The Amazon Resource Name (ARN) of the CMK to use when encrypting log data.\n            returned: always\n            type: str\n        tags:\n            description: A dictionary representing the tags on the log group.\n            returned: always\n            type: dict\n            version_added: 4.0.0\n            version_added_collection: community.aws\n\"\"\"\n\ntry:\n    import botocore\nexcept ImportError:\n    pass  # Handled by AnsibleAWSModule\n\nfrom ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict\n\nfrom ansible_collections.amazon.aws.plugins.module_utils.botocore import is_boto3_error_code\nfrom ansible_collections.amazon.aws.plugins.module_utils.modules import AnsibleAWSModule\nfrom ansible_collections.amazon.aws.plugins.module_utils.retries import AWSRetry\n\n\n@AWSRetry.exponential_backoff()\ndef list_tags_log_group_with_backoff(client, log_group_name):\n    return client.list_tags_log_group(logGroupName=log_group_name)\n\n\n@AWSRetry.exponential_backoff()\ndef describe_log_groups_with_backoff(client, **kwargs):\n    paginator = client.get_paginator(\"describe_log_groups\")\n    return paginator.paginate(**kwargs).build_full_result()\n\n\ndef describe_log_group(client, log_group_name, module):\n    params = {}\n    if log_group_name:\n        params[\"logGroupNamePrefix\"] = log_group_name\n    try:\n        desc_log_group = describe_log_groups_with_backoff(client, **params)\n    except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e:\n        module.fail_json_aws(e, msg=f\"Unable to describe log group {log_group_name}\")\n\n    for log_group in desc_log_group[\"logGroups\"]:\n        log_group_name = log_group[\"logGroupName\"]\n        try:\n            tags = list_tags_log_group_with_backoff(client, log_group_name)\n        except is_boto3_error_code(\"AccessDeniedException\"):\n            tags = {}\n            module.warn(f\"Permission denied listing tags for log group {log_group_name}\")\n        except (\n            botocore.exceptions.ClientError,\n            botocore.exceptions.BotoCoreError,\n        ) as e:  # pylint: disable=duplicate-except\n            module.fail_json_aws(e, msg=f\"Unable to describe tags for log group {log_group_name}\")\n        log_group[\"tags\"] = tags.get(\"tags\", {})\n\n    return desc_log_group\n\n\ndef main():\n    argument_spec = dict(\n        log_group_name=dict(),\n    )\n\n    module = AnsibleAWSModule(argument_spec=argument_spec, supports_check_mode=True)\n\n    try:\n        logs = module.client(\"logs\")\n    except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e:\n        module.fail_json_aws(e, msg=\"Failed to connect to AWS\")\n\n    desc_log_group = describe_log_group(client=logs, log_group_name=module.params[\"log_group_name\"], module=module)\n    final_log_group_snake = []\n\n    for log_group in desc_log_group[\"logGroups\"]:\n        final_log_group_snake.append(camel_dict_to_snake_dict(log_group, ignore_list=[\"tags\"]))\n\n    desc_log_group_result = dict(changed=False, log_groups=final_log_group_snake)\n    module.exit_json(**desc_log_group_result)\n\n\nif __name__ == \"__main__\":\n    main()\n", "path": "plugins/modules/cloudwatchlogs_log_group_info.py"}]}