apigeecli 0.53.4__tar.gz → 0.53.5__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 (99) hide show
  1. {apigeecli-0.53.4/apigeecli.egg-info → apigeecli-0.53.5}/PKG-INFO +10 -26
  2. {apigeecli-0.53.4 → apigeecli-0.53.5}/README.rst +9 -25
  3. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/__init__.py +1 -1
  4. {apigeecli-0.53.4 → apigeecli-0.53.5/apigeecli.egg-info}/PKG-INFO +10 -26
  5. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigeecli.egg-info/SOURCES.txt +0 -1
  6. apigeecli-0.53.4/apigee/apis/pull.py +0 -255
  7. {apigeecli-0.53.4 → apigeecli-0.53.5}/LICENSE +0 -0
  8. {apigeecli-0.53.4 → apigeecli-0.53.5}/NOTICE +0 -0
  9. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/__main__.py +0 -0
  10. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/apiproducts/__init__.py +0 -0
  11. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/apiproducts/apiproducts.py +0 -0
  12. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/apiproducts/commands.py +0 -0
  13. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/apiproducts/serializer.py +0 -0
  14. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/apis/__init__.py +0 -0
  15. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/apis/api_puller_with_dependency_extraction.py +0 -0
  16. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/apis/apis.py +0 -0
  17. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/apis/commands.py +0 -0
  18. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/apis/deploy.py +0 -0
  19. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/apis/serializer.py +0 -0
  20. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/apps/__init__.py +0 -0
  21. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/apps/apps.py +0 -0
  22. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/apps/commands.py +0 -0
  23. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/apps/serializer.py +0 -0
  24. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/auth.py +0 -0
  25. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/backups/__init__.py +0 -0
  26. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/backups/backups.py +0 -0
  27. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/backups/commands.py +0 -0
  28. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/caches/__init__.py +0 -0
  29. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/caches/caches.py +0 -0
  30. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/caches/commands.py +0 -0
  31. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/caches/serializer.py +0 -0
  32. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/cls.py +0 -0
  33. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/configure/__init__.py +0 -0
  34. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/configure/commands.py +0 -0
  35. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/console.py +0 -0
  36. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/crypto.py +0 -0
  37. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/deployments/__init__.py +0 -0
  38. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/deployments/commands.py +0 -0
  39. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/deployments/deployments.py +0 -0
  40. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/deployments/serializer.py +0 -0
  41. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/developers/__init__.py +0 -0
  42. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/developers/commands.py +0 -0
  43. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/developers/developers.py +0 -0
  44. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/developers/serializer.py +0 -0
  45. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/encryption_utils.py +0 -0
  46. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/exceptions.py +0 -0
  47. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/keystores/__init__.py +0 -0
  48. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/keystores/commands.py +0 -0
  49. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/keystores/keystores.py +0 -0
  50. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/keystores/serializer.py +0 -0
  51. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/keyvaluemaps/__init__.py +0 -0
  52. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/keyvaluemaps/commands.py +0 -0
  53. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/keyvaluemaps/keyvaluemaps.py +0 -0
  54. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/keyvaluemaps/serializer.py +0 -0
  55. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/maskconfigs/__init__.py +0 -0
  56. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/maskconfigs/commands.py +0 -0
  57. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/maskconfigs/maskconfigs.py +0 -0
  58. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/maskconfigs/serializer.py +0 -0
  59. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/permissions/__init__.py +0 -0
  60. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/permissions/commands.py +0 -0
  61. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/permissions/permissions.py +0 -0
  62. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/permissions/serializer.py +0 -0
  63. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/plugins/__init__.py +0 -0
  64. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/plugins/commands.py +0 -0
  65. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/prefix.py +0 -0
  66. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/references/__init__.py +0 -0
  67. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/references/commands.py +0 -0
  68. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/references/references.py +0 -0
  69. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/references/serializer.py +0 -0
  70. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/sharedflows/__init__.py +0 -0
  71. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/sharedflows/commands.py +0 -0
  72. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/sharedflows/serializer.py +0 -0
  73. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/sharedflows/sharedflows.py +0 -0
  74. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/silent.py +0 -0
  75. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/targetservers/__init__.py +0 -0
  76. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/targetservers/commands.py +0 -0
  77. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/targetservers/serializer.py +0 -0
  78. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/targetservers/targetservers.py +0 -0
  79. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/types.py +0 -0
  80. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/userroles/__init__.py +0 -0
  81. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/userroles/commands.py +0 -0
  82. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/userroles/userroles.py +0 -0
  83. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/utils.py +0 -0
  84. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/utils_init.py +0 -0
  85. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/verbose.py +0 -0
  86. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/virtualhosts/__init__.py +0 -0
  87. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/virtualhosts/commands.py +0 -0
  88. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/virtualhosts/serializer.py +0 -0
  89. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigee/virtualhosts/virtualhosts.py +0 -0
  90. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigeecli.egg-info/dependency_links.txt +0 -0
  91. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigeecli.egg-info/entry_points.txt +0 -0
  92. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigeecli.egg-info/requires.txt +0 -0
  93. {apigeecli-0.53.4 → apigeecli-0.53.5}/apigeecli.egg-info/top_level.txt +0 -0
  94. {apigeecli-0.53.4 → apigeecli-0.53.5}/setup.cfg +0 -0
  95. {apigeecli-0.53.4 → apigeecli-0.53.5}/setup.py +0 -0
  96. {apigeecli-0.53.4 → apigeecli-0.53.5}/tests/__init__.py +0 -0
  97. {apigeecli-0.53.4 → apigeecli-0.53.5}/tests/test_auth.py +0 -0
  98. {apigeecli-0.53.4 → apigeecli-0.53.5}/tests/test_echo.py +0 -0
  99. {apigeecli-0.53.4 → apigeecli-0.53.5}/tests/test_encryption_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: apigeecli
