fluidattacks_dynamo_etl 4.0.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.
- fluidattacks_dynamo_etl-4.0.5/.envrc +1 -0
- fluidattacks_dynamo_etl-4.0.5/PKG-INFO +18 -0
- fluidattacks_dynamo_etl-4.0.5/build/default.nix +49 -0
- fluidattacks_dynamo_etl-4.0.5/build/filter.nix +12 -0
- fluidattacks_dynamo_etl-4.0.5/build/image.nix +50 -0
- fluidattacks_dynamo_etl-4.0.5/build/jobs/default.nix +69 -0
- fluidattacks_dynamo_etl-4.0.5/build/jobs/integrates_schema.sh +8 -0
- fluidattacks_dynamo_etl-4.0.5/build/jobs/sifts_state.schema.json +2 -0
- fluidattacks_dynamo_etl-4.0.5/build/jobs/update_integrates.py +13 -0
- fluidattacks_dynamo_etl-4.0.5/build/jobs/update_sifts.py +13 -0
- fluidattacks_dynamo_etl-4.0.5/flake.lock +803 -0
- fluidattacks_dynamo_etl-4.0.5/flake.nix +58 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/__init__.py +11 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/_core.py +74 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/_logger.py +27 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/_multi_file/__init__.py +0 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/_multi_file/classifier.py +37 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/_multi_file/splitter.py +220 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/_parallel.py +124 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/_utils/__init__.py +93 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/_utils/dict.py +23 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/_utils/iter.py +32 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/_utils/merge.py +15 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/_utils/non_empty.py +58 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/_utils/pure_io.py +225 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/cli/__init__.py +84 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/cli/_schemas.py +37 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/cue_schema/__init__.py +25 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/cue_schema/_utils.py +28 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/cue_schema/core/__init__.py +0 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/cue_schema/core/primitive.py +24 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/cue_schema/core/resolved.py +205 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/cue_schema/core/unresolved.py +145 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/cue_schema/decode/__init__.py +0 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/cue_schema/decode/core.py +77 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/cue_schema/decode/schemas.py +50 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/cue_schema/decode/u_type.py +219 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/cue_schema/encode/__init__.py +0 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/cue_schema/encode/data_type.py +46 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/cue_schema/flattener/__init__.py +24 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/cue_schema/flattener/base.py +114 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/cue_schema/flattener/core.py +11 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/cue_schema/flattener/inner.py +68 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/cue_schema/merge.py +82 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/cue_schema/resolve.py +61 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/cue_schema/simplify.py +124 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/data_schema/__init__.py +0 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/data_schema/cache.py +38 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/data_schema/decode.py +27 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/data_values/__init__.py +0 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/data_values/flattener/__init__.py +29 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/data_values/flattener/_flattener.py +77 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/data_values/flattener/_nested_id.py +62 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/data_values/flattener/_to_table.py +168 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/data_values/flattener/core.py +114 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/data_values/transform/__init__.py +0 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/data_values/transform/adjust_obj.py +30 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/data_values/transform/adjust_value.py +186 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/data_values/transform/complete_record.py +39 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/data_values/transform/csv_format.py +52 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/data_values/transform/postfix.py +59 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/data_values/transform/str_date.py +39 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/dynamo/__init__.py +0 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/dynamo/export/__init__.py +29 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/dynamo/export/_client.py +136 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/dynamo/export/_core.py +58 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/dynamo/export/decode.py +38 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/dynamo/table/__init__.py +23 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/dynamo/table/_client.py +167 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/dynamo/table/_core.py +53 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/dynamo/table/_decode.py +89 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/dynamo/table/_encode.py +87 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/dynamo/value/__init__.py +31 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/dynamo/value/_factory.py +150 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/dynamo/value/_scalar.py +131 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/dynamo/value/_scalar_set.py +100 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/dynamo/value/_transform.py +138 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/dynamo/value/_value.py +106 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/dynamo/value/decode.py +133 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/etls/__init__.py +20 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/etls/core.py +26 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/etls/generic/__init__.py +0 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/etls/generic/core.py +54 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/etls/generic/executor.py +54 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/etls/generic/phases.py +144 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/etls/generic/segment.py +26 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/etls/integrates/__init__.py +19 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/etls/integrates/_core.py +26 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/etls/integrates/schema.py +183 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/etls/sifts.py +43 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/jobs_sdk/__init__.py +0 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/jobs_sdk/batch/__init__.py +33 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/jobs_sdk/batch/_core.py +23 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/jobs_sdk/batch/_jobs.py +234 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/jschema/__init__.py +0 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/jschema/decode/__init__.py +49 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/jschema/decode/_core.py +67 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/jschema/decode/_number.py +98 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/jschema/decode/_object.py +100 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/jschema/decode/_string.py +66 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/jschema/encode/__init__.py +46 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/jschema/encode/_number.py +67 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/jschema/encode/_object.py +60 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/jschema/encode/_string.py +32 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/jschema/number.py +142 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/jschema/object.py +91 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/jschema/string.py +65 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/phases/__init__.py +0 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/phases/core.py +76 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/phases/download_from_export/__init__.py +94 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/phases/download_from_export/_decode_segment.py +28 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/phases/download_transform.py +54 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/phases/plan_and_send.py +26 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/phases/segmentation_plan/__init__.py +3 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/phases/segmentation_plan/_assignments.py +89 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/phases/segmentation_plan/_core.py +8 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/phases/segmentation_plan/_decode.py +13 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/phases/segmentation_plan/_encode.py +27 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/phases/transform.py +88 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/phases/upload_csv.py +114 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/phases/upload_snowflake/__init__.py +150 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/phases/upload_snowflake/_copy.py +114 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/phases/upload_snowflake/_prepare.py +97 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/s3/__init__.py +14 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/s3/_core.py +26 -0
- fluidattacks_dynamo_etl-4.0.5/fluidattacks_dynamo_etl/s3/_operations.py +144 -0
- fluidattacks_dynamo_etl-4.0.5/mypy.ini +30 -0
- fluidattacks_dynamo_etl-4.0.5/pyproject.toml +49 -0
- fluidattacks_dynamo_etl-4.0.5/ruff.toml +55 -0
- fluidattacks_dynamo_etl-4.0.5/tests/__init__.py +0 -0
- fluidattacks_dynamo_etl-4.0.5/tests/test_core.py +7 -0
- fluidattacks_dynamo_etl-4.0.5/tests/test_data_schema/__init__.py +0 -0
- fluidattacks_dynamo_etl-4.0.5/tests/test_data_schema/test_flatten.py +35 -0
- fluidattacks_dynamo_etl-4.0.5/tests/test_data_schema/test_merge.py +61 -0
- fluidattacks_dynamo_etl-4.0.5/tests/test_multiline.py +52 -0
- fluidattacks_dynamo_etl-4.0.5/tests/test_transform_phase.py +33 -0
- fluidattacks_dynamo_etl-4.0.5/tests_fx/__init__.py +0 -0
- fluidattacks_dynamo_etl-4.0.5/tests_fx/test_core.py +43 -0
- fluidattacks_dynamo_etl-4.0.5/tests_fx/test_integrates_schema.py +35 -0
- fluidattacks_dynamo_etl-4.0.5/uv.lock +2155 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
use_flake ".#python311.devShell"
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: fluidattacks_dynamo_etl
|
|
3
|
+
Version: 4.0.5
|
|
4
|
+
Summary: Dynamo ETLs configuration
|
|
5
|
+
Author-email: Product Team <development@fluidattacks.com>
|
|
6
|
+
Requires-Python: >=3.11
|
|
7
|
+
Requires-Dist: boto3 >=1.34.131, <2.0.0
|
|
8
|
+
Requires-Dist: click >=8.1.3, <9.0.0
|
|
9
|
+
Requires-Dist: python-dateutil >=2.9.0.post0, <3.0.0
|
|
10
|
+
Requires-Dist: fa-purity >=2.6.0, <3.0.0
|
|
11
|
+
Requires-Dist: fa_singer_io >=3.0.0, <4.0.0
|
|
12
|
+
Requires-Dist: redshift-client >=10.0.0, <11.0.0
|
|
13
|
+
Requires-Dist: fluidattacks-connection-manager>=4.0.0, <5.0.0
|
|
14
|
+
Requires-Dist: fluidattacks-batch-client>=0.2.2, <1.0.0
|
|
15
|
+
Requires-Dist: fluidattacks-etl-utils >=4.1.0, <5.0.0
|
|
16
|
+
Requires-Dist: fluidattacks-target-warehouse >=3.0.0, <4.0.0
|
|
17
|
+
Requires-Dist: fluidattacks-utils-logger >=3.0.0, <4.0.0
|
|
18
|
+
Requires-Dist: snowflake-client >=5.0.0, <6.0.0
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
nixpkgs,
|
|
3
|
+
builders,
|
|
4
|
+
scripts,
|
|
5
|
+
src,
|
|
6
|
+
system,
|
|
7
|
+
job_inputs,
|
|
8
|
+
}:
|
|
9
|
+
let
|
|
10
|
+
build_additionals =
|
|
11
|
+
bundle:
|
|
12
|
+
let
|
|
13
|
+
bin = nixpkgs.writeShellApplication {
|
|
14
|
+
name = "dynamo-etl";
|
|
15
|
+
runtimeInputs = [
|
|
16
|
+
bundle.env.runtime
|
|
17
|
+
nixpkgs.sops
|
|
18
|
+
nixpkgs.openssh
|
|
19
|
+
];
|
|
20
|
+
runtimeEnv = {
|
|
21
|
+
AWS_DEFAULT_REGION = "us-east-1";
|
|
22
|
+
};
|
|
23
|
+
text = ''
|
|
24
|
+
dynamo-etl "''${@}"
|
|
25
|
+
'';
|
|
26
|
+
};
|
|
27
|
+
image = import ./image.nix { inherit nixpkgs bin; };
|
|
28
|
+
jobs = import ./jobs {
|
|
29
|
+
inherit
|
|
30
|
+
nixpkgs
|
|
31
|
+
job_inputs
|
|
32
|
+
system
|
|
33
|
+
bundle
|
|
34
|
+
image
|
|
35
|
+
;
|
|
36
|
+
};
|
|
37
|
+
in
|
|
38
|
+
{
|
|
39
|
+
inherit bin image;
|
|
40
|
+
job = bundle.job // jobs;
|
|
41
|
+
};
|
|
42
|
+
in
|
|
43
|
+
{
|
|
44
|
+
inherit src;
|
|
45
|
+
root_path = "observes/etl/dynamo";
|
|
46
|
+
module_name = "fluidattacks_dynamo_etl";
|
|
47
|
+
pypi_token_var = "DYNAMO_ETL_TOKEN";
|
|
48
|
+
override = bundle: bundle // (build_additionals bundle);
|
|
49
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{ nixpkgs, bin }:
|
|
2
|
+
let
|
|
3
|
+
tempDir = nixpkgs.runCommand "temp-dir" { } ''
|
|
4
|
+
mkdir -p $out/tmp
|
|
5
|
+
'';
|
|
6
|
+
fluidSetup = nixpkgs.runCommand "fluid-public-ssh" { } ''
|
|
7
|
+
mkdir -p $out/root/.ssh
|
|
8
|
+
touch $out/root/.ssh/id_ed25519
|
|
9
|
+
echo 'gitlab.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAfuCHKVTjquxvt6CM6tdG4SLp1Btn/nOeHHE5UOzRdf' > $out/root/.ssh/known_hosts
|
|
10
|
+
'';
|
|
11
|
+
rootHome = nixpkgs.runCommand "root-home" { } ''
|
|
12
|
+
mkdir -p $out/etc
|
|
13
|
+
echo 'root:x:0:0:root user:/root:/bin/sh' > $out/etc/passwd
|
|
14
|
+
echo 'nobody:x:65534:65534:nobody:/var/empty:/bin/sh' >> $out/etc/passwd
|
|
15
|
+
'';
|
|
16
|
+
with_universe_ssh =
|
|
17
|
+
shell_app:
|
|
18
|
+
nixpkgs.writeShellApplication {
|
|
19
|
+
inherit (shell_app) name;
|
|
20
|
+
runtimeInputs = [ nixpkgs.coreutils ];
|
|
21
|
+
text = ''
|
|
22
|
+
echo "$UNIVERSE_SSH_KEY" > /root/.ssh/id_ed25519
|
|
23
|
+
chmod 1777 /tmp
|
|
24
|
+
chmod 400 /root/.ssh
|
|
25
|
+
chmod 400 /root/.ssh/id_ed25519
|
|
26
|
+
chmod 400 /root/.ssh/known_hosts
|
|
27
|
+
${shell_app}/bin/${shell_app.name} "''${@}"
|
|
28
|
+
'';
|
|
29
|
+
# UNIVERSE_SSH_KEY should be impure and not set at build time because is a secret
|
|
30
|
+
};
|
|
31
|
+
# [NOTICE] to maintain the program agnostic of ssh config as on the build/dev env,
|
|
32
|
+
# ssh setup must be done on the container derivation
|
|
33
|
+
in
|
|
34
|
+
nixpkgs.dockerTools.buildImage {
|
|
35
|
+
name = "dynamo_etl";
|
|
36
|
+
copyToRoot = [
|
|
37
|
+
nixpkgs.dockerTools.caCertificates
|
|
38
|
+
nixpkgs.dockerTools.fakeNss
|
|
39
|
+
(with_universe_ssh bin)
|
|
40
|
+
tempDir
|
|
41
|
+
fluidSetup
|
|
42
|
+
rootHome
|
|
43
|
+
];
|
|
44
|
+
# tempDir: required by mktemp
|
|
45
|
+
# caCertificates: provably required by requests and internet-communication libraries
|
|
46
|
+
# fakeNss: provably required by ssh, git or other cli tools
|
|
47
|
+
config = {
|
|
48
|
+
Env = [ "PATH=/bin" ];
|
|
49
|
+
};
|
|
50
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
bundle,
|
|
3
|
+
image,
|
|
4
|
+
nixpkgs,
|
|
5
|
+
job_inputs,
|
|
6
|
+
system,
|
|
7
|
+
}:
|
|
8
|
+
let
|
|
9
|
+
determine_integrates_schema =
|
|
10
|
+
CUE_SCHEMA_DIR:
|
|
11
|
+
let
|
|
12
|
+
det-schema = nixpkgs.writeShellApplication {
|
|
13
|
+
runtimeEnv = { inherit CUE_SCHEMA_DIR; };
|
|
14
|
+
name = "det-schema";
|
|
15
|
+
runtimeInputs = [
|
|
16
|
+
nixpkgs.cue
|
|
17
|
+
bundle.env.runtime
|
|
18
|
+
];
|
|
19
|
+
text = builtins.readFile ./integrates_schema.sh;
|
|
20
|
+
};
|
|
21
|
+
in
|
|
22
|
+
derivation {
|
|
23
|
+
inherit system;
|
|
24
|
+
name = "observes-dynamo-etl-det-integrates-schema";
|
|
25
|
+
builder = "${nixpkgs.bash}/bin/bash";
|
|
26
|
+
args = [ "${det-schema}/bin/det-schema" ];
|
|
27
|
+
};
|
|
28
|
+
in
|
|
29
|
+
{
|
|
30
|
+
determine_integrates_schema = determine_integrates_schema job_inputs.pinned_integrates_cue_schema;
|
|
31
|
+
update_integrates_schema = nixpkgs.writeShellApplication {
|
|
32
|
+
runtimeEnv = {
|
|
33
|
+
AWS_DEFAULT_REGION = "us-east-1";
|
|
34
|
+
INTEGRATES_VMS_SCHEMAS = determine_integrates_schema job_inputs.self_integrates_cue_schema;
|
|
35
|
+
};
|
|
36
|
+
name = "observes-dynamo-etl-update-integrates-schema";
|
|
37
|
+
runtimeInputs = [ bundle.env.runtime ];
|
|
38
|
+
text = "python ${./update_integrates.py}";
|
|
39
|
+
};
|
|
40
|
+
update_sifts_schema = nixpkgs.writeShellApplication {
|
|
41
|
+
runtimeEnv = {
|
|
42
|
+
AWS_DEFAULT_REGION = "us-east-1";
|
|
43
|
+
SIFTS_SCHEMAS = ./sifts_state.schema.json;
|
|
44
|
+
};
|
|
45
|
+
name = "observes-dynamo-etl-update-sifts-schema";
|
|
46
|
+
runtimeInputs = [ bundle.env.runtime ];
|
|
47
|
+
text = "python ${./update_sifts.py}";
|
|
48
|
+
};
|
|
49
|
+
deploy_image = nixpkgs.writeShellApplication {
|
|
50
|
+
name = "observes-dynamo-etl-deploy-image";
|
|
51
|
+
extraShellCheckFlags = [ "-x" ];
|
|
52
|
+
runtimeInputs = [
|
|
53
|
+
nixpkgs.skopeo
|
|
54
|
+
job_inputs.shell-helpers.helper-aws
|
|
55
|
+
job_inputs.shell-helpers.helper-sops
|
|
56
|
+
job_inputs.ecr_deploy_image.env.runtime
|
|
57
|
+
];
|
|
58
|
+
text = ''
|
|
59
|
+
# shellcheck source=${job_inputs.shell-helpers.helper-aws}/bin/helper-aws
|
|
60
|
+
source helper-aws aws_login prod_common 3600
|
|
61
|
+
|
|
62
|
+
deploy-image deploy \
|
|
63
|
+
--registry "205810638802.dkr.ecr.us-east-1.amazonaws.com/observes/dynamo_etl" \
|
|
64
|
+
--region "us-east-1" \
|
|
65
|
+
--image-tar "${image}" \
|
|
66
|
+
--version "${bundle.pkg.version}"
|
|
67
|
+
'';
|
|
68
|
+
};
|
|
69
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# shellcheck shell=bash
|
|
2
|
+
|
|
3
|
+
BUILDER_PWD="${PWD}"
|
|
4
|
+
cd "${CUE_SCHEMA_DIR}" || exit
|
|
5
|
+
cue eval -O ./tables/integrates_vms/full_schema.cue --out "openapi" > "${BUILDER_PWD}/integrates_schema.openapi.json"
|
|
6
|
+
# the `out` env var comes from the nix builder environment
|
|
7
|
+
# shellcheck disable=SC2154
|
|
8
|
+
dynamo-etl schemas integrates-vms "${BUILDER_PWD}/integrates_schema.openapi.json" > "${out}"
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
{"type": "SCHEMA", "stream": "sifts_state", "schema": {"properties": {"code_hash_str": {"type": ["string", "null"], "precision": 256, "metatype": "dynamic"}, "version_str": {"type": ["string", "null"], "precision": 256, "metatype": "dynamic"}, "prediction_label_str": {"type": ["string", "null"], "precision": 256, "metatype": "dynamic"}, "prediction_score_float": {"type": ["null", "number"], "size": "float"}, "created_at_datetime": {"type": ["string", "null"], "precision": 256, "metatype": "dynamic", "format": "date-time"}, "category_str": {"type": ["string", "null"], "precision": 256, "metatype": "dynamic"}, "subcategory_str": {"type": ["string", "null"], "precision": 256, "metatype": "dynamic"}, "pk_str": {"type": ["string", "null"], "precision": 1000, "metatype": "dynamic"}, "sk_str": {"type": ["string", "null"], "precision": 1000, "metatype": "dynamic"}, "group_name_str": {"type": ["string", "null"], "precision": 256, "metatype": "dynamic"}, "commit_str": {"type": ["string", "null"], "precision": 256, "metatype": "dynamic"}, "path_str": {"type": ["string", "null"], "precision": 1000, "metatype": "dynamic"}, "start_byte_int": {"type": ["integer", "null"], "size": "normal"}, "end_byte_int": {"type": ["integer", "null"], "size": "normal"}, "start_line_int": {"type": ["integer", "null"], "size": "normal"}, "start_column_int": {"type": ["integer", "null"], "size": "normal"}, "end_line_int": {"type": ["integer", "null"], "size": "normal"}, "end_column_int": {"type": ["integer", "null"], "size": "normal"}, "node_type_str": {"type": ["string", "null"], "precision": 256, "metatype": "dynamic"}, "model_str": {"type": ["string", "null"], "precision": 256, "metatype": "dynamic"}, "root_nickname_str": {"type": ["string", "null"], "precision": 256, "metatype": "dynamic"}, "file_path_str": {"type": ["string", "null"], "precision": 1000, "metatype": "dynamic"}, "snippet_hash_id_str": {"type": ["string", "null"], "precision": 1000, "metatype": "dynamic"}, "analyzed_at_datetime": {"type": ["string", "null"], "precision": 256, "metatype": "dynamic", "format": "date-time"}, "candidate_index_int": {"type": ["integer", "null"], "size": "normal"}, "cost_float": {"type": ["null", "number"], "size": "float"}, "input_tokens_int": {"type": ["integer", "null"], "size": "normal"}, "output_tokens_int": {"type": ["integer", "null"], "size": "normal"}, "total_tokens_int": {"type": ["integer", "null"], "size": "normal"}, "vulnerable_bool": {"type": "boolean"}, "ranking_score_float": {"type": ["null", "number"], "size": "float"}, "reason_str": {"type": ["string", "null"], "precision": 16777216, "metatype": "dynamic"}, "sifts_state____vulnerable_lines_str": {"type": ["string", "null"], "precision": 256, "metatype": "dynamic"}, "suggested_criteria_code_str": {"type": ["string", "null"], "precision": 256, "metatype": "dynamic"}, "suggested_finding_title_str": {"type": ["string", "null"], "precision": 256, "metatype": "dynamic"}, "trace_id_str": {"type": ["string", "null"], "precision": 256, "metatype": "dynamic"}, "vulnerability_id_candidate_str": {"type": ["string", "null"], "precision": 256, "metatype": "dynamic"}}}, "key_properties": []}
|
|
2
|
+
{"type": "SCHEMA", "stream": "sifts_state____vulnerable_lines_str", "schema": {"properties": {"val_str": {"type": ["string", "null"], "precision": 256, "metatype": "dynamic"}, "sid0_str": {"type": ["string", "null"], "precision": 256, "metatype": "dynamic"}, "forward_index_int": {"type": ["integer", "null"], "size": "normal"}, "backward_index_int": {"type": ["integer", "null"], "size": "normal"}}}, "key_properties": []}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# noqa: INP001
|
|
2
|
+
# this is a script not intented to be a pkg
|
|
3
|
+
from os import environ
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
from fa_purity import Cmd, UnitType, Unsafe
|
|
7
|
+
|
|
8
|
+
from fluidattacks_dynamo_etl.etls.integrates.schema import update_schema_cache
|
|
9
|
+
|
|
10
|
+
cmd: Cmd[UnitType] = update_schema_cache(Path(environ["INTEGRATES_VMS_SCHEMAS"])).map(
|
|
11
|
+
lambda r: r.alt(Unsafe.raise_exception).to_union(),
|
|
12
|
+
)
|
|
13
|
+
cmd.compute()
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# noqa: INP001
|
|
2
|
+
# this is a script not intented to be a pkg
|
|
3
|
+
from os import environ
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
from fa_purity import Cmd, UnitType, Unsafe
|
|
7
|
+
|
|
8
|
+
from fluidattacks_dynamo_etl.etls.sifts import update_schema_cache
|
|
9
|
+
|
|
10
|
+
cmd: Cmd[UnitType] = update_schema_cache(Path(environ["SIFTS_SCHEMAS"])).map(
|
|
11
|
+
lambda r: r.alt(Unsafe.raise_exception).to_union(),
|
|
12
|
+
)
|
|
13
|
+
cmd.compute()
|