vgs-cli 1.30.2.dev9__tar.gz → 1.30.3.dev1__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 (53) hide show
  1. {vgs-cli-1.30.2.dev9/vgs_cli.egg-info → vgs-cli-1.30.3.dev1}/PKG-INFO +1 -1
  2. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1/vgs_cli.egg-info}/PKG-INFO +1 -1
  3. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgs_cli.egg-info/SOURCES.txt +2 -0
  4. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgscli/_version.py +1 -1
  5. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgscli/cli/commands/apply.py +19 -11
  6. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgscli/cli/commands/generate.py +19 -2
  7. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgscli/cli/commands/get.py +32 -3
  8. vgs-cli-1.30.3.dev1/vgscli/resource-templates/http-route-template.yaml +61 -0
  9. vgs-cli-1.30.3.dev1/vgscli/resource-templates/mft-route-template.yaml +10 -0
  10. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgscli/vgs.py +14 -14
  11. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/LICENSE +0 -0
  12. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/MANIFEST.in +0 -0
  13. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/README.md +0 -0
  14. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/requirements.txt +0 -0
  15. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/setup.cfg +0 -0
  16. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/setup.py +0 -0
  17. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/test-requirements.txt +0 -0
  18. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgs_cli.egg-info/dependency_links.txt +0 -0
  19. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgs_cli.egg-info/entry_points.txt +0 -0
  20. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgs_cli.egg-info/not-zip-safe +0 -0
  21. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgs_cli.egg-info/requires.txt +0 -0
  22. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgs_cli.egg-info/top_level.txt +0 -0
  23. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgscli/__init__.py +0 -0
  24. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgscli/access_logs.py +0 -0
  25. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgscli/audits_api.py +0 -0
  26. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgscli/auth.py +0 -0
  27. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgscli/auth_server.py +0 -0
  28. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgscli/auth_utils.py +0 -0
  29. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgscli/callback_server.py +0 -0
  30. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgscli/cli/__init__.py +0 -0
  31. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgscli/cli/commands/__init__.py +0 -0
  32. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgscli/cli/types/__init__.py +0 -0
  33. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgscli/cli/types/resource_id.py +0 -0
  34. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgscli/cli/types/variable.py +0 -0
  35. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgscli/cli_utils.py +0 -0
  36. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgscli/click_extensions.py +0 -0
  37. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgscli/config_file.py +0 -0
  38. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgscli/errors.py +0 -0
  39. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgscli/file_token_util.py +0 -0
  40. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgscli/id_generator.py +0 -0
  41. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgscli/keyring_token_util.py +0 -0
  42. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgscli/resource-templates/service-account/calm.yaml +0 -0
  43. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgscli/resource-templates/service-account/checkout.yaml +0 -0
  44. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgscli/resource-templates/service-account/payments-admin.yaml +0 -0
  45. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgscli/resource-templates/service-account/sub-account-checkout.yaml +0 -0
  46. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgscli/resource-templates/service-account/vgs-cli.yaml +0 -0
  47. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgscli/resource-templates/vault-template.yaml +0 -0
  48. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgscli/testing.py +0 -0
  49. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgscli/text.py +0 -0
  50. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgscli/token_handler.py +0 -0
  51. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgscli/validation-schemas/service-account-schema.yaml +0 -0
  52. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgscli/validation-schemas/vault-resources.yaml +0 -0
  53. {vgs-cli-1.30.2.dev9 → vgs-cli-1.30.3.dev1}/vgscli/validation-schemas/vault-schema.yaml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vgs-cli
3
- Version: 1.30.2.dev9
3
+ Version: 1.30.3.dev1
4
4
  Summary: VGS Client
5
5
  Home-page: https://github.com/verygoodsecurity/vgs-cli
6
6
  Author: Very Good Security
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vgs-cli
3
- Version: 1.30.2.dev9
3
+ Version: 1.30.3.dev1
4
4
  Summary: VGS Client
5
5
  Home-page: https://github.com/verygoodsecurity/vgs-cli
6
6
  Author: Very Good Security
@@ -39,6 +39,8 @@ vgscli/cli/commands/get.py
39
39
  vgscli/cli/types/__init__.py
40
40
  vgscli/cli/types/resource_id.py
41
41
  vgscli/cli/types/variable.py
42
+ vgscli/resource-templates/http-route-template.yaml
43
+ vgscli/resource-templates/mft-route-template.yaml
42
44
  vgscli/resource-templates/vault-template.yaml
43
45
  vgscli/resource-templates/service-account/calm.yaml
44
46
  vgscli/resource-templates/service-account/checkout.yaml
@@ -6,7 +6,7 @@ from semver import VersionInfo
6
6
 
7
7
  from vgscli.text import bold, green
8
8
 
9
- __version__ = "1.30.2.dev9"
9
+ __version__ = "1.30.3.dev1"
10
10
 
11
11
 
12
12
  # noinspection PyBroadException
@@ -1,4 +1,3 @@
1
- import json
2
1
  import logging
3
2
  import time
4
3
  from typing import Optional
