vgs-cli 0.0.1.dev0__py3-none-any.whl
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.
- vgs_cli-0.0.1.dev0.data/data/vgscli/calm.yaml +16 -0
- vgs_cli-0.0.1.dev0.data/data/vgscli/checkout.yaml +21 -0
- vgs_cli-0.0.1.dev0.data/data/vgscli/http-route-template.yaml +61 -0
- vgs_cli-0.0.1.dev0.data/data/vgscli/mft-route-template.yaml +10 -0
- vgs_cli-0.0.1.dev0.data/data/vgscli/payments-admin.yaml +25 -0
- vgs_cli-0.0.1.dev0.data/data/vgscli/service-account-schema.yaml +54 -0
- vgs_cli-0.0.1.dev0.data/data/vgscli/sub-account-checkout.yaml +23 -0
- vgs_cli-0.0.1.dev0.data/data/vgscli/vault-resources.yaml +710 -0
- vgs_cli-0.0.1.dev0.data/data/vgscli/vault-schema.yaml +36 -0
- vgs_cli-0.0.1.dev0.data/data/vgscli/vault-template.yaml +12 -0
- vgs_cli-0.0.1.dev0.data/data/vgscli/vgs-cli.yaml +17 -0
- vgs_cli-0.0.1.dev0.dist-info/METADATA +139 -0
- vgs_cli-0.0.1.dev0.dist-info/RECORD +56 -0
- vgs_cli-0.0.1.dev0.dist-info/WHEEL +5 -0
- vgs_cli-0.0.1.dev0.dist-info/entry_points.txt +2 -0
- vgs_cli-0.0.1.dev0.dist-info/licenses/LICENSE +22 -0
- vgs_cli-0.0.1.dev0.dist-info/top_level.txt +1 -0
- vgscli/__init__.py +0 -0
- vgscli/_version.py +32 -0
- vgscli/access_logs.py +65 -0
- vgscli/audits_api.py +102 -0
- vgscli/auth.py +68 -0
- vgscli/auth_server.py +131 -0
- vgscli/auth_utils.py +24 -0
- vgscli/callback_server.py +41 -0
- vgscli/cert_manager_api.py +34 -0
- vgscli/cli/__init__.py +23 -0
- vgscli/cli/commands/__init__.py +3 -0
- vgscli/cli/commands/apply.py +307 -0
- vgscli/cli/commands/generate.py +134 -0
- vgscli/cli/commands/get.py +200 -0
- vgscli/cli/types/__init__.py +2 -0
- vgscli/cli/types/resource_id.py +39 -0
- vgscli/cli/types/variable.py +21 -0
- vgscli/cli_utils.py +132 -0
- vgscli/click_extensions.py +88 -0
- vgscli/config_file.py +58 -0
- vgscli/errors.py +263 -0
- vgscli/file_token_util.py +30 -0
- vgscli/id_generator.py +46 -0
- vgscli/keyring_token_util.py +128 -0
- vgscli/resource-templates/http-route-template.yaml +61 -0
- vgscli/resource-templates/mft-route-template.yaml +10 -0
- vgscli/resource-templates/service-account/calm.yaml +16 -0
- vgscli/resource-templates/service-account/checkout.yaml +21 -0
- vgscli/resource-templates/service-account/payments-admin.yaml +25 -0
- vgscli/resource-templates/service-account/sub-account-checkout.yaml +23 -0
- vgscli/resource-templates/service-account/vgs-cli.yaml +17 -0
- vgscli/resource-templates/vault-template.yaml +12 -0
- vgscli/testing.py +48 -0
- vgscli/text.py +9 -0
- vgscli/token_handler.py +11 -0
- vgscli/validation-schemas/service-account-schema.yaml +54 -0
- vgscli/validation-schemas/vault-resources.yaml +710 -0
- vgscli/validation-schemas/vault-schema.yaml +36 -0
- vgscli/vgs.py +249 -0
vgscli/testing.py
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import importlib
|
|
2
|
+
import unittest
|
|
3
|
+
from typing import List
|
|
4
|
+
from unittest import mock
|
|
5
|
+
|
|
6
|
+
from click.testing import CliRunner, Result
|
|
7
|
+
|
|
8
|
+
from vgscli.vgs import cli
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class CliRunnerTestCase(unittest.TestCase):
|
|
12
|
+
def setUp(self) -> None:
|
|
13
|
+
self.runner = CliRunner()
|
|
14
|
+
|
|
15
|
+
def invoke(self, command: List[str]) -> Result:
|
|
16
|
+
return self.runner.invoke(cli, args=[*command])
|
|
17
|
+
|
|
18
|
+
def assertExitCode(self, result: Result, exit_code: int) -> None:
|
|
19
|
+
self.assertEqual(exit_code, result.exit_code, "Unexpected exit code")
|
|
20
|
+
|
|
21
|
+
def assertOutput(self, result: Result, output: str) -> None:
|
|
22
|
+
self.assertEqual(output, result.output, "Unexpected output")
|
|
23
|
+
|
|
24
|
+
def assertOutputContains(self, result: Result, expected: str) -> None:
|
|
25
|
+
self.assertTrue(
|
|
26
|
+
expected in result.output,
|
|
27
|
+
f'Could not find "{expected}" in "{result.output}"',
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
# https://stackoverflow.com/questions/52324568
|
|
32
|
+
def patch(*args, **kwargs):
|
|
33
|
+
target = args[0].split(".")
|
|
34
|
+
|
|
35
|
+
for i in range(len(target), 0, -1):
|
|
36
|
+
# noinspection PyBroadException
|
|
37
|
+
try:
|
|
38
|
+
module = importlib.import_module(".".join(target[:i]))
|
|
39
|
+
|
|
40
|
+
# noinspection PyShadowingNames
|
|
41
|
+
patch = mock.patch(*args, **kwargs)
|
|
42
|
+
patch.attribute = ".".join(target[i:])
|
|
43
|
+
patch.getter = lambda: module
|
|
44
|
+
return patch
|
|
45
|
+
except Exception:
|
|
46
|
+
pass
|
|
47
|
+
|
|
48
|
+
return mock.patch(*args, **kwargs)
|
vgscli/text.py
ADDED
vgscli/token_handler.py
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
"$schema": http://json-schema.org/draft-07/schema#
|
|
3
|
+
type: object
|
|
4
|
+
properties:
|
|
5
|
+
apiVersion:
|
|
6
|
+
type: string
|
|
7
|
+
enum:
|
|
8
|
+
- 1.0.0
|
|
9
|
+
kind:
|
|
10
|
+
type: string
|
|
11
|
+
enum:
|
|
12
|
+
- ServiceAccount
|
|
13
|
+
data:
|
|
14
|
+
type: object
|
|
15
|
+
properties:
|
|
16
|
+
name:
|
|
17
|
+
type: string
|
|
18
|
+
annotations:
|
|
19
|
+
type: object
|
|
20
|
+
additionalProperties:
|
|
21
|
+
type: string
|
|
22
|
+
default: {}
|
|
23
|
+
vaults:
|
|
24
|
+
type: array
|
|
25
|
+
items:
|
|
26
|
+
type: string
|
|
27
|
+
scopes:
|
|
28
|
+
type: array
|
|
29
|
+
items:
|
|
30
|
+
oneOf:
|
|
31
|
+
- type: object
|
|
32
|
+
properties:
|
|
33
|
+
name:
|
|
34
|
+
type: string
|
|
35
|
+
optional:
|
|
36
|
+
type: boolean
|
|
37
|
+
default: false
|
|
38
|
+
required:
|
|
39
|
+
- name
|
|
40
|
+
additionalProperties: false
|
|
41
|
+
- type: string # Left for compatibility
|
|
42
|
+
minItems: 1
|
|
43
|
+
accessTokenLifespan:
|
|
44
|
+
type: integer
|
|
45
|
+
minimum: 60
|
|
46
|
+
required:
|
|
47
|
+
- name
|
|
48
|
+
- scopes
|
|
49
|
+
additionalProperties: false
|
|
50
|
+
required:
|
|
51
|
+
- apiVersion
|
|
52
|
+
- kind
|
|
53
|
+
- data
|
|
54
|
+
additionalProperties: false
|