3
- Version: 0.53.4
3
+ Version: 0.53.5
4
4
  Summary: The Apigee Edge command-line interface is an unofficial Python command-line tool built to simplify and automate Apigee Edge API usage, with support for SSO, MFA, and basic authentication.
5
5
  Home-page: https://github.com/darumatic/apigee-cli
6
6
  Author: Matthew Delotavo
@@ -23,7 +23,7 @@ License-File: NOTICE
23
23
  apigee-cli
24
24
  ==========
25
25
 
26
- |License| |Python version| |Downloads|
26
+ |Python version| |Downloads| |License|
27
27
 
28
28
  .. warning::
29
29
 
@@ -35,11 +35,13 @@ Initially developed for Darumatic clients, this project remains available as a w
35
35
 
36
36
  I have created private forks for clients, where I continued to add features, fixes, and unit tests. However, I do not intend to maintain this public version. Feel free to explore and learn from the code.
37
37
 
38
- If you’re up for a challenge, try updating the code to work with Apigee X :)
38
+ If you’re up for a challenge, try updating the code to work with Apigee X (ง•_•)
39
39
 
40
- .. note::
40
+ -----------------------------------------
41
+ Why use this instead of the official tool
42
+ -----------------------------------------
41
43
 
42
- **apigee-cli** is highly experimental and is not affiliated with Apigee or Google.
44
+ The `official Apigee CLI`_ is powerful and may suit your needs. However, I built this version to better support our CI/CD processes, self-service operations, and DevOps workflows that are difficult to manage with the official tool.
43
45
 
44
46
  ------------
45
47
  Installation
@@ -126,25 +128,6 @@ Run the following command to get a list of API proxies in your ``default`` Apige
126
128
  $ apigee apis list
127
129
  ["helloworld", "oauth"]
128
130
 
129
- --------------------
130
- Why does this exist?
131
- --------------------
132
-
133
- It is intended for general administrative use from your shell, as a package for developers,
134
- and to support automation for common development tasks, such as test automation
135
- or Continuous Integration/Continuous Deployment (CI/CD).
136
-
137
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
138
- When to use this over the official tool
139
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
140
-
141
- Apigee Corporation maintains their own `fully-featured CLI`_ for the Apigee Management API
142
- that can be used as an SDK to orchestrate tasks and may be more than suitable for your needs.
143
-
144
- We built and use the Apigee CLI to implement and distribute features that allow our clients
145
- to manage CI/CD, perform self-service operations and promote our DevOps workflows
146
- which are difficult to perform using official tools.
147
-
148
131
  -------------
149
132
  Running Tests
150
133
  -------------
@@ -182,10 +165,11 @@ For further questions, feel free to contact us at hello@darumatic.com.
182
165
  ----------
183
166
  Disclaimer
184
167
  ----------