@@ -192,18 +191,28 @@ def sync_http_route(payload, ctx, vault_id):
192
191
  route_id = payload["spec"]["id"]
193
192
  try:
194
193
  # api expects it to be wrapped in data attribute
195
- result = vault_management_api.routes.update(
194
+ response = vault_management_api.routes.update(
196
195
  route_id, body={"data": payload["spec"]}
197
196
  )
198
- logger.debug(result)
199
- print(result)
200
- print(result.body)
201
- result = normalize_one(json.loads(result.body)["data"])
202
- click.echo(f"Route {route_id} processed")
203
197
  except exceptions.ClientError as e:
204
198
  error_msg = "\n".join([error["detail"] for error in e.response.body["errors"]])
205
199
  raise RouteNotValidError(error_msg)
206
- return result
200
+ logger.debug(response)
201
+ payload = normalize_one(response.body["data"])
202
+ payload = wrap_in_http_envelope(payload)
203
+ click.echo(f"Route {route_id} processed")
204
+ return payload
205
+
206
+
207
+ def wrap_in_http_envelope(payload):
208
+ # TODO: this either needs to come from the API or we should add support for versioning in the client (yuk)
209
+ envelope = {
210
+ "apiVersion": "vault.vgs.io/v1",
211
+ "kind": "HttpRoute",
212
+ "metadata": {"name": payload["id"]},
213
+ "spec": payload,
214
+ }
215
+ return envelope
207
216
 
208
217
 
209
218
  def sync_mft_route(payload, ctx, vault_id):
@@ -262,6 +271,5 @@ def all_vault_resources(
262
271
  response_payload = HANDLERS[(resource["apiVersion"], resource["kind"])](
263
272
  resource, ctx, vault
264
273
  )
265
- print(f'got {response_payload}')
266
- # if response_payload:
267
- # print(dump_yaml(response_payload))
274
+ if response_payload:
275
+ print(dump_yaml(response_payload))
@@ -1,10 +1,9 @@
1
1
  import click
2
2
  from click_plugins import with_plugins
3
3
  from pkg_resources import iter_entry_points
4
-
5
4
  from vgscli.cli import create_account_mgmt_api, create_vault_mgmt_api
6
- from vgscli.errors import handle_errors
7
5
  from vgscli.cli_utils import dump_camelized_yaml, read_file
6
+ from vgscli.errors import handle_errors
8
7
 
9
8
 
10
9
  @with_plugins(iter_entry_points("vgs.generate.plugins"))
@@ -53,3 +52,21 @@ def generate_access_credentials(ctx, vault):
53
52
  }
54
53
  )
55
54
  )
55
+
56
+
57
+ @generate.command("http-route")
58
+ @handle_errors()
59
+ def generate_route():
60
+ """
61
+ Generate a VGS HTTP Route
62
+ """
63
+ click.echo(read_file("resource-templates/http-route-template.yaml"), nl=False)
64
+
65
+
66
+ @generate.command("mft-route")
67
+ @handle_errors()
68
+ def generate_route():
69
+ """
70
+ Generate a VGS MFT Route
71
+ """
72
+ click.echo(read_file("resource-templates/mft-route-template.yaml"), nl=False)
@@ -1,13 +1,18 @@
1
1
  import click
2
+ import yaml
2
3
  from click_plugins import with_plugins
3
4
  from pkg_resources import iter_entry_points
4
-
5
5
  from simple_rest_client.exceptions import ClientError, ServerError
6
-
6
+ from vgscli.auth import handshake, token_util
7
7
  from vgscli.cli import create_account_mgmt_api, create_vault_mgmt_api
8
8
  from vgscli.cli.types import ResourceId, ResourceIdParamType
9
- from vgscli.errors import handle_errors, ServiceClientListingError
10
9
  from vgscli.cli_utils import dump_camelized_yaml
10
+ from vgscli.errors import ServiceClientListingError, handle_errors
11
+
12
+ from vgs.sdk.routes import normalize
13
+ from vgs.sdk.vaults_api import create_api as create_vault_mgmt_api
14
+
15
+ from .apply import wrap_in_http_envelope
11
16
 
12
17
 
13
18
  @with_plugins(iter_entry_points("vgs.get.plugins"))
@@ -130,3 +135,27 @@ def get_vaults(ctx):
130
135
  }
131
136
  )
132
137
  )
