vgs-cli 1.35.0.dev2__py3-none-any.whl → 1.35.0.dev3__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-1.35.0.dev2.data → vgs_cli-1.35.0.dev3.data}/data/vgscli/form-template.yaml +1 -1
- {vgs_cli-1.35.0.dev2.dist-info → vgs_cli-1.35.0.dev3.dist-info}/METADATA +8 -1
- {vgs_cli-1.35.0.dev2.dist-info → vgs_cli-1.35.0.dev3.dist-info}/RECORD +40 -39
- vgscli/_version.py +1 -1
- vgscli/audits_api.py +9 -8
- vgscli/auth_server.py +13 -6
- vgscli/cert_manager_api.py +8 -7
- vgscli/cli/__init__.py +32 -5
- vgscli/cli/commands/apply.py +11 -4
- vgscli/cli/commands/certificate.py +2 -1
- vgscli/cli/commands/delete.py +4 -3
- vgscli/cli/commands/generate.py +2 -1
- vgscli/cli/commands/get.py +4 -4
- vgscli/collect_forms_api.py +9 -8
- vgscli/errors.py +64 -14
- vgscli/resource-templates/form-template.yaml +1 -1
- vgscli/telemetry.py +757 -0
- vgscli/tenant_creation.py +1 -1
- vgscli/vgs.py +3 -1
- {vgs_cli-1.35.0.dev2.data → vgs_cli-1.35.0.dev3.data}/data/vgscli/collect-form-api-schema.yaml +0 -0
- {vgs_cli-1.35.0.dev2.data → vgs_cli-1.35.0.dev3.data}/data/vgscli/collect-form-schema.yaml +0 -0
- {vgs_cli-1.35.0.dev2.data → vgs_cli-1.35.0.dev3.data}/data/vgscli/credentials-admin.yaml +0 -0
- {vgs_cli-1.35.0.dev2.data → vgs_cli-1.35.0.dev3.data}/data/vgscli/http-route-template.yaml +0 -0
- {vgs_cli-1.35.0.dev2.data → vgs_cli-1.35.0.dev3.data}/data/vgscli/notification-integration-schema.yaml +0 -0
- {vgs_cli-1.35.0.dev2.data → vgs_cli-1.35.0.dev3.data}/data/vgscli/notification-template.yaml +0 -0
- {vgs_cli-1.35.0.dev2.data → vgs_cli-1.35.0.dev3.data}/data/vgscli/public-credential-collect.yaml +0 -0
- {vgs_cli-1.35.0.dev2.data → vgs_cli-1.35.0.dev3.data}/data/vgscli/read-credentials-no-pci.yaml +0 -0
- {vgs_cli-1.35.0.dev2.data → vgs_cli-1.35.0.dev3.data}/data/vgscli/read-credentials-with-pci.yaml +0 -0
- {vgs_cli-1.35.0.dev2.data → vgs_cli-1.35.0.dev3.data}/data/vgscli/service-account-schema.yaml +0 -0
- {vgs_cli-1.35.0.dev2.data → vgs_cli-1.35.0.dev3.data}/data/vgscli/sftp-route-template.yaml +0 -0
- {vgs_cli-1.35.0.dev2.data → vgs_cli-1.35.0.dev3.data}/data/vgscli/tenant-schema.yaml +0 -0
- {vgs_cli-1.35.0.dev2.data → vgs_cli-1.35.0.dev3.data}/data/vgscli/tenant-template.yaml +0 -0
- {vgs_cli-1.35.0.dev2.data → vgs_cli-1.35.0.dev3.data}/data/vgscli/vault-resources.yaml +0 -0
- {vgs_cli-1.35.0.dev2.data → vgs_cli-1.35.0.dev3.data}/data/vgscli/vault-schema.yaml +0 -0
- {vgs_cli-1.35.0.dev2.data → vgs_cli-1.35.0.dev3.data}/data/vgscli/vault-template.yaml +0 -0
- {vgs_cli-1.35.0.dev2.data → vgs_cli-1.35.0.dev3.data}/data/vgscli/vgs-cli.yaml +0 -0
- {vgs_cli-1.35.0.dev2.dist-info → vgs_cli-1.35.0.dev3.dist-info}/WHEEL +0 -0
- {vgs_cli-1.35.0.dev2.dist-info → vgs_cli-1.35.0.dev3.dist-info}/entry_points.txt +0 -0
- {vgs_cli-1.35.0.dev2.dist-info → vgs_cli-1.35.0.dev3.dist-info}/licenses/LICENSE +0 -0
- {vgs_cli-1.35.0.dev2.dist-info → vgs_cli-1.35.0.dev3.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: vgs-cli
|
|
3
|
-
Version: 1.35.0.
|
|
3
|
+
Version: 1.35.0.dev3
|
|
4
4
|
Summary: VGS Client
|
|
5
5
|
Home-page: https://github.com/verygoodsecurity/vgs-cli
|
|
6
6
|
Author: Very Good Security
|
|
@@ -71,6 +71,7 @@ Command Line Tool for programmatic configurations on VGS.
|
|
|
71
71
|
- [Service accounts](#service-accounts)
|
|
72
72
|
- [Certificates](#certificates)
|
|
73
73
|
- [Automation with VGS CLI](#automation-with-vgs-cli)
|
|
74
|
+
- [Telemetry](#telemetry)
|
|
74
75
|
|
|
75
76
|
## Requirements
|
|
76
77
|
[Python 3.11 or newer](https://www.python.org/downloads/) with OpenSSL 1.1.1 or newer, or [Docker](https://docs.docker.com/get-docker/).
|
|
@@ -244,3 +245,9 @@ for the full workflow.
|
|
|
244
245
|
## Automation with VGS CLI
|
|
245
246
|
|
|
246
247
|
If you want to use the VGS CLI for automation, create a [service account](https://docs.verygoodsecurity.com/vault/developer-tools/vgs-cli/service-account).
|
|
248
|
+
|
|
249
|
+
## Telemetry
|
|
250
|
+
|
|
251
|
+
VGS CLI collects limited usage analytics to help VGS understand how the CLI is
|
|
252
|
+
used and improve the product. To disable telemetry, set
|
|
253
|
+
`VGS_CLI_TELEMETRY_OPTOUT=1` or `DO_NOT_TRACK=1`.
|
|
@@ -1,63 +1,64 @@
|
|
|
1
|
-
vgs_cli-1.35.0.
|
|
2
|
-
vgs_cli-1.35.0.
|
|
3
|
-
vgs_cli-1.35.0.
|
|
4
|
-
vgs_cli-1.35.0.
|
|
5
|
-
vgs_cli-1.35.0.
|
|
6
|
-
vgs_cli-1.35.0.
|
|
7
|
-
vgs_cli-1.35.0.
|
|
8
|
-
vgs_cli-1.35.0.
|
|
9
|
-
vgs_cli-1.35.0.
|
|
10
|
-
vgs_cli-1.35.0.
|
|
11
|
-
vgs_cli-1.35.0.
|
|
12
|
-
vgs_cli-1.35.0.
|
|
13
|
-
vgs_cli-1.35.0.
|
|
14
|
-
vgs_cli-1.35.0.
|
|
15
|
-
vgs_cli-1.35.0.
|
|
16
|
-
vgs_cli-1.35.0.
|
|
17
|
-
vgs_cli-1.35.0.
|
|
18
|
-
vgs_cli-1.35.0.
|
|
19
|
-
vgs_cli-1.35.0.
|
|
1
|
+
vgs_cli-1.35.0.dev3.data/data/vgscli/collect-form-api-schema.yaml,sha256=THuJbLUo7LOr0c1JUo3FPJEc9Jvde59K4JjdlkVF3hw,1246
|
|
2
|
+
vgs_cli-1.35.0.dev3.data/data/vgscli/collect-form-schema.yaml,sha256=vHAN6_Gsg14CeSL41sHEQgboYF-CHF2RaNw72aJ3W8o,1337
|
|
3
|
+
vgs_cli-1.35.0.dev3.data/data/vgscli/credentials-admin.yaml,sha256=acyLd54Cp7l2fpugfjVfYh07-MIE0BX-JVq4lHraE1s,869
|
|
4
|
+
vgs_cli-1.35.0.dev3.data/data/vgscli/form-template.yaml,sha256=pY4gOd8jXJRohcpJYijBt4m5cPyHvEVlCBtHgs2AL8M,927
|
|
5
|
+
vgs_cli-1.35.0.dev3.data/data/vgscli/http-route-template.yaml,sha256=vGHvBXA_6pwFtH1vVRWKiwxb4sahzuLvpqGAlavrStc,1085
|
|
6
|
+
vgs_cli-1.35.0.dev3.data/data/vgscli/notification-integration-schema.yaml,sha256=1qHzS5ZxlhTdrDab6-qJhszwu7cpith2HleX3uAO_4E,1837
|
|
7
|
+
vgs_cli-1.35.0.dev3.data/data/vgscli/notification-template.yaml,sha256=hr36msbrgiTjWligLHVDHMmO49QDzjTwBSLYoBw3WQE,1288
|
|
8
|
+
vgs_cli-1.35.0.dev3.data/data/vgscli/public-credential-collect.yaml,sha256=CiorC-6TMx7M0TI8DHmoRSfVKDpOom2wIr_ilwmHQNA,696
|
|
9
|
+
vgs_cli-1.35.0.dev3.data/data/vgscli/read-credentials-no-pci.yaml,sha256=_kWRne_ARh8v7A_jHG08gwgPG6NqZhrDRyq6L-ULs2M,769
|
|
10
|
+
vgs_cli-1.35.0.dev3.data/data/vgscli/read-credentials-with-pci.yaml,sha256=jWXgFdcqZYisakAt9COM6cjf2-x_Q4eidDLaUh8CZOk,796
|
|
11
|
+
vgs_cli-1.35.0.dev3.data/data/vgscli/service-account-schema.yaml,sha256=L1pjNXgnks15N1wNgf_1GmGcOvxn0nu49v7ersUjFno,1090
|
|
12
|
+
vgs_cli-1.35.0.dev3.data/data/vgscli/sftp-route-template.yaml,sha256=zkT6lIVDgVyzLKgZ8QnyJJooy2egZk1cQthdjan_JrM,853
|
|
13
|
+
vgs_cli-1.35.0.dev3.data/data/vgscli/tenant-schema.yaml,sha256=gBO7xVe2qXSymG0B_45hC11X5nm_jCCAH4Yjs-sbC8g,1457
|
|
14
|
+
vgs_cli-1.35.0.dev3.data/data/vgscli/tenant-template.yaml,sha256=F0wIBkC2dFJUNeJet-FzPX3qrLMHcGIaJvhsDzzAOCc,765
|
|
15
|
+
vgs_cli-1.35.0.dev3.data/data/vgscli/vault-resources.yaml,sha256=95CCxQher3MBQq96bvjZviNgo1rgv_NhCtI8X-oxIpA,26335
|
|
16
|
+
vgs_cli-1.35.0.dev3.data/data/vgscli/vault-schema.yaml,sha256=a-wW7X8RyHr-669wtOZrlxlIfeQVtx8EUfA-3vpYytk,637
|
|
17
|
+
vgs_cli-1.35.0.dev3.data/data/vgscli/vault-template.yaml,sha256=IlDisL3H5LXUDMkhUaouKMarRdu0-pJxpTz8ij_lp_M,383
|
|
18
|
+
vgs_cli-1.35.0.dev3.data/data/vgscli/vgs-cli.yaml,sha256=5gCjjloyepaKI6zZfDLeUEWxuRExI-dGJI9RO3omP2k,484
|
|
19
|
+
vgs_cli-1.35.0.dev3.dist-info/licenses/LICENSE,sha256=NwSyzgDYdzv6O2ns2C6UODGI8LN1VnVe_FPTnWS4eXY,1082
|
|
20
20
|
vgscli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
21
|
-
vgscli/_version.py,sha256=
|
|
21
|
+
vgscli/_version.py,sha256=j_AeccOPC7DV8cBY5WdN_c0pV8AQX8WbdoUyTLa3ZhQ,1681
|
|
22
22
|
vgscli/access_logs.py,sha256=G0GjlLjWiC-N6OzK6-RCvWddcVGQlLCLAcyO9pLWIOM,1928
|
|
23
|
-
vgscli/audits_api.py,sha256=
|
|
23
|
+
vgscli/audits_api.py,sha256=AaF5Go019TOerBlQzygwMeOxeW9vPPJPgxa95kttF-M,3215
|
|
24
24
|
vgscli/auth.py,sha256=vdUZ12nqtefIuSHNmwCFvxoqwS3m6ZP5TqLZFNwKnSU,2104
|
|
25
|
-
vgscli/auth_server.py,sha256=
|
|
25
|
+
vgscli/auth_server.py,sha256=LX8SphoWE5vh4NRQ0490VTa73cKpa7FE9_CblNY31Ro,4482
|
|
26
26
|
vgscli/auth_utils.py,sha256=aC1VI0dFdFeupLS9Okz4uDz-wHhhFabqiLUg2R5vO2s,600
|
|
27
27
|
vgscli/callback_server.py,sha256=oFFF5AGbbwhF7Hsc5fzS7jeGFzIMbebc9Qdq8uEl1PY,1055
|
|
28
28
|
vgscli/calm_api.py,sha256=5ZZhJUCuA2E5X670L-EkB_mL2kqHPrYy-ca6WtwTacg,1384
|
|
29
|
-
vgscli/cert_manager_api.py,sha256=
|
|
29
|
+
vgscli/cert_manager_api.py,sha256=b_IEIZFLY7Q4ygThWcUUR8Ynr02MXgVVe9qDFE7CQUc,1650
|
|
30
30
|
vgscli/cli_progress.py,sha256=Kpc7iZo0zO6YX3WynteBELuWSYGVvqEjKLq2E5x4lnE,2520
|
|
31
31
|
vgscli/cli_utils.py,sha256=NzXK29_yIDrB-3T_XdLLB8NCWneQ-cpZFi9mazQL9tQ,3810
|
|
32
32
|
vgscli/click_extensions.py,sha256=m-RpaPaH69m4caYbuiu0j2blxeyy8c8hA0Tvygw1Mvc,7271
|
|
33
33
|
vgscli/collect_forms.py,sha256=HAg-tvpXxmVq5Zns4v8G0cP-tgYKuWmVFwzuNjieu-A,4619
|
|
34
|
-
vgscli/collect_forms_api.py,sha256=
|
|
34
|
+
vgscli/collect_forms_api.py,sha256=rORLu-jd5IMsiAoR7VkgIkpskWd9GfjZs6zeHKEoOPs,1258
|
|
35
35
|
vgscli/config_file.py,sha256=HB8lANU0qoO09Wnkf-QDzPh2qtrnFcqcetnCaQgtQ3U,1543
|
|
36
|
-
vgscli/errors.py,sha256=
|
|
36
|
+
vgscli/errors.py,sha256=5TzG28h1pK9MXjXT46zexcP9xeQ146QIYFQAotyqLuM,13961
|
|
37
37
|
vgscli/file_token_util.py,sha256=537b54paMGw0u5PL5VJgQqQ7awKa9lQP88n3tUc_lyw,771
|
|
38
38
|
vgscli/id_generator.py,sha256=3CbvSOUSyLON76p6M8wUhVQVig8j75_rnWdpxLhBifM,1510
|
|
39
39
|
vgscli/keyring_token_util.py,sha256=cnR72-0AInzujUsIwHoXwPbgprbkllgAXN-AAI3qsPM,4632
|
|
40
40
|
vgscli/notifications.py,sha256=6D8HFDEl3X4V0V9fYZT-9nWYe2KYVahfhRLMF0pbh4I,6252
|
|
41
41
|
vgscli/notifications_api.py,sha256=1EXmRb2fOJrU1QOAZ6gmq8yMjBLhNZGSVs3kRtD2Dfw,2342
|
|
42
42
|
vgscli/payment_accounts_api.py,sha256=wF6K3m7nlKtPmqO9RCpmGFSXYHWtwfhXqNfgI1IGqFI,1665
|
|
43
|
+
vgscli/telemetry.py,sha256=pvOVw7Lv4_YB5FYjGwD6molA5X964MntFWkHn7CuhFQ,26113
|
|
43
44
|
vgscli/tenant_configuration.py,sha256=iC33f2lBHDEL4oHPvdlWp_w--u2x_nWOb86jTHumDLg,5881
|
|
44
|
-
vgscli/tenant_creation.py,sha256=
|
|
45
|
+
vgscli/tenant_creation.py,sha256=8vyqD5J_4xefqvc4Yvx0PeHSSpNlcU8CdqB101H6Bn0,22225
|
|
45
46
|
vgscli/tenant_provisioning_api.py,sha256=-mQcSECgWG23LKczu1B9J1d7Bb6ZA6lkpr9RegJiiLg,1203
|
|
46
47
|
vgscli/testing.py,sha256=MLrsvy3mEwvjtqyuG0UjwEX-rDkbWUo52aXvu2H2sTk,1437
|
|
47
48
|
vgscli/text.py,sha256=c2d1As7awq8PlEF9NiI6JrjsYYousj9YT0o1xOQ2MQM,172
|
|
48
49
|
vgscli/token_handler.py,sha256=MvtmlicqnGrcopNkTr8Q2RlKE7IDj_sJFxF_39Jd7W8,183
|
|
49
|
-
vgscli/vgs.py,sha256=
|
|
50
|
-
vgscli/cli/__init__.py,sha256=
|
|
50
|
+
vgscli/vgs.py,sha256=a1t-0fy7wmHqI_0qVonA1XXz0rMCCRDOKS8e0KNMXC4,6364
|
|
51
|
+
vgscli/cli/__init__.py,sha256=da9LPKYdnal26ntEP22PNn-dZYBbsNkP7tzOwzD6kY4,3915
|
|
51
52
|
vgscli/cli/commands/__init__.py,sha256=8ptc9-Vzdx0HU3ZeMcKERYjmJyuB5IMjBSF3Igx5yQ4,206
|
|
52
|
-
vgscli/cli/commands/apply.py,sha256=
|
|
53
|
-
vgscli/cli/commands/certificate.py,sha256=
|
|
54
|
-
vgscli/cli/commands/delete.py,sha256=
|
|
55
|
-
vgscli/cli/commands/generate.py,sha256=
|
|
56
|
-
vgscli/cli/commands/get.py,sha256=
|
|
53
|
+
vgscli/cli/commands/apply.py,sha256=p6ZbPLE3SebX-AUYCLkVqTDXppT_Dt7Ua7JaUoP-R08,26662
|
|
54
|
+
vgscli/cli/commands/certificate.py,sha256=cy8oRiEkUYfFExCG5GdjYqEJ91rCgA6hy98cpHkorHM,22994
|
|
55
|
+
vgscli/cli/commands/delete.py,sha256=D7k_3oHNIp3NqqLgOAPIKkXa8TSoELB8VrGEuHgKCRc,3937
|
|
56
|
+
vgscli/cli/commands/generate.py,sha256=6SkeXN7lyzllezjYliWQ_CUncMWbDFX1Jx_1vlwDCh8,5512
|
|
57
|
+
vgscli/cli/commands/get.py,sha256=7lFV3X7mMuxtA-dRmm3ru9AQ4ZwXdx85I6gvB_aOqEs,11392
|
|
57
58
|
vgscli/cli/types/__init__.py,sha256=a-P-SoGHpLzMg7CL1hhg5x_nf6sHq0qAuGm_AtIITmw,107
|
|
58
59
|
vgscli/cli/types/resource_id.py,sha256=7JILR-KjoVGQDHB40tXJfTcU53iR8wM9Zr24fY5le3o,1172
|
|
59
60
|
vgscli/cli/types/variable.py,sha256=IVcszPoWmTjeo_evDsLN06LuUZGTLL-wcZCVfBNBP8I,414
|
|
60
|
-
vgscli/resource-templates/form-template.yaml,sha256=
|
|
61
|
+
vgscli/resource-templates/form-template.yaml,sha256=pY4gOd8jXJRohcpJYijBt4m5cPyHvEVlCBtHgs2AL8M,927
|
|
61
62
|
vgscli/resource-templates/http-route-template.yaml,sha256=vGHvBXA_6pwFtH1vVRWKiwxb4sahzuLvpqGAlavrStc,1085
|
|
62
63
|
vgscli/resource-templates/notification-template.yaml,sha256=hr36msbrgiTjWligLHVDHMmO49QDzjTwBSLYoBw3WQE,1288
|
|
63
64
|
vgscli/resource-templates/sftp-route-template.yaml,sha256=zkT6lIVDgVyzLKgZ8QnyJJooy2egZk1cQthdjan_JrM,853
|
|
@@ -75,8 +76,8 @@ vgscli/validation-schemas/service-account-schema.yaml,sha256=L1pjNXgnks15N1wNgf_
|
|
|
75
76
|
vgscli/validation-schemas/tenant-schema.yaml,sha256=gBO7xVe2qXSymG0B_45hC11X5nm_jCCAH4Yjs-sbC8g,1457
|
|
76
77
|
vgscli/validation-schemas/vault-resources.yaml,sha256=95CCxQher3MBQq96bvjZviNgo1rgv_NhCtI8X-oxIpA,26335
|
|
77
78
|
vgscli/validation-schemas/vault-schema.yaml,sha256=a-wW7X8RyHr-669wtOZrlxlIfeQVtx8EUfA-3vpYytk,637
|
|
78
|
-
vgs_cli-1.35.0.
|
|
79
|
-
vgs_cli-1.35.0.
|
|
80
|
-
vgs_cli-1.35.0.
|
|
81
|
-
vgs_cli-1.35.0.
|
|
82
|
-
vgs_cli-1.35.0.
|
|
79
|
+
vgs_cli-1.35.0.dev3.dist-info/METADATA,sha256=Ic8p-cV8MBTlssFrLm-lqcNFY0x7ml_eIb8zN-zM8_Y,9210
|
|
80
|
+
vgs_cli-1.35.0.dev3.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
81
|
+
vgs_cli-1.35.0.dev3.dist-info/entry_points.txt,sha256=wCWhRQiMX4Ja6kkqJlYr8LbuiywpmXyyRAZPsau-_RY,39
|
|
82
|
+
vgs_cli-1.35.0.dev3.dist-info/top_level.txt,sha256=gabTxCWMkl80q6ha_m-hs_1wQMfGntZcv5DEmkl8JEw,7
|
|
83
|
+
vgs_cli-1.35.0.dev3.dist-info/RECORD,,
|
vgscli/_version.py
CHANGED
vgscli/audits_api.py
CHANGED
|
@@ -5,8 +5,8 @@ from typing import Dict
|
|
|
5
5
|
from simple_rest_client.api import API
|
|
6
6
|
from simple_rest_client.resource import Resource
|
|
7
7
|
|
|
8
|
-
from vgscli._version import __version__
|
|
9
8
|
from vgscli.errors import VaultNotFoundError
|
|
9
|
+
from vgscli.telemetry import request_headers
|
|
10
10
|
|
|
11
11
|
logger = logging.getLogger(__name__)
|
|
12
12
|
|
|
@@ -75,13 +75,14 @@ def create_api(ctx, vault_id, environment, token):
|
|
|
75
75
|
api = API(
|
|
76
76
|
api_root_url=env_url[environment],
|
|
77
77
|
params={}, # default params
|
|
78
|
-
headers=
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
78
|
+
headers=request_headers(
|
|
79
|
+
{
|
|
80
|
+
"VGS-Tenant": vault_id,
|
|
81
|
+
"Content-Type": "application/vnd.api+json",
|
|
82
|
+
"Accept": "application/vnd.api+json",
|
|
83
|
+
"Authorization": "Bearer {}".format(token),
|
|
84
|
+
}
|
|
85
|
+
), # default headers
|
|
85
86
|
timeout=50, # default timeout in seconds
|
|
86
87
|
append_slash=False, # append slash to final url
|
|
87
88
|
json_encode_body=True, # encode body as json
|
vgscli/auth_server.py
CHANGED
|
@@ -11,6 +11,7 @@ from vgs.sdk.utils import is_port_accessible
|
|
|
11
11
|
from vgscli.auth_utils import code_challenge, generate_code_verifier
|
|
12
12
|
from vgscli.callback_server import RequestServer
|
|
13
13
|
from vgscli.keyring_token_util import KeyringTokenUtil
|
|
14
|
+
from vgscli.telemetry import apply_request_headers, request_headers
|
|
14
15
|
from vgscli.token_handler import CodeHandler
|
|
15
16
|
|
|
16
17
|
|
|
@@ -46,7 +47,7 @@ class AuthServer:
|
|
|
46
47
|
)
|
|
47
48
|
self.app = RequestServer(self.host, self.accessible_port)
|
|
48
49
|
self.environment = environment
|
|
49
|
-
self.auth_api = auth_api.create_api(environment)
|
|
50
|
+
self.auth_api = apply_request_headers(auth_api.create_api(environment))
|
|
50
51
|
|
|
51
52
|
def login(self, environment, **kwargs):
|
|
52
53
|
thread = self.ServerThread(self.app)
|
|
@@ -86,11 +87,17 @@ class AuthServer:
|
|
|
86
87
|
return self.token_util.get_access_token()
|
|
87
88
|
|
|
88
89
|
def logout(self):
|
|
89
|
-
auth_api.logout(
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
90
|
+
self.auth_api.auth.logout(
|
|
91
|
+
headers=request_headers(
|
|
92
|
+
{
|
|
93
|
+
"Authorization": self.token_util.get_access_token(),
|
|
94
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
95
|
+
}
|
|
96
|
+
),
|
|
97
|
+
body="client_id={client_id}&refresh_token={refresh_token}".format(
|
|
98
|
+
client_id=self.CLIENT_ID,
|
|
99
|
+
refresh_token=self.token_util.get_refresh_token(),
|
|
100
|
+
),
|
|
94
101
|
)
|
|
95
102
|
|
|
96
103
|
def refresh_authentication(self):
|
vgscli/cert_manager_api.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from simple_rest_client.api import API
|
|
2
2
|
from simple_rest_client.resource import Resource
|
|
3
3
|
|
|
4
|
-
from vgscli.
|
|
4
|
+
from vgscli.telemetry import request_headers
|
|
5
5
|
|
|
6
6
|
CERT_MANAGER_URLS = {
|
|
7
7
|
"dev": "https://cert-manager-api.verygoodsecurity.io",
|
|
@@ -32,12 +32,13 @@ def create_cert_manager_api(vault_id, environment, token):
|
|
|
32
32
|
base = CERT_MANAGER_URLS.get(env, CERT_MANAGER_URLS["prod"])
|
|
33
33
|
api_root_url = _ensure_api_root(base)
|
|
34
34
|
|
|
35
|
-
headers =
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
headers = request_headers(
|
|
36
|
+
{
|
|
37
|
+
"Content-Type": "application/vnd.api+json",
|
|
38
|
+
"Accept": "application/json",
|
|
39
|
+
"Authorization": f"Bearer {token}",
|
|
40
|
+
}
|
|
41
|
+
)
|
|
41
42
|
if vault_id:
|
|
42
43
|
headers["VGS-Tenant"] = vault_id
|
|
43
44
|
|
vgscli/cli/__init__.py
CHANGED
|
@@ -5,13 +5,17 @@ from vgs.sdk.vault_mgmt import VaultMgmtAPI
|
|
|
5
5
|
from vgscli.auth import handshake, token_util
|
|
6
6
|
from vgscli.calm_api import create_api as create_calm_api_client
|
|
7
7
|
from vgscli.collect_forms_api import create_api as create_collect_forms_api_client
|
|
8
|
+
from vgscli.errors import VaultNotFoundError
|
|
8
9
|
from vgscli.notifications import resolve_organization
|
|
9
10
|
from vgscli.notifications_api import create_api as create_notifications_api_client
|
|
10
11
|
from vgscli.payment_accounts_api import create_api as create_payment_accounts_api_client
|
|
12
|
+
from vgscli.telemetry import apply_request_headers
|
|
11
13
|
from vgscli.tenant_provisioning_api import (
|
|
12
14
|
create_api as create_tenant_provisioning_api_client,
|
|
13
15
|
)
|
|
14
16
|
|
|
17
|
+
ROUTES_API_TIMEOUT_SECONDS = 50
|
|
18
|
+
|
|
15
19
|
|
|
16
20
|
def create_account_mgmt_api(ctx: click.Context) -> AccountMgmtAPI:
|
|
17
21
|
environment = ctx.obj.env
|
|
@@ -19,7 +23,7 @@ def create_account_mgmt_api(ctx: click.Context) -> AccountMgmtAPI:
|
|
|
19
23
|
handshake(ctx, environment)
|
|
20
24
|
access_token = token_util.get_access_token()
|
|
21
25
|
|
|
22
|
-
return AccountMgmtAPI(access_token, environment)
|
|
26
|
+
return apply_request_headers(AccountMgmtAPI(access_token, environment))
|
|
23
27
|
|
|
24
28
|
|
|
25
29
|
def create_vault_mgmt_api(ctx: click.Context, root_url: str) -> VaultMgmtAPI:
|
|
@@ -28,7 +32,28 @@ def create_vault_mgmt_api(ctx: click.Context, root_url: str) -> VaultMgmtAPI:
|
|
|
28
32
|
handshake(ctx, environment)
|
|
29
33
|
access_token = token_util.get_access_token()
|
|
30
34
|
|
|
31
|
-
return VaultMgmtAPI(access_token, root_url)
|
|
35
|
+
return apply_request_headers(VaultMgmtAPI(access_token, root_url))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def create_routes_api(
|
|
39
|
+
ctx: click.Context, vault_id: str, environment: str, access_token: str
|
|
40
|
+
) -> VaultMgmtAPI:
|
|
41
|
+
"""Resolve and create a routes API without losing CLI request headers."""
|
|
42
|
+
account_mgmt = apply_request_headers(AccountMgmtAPI(access_token, environment))
|
|
43
|
+
account_mgmt.timeout = ROUTES_API_TIMEOUT_SECONDS
|
|
44
|
+
account_mgmt.vaults.timeout = ROUTES_API_TIMEOUT_SECONDS
|
|
45
|
+
response = account_mgmt.vaults.get_by_id(vault_id)
|
|
46
|
+
try:
|
|
47
|
+
root_url = response.body["data"][0]["links"]["vault_management_api"]
|
|
48
|
+
except (KeyError, IndexError, TypeError):
|
|
49
|
+
raise VaultNotFoundError(vault_id, ctx)
|
|
50
|
+
|
|
51
|
+
api = apply_request_headers(VaultMgmtAPI(access_token, root_url))
|
|
52
|
+
api.timeout = ROUTES_API_TIMEOUT_SECONDS
|
|
53
|
+
api.routes.timeout = ROUTES_API_TIMEOUT_SECONDS
|
|
54
|
+
api.vaults.timeout = ROUTES_API_TIMEOUT_SECONDS
|
|
55
|
+
api.headers["VGS-Tenant"] = vault_id
|
|
56
|
+
return api
|
|
32
57
|
|
|
33
58
|
|
|
34
59
|
def create_collect_forms_api(ctx: click.Context, vault_id: str):
|
|
@@ -80,9 +105,11 @@ def create_notifications_api(ctx: click.Context, organization_id: str = None):
|
|
|
80
105
|
access_token = token_util.get_access_token()
|
|
81
106
|
organization_internal_id = None
|
|
82
107
|
if organization_id:
|
|
83
|
-
account_mgmt = AccountMgmtAPI(access_token, environment)
|
|
108
|
+
account_mgmt = apply_request_headers(AccountMgmtAPI(access_token, environment))
|
|
84
109
|
organization_internal_id = resolve_organization(account_mgmt, organization_id)
|
|
85
110
|
|
|
86
|
-
return
|
|
87
|
-
|
|
111
|
+
return apply_request_headers(
|
|
112
|
+
create_notifications_api_client(
|
|
113
|
+
environment, access_token, organization_internal_id
|
|
114
|
+
)
|
|
88
115
|
)
|
vgscli/cli/commands/apply.py
CHANGED
|
@@ -12,7 +12,6 @@ from click_plugins import with_plugins
|
|
|
12
12
|
from simple_rest_client import exceptions
|
|
13
13
|
from simple_rest_client.exceptions import ClientError
|
|
14
14
|
from vgs.sdk.routes import dump_yaml, normalize
|
|
15
|
-
from vgs.sdk.vaults_api import create_api as create_vaults_api
|
|
16
15
|
|
|
17
16
|
from vgscli.auth import handshake, token_util
|
|
18
17
|
from vgscli.cli import (
|
|
@@ -21,9 +20,9 @@ from vgscli.cli import (
|
|
|
21
20
|
create_collect_forms_api,
|
|
22
21
|
create_notifications_api,
|
|
23
22
|
create_payment_accounts_api,
|
|
24
|
-
create_tenant_provisioning_api,
|
|
25
|
-
create_vault_mgmt_api,
|
|
26
23
|
)
|
|
24
|
+
from vgscli.cli import create_routes_api as create_vaults_api
|
|
25
|
+
from vgscli.cli import create_tenant_provisioning_api, create_vault_mgmt_api
|
|
27
26
|
from vgscli.cli.types import ResourceId, ResourceIdParamType
|
|
28
27
|
from vgscli.cli_progress import Spinner
|
|
29
28
|
from vgscli.cli_utils import (
|
|
@@ -58,6 +57,7 @@ from vgscli.notifications import (
|
|
|
58
57
|
redact_notification_integration,
|
|
59
58
|
validate_notification_configuration,
|
|
60
59
|
)
|
|
60
|
+
from vgscli.telemetry import TelemetryGroup, record_outcome, record_tenant_id
|
|
61
61
|
from vgscli.tenant_creation import (
|
|
62
62
|
TenantCreationStageError,
|
|
63
63
|
TenantCreationState,
|
|
@@ -106,7 +106,7 @@ def _sync_route(route_data, vault_management_api, ctx=None):
|
|
|
106
106
|
|
|
107
107
|
|
|
108
108
|
@with_plugins(iter_entry_points("vgs.apply.plugins"))
|
|
109
|
-
@click.group("apply")
|
|
109
|
+
@click.group("apply", cls=TelemetryGroup)
|
|
110
110
|
def apply() -> None:
|
|
111
111
|
"""
|
|
112
112
|
Create or update a VGS resource.
|
|
@@ -393,6 +393,7 @@ def _apply_tenant_data(
|
|
|
393
393
|
attributes = response.body["data"]["attributes"]
|
|
394
394
|
|
|
395
395
|
output_data["id"] = attributes["identifier"]
|
|
396
|
+
record_tenant_id(output_data["id"])
|
|
396
397
|
output_data["credentials"] = {
|
|
397
398
|
"username": attributes["credentials"]["key"],
|
|
398
399
|
"password": attributes["credentials"]["secret"],
|
|
@@ -515,6 +516,8 @@ def apply_tenant(
|
|
|
515
516
|
state = existing_state
|
|
516
517
|
is_resuming = True
|
|
517
518
|
|
|
519
|
+
record_tenant_id(state.tenant_id)
|
|
520
|
+
|
|
518
521
|
try:
|
|
519
522
|
account_mgmt = create_account_mgmt_api(ctx)
|
|
520
523
|
existing_tenant_name = None
|
|
@@ -562,13 +565,17 @@ def apply_tenant(
|
|
|
562
565
|
raise TenantCreationError(
|
|
563
566
|
error.stage, error.state_path, error.cause, ctx=ctx
|
|
564
567
|
) from None
|
|
568
|
+
finally:
|
|
569
|
+
record_tenant_id(state.tenant_id)
|
|
565
570
|
|
|
566
571
|
if existing_tenant_name is not None:
|
|
572
|
+
record_outcome("already-exists")
|
|
567
573
|
click.echo(
|
|
568
574
|
f'Tenant "{existing_tenant_name}" already exists. No changes were made.'
|
|
569
575
|
)
|
|
570
576
|
return
|
|
571
577
|
|
|
578
|
+
record_outcome("resumed" if is_resuming else "created")
|
|
572
579
|
_echo_tenant_creation_state(state, resolved_state_file)
|
|
573
580
|
|
|
574
581
|
|
|
@@ -16,6 +16,7 @@ from vgscli.cert_manager_api import create_cert_manager_api
|
|
|
16
16
|
from vgscli.cli_utils import dump_camelized_yaml
|
|
17
17
|
from vgscli.click_extensions import tenant_option
|
|
18
18
|
from vgscli.errors import handle_errors
|
|
19
|
+
from vgscli.telemetry import TelemetryGroup
|
|
19
20
|
|
|
20
21
|
logger = logging.getLogger(__name__)
|
|
21
22
|
|
|
@@ -314,7 +315,7 @@ def _read_certificate_as_pem(cert_file: str) -> str:
|
|
|
314
315
|
return _der_to_pem_certificate(data)
|
|
315
316
|
|
|
316
317
|
|
|
317
|
-
@click.group("certificate")
|
|
318
|
+
@click.group("certificate", cls=TelemetryGroup)
|
|
318
319
|
def certificate() -> None:
|
|
319
320
|
"""Manage certificates."""
|
|
320
321
|
|
vgscli/cli/commands/delete.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import click
|
|
2
2
|
from click_plugins import with_plugins
|
|
3
|
-
from vgs.sdk.vaults_api import create_api as create_vaults_api
|
|
4
3
|
|
|
5
4
|
from vgscli.auth import handshake, token_util
|
|
6
5
|
from vgscli.cli import (
|
|
@@ -8,15 +7,17 @@ from vgscli.cli import (
|
|
|
8
7
|
create_collect_forms_api,
|
|
9
8
|
create_notifications_api,
|
|
10
9
|
)
|
|
10
|
+
from vgscli.cli import create_routes_api as create_vaults_api
|
|
11
11
|
from vgscli.cli.types import ResourceId, ResourceIdParamType
|
|
12
12
|
from vgscli.cli_utils import iter_entry_points
|
|
13
13
|
from vgscli.click_extensions import tenant_option
|
|
14
14
|
from vgscli.collect_forms import validate_collect_form_identifier
|
|
15
15
|
from vgscli.errors import handle_errors
|
|
16
|
+
from vgscli.telemetry import TelemetryGroup
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
@with_plugins(iter_entry_points("vgs.delete.plugins"))
|
|
19
|
-
@click.group("delete")
|
|
20
|
+
@click.group("delete", cls=TelemetryGroup)
|
|
20
21
|
def delete():
|
|
21
22
|
"""
|
|
22
23
|
Delete VGS resource.
|
|
@@ -95,7 +96,7 @@ def delete_route(ctx, vault, route_id, confirm: bool):
|
|
|
95
96
|
vaults_api = create_vaults_api(
|
|
96
97
|
ctx, vault, ctx.obj.env, token_util.get_access_token()
|
|
97
98
|
)
|
|
98
|
-
vaults_api.routes.
|
|
99
|
+
vaults_api.routes.destroy(route_id)
|
|
99
100
|
|
|
100
101
|
click.secho(f"Route {route_id} deleted successfully", fg="green")
|
|
101
102
|
|
vgscli/cli/commands/generate.py
CHANGED
|
@@ -14,10 +14,11 @@ from vgscli.click_extensions import (
|
|
|
14
14
|
tenant_selection_option,
|
|
15
15
|
)
|
|
16
16
|
from vgscli.errors import handle_errors
|
|
17
|
+
from vgscli.telemetry import TelemetryGroup
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
@with_plugins(iter_entry_points("vgs.generate.plugins"))
|
|
20
|
-
@click.group("generate")
|
|
21
|
+
@click.group("generate", cls=TelemetryGroup)
|
|
21
22
|
def generate() -> None:
|
|
22
23
|
"""
|
|
23
24
|
Output a VGS resource template. Edited templates can be applied with a
|
vgscli/cli/commands/get.py
CHANGED
|
@@ -4,7 +4,6 @@ from click_plugins import with_plugins
|
|
|
4
4
|
from simple_rest_client.exceptions import ClientError, ServerError
|
|
5
5
|
from vgs.sdk.routes import dump_all_routes, normalize
|
|
6
6
|
from vgs.sdk.serializers import yaml # this one correctly outputs blocks
|
|
7
|
-
from vgs.sdk.vaults_api import create_api as create_vault_mgmt_api_routes
|
|
8
7
|
|
|
9
8
|
from vgscli.auth import handshake, token_util
|
|
10
9
|
from vgscli.cli import (
|
|
@@ -13,9 +12,9 @@ from vgscli.cli import (
|
|
|
13
12
|
create_collect_forms_api,
|
|
14
13
|
create_notifications_api,
|
|
15
14
|
create_payment_accounts_api,
|
|
16
|
-
create_tenant_provisioning_api,
|
|
17
|
-
create_vault_mgmt_api,
|
|
18
15
|
)
|
|
16
|
+
from vgscli.cli import create_routes_api as create_vault_mgmt_api_routes
|
|
17
|
+
from vgscli.cli import create_tenant_provisioning_api, create_vault_mgmt_api
|
|
19
18
|
from vgscli.cli.types import ResourceId, ResourceIdParamType
|
|
20
19
|
from vgscli.cli_utils import dump_camelized_yaml, iter_entry_points
|
|
21
20
|
from vgscli.click_extensions import (
|
|
@@ -33,12 +32,13 @@ from vgscli.notifications import (
|
|
|
33
32
|
enrich_notification_events,
|
|
34
33
|
redact_notification_integrations,
|
|
35
34
|
)
|
|
35
|
+
from vgscli.telemetry import TelemetryGroup
|
|
36
36
|
|
|
37
37
|
from .apply import wrap_in_http_envelope
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
@with_plugins(iter_entry_points("vgs.get.plugins"))
|
|
41
|
-
@click.group("get")
|
|
41
|
+
@click.group("get", cls=TelemetryGroup)
|
|
42
42
|
def get() -> None:
|
|
43
43
|
"""
|
|
44
44
|
Get VGS resource.
|
vgscli/collect_forms_api.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from simple_rest_client.api import API
|
|
2
2
|
from simple_rest_client.resource import Resource
|
|
3
3
|
|
|
4
|
-
from vgscli.
|
|
4
|
+
from vgscli.telemetry import request_headers
|
|
5
5
|
|
|
6
6
|
COLLECT_FORMS_URLS = {
|
|
7
7
|
"dev": "https://dashboard-service.apps.verygoodsecurity.io",
|
|
@@ -23,13 +23,14 @@ def create_api(vault_id, environment, token):
|
|
|
23
23
|
api = API(
|
|
24
24
|
api_root_url=COLLECT_FORMS_URLS[environment],
|
|
25
25
|
params={},
|
|
26
|
-
headers=
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
headers=request_headers(
|
|
27
|
+
{
|
|
28
|
+
"Accept": "application/json",
|
|
29
|
+
"Content-Type": "application/json",
|
|
30
|
+
"Authorization": f"Bearer {token}",
|
|
31
|
+
"vgs-vault": vault_id,
|
|
32
|
+
}
|
|
33
|
+
),
|
|
33
34
|
timeout=30,
|
|
34
35
|
append_slash=False,
|
|
35
36
|
json_encode_body=True,
|