185
- This is not an officially supported Google product.
168
+
169
+ This tool is not affiliated with Apigee or Google and is highly experimental.
186
170
 
187
171
 
188
- .. _`fully-featured CLI`: https://github.com/apigee/apigeetool-node
172
+ .. _`official Apigee CLI`: https://github.com/apigee/apigeetool-node
189
173
 
190
174
  .. |Upload Python Package badge| image:: https://github.com/mdelotavo/apigee-cli/workflows/Upload%20Python%20Package/badge.svg
191
175
  :target: https://github.com/mdelotavo/apigee-cli/actions?query=workflow%3A%22Upload+Python+Package%22
@@ -2,7 +2,7 @@
2
2
  apigee-cli
3
3
  ==========
4
4
 
5
- |License| |Python version| |Downloads|
5
+ |Python version| |Downloads| |License|
6
6
 
7
7
  .. warning::
8
8
 
@@ -14,11 +14,13 @@ Initially developed for Darumatic clients, this project remains available as a w
14
14
 
15
15
  I have created private forks for clients, where I continued to add features, fixes, and unit tests. However, I do not intend to maintain this public version. Feel free to explore and learn from the code.
16
16
 
17
- If you’re up for a challenge, try updating the code to work with Apigee X :)
17
+ If you’re up for a challenge, try updating the code to work with Apigee X (ง•_•)
18
18
 
19
- .. note::
19
+ -----------------------------------------
20
+ Why use this instead of the official tool
21
+ -----------------------------------------
20
22
 
21
- **apigee-cli** is highly experimental and is not affiliated with Apigee or Google.
23
+ The `official Apigee CLI`_ is powerful and may suit your needs. However, I built this version to better support our CI/CD processes, self-service operations, and DevOps workflows that are difficult to manage with the official tool.
22
24
 
23
25
  ------------
24
26
  Installation
@@ -105,25 +107,6 @@ Run the following command to get a list of API proxies in your ``default`` Apige
105
107
  $ apigee apis list
106
108
  ["helloworld", "oauth"]
107
109
 
108
- --------------------
109
- Why does this exist?
110
- --------------------
111
-
112
- It is intended for general administrative use from your shell, as a package for developers,
113
- and to support automation for common development tasks, such as test automation
114
- or Continuous Integration/Continuous Deployment (CI/CD).
115
-
116
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
117
- When to use this over the official tool
118
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
119
-
120
- Apigee Corporation maintains their own `fully-featured CLI`_ for the Apigee Management API
121
- that can be used as an SDK to orchestrate tasks and may be more than suitable for your needs.
122
-
123
- We built and use the Apigee CLI to implement and distribute features that allow our clients
124
- to manage CI/CD, perform self-service operations and promote our DevOps workflows
125
- which are difficult to perform using official tools.
126
-
127
110
  -------------
128
111
  Running Tests
129
112
  -------------
@@ -161,10 +144,11 @@ For further questions, feel free to contact us at hello@darumatic.com.
161
144
  ----------
162
145
  Disclaimer
163
146
  ----------
164
- This is not an officially supported Google product.
147
+
148
+ This tool is not affiliated with Apigee or Google and is highly experimental.
165
149
 
166
150
 
167
- .. _`fully-featured CLI`: https://github.com/apigee/apigeetool-node
151
+ .. _`official Apigee CLI`: https://github.com/apigee/apigeetool-node
168
152
 
169
153
  .. |Upload Python Package badge| image:: https://github.com/mdelotavo/apigee-cli/workflows/Upload%20Python%20Package/badge.svg
170
154
  :target: https://github.com/mdelotavo/apigee-cli/actions?query=workflow%3A%22Upload+Python+Package%22
@@ -6,7 +6,7 @@ from apigee import utils_init
6
6
 
7
7
  APP = "apigeecli"
8
8
  CMD = "apigee"
9
- __version__ = "0.53.4"
9
+ __version__ = "0.53.5"
10
10
  description = "The Apigee Edge command-line interface is an unofficial Python command-line tool built to simplify and automate Apigee Edge API usage, with support for SSO, MFA, and basic authentication."
11
11
  long_description = """This tool is no longer actively maintained. Initially developed for Darumatic clients, this project remains available as a working proof of concept, proven reliable in production CI/CD pipelines. The custom plugins feature will remain functional even if Apigee Edge APIs stop working."""