138
+
139
+
140
+ @get.command("http-routes")
141
+ @click.option("--vault", "-V", help="Vault ID", required=True)
142
+ @click.pass_context
143
+ @handle_errors()
144
+ def get_vaults(ctx, vault):
145
+ """
146
+ Get vaults
147
+ """
148
+
149
+ handshake(ctx, ctx.obj.env)
150
+
151
+ vault_management_api = create_vault_mgmt_api(
152
+ ctx, vault, ctx.obj.env, token_util.get_access_token()
153
+ )
154
+
155
+ response = vault_management_api.routes.list()
156
+ routes = normalize(response.body["data"])
157
+
158
+ # for each route, wrap in envelope and return
159
+ wrapped = [wrap_in_http_envelope(route) for route in routes]
160
+
161
+ click.echo(yaml.dump_all(wrapped, indent=2, default_flow_style=False))
@@ -0,0 +1,61 @@
1
+ apiVersion: vault.vgs.io/v1
2
+ kind: HttpRoute
3
+ metadata:
4
+ name: your-name-here
5
+ labels:
6
+ vgs.io/vaultId: your-vault-id-here
7
+ spec:
8
+ # TODO: Change this ID
9
+ id: &routeId 7478d3b7-beef-cafe-0000-000000000000
10
+ type: rule_chain
11
+ attributes:
12
+ id: *routeId
13
+ host_endpoint: httpbin.org
14
+ destination_override_endpoint: '*'
15
+ ordinal: 0
16
+ port: 0
17
+ protocol: http
18
+ source_endpoint: '*'
19
+ tags:
20
+ # TODO: add a good name
21
+ name: Display name of route here
22
+ # TODO: add version here
23
+ vgs.io/version: 0.1.0
24
+ # filters
25
+ entries:
26
+ # first filter - document here what it does
27
+ - classifiers: {}
28
+ config:
29
+ condition: OR
30
+ rules:
31
+ - expression:
32
+ field: PathInfo
33
+ operator: matches
34
+ type: string
35
+ values:
36
+ - /post
37
+ id: 955834e8-beef-cafe-0000-000000000000
38
+ id_selector: null
39
+ operation: ENRICH
40
+ operations:
41
+ - name: github.com/verygoodsecurity/common/compute/larky/http/Process
42
+ parameters:
43
+ script: |
44
+ load('@stdlib//json', 'json')
45
+ load("@stdlib//builtins", "builtins")
46
+
47
+ load("@vgs//vault", "vault")
48
+
49
+ def process(input, ctx):
50
+ # TODO: write your larky code here.
51
+
52
+ return input
53
+ phase: REQUEST
54
+ public_token_generator: UUID
55
+ targets:
56
+ - body
57
+ token_manager: PERSISTENT
58
+ transformer: JSON_PATH
59
+ transformer_config:
60
+ - $.whatever_this_field_is_unused
61
+ transformer_config_map: null
@@ -0,0 +1,10 @@
1
+ ---
2
+ apiVersion: apps.vgs.io/v1beta
3
+ kind: MftRoute
4
+ metadata:
5
+ name: my-mft-route
6
+ id: foo
7
+ spec:
8
+ source: foo
9
+ destination: bar
10
+ when: []
@@ -3,27 +3,27 @@ from typing import Optional
3
3
 
4
4
  import click
5
5
  from click_plugins import with_plugins
6
- from pkg_resources import iter_entry_points
7
6
  from jinja2 import Environment, PackageLoader, StrictUndefined, UndefinedError
7
+ from pkg_resources import iter_entry_points
8
8
  from simple_rest_client.exceptions import ClientError
9
-
10
- from vgs.sdk.accounts_api import create_api as create_accounts_api
11
- from vgs.sdk.routes import dump_all_routes, sync_all_routes
12
- from vgs.sdk.serializers import wrap_records, format_logs
13
- from vgs.sdk.utils import resolve_env
14
- from vgs.sdk.vaults_api import create_api as create_vaults_api
15
-
16
9
  from vgscli import auth
17
10
  from vgscli._version import check_for_updates, version
18
- from vgscli.access_logs import prepare_filter, fetch_logs
19
- from vgscli.audits_api import create_api as create_audits_api, OperationLogsQueryConfig
11
+ from vgscli.access_logs import fetch_logs, prepare_filter
12
+ from vgscli.audits_api import OperationLogsQueryConfig
13
+ from vgscli.audits_api import create_api as create_audits_api
20
14
  from vgscli.auth import client_credentials_login, handshake, token_util
21
- from vgscli.click_extensions import Config, DateTimeDuration
15
+ from vgscli.cli.commands import apply, generate, get
16
+ from vgscli.cli.types import Variable, VariableParamType
22
17
  from vgscli.cli_utils import format_org_id
18
+ from vgscli.click_extensions import Config, DateTimeDuration
23
19
  from vgscli.config_file import configuration_option
24
- from vgscli.cli.commands import apply, generate, get
25
- from vgscli.cli.types import VariableParamType, Variable
26
- from vgscli.errors import handle_errors, ServiceClientDeletionError
20
+ from vgscli.errors import ServiceClientDeletionError, handle_errors
21
+
22
+ from vgs.sdk.accounts_api import create_api as create_accounts_api
23
+ from vgs.sdk.routes import dump_all_routes, sync_all_routes
24
+ from vgs.sdk.serializers import format_logs, wrap_records
25
+ from vgs.sdk.utils import resolve_env
26
+ from vgs.sdk.vaults_api import create_api as create_vaults_api
27
27
 
28
28
 
29
29
  @with_plugins(iter_entry_points("vgs.plugins"))
File without changes
File without changes
File without changes
File without changes
File without changes