pycfmodel 1.0.0__tar.gz → 1.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. pycfmodel-1.1.0/PKG-INFO +140 -0
  2. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/cloudformation_actions.py +1670 -58
  3. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/model/resources/generic_resource.py +15 -3
  4. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/model/resources/properties/statement.py +1 -1
  5. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/resolver.py +8 -1
  6. pycfmodel-1.1.0/pycfmodel.egg-info/PKG-INFO +140 -0
  7. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel.egg-info/requires.txt +1 -1
  8. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pyproject.toml +4 -4
  9. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/setup.py +3 -3
  10. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/tests/resources/test_generic_resoure.py +36 -0
  11. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/tests/resources/test_kms_key.py +1 -0
  12. pycfmodel-1.0.0/PKG-INFO +0 -137
  13. pycfmodel-1.0.0/pycfmodel.egg-info/PKG-INFO +0 -137
  14. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/LICENSE.md +0 -0
  15. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/README.md +0 -0
  16. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/__init__.py +0 -0
  17. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/action_expander.py +0 -0
  18. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/constants.py +0 -0
  19. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/model/base.py +0 -0
  20. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/model/cf_model.py +0 -0
  21. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/model/generic.py +0 -0
  22. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/model/parameter.py +0 -0
  23. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/model/resources/ec2_vpc_endpoint_policy.py +0 -0
  24. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/model/resources/es_domain.py +0 -0
  25. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/model/resources/iam_group.py +0 -0
  26. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/model/resources/iam_managed_policy.py +0 -0
  27. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/model/resources/iam_policy.py +0 -0
  28. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/model/resources/iam_role.py +0 -0
  29. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/model/resources/iam_user.py +0 -0
  30. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/model/resources/kms_key.py +0 -0
  31. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/model/resources/opensearch_domain.py +0 -0
  32. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/model/resources/properties/policy.py +0 -0
  33. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/model/resources/properties/policy_document.py +0 -0
  34. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/model/resources/properties/property.py +0 -0
  35. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/model/resources/properties/security_group_egress_prop.py +0 -0
  36. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/model/resources/properties/security_group_ingress_prop.py +0 -0
  37. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/model/resources/properties/statement_condition.py +0 -0
  38. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/model/resources/properties/tag.py +0 -0
  39. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/model/resources/properties/types.py +0 -0
  40. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/model/resources/resource.py +0 -0
  41. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/model/resources/s3_bucket.py +0 -0
  42. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/model/resources/s3_bucket_policy.py +0 -0
  43. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/model/resources/security_group.py +0 -0
  44. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/model/resources/security_group_egress.py +0 -0
  45. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/model/resources/security_group_ingress.py +0 -0
  46. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/model/resources/sns_topic_policy.py +0 -0
  47. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/model/resources/sqs_queue_policy.py +0 -0
  48. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/model/resources/types.py +0 -0
  49. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/model/types.py +0 -0
  50. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/model/utils.py +0 -0
  51. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel/utils.py +0 -0
  52. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel.egg-info/SOURCES.txt +0 -0
  53. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel.egg-info/dependency_links.txt +0 -0
  54. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/pycfmodel.egg-info/top_level.txt +0 -0
  55. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/scripts/generate_cloudformation_actions_file.py +0 -0
  56. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/setup.cfg +0 -0
  57. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/tests/resources/properties/test_policy_document.py +0 -0
  58. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/tests/resources/properties/test_principal.py +0 -0
  59. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/tests/resources/properties/test_statement.py +0 -0
  60. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/tests/resources/properties/test_statement_condition.py +0 -0
  61. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/tests/resources/test_ec2_vpc_endpoint_policy.py +0 -0
  62. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/tests/resources/test_es_domain.py +0 -0
  63. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/tests/resources/test_iam_group.py +0 -0
  64. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/tests/resources/test_iam_managed_policy.py +0 -0
  65. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/tests/resources/test_iam_policy.py +0 -0
  66. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/tests/resources/test_iam_role.py +0 -0
  67. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/tests/resources/test_iam_user.py +0 -0
  68. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/tests/resources/test_opensearch_domain.py +0 -0
  69. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/tests/resources/test_rds_security_groups.py +0 -0
  70. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/tests/resources/test_s3_bucket.py +0 -0
  71. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/tests/resources/test_s3_bucket_policy.py +0 -0
  72. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/tests/resources/test_security_group.py +0 -0
  73. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/tests/resources/test_security_group_egress.py +0 -0
  74. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/tests/resources/test_security_group_ingress.py +0 -0
  75. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/tests/resources/test_sns_topic_policy.py +0 -0
  76. {pycfmodel-1.0.0 → pycfmodel-1.1.0}/tests/resources/test_sqs_queue_policy.py +0 -0