12
12
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: apigeecli
3
- Version: 0.53.4
3
+ Version: 0.53.5
4
4
  Summary: The Apigee Edge command-line interface is an unofficial Python command-line tool built to simplify and automate Apigee Edge API usage, with support for SSO, MFA, and basic authentication.
5
5
  Home-page: https://github.com/darumatic/apigee-cli
6
6
  Author: Matthew Delotavo
@@ -23,7 +23,7 @@ License-File: NOTICE
23
23
  apigee-cli
24
24
  ==========
25
25
 
26
- |License| |Python version| |Downloads|
26
+ |Python version| |Downloads| |License|
27
27
 
28
28
  .. warning::
29
29
 
@@ -35,11 +35,13 @@ Initially developed for Darumatic clients, this project remains available as a w
35
35
 
36
36
  I have created private forks for clients, where I continued to add features, fixes, and unit tests. However, I do not intend to maintain this public version. Feel free to explore and learn from the code.
37
37
 
38
- If you’re up for a challenge, try updating the code to work with Apigee X :)
38
+ If you’re up for a challenge, try updating the code to work with Apigee X (ง•_•)
39
39
 
40
- .. note::
40
+ -----------------------------------------
41
+ Why use this instead of the official tool
42
+ -----------------------------------------
41
43
 
42
- **apigee-cli** is highly experimental and is not affiliated with Apigee or Google.
44
+ The `official Apigee CLI`_ is powerful and may suit your needs. However, I built this version to better support our CI/CD processes, self-service operations, and DevOps workflows that are difficult to manage with the official tool.
43
45
 
44
46
  ------------
45
47
  Installation
@@ -126,25 +128,6 @@ Run the following command to get a list of API proxies in your ``default`` Apige
126
128
  $ apigee apis list
127
129
  ["helloworld", "oauth"]
128
130
 
129
- --------------------
130
- Why does this exist?
131
- --------------------
132
-
133
- It is intended for general administrative use from your shell, as a package for developers,
134
- and to support automation for common development tasks, such as test automation
135
- or Continuous Integration/Continuous Deployment (CI/CD).
136
-
137
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
138
- When to use this over the official tool
139
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
140
-
141
- Apigee Corporation maintains their own `fully-featured CLI`_ for the Apigee Management API
142
- that can be used as an SDK to orchestrate tasks and may be more than suitable for your needs.
143
-
144
- We built and use the Apigee CLI to implement and distribute features that allow our clients
145
- to manage CI/CD, perform self-service operations and promote our DevOps workflows
146
- which are difficult to perform using official tools.
147
-
148
131
  -------------
149
132
  Running Tests
150
133
  -------------
@@ -182,10 +165,11 @@ For further questions, feel free to contact us at hello@darumatic.com.
182
165
  ----------
183
166
  Disclaimer
184
167
  ----------
185
- This is not an officially supported Google product.
168
+
169
+ This tool is not affiliated with Apigee or Google and is highly experimental.
186
170
 
187
171
 
188
- .. _`fully-featured CLI`: https://github.com/apigee/apigeetool-node
172
+ .. _`official Apigee CLI`: https://github.com/apigee/apigeetool-node
189
173
 
190
174
  .. |Upload Python Package badge| image:: https://github.com/mdelotavo/apigee-cli/workflows/Upload%20Python%20Package/badge.svg
191
175
  :target: https://github.com/mdelotavo/apigee-cli/actions?query=workflow%3A%22Upload+Python+Package%22
@@ -25,7 +25,6 @@ apigee/apis/api_puller_with_dependency_extraction.py
25
25
  apigee/apis/apis.py
26
26
  apigee/apis/commands.py
27
27
  apigee/apis/deploy.py
28
- apigee/apis/pull.py
29
28
  apigee/apis/serializer.py
30
29
  apigee/apps/__init__.py
31
30
  apigee/apps/apps.py