@@ -0,0 +1,140 @@
1
+ Metadata-Version: 2.1
2
+ Name: pycfmodel
3
+ Version: 1.1.0
4
+ Summary: A python model for CloudFormation scripts
5
+ Home-page: https://github.com/Skyscanner/pycfmodel
6
+ Author: Skyscanner Product Security
7
+ Author-email: security@skyscanner.net
8
+ License: UNKNOWN
9
+ Platform: UNKNOWN
10
+ Requires-Python: >=3.9
11
+ Description-Content-Type: text/markdown
12
+ Provides-Extra: dev
13
+ Provides-Extra: docs
14
+ License-File: LICENSE.md
15
+
16
+ # pycfmodel
17
+
18
+ ![Build Status](https://github.com/Skyscanner/pycfmodel/workflows/PyPI%20release/badge.svg)
19
+ [![PyPI version](https://badge.fury.io/py/pycfmodel.svg)](https://badge.fury.io/py/pycfmodel)
20
+ [![Documentation Status](https://readthedocs.org/projects/pycfmodel/badge/?version=latest)](https://pycfmodel.readthedocs.io/en/latest/?badge=latest)
21
+ ![License](https://img.shields.io/github/license/skyscanner/pycfmodel)
22
+
23
+ *A python model for Cloud Formation scripts.*
24
+
25
+ **pycfmodel** makes it easier to work with CloudFormation scripts in Python by
26
+ creating a model comprised of python objects. Objects have various helper
27
+ functions which help with performing common tasks related to parsing and
28
+ inspecting CloudFormation scripts.
29
+
30
+ `pip install pycfmodel`
31
+
32
+ ## Currently Supported
33
+
34
+ * AWSTemplateFormatVersion
35
+ * Conditions
36
+ * Description
37
+ * Mappings
38
+ * Metadata
39
+ * Outputs
40
+ * Parameters
41
+ * Resources:
42
+ * Properties:
43
+ * Policy
44
+ * Policy Document
45
+ * Principal
46
+ * Security Group Egress Prop
47
+ * Security Group Ingress Prop
48
+ * Statement
49
+ * Tag
50
+ * EC2 VPC Endpoint Policy
51
+ * Generic Resource
52
+ * IAM Group
53
+ * IAM Managed Policy
54
+ * IAM Policy
55
+ * IAM Role
56
+ * IAM User
57
+ * KMS Key
58
+ * OpenSearch Service (legacy ElasticSearch resource)
59
+ * Elasticsearch Domain
60
+ * OpenSearch Service
61
+ * OpenSearchService Domain
62
+ * S3 Bucket
63
+ * S3 Bucket Policy
64
+ * Security Group
65
+ * Security Group Egress
66
+ * Security Group Ingress
67
+ * SNS Topic Policy
68
+ * SQS Queue Policy
69
+ * Transform
70
+
71
+ ## Example
72
+
73
+ ```python
74
+ from pycfmodel import parse
75
+
76
+ template = {
77
+ "AWSTemplateFormatVersion": "2010-09-09",
78
+ "Parameters": {"StarParameter": {"Type": "String", "Default": "*", "Description": "Star Param"}},
79
+ "Resources": {
80
+ "rootRole": {
81
+ "Type": "AWS::IAM::Role",
82
+ "Properties": {
83
+ "AssumeRolePolicyDocument": {
84
+ "Version": "2012-10-17",
85
+ "Statement": [
86
+ {
87
+ "Effect": "Allow",
88
+ "Principal": {"AWS": {"Fn::Sub": "arn:aws:iam::${AWS::AccountId}:root"}},
89
+ "Action": ["sts:AssumeRole"],
90
+ }
91
+ ],
92
+ },
93
+ "Path": "/",
94
+ "Policies": [
95
+ {
96
+ "PolicyName": "root",
97
+ "PolicyDocument": {
98
+ "Version": "2012-10-17",
99
+ "Statement": [
100
+ {
101
+ "Effect": "Allow",
102
+ "Action": {"Ref": "StarParameter"},
103
+ "Resource": {"Ref": "StarParameter"},
104
+ }
105
+ ],
106
+ },
107
+ }
108
+ ],
109
+ },
110
+ }
111
+ },
112
+ }
113
+
114
+ model = parse(template).resolve(extra_params={"AWS::AccountId": "123"})
115
+ rootRole = model.Resources["rootRole"]
116
+ policy = rootRole.Properties.Policies[0]
117
+ statement = policy.PolicyDocument.Statement[0]
118
+
119
+ assert statement.Action == "*"
120
+ assert statement.Resource == "*"
121
+ assert rootRole.Properties.AssumeRolePolicyDocument.Statement[0].Principal == {"AWS": "arn:aws:iam::123:root"}
122
+ ```
123
+
124
+ ## Local Development Commands
125
+
126
+ ```bash
127
+ make install-dev
128
+ make coverage
129
+ make test
130
+ make freeze
131
+ ```
132
+
133
+ If the test `tests/test_constants.py::test_cloudformation_actions` is failing, it can be resolved by updating the known
134
+ AWS Actions:
135
+
136
+ ```bash
137
+ python3 scripts/generate_cloudformation_actions_file.py
138
+ ```
139
+
140
+