@@ -1,255 +0,0 @@
1
- import logging
2
- import os
3
- import xml.etree.ElementTree as et
4
- from pathlib import Path
5
-
6
- from apigee import console
7
- from apigee.apis.apis import Apis
8
- from apigee.caches.caches import Caches
9
- from apigee.keyvaluemaps.keyvaluemaps import Keyvaluemaps
10
- from apigee.targetservers.targetservers import Targetservers
11
- from apigee.utils import (extract_zip, make_dirs, path_exists, paths_exist,
12
- run_func_on_dir_files, run_func_on_iterable)
13
-
14
-
15
- class PullApis:
16
- def __init__(self, auth, org_name, revision_number, environment, work_tree=None):
17
- self.auth = auth
18
- self.org_name = org_name
19
- self.work_tree = work_tree
20
- self.revision_number = revision_number
21
- self.environment = environment
22
- self.keyvaluemaps_dir = "keyvaluemaps"
23
- self.targetservers_dir = "targetservers"
24
- self.caches_dir = "caches"
25
- self._apiproxy_dir = self.work_tree
26
- self.zip_file = str(Path(self.apiproxy_dir).with_suffix(".zip"))
27
-
28
- def __call__(self, *args, **kwargs):
29
- self.pull(*args, **kwargs)
30
-
31
- @property
32
- def auth(self):
33
- return self._auth
34
-
35
- @auth.setter
36
- def auth(self, value):
37
- self._auth = value
38
-
39
- @property
40
- def org_name(self):
41
- return self._org_name
42
-
43
- @org_name.setter
44
- def org_name(self, value):
45
- self._org_name = value
46
-
47
- @property
48
- def revision_number(self):
49
- return self._revision_number
50
-
51
- @revision_number.setter
52
- def revision_number(self, value):
53
- self._revision_number = value
54
-
55
- @property
56
- def environment(self):
57
- return self._environment
58
-
59
- @environment.setter
60
- def environment(self, value):
61
- self._environment = value
62
-
63
- @property
64
- def work_tree(self):
65
- return self._work_tree
66
-
67
- @work_tree.setter
68
- def work_tree(self, value):
69
- if value:
70
- if not os.path.exists(value):
71
- os.makedirs(value)
72
- self._work_tree = str(Path(value).resolve())
73
- else:
74
- self._work_tree = os.getcwd()
75
-
76
- @property
77
- def keyvaluemaps_dir(self):
78
- return self._keyvaluemaps_dir
79
-
80
- @keyvaluemaps_dir.setter
81
- def keyvaluemaps_dir(self, value):
82
- self._keyvaluemaps_dir = str(Path(self.work_tree) / value / self.environment)
83
-
84
- @property
85
- def targetservers_dir(self):
86
- return self._targetservers_dir
87
-
88
- @targetservers_dir.setter
89
- def targetservers_dir(self, value):
90
- self._targetservers_dir = str(Path(self.work_tree) / value / self.environment)
91
-
92
- @property
93
- def caches_dir(self):
94
- return self._caches_dir
95
-
96
- @caches_dir.setter
97
- def caches_dir(self, value):
98
- self._caches_dir = str(Path(self.work_tree) / value / self.environment)
99
-
100
- @property
101
- def apiproxy_dir(self):
102
- return self._apiproxy_dir
103
-
104
- @apiproxy_dir.setter
105
- def apiproxy_dir(self, value):
106
- self._apiproxy_dir = str(Path(self.work_tree) / value)
107
-
108
- @property
109
- def zip_file(self):
110
- return self._zip_file
111
-
112
- @zip_file.setter
113
- def zip_file(self, value):
114
- self._zip_file = value
115
-
116
- # def call_export_method(self, resource_type, files, environment, dependencies=[], force=True):
117
- def call_export_method(self, resource_type, files, environment, force=True):
118
- resource_files = getattr(self, f"get_{resource_type}_dependencies")(files)
119
- # dependencies.extend(resource_files)
120
- getattr(self, f"export_{resource_type}_dependencies")(
121
- environment, resource_files, force=force
122
- )
123
- # return dependencies
124
- return resource_files
125
-
126
- def get_apiproxy_files(self, directory):
127
- return run_func_on_dir_files(str(Path(directory) / "apiproxy"), lambda f: f)
128
-
129
- def get_keyvaluemap_dependencies(self, files):
130
- def _func(f, _state):
131
- try:
132
- root = et.parse(f).getroot()
133
- if (
134
- root.tag == "KeyValueMapOperations"
135
- and root.attrib["mapIdentifier"] not in _state
136
- ):
137
- _state.add(root.attrib["mapIdentifier"])
138
- return root.attrib["mapIdentifier"]
139
- except Exception as e:
140
- logging.warning(f"{e}; file={f}", exc_info=True)
141
-
142
- return run_func_on_iterable(files, _func, args=(set(),))
143
-
144
- def export_keyvaluemap_dependencies(
145
- self, environment, keyvaluemaps, force=False, expc_verbosity=1
146
- ):
147
- make_dirs(self._keyvaluemaps_dir)
148
-
149
- def _func(kvm):
150
- kvm_file = str(Path(self._keyvaluemaps_dir) / f"{kvm}.json")
151
- if not force:
152
- path_exists(os.path.relpath(kvm_file))
153
- resp = (
154
- Keyvaluemaps(self._auth, self._org_name, kvm)
155
- .get_keyvaluemap_in_an_environment(environment)
156
- .text
157
- )
158
- console.echo(resp, expc_verbosity=1)
159
- with open(kvm_file, "w") as f:
160
- f.write(resp)
161
-
162
- return run_func_on_iterable(keyvaluemaps, _func)
163
-
164
- def get_targetserver_dependencies(self, files):
165
- def _func(f, _state):
166
- try:
167
- root = et.parse(f).getroot()
168
- for child in root.iter("Server"):
169
- if child.attrib["name"] not in _state:
170
- _state.add(child.attrib["name"])
171
- return child.attrib["name"]
172
- except Exception as e:
173
- logging.warning(f"{e}; file={f}", exc_info=True)
174
-
175
- return run_func_on_iterable(files, _func, args=(set(),))
176
-
177
- def export_targetserver_dependencies(
178
- self, environment, targetservers, force=False, expc_verbosity=1
179
- ):
180
- make_dirs(self._targetservers_dir)
181
-
182
- def _func(ts):
183
- ts_file = str(Path(self._targetservers_dir) / f"{ts}.json")
184
- if not force:
185
- path_exists(os.path.relpath(ts_file))
186
- resp = (
187
- Targetservers(self._auth, self._org_name, ts)
188
- .get_targetserver(environment)
189
- .text
190
- )
191
- console.echo(resp, expc_verbosity=1)
192
- with open(ts_file, "w") as f:
193
- f.write(resp)
194
-
195
- return run_func_on_iterable(targetservers, _func)
196
-
197
- def get_cache_dependencies(self, files):
198
- def _func(f, _state):
199
- try:
200
- name = et.parse(f).find(".//CacheResource").text
201
- if name and name not in _state:
202
- _state.add(name)
203
- return name
204
- except Exception as e:
205
- logging.warning(f"{e}; file={f}", exc_info=True)
206
-
207
- return run_func_on_iterable(files, _func, args=(set(),))
208
-
209
- def export_cache_dependencies(
210
- self, environment, caches, force=False, expc_verbosity=1
211
- ):
212
- make_dirs(self._caches_dir)
213
-
214
- def _func(cache):
215
- cache_file = str(Path(self._caches_dir) / f"{cache}.json")
216
- if not force:
217
- path_exists(os.path.relpath(cache_file))
218
- resp = (
219
- Caches(self._auth, self._org_name, cache)
220
- .get_information_about_a_cache(environment)
221
- .text
222
- )
223
- console.echo(resp, expc_verbosity=1)
224
- with open(cache_file, "w") as f:
225
- f.write(resp)
226
-
227
- return run_func_on_iterable(caches, _func)
228
-
229
- # def pull(self, api_name, dependencies=[], force=False, prefix=None, basepath=None):
230
- def pull(self, api_name, force=False):
231
- # dependencies.append(api_name)
232
- make_dirs(self.work_tree)
233
- self.apiproxy_dir = api_name
234
- if not force:
235
- paths_exist(
236
- (os.path.relpath(self.zip_file), os.path.relpath(self.apiproxy_dir))
237
- )
238
- exported_api = Apis(self.auth, self.org_name).export_api_proxy(
239
- api_name, self.revision_number, fs_write=True, output_file=self.zip_file
240
- )
241
- make_dirs(self.apiproxy_dir)
242
- extract_zip(self.zip_file, self.apiproxy_dir)
243
- os.remove(self.zip_file)
244
- files = self.get_apiproxy_files(self.apiproxy_dir)
245
- for resource_type in ("keyvaluemap", "targetserver", "cache"):
246
- self.call_export_method(
247
- # resource_type, files, self.environment, dependencies=dependencies, force=force
248
- resource_type,
249
- files,
250
- self.environment,
251
- force=force,
252
- )
253
- # print(dependencies)
254
- # return exported_api, dependencies
255
- return exported_api
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes