Skip to content

feat: Custom metadata mechanism #201

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 492 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
492 commits
Select commit Hold shift + click to select a range
c47d2f0
fix: print method output in docker + tweak docker compose files
wphyojpl Feb 6, 2023
7bb418b
chore: update changelog
wphyojpl Feb 6, 2023
b26b227
feat: add CMR granules search which returns STAC
wphyojpl Mar 9, 2023
a4c9d47
Merge pull request #120 from unity-sds/split-stage-in-out
ngachung Mar 15, 2023
5cc8c98
breaking: configurable file postfixes for PDS metadata extraction (#124)
wphyojpl Apr 5, 2023
47eed19
feat: reduce pystac length by keeping only data asset (#126)
wphyojpl Apr 11, 2023
1c27f66
feat: granules query pagination (#131)
wphyojpl Apr 11, 2023
6a6ecad
feat: add EDL token class
wphyojpl Apr 12, 2023
e1ed5ed
feat: adding DAAC download in docker stage in (in-progress)
wphyojpl Apr 12, 2023
a64e821
feat: add option to parse downloading stac from file (#134)
wphyojpl Apr 12, 2023
3375bce
fix: uncomment temporal in CMR granules search (#136)
wphyojpl Apr 13, 2023
be24023
chore: merge from develop
wphyojpl Apr 17, 2023
da2abe5
fix: some typo in download daac
wphyojpl Apr 17, 2023
1aa62b6
chore: add some TODOs
wphyojpl Apr 17, 2023
9a756ff
fix: update client id
wphyojpl Apr 17, 2023
83efad3
fix: update client id
wphyojpl Apr 17, 2023
a0ae495
chore: update changelog
wphyojpl Apr 17, 2023
2e2fee1
Merge pull request #132 from unity-sds/daac-download
ngachung Apr 21, 2023
b67aa67
feat: Checkout stage with STAC catalog json (#138)
wphyojpl Apr 24, 2023
512133e
feat: daac download from stac json file
wphyojpl Apr 24, 2023
7795cd1
Merge branch 'develop' of github.com:unity-sds/unity-data-services in…
wphyojpl Apr 24, 2023
81947a2
chore: update version
wphyojpl Apr 24, 2023
e7686cd
Merge pull request #142 from unity-sds/daac-download-stac-file
ngachung Apr 24, 2023
0a814a0
fix: downloaded stac to return local absolute path
wphyojpl Apr 24, 2023
a92a6fc
chore: update PR link
wphyojpl Apr 24, 2023
abc7a31
Merge pull request #144 from unity-sds/stac-local-url
ngachung Apr 25, 2023
bc051df
feat: add metadata extraction from stac + refactor
wphyojpl Apr 25, 2023
ff71035
chore: refactor
wphyojpl Apr 25, 2023
f21745c
chore: refactor
wphyojpl Apr 25, 2023
4f709f7
fix: error during refactor
wphyojpl Apr 25, 2023
13a8879
chore: still refactoring
wphyojpl Apr 25, 2023
688a0eb
fix: update code for stac lambda
wphyojpl Apr 25, 2023
56d2332
feat: add terraform
wphyojpl Apr 25, 2023
46c28de
Merge branch 'develop' of github.com:unity-sds/unity-data-services in…
wphyojpl Apr 25, 2023
0e1b905
chore: update version
wphyojpl Apr 25, 2023
204695c
chore: merge from develop
wphyojpl Apr 26, 2023
7bf7e7c
chore: merge from develop
wphyojpl Apr 26, 2023
a517989
Merge pull request #146 from unity-sds/stac-metadata-extraction
ngachung Apr 28, 2023
9baeb78
feat: optional output to file
wphyojpl May 3, 2023
e53d7f7
fix: add unit test + create folder if needed
wphyojpl May 4, 2023
018b85d
fix: tweak it a bit to avoid writing it twice in case some steps are …
wphyojpl May 4, 2023
66498d6
chore: update readme
wphyojpl May 4, 2023
854f8e8
fix: use cas structure to generate metadata for stac (#148)
wphyojpl May 5, 2023
b582adc
Merge branch 'develop' into output-to-file
wphyojpl May 5, 2023
0c12c1c
chore: merge from develop
wphyojpl May 10, 2023
65f6605
chore: merge from develop
wphyojpl May 10, 2023
55c8e5e
fix: update requests version for git error
wphyojpl May 10, 2023
1c63675
fix: update requests version for git error
wphyojpl May 10, 2023
2a00918
fix: reshuffle to fix version mismatch
wphyojpl May 10, 2023
6dd0d61
fix: reshuffle to fix version mismatch
wphyojpl May 10, 2023
3b6f68d
fixing urllib3 version
wphyojpl May 10, 2023
6a6d7f7
fixing urllib3 version
wphyojpl May 10, 2023
55ddcf5
Merge pull request #149 from unity-sds/output-to-file
ngachung May 15, 2023
54ebc7c
fix: allow catalog stage input from file
wphyojpl May 22, 2023
639084d
chore: update changelog
wphyojpl May 22, 2023
915406c
fix: remove local var. using parent var
wphyojpl May 22, 2023
a79f1ec
Merge pull request #152 from unity-sds/catalog-stage-from-file
ngachung May 23, 2023
a122a09
fix: production datetime not in +00:00 format
wphyojpl May 23, 2023
f836c0f
chore: update version + readme
wphyojpl May 23, 2023
e17bb6a
Merge branch 'develop' of github.com:unity-sds/unity-data-services in…
wphyojpl May 23, 2023
fb7465b
Merge branch 'develop' of github.com:unity-sds/unity-data-services in…
wphyojpl May 23, 2023
dc2d226
fix: add tags to opensearch
wphyojpl May 23, 2023
7a1d20f
fix: add tags to opensearch
wphyojpl May 23, 2023
038b94c
Merge pull request #154 from unity-sds/stac-metadata-datetime
ngachung May 24, 2023
a0f2b20
fix: add tags in tf
wphyojpl Jun 6, 2023
51854c5
fix: add tags in tf
wphyojpl Jun 6, 2023
9555ab7
Merge branch 'develop' of github.com:unity-sds/unity-data-services in…
wphyojpl Jun 6, 2023
cd9dcd9
Merge branch 'develop' of github.com:unity-sds/unity-data-services in…
wphyojpl Jun 6, 2023
9f9fe68
feat: add public http download class
wphyojpl Jun 12, 2023
90193dd
breaking: search return entire feature-collection
wphyojpl Jun 12, 2023
c10f331
breaking: daac downloader accepts only features collection
wphyojpl Jun 13, 2023
a4bb017
chore: update daac testcase
wphyojpl Jun 13, 2023
6c26b0b
feat: refactor download classes to use inheritance
wphyojpl Jun 13, 2023
837a22f
fix: http downloader had a typo bug
wphyojpl Jun 13, 2023
6526a4b
chore: update readme
wphyojpl Jun 13, 2023
7853a92
chore: update readme
wphyojpl Jun 13, 2023
52e91d5
Merge pull request #161 from unity-sds/http.download
ngachung Jun 13, 2023
dbe6445
feat: new upload handler for relative paths + user granule-id from th…
wphyojpl Jun 19, 2023
523527d
feat: output to be an item-collection
wphyojpl Jun 19, 2023
f5dd731
feat: update catalog to accept item collection
wphyojpl Jun 20, 2023
169fca9
chore: update version
wphyojpl Jun 20, 2023
78109a7
breaking: removing old upload styles + default it to new style if mis…
wphyojpl Jun 21, 2023
8652635
chore: delete old classes
wphyojpl Jun 21, 2023
41f88f0
chore: update version since it is breaking change now
wphyojpl Jun 21, 2023
b79d414
Merge pull request #163 from unity-sds/upload.relative.path
ngachung Jun 21, 2023
09a1569
fix: convert all outputs into json str
wphyojpl Jun 21, 2023
5b93b87
chore: update version
wphyojpl Jun 21, 2023
c601b40
chore: update PR number
wphyojpl Jun 21, 2023
4badceb
Merge pull request #165 from unity-sds/output-in-json-str
ngachung Jun 22, 2023
1a0ade8
feat: added filter keyword in granules endpoint + repeatedly checking…
wphyojpl Jul 5, 2023
5883643
feat: parallelize download (#169)
wphyojpl Jul 5, 2023
efe0ab1
fix: retry 5 times + wait 45 sec for DAAC
wphyojpl Jul 7, 2023
fc70523
fix: retry 5 times + wait 45 sec for DAAC
wphyojpl Jul 7, 2023
c39fde2
feat: make re-try configurable
wphyojpl Jul 7, 2023
db64367
feat: make re-try configurable
wphyojpl Jul 7, 2023
6e03fe4
fix: download error (#182)
wphyojpl Jul 10, 2023
4845f19
Merge branch 'develop' of github.com:unity-sds/unity-data-services in…
wphyojpl Jul 10, 2023
b20d4a0
Merge branch 'develop' of github.com:unity-sds/unity-data-services in…
wphyojpl Jul 10, 2023
4b6b297
chore: merge from develop
wphyojpl Jul 10, 2023
f668e44
chore: merge from develop
wphyojpl Jul 10, 2023
d1a9b2e
Updated CHANGELOG.md to include Unity Release 23.2 release notes.
ngachung Jul 20, 2023
bc8a922
feat: adding fastapi (in-progress)
wphyojpl Jul 20, 2023
924aa42
feat: adding fastapi (in-progress)
wphyojpl Jul 20, 2023
bf37b6a
fix: get collection creation working (in-progress)
wphyojpl Jul 21, 2023
a2a8718
fix: get collection creation working (in-progress)
wphyojpl Jul 21, 2023
d1a8beb
fix: Update stage out task to read STAC items from STAC catalog (#188)
wphyojpl Jul 21, 2023
1a96c87
Merge branch 'develop' of github.com:unity-sds/unity-data-services in…
wphyojpl Jul 24, 2023
46a2f7b
Merge branch 'develop' of github.com:unity-sds/unity-data-services in…
wphyojpl Jul 24, 2023
3917987
fix: add root link in collection stac
wphyojpl Jul 24, 2023
f803439
fix: add root link in collection stac
wphyojpl Jul 24, 2023
da78408
feat: updating terraform
wphyojpl Jul 24, 2023
308d840
feat: updating terraform
wphyojpl Jul 24, 2023
825b749
fix: actual creation has some error
wphyojpl Jul 25, 2023
74af0be
fix: actual creation has some error
wphyojpl Jul 25, 2023
f685002
fix: json to invoke magnum lambda is updated
wphyojpl Jul 25, 2023
774f3a8
fix: json to invoke magnum lambda is updated
wphyojpl Jul 25, 2023
036f5f8
chore: update log statement
wphyojpl Jul 26, 2023
b4d6948
chore: update log statement
wphyojpl Jul 26, 2023
b7bcec8
fix: attempting bugfix
wphyojpl Jul 26, 2023
3492b99
fix: attempting bugfix
wphyojpl Jul 26, 2023
66b2c8b
fix: some weird error. updating function name to confirm it
wphyojpl Jul 26, 2023
2260947
fix: some weird error. updating function name to confirm it
wphyojpl Jul 26, 2023
e91d43f
fix: teraform error due to partial update only
wphyojpl Jul 26, 2023
a3217d4
fix: teraform error due to partial update only
wphyojpl Jul 26, 2023
e34f7a6
fix: dummy commit
wphyojpl Jul 26, 2023
3a297d8
fix: dummy commit
wphyojpl Jul 26, 2023
f7823fc
fix: allow slash and no slash
wphyojpl Jul 26, 2023
16bb957
fix: allow slash and no slash
wphyojpl Jul 26, 2023
a33389f
fix: trying slash and no-slash
wphyojpl Jul 31, 2023
72febf0
fix: trying slash and no-slash
wphyojpl Jul 31, 2023
12ed814
fix: trying slash and no-slash
wphyojpl Jul 31, 2023
64fb114
fix: trying slash and no-slash
wphyojpl Jul 31, 2023
718a297
fix: trying slash and no-slash
wphyojpl Jul 31, 2023
c9454ad
fix: trying slash and no-slash
wphyojpl Jul 31, 2023
0af1150
fix: trying slash and no-slash
wphyojpl Jul 31, 2023
e57d88c
fix: trying slash and no-slash
wphyojpl Jul 31, 2023
02ee0bc
fix: trying slash and no-slash
wphyojpl Jul 31, 2023
b27be2a
fix: trying slash and no-slash
wphyojpl Jul 31, 2023
879bc80
fix: trying slash and no-slash
wphyojpl Jul 31, 2023
bb029c6
fix: trying slash and no-slash
wphyojpl Jul 31, 2023
c677993
fix: trying slash and no-slash
wphyojpl Jul 31, 2023
30d7133
fix: trying slash and no-slash
wphyojpl Jul 31, 2023
2847cf3
fix: trying slash and no-slash
wphyojpl Jul 31, 2023
cb13811
fix: trying slash and no-slash
wphyojpl Jul 31, 2023
5102f6a
fix: trying slash and no-slash
wphyojpl Jul 31, 2023
64885de
fix: trying slash and no-slash
wphyojpl Jul 31, 2023
e7d4f40
feat: add uds endpoint tests
wphyojpl Jul 31, 2023
68f5ff3
feat: add uds endpoint tests
wphyojpl Jul 31, 2023
5ec0364
Merge branch 'develop' of github.com:unity-sds/unity-data-services in…
wphyojpl Jul 31, 2023
33a3089
Merge branch 'develop' of github.com:unity-sds/unity-data-services in…
wphyojpl Jul 31, 2023
7689ebd
chore: merge from fastapi
wphyojpl Jul 31, 2023
f3e4f26
chore: merge from fastapi
wphyojpl Jul 31, 2023
a767d24
feat: am-uds-dapa comes from config with defaulted to that string
wphyojpl Jul 31, 2023
3fa9081
feat: am-uds-dapa comes from config with defaulted to that string
wphyojpl Jul 31, 2023
5d5ee41
Merge branch 'fastapi' of github.com:unity-sds/unity-data-services in…
wphyojpl Jul 31, 2023
1beaabb
Merge branch 'fastapi' of github.com:unity-sds/unity-data-services in…
wphyojpl Jul 31, 2023
ff04dae
feat: adding fastapi
wphyojpl Jul 31, 2023
9f762a2
feat: adding fastapi
wphyojpl Jul 31, 2023
38e265b
Merge branch 'develop' of github.com:unity-sds/unity-data-services in…
wphyojpl Aug 7, 2023
e87617e
feat: endpoint to setup es
wphyojpl Aug 7, 2023
2f88121
feat: endpoint to setup es
wphyojpl Aug 7, 2023
8724fad
feat: Using Fastapi for all API endpoints (#190)
wphyojpl Aug 7, 2023
6fbe8a1
fix: merge from develop
wphyojpl Aug 7, 2023
822d7d9
fix: merge from develop
wphyojpl Aug 7, 2023
fa4b2d4
fix: make venjue specific ssm params
wphyojpl Aug 7, 2023
1839e1a
fix: make venjue specific ssm params
wphyojpl Aug 7, 2023
5cac492
fix: need to dump model to become json
wphyojpl Aug 7, 2023
6b3e249
fix: need to dump model to become json
wphyojpl Aug 7, 2023
f717d84
fix: json validator error
wphyojpl Aug 8, 2023
3359c6e
fix: json validator error
wphyojpl Aug 8, 2023
e869cf7
fix: json validator error
wphyojpl Aug 8, 2023
b106116
fix: json validator error
wphyojpl Aug 8, 2023
97151f1
feat: adding auth to endpoints
wphyojpl Aug 8, 2023
3d8243e
feat: adding auth to endpoints
wphyojpl Aug 8, 2023
26eae47
fix: typo
wphyojpl Aug 8, 2023
4e43eb6
fix: typo
wphyojpl Aug 8, 2023
1be2bf2
fix: add some logs
wphyojpl Aug 8, 2023
8281c4d
fix: add some logs
wphyojpl Aug 8, 2023
a689dfb
fix: add some logs
wphyojpl Aug 8, 2023
14f6815
fix: add some logs
wphyojpl Aug 8, 2023
15d4503
fix: add some logs
wphyojpl Aug 8, 2023
655819e
fix: add some logs
wphyojpl Aug 8, 2023
b614749
fix: update new collection to custom collection table
wphyojpl Aug 8, 2023
b6f7d0d
fix: update new collection to custom collection table
wphyojpl Aug 8, 2023
eb8ade8
fix: need token now for internal call
wphyojpl Aug 8, 2023
8919baa
fix: need token now for internal call
wphyojpl Aug 8, 2023
5591f46
fix: need token now for internal call
wphyojpl Aug 8, 2023
b1c776e
fix: need token now for internal call
wphyojpl Aug 8, 2023
d8b569c
fix: need token now for internal call
wphyojpl Aug 8, 2023
def53b8
fix: need token now for internal call
wphyojpl Aug 8, 2023
f3cb5be
fix: need token now for internal call
wphyojpl Aug 8, 2023
3813adc
fix: need token now for internal call
wphyojpl Aug 8, 2023
4596cb8
fix: need token now for internal call
wphyojpl Aug 8, 2023
694699e
fix: need token now for internal call
wphyojpl Aug 8, 2023
16dce99
fix: no need to ignore case
wphyojpl Aug 8, 2023
33204cf
fix: no need to ignore case
wphyojpl Aug 8, 2023
8166883
chore: merge from develop
wphyojpl Aug 9, 2023
05c460c
fix: S3 upload structure (add collection folder) (#193)
wphyojpl Aug 16, 2023
2c3aa62
fix: Cataloging large number asynchronously by batch + download is st…
wphyojpl Aug 16, 2023
d25fe13
chore: merged from develop
wphyojpl Aug 16, 2023
861be39
chore: merged from develop
wphyojpl Aug 16, 2023
a702b37
Merge branch 'develop' of github.com:unity-sds/unity-data-services in…
wphyojpl Aug 16, 2023
83bfbb8
feat: starting endpoint to create granules collections
wphyojpl Aug 28, 2023
8581f5d
fix: add missing import statement
wphyojpl Aug 28, 2023
42de97c
chore: update version
wphyojpl Aug 28, 2023
f6e2243
chore: dummy commit
wphyojpl Aug 28, 2023
077b463
fix: dummy commit
wphyojpl Aug 28, 2023
838ec38
fix: make name valid for ES index
wphyojpl Aug 29, 2023
d7a749f
fix: make name valid for ES index
wphyojpl Aug 29, 2023
1ff1d10
fix: make name valid for ES index
wphyojpl Aug 29, 2023
78b6d13
fix: make name valid for ES index
wphyojpl Aug 29, 2023
27eefb2
fix: make alias name lowercase
wphyojpl Aug 29, 2023
d85e7c7
feat: add destroy endpoint
wphyojpl Aug 29, 2023
a4516c7
feat: add destroy endpoint
wphyojpl Aug 29, 2023
6e07585
fix: wrong method in destroy
wphyojpl Aug 29, 2023
a136f38
fix: use read alias to get all indices
wphyojpl Aug 29, 2023
bad9191
feat: add get and delete single index endpoint
wphyojpl Aug 29, 2023
ffd9c34
chore: remove urn:nasa:unity from test case. we will not store them a…
wphyojpl Sep 6, 2023
31748a3
feat: also store custom metadata during extraction
wphyojpl Sep 6, 2023
d1c9686
feat: update tf module to support custom metadata
wphyojpl Sep 6, 2023
c12b255
fix: update test + fix some bugs
wphyojpl Sep 6, 2023
82cb3fc
feat: item transformer to expect custom_metadata
wphyojpl Sep 6, 2023
455f52f
feat: query granule to include custom metadata (not tested)
wphyojpl Sep 6, 2023
8b957d3
fix: deleting accidental commits
wphyojpl Sep 6, 2023
67b9c64
fix: allow report_to_ems from config + event_time for record entry
wphyojpl Sep 13, 2023
559e7e1
Merge branch 'elasticsearch.lib' into custom-metadata
wphyojpl Sep 13, 2023
25b3c51
Merge branch 'develop' into elasticsearch.lib
wphyojpl Sep 13, 2023
cdda67a
chore: merge from develop
wphyojpl Sep 13, 2023
ea3faf3
Merge branch 'elasticsearch.lib' of github.com:unity-sds/unity-data-s…
wphyojpl Sep 13, 2023
8992af8
chore: merge from elasticsearch branch
wphyojpl Sep 13, 2023
d81ff4d
fix: delete accidental commits
wphyojpl Sep 13, 2023
19b3507
fix: checking why custom metadata not being ingested
wphyojpl Sep 14, 2023
71fce9a
fix: granule id + collection id for uniqueness
wphyojpl Sep 14, 2023
a736f6e
fix: wrong dsl to get granules custom metadata
wphyojpl Sep 14, 2023
0c830f0
fix: debugging granules retrieval bug
wphyojpl Sep 14, 2023
5e6da20
fix: ingest granule_id starting with collection id
wphyojpl Sep 14, 2023
aeee4b9
fix: granule_id already starts with collection
wphyojpl Sep 14, 2023
10e98dd
fix: hide granule_id in custom_metadata result
wphyojpl Sep 14, 2023
890640d
chore: add end to end test for custom metadata
wphyojpl Sep 14, 2023
4661d37
feat: adding endpoint to get custom metadata fields
wphyojpl Sep 15, 2023
9f6f24a
feat: hiding default fields and other settings
wphyojpl Sep 15, 2023
7280f83
fix: format error
wphyojpl Sep 15, 2023
d2f199c
fix: format error
wphyojpl Sep 15, 2023
3e0d0a7
chore: pull from develop
wphyojpl Sep 18, 2023
4b8aa1a
chore: merge from elasticsearch.lib
wphyojpl Sep 18, 2023
95b2f04
fix: why collections not returning
wphyojpl Sep 27, 2023
be5c435
fix: still fixing why collections not showing up
wphyojpl Sep 27, 2023
c2c2596
fix: debugging code has error
wphyojpl Sep 27, 2023
cebdbcb
fix: remove debugging query
wphyojpl Sep 27, 2023
56a7a38
chore: update changelog
wphyojpl Sep 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ local*
*egg-info*
dist
__pycache__
.env
.env
.terraform

8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [5.5.0] - 2023-09-28
### Added
- [#201](https://github.com/unity-sds/unity-data-services/pull/201) feat: Custom metadata mechanism

## [5.4.0] - 2023-08-16
### Added
- [#95](https://github.com/unity-sds/unity-data-services/pull/95) feat: elasticsearch branch

## [5.3.3] - 2023-09-18
### Changed
- [#204](https://github.com/unity-sds/unity-data-services/pull/204) chore: clean.up - remove old codes
Expand Down
18 changes: 18 additions & 0 deletions ci.cd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,26 @@ update_lambda_function_mcp_dev_6:
aws lambda update-function-code --s3-key unity_cumulus_lambda/cumulus_lambda_functions_deployment.zip --s3-bucket uds-dev-cumulus-public --function-name arn:aws:lambda:us-west-2:237868187491:function:uds-dev-cumulus-metadata_s4pa_generate_cmr --publish &>/dev/null
update_lambda_function_mcp_dev_7:
aws lambda update-function-code --s3-key unity_cumulus_lambda/cumulus_lambda_functions_deployment.zip --s3-bucket uds-dev-cumulus-public --function-name arn:aws:lambda:us-west-2:237868187491:function:uds-dev-cumulus-metadata_stac_generate_cmr --publish &>/dev/null
update_lambda_function_mcp_dev_auth_list:
aws lambda update-function-code --s3-key unity_cumulus_lambda/cumulus_lambda_functions_deployment.zip --s3-bucket uds-dev-cumulus-public --function-name arn:aws:lambda:us-west-2:237868187491:function:uds-dev-cumulus-cumulus_auth_list --publish &>/dev/null
update_lambda_function_mcp_dev_auth_add:
aws lambda update-function-code --s3-key unity_cumulus_lambda/cumulus_lambda_functions_deployment.zip --s3-bucket uds-dev-cumulus-public --function-name arn:aws:lambda:us-west-2:237868187491:function:uds-dev-cumulus-cumulus_auth_add --publish &>/dev/null
update_lambda_function_mcp_dev_auth_delete:
aws lambda update-function-code --s3-key unity_cumulus_lambda/cumulus_lambda_functions_deployment.zip --s3-bucket uds-dev-cumulus-public --function-name arn:aws:lambda:us-west-2:237868187491:function:uds-dev-cumulus-cumulus_auth_delete --publish &>/dev/null

update_lambda_function_mcp_dev_uds_api:
aws lambda update-function-code --s3-key unity_cumulus_lambda/cumulus_lambda_functions_deployment.zip --s3-bucket uds-dev-cumulus-public --function-name arn:aws:lambda:us-west-2:237868187491:function:uds-dev-cumulus-uds_api_1 --publish &>/dev/null

update_lambda_function_mcp_sbx_uds_api:
aws lambda update-function-code --s3-key unity_cumulus_lambda/cumulus_lambda_functions_deployment.zip --s3-bucket uds-dev-cumulus-public --function-name arn:aws:lambda:us-west-2:237868187491:function:uds-sbx-cumulus-uds_api_1 --publish &>/dev/null

mcp_dev: upload_lambda_mcp_dev update_lambda_function_mcp_dev_auth_list update_lambda_function_mcp_dev_auth_add update_lambda_function_mcp_dev_auth_delete

mcp_dev_fastapi: upload_lambda_mcp_dev update_lambda_function_mcp_dev_uds_api

update_lambda_function_mcp_sbx_7:
aws lambda update-function-code --s3-key unity_cumulus_lambda/cumulus_lambda_functions_deployment.zip --s3-bucket uds-dev-cumulus-public --function-name arn:aws:lambda:us-west-2:237868187491:function:uds-sbx-cumulus-metadata_stac_generate_cmr --publish &>/dev/null

mcp_sbx: upload_lambda_mcp_dev update_lambda_function_mcp_sbx_7

mcp_sbx_fastapi: upload_lambda_mcp_dev update_lambda_function_mcp_sbx_uds_api
Empty file.
181 changes: 181 additions & 0 deletions cumulus_lambda_functions/cumulus_auth_crud/auth_crud.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
import json
import os

from cumulus_lambda_functions.lib.authorization.uds_authorizer_abstract import UDSAuthorizorAbstract
from cumulus_lambda_functions.lib.authorization.uds_authorizer_factory import UDSAuthorizerFactory
from cumulus_lambda_functions.lib.json_validator import JsonValidator

from cumulus_lambda_functions.lib.lambda_logger_generator import LambdaLoggerGenerator
from cumulus_lambda_functions.lib.uds_db.db_constants import DBConstants
from cumulus_lambda_functions.lib.utils.lambda_api_gateway_utils import LambdaApiGatewayUtils

LOGGER = LambdaLoggerGenerator.get_logger(__name__, LambdaLoggerGenerator.get_level_from_env())


delete_schema = {
'type': 'object',
'required': ['tenant', 'venue', 'group_name'],
'properties': {
'tenant': {'type': 'string'},
'venue': {'type': 'string'},
'group_name': {'type': 'string'},
}
}

list_schema = {
'type': 'object',
'properties': {
'tenant': {'type': 'string'},
'venue': {'type': 'string'},
'group_names': {
'type': 'array',
'items': {'type': 'string'},
'minItems': 1,
},
}
}

add_schema = {
'type': 'object',
'required': ['tenant', 'venue', 'group_name', 'actions', 'resources'],
'properties': {
'tenant': {'type': 'string'},
'venue': {'type': 'string'},
'group_name': {'type': 'string'},
'actions': {
'type': 'array',
'items': {
'type': 'string',
'enum': [DBConstants.create, DBConstants.delete, DBConstants.update, DBConstants.read]
},
'minItems': 1,
},
'resources': {
'type': 'array',
'items': {'type': 'string'},
'minItems': 1,
},
}

}


class AuthCrud:
def __init__(self, event):
required_env = ['ES_URL', 'ADMIN_COMMA_SEP_GROUPS']
if not all([k in os.environ for k in required_env]):
raise EnvironmentError(f'one or more missing env: {required_env}')
self.__admin_groups = [k.strip() for k in os.getenv('ADMIN_COMMA_SEP_GROUPS').split(',')]
self.__event = event
self.__request_body = {}
self.__es_url = os.getenv('ES_URL')
self.__es_port = int(os.getenv('ES_PORT', '443'))
self.__authorizer: UDSAuthorizorAbstract = UDSAuthorizerFactory() \
.get_instance(UDSAuthorizerFactory.cognito,
es_url=self.__es_url,
es_port=self.__es_port
)
self.__lambda_utils = LambdaApiGatewayUtils(self.__event, 10)

def __is_admin(self):
auth_info = self.__lambda_utils.get_authorization_info()
belonged_admin_groups = list(set(self.__admin_groups) & set(auth_info['ldap_groups']))
return len(belonged_admin_groups) > 0

def __load_request_body(self):
if 'body' in self.__event and self.__event['body'] is not None:
self.__request_body = json.loads(self.__event['body'])
return

def list_all_record(self):
if not self.__is_admin():
return {
'statusCode': 403,
'body': f'user is not in admin groups: {self.__admin_groups}'
}
self.__load_request_body()
all_records = self.__authorizer.list_groups(
tenant=self.__request_body['tenant'] if 'tenant' in self.__request_body else None,
venue=self.__request_body['venue'] if 'venue' in self.__request_body else None,
ldap_group_names=self.__request_body['group_names'] if 'group_names' in self.__request_body else None,
)
return {
'statusCode': 200,
'body': json.dumps(all_records)
}

def add_new_record(self):
if not self.__is_admin():
return {
'statusCode': 403,
'body': f'user is not in admin groups: {self.__admin_groups}'
}
self.__load_request_body()
body_validator_result = JsonValidator(add_schema).validate(self.__request_body)
if body_validator_result is not None:
LOGGER.error(f'invalid add body: {body_validator_result}. request_body: {self.__request_body}')
return {
'statusCode': 500,
'body': f'invalid add body: {body_validator_result}. request_body: {self.__request_body}'
}
self.__authorizer.add_authorized_group(
action=self.__request_body['actions'],
resource=self.__request_body['resources'],
tenant=self.__request_body['tenant'],
venue=self.__request_body['venue'],
ldap_group_name=self.__request_body['group_name'],
)
return {
'statusCode': 200,
'body': 'inserted'
}

def update_record(self):
if not self.__is_admin():
return {
'statusCode': 403,
'body': f'user is not in admin groups: {self.__admin_groups}'
}
self.__load_request_body()
body_validator_result = JsonValidator(add_schema).validate(self.__request_body)
if body_validator_result is not None:
LOGGER.error(f'invalid update body: {body_validator_result}. request_body: {self.__request_body}')
return {
'statusCode': 500,
'body': f'invalid update body: {body_validator_result}. request_body: {self.__request_body}'
}
self.__authorizer.update_authorized_group(
action=self.__request_body['actions'],
resource=self.__request_body['resources'],
tenant=self.__request_body['tenant'],
venue=self.__request_body['venue'],
ldap_group_name=self.__request_body['group_name'],
)
return {
'statusCode': 200,
'body': 'updated'
}

def delete_record(self):
if not self.__is_admin():
return {
'statusCode': 403,
'body': f'user is not in admin groups: {self.__admin_groups}'
}
self.__load_request_body()
body_validator_result = JsonValidator(delete_schema).validate(self.__request_body)
if body_validator_result is not None:
LOGGER.error(f'invalid delete body: {body_validator_result}. request_body: {self.__request_body}')
return {
'statusCode': 500,
'body': f'invalid delete body: {body_validator_result}. request_body: {self.__request_body}'
}
self.__authorizer.delete_authorized_group(
tenant=self.__request_body.get('tenant'),
venue=self.__request_body.get('venue'),
ldap_group_name=self.__request_body.get('group_name'),
)
return {
'statusCode': 200,
'body': 'deleted'
}
22 changes: 22 additions & 0 deletions cumulus_lambda_functions/cumulus_auth_crud/lambda_function.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from cumulus_lambda_functions.cumulus_auth_crud.auth_crud import AuthCrud
from cumulus_lambda_functions.lib.lambda_logger_generator import LambdaLoggerGenerator


def auth_list(event, context):
LambdaLoggerGenerator.remove_default_handlers()
return AuthCrud(event).list_all_record()


def auth_add(event, context):
LambdaLoggerGenerator.remove_default_handlers()
return AuthCrud(event).add_new_record()


def auth_update(event, context):
LambdaLoggerGenerator.remove_default_handlers()
return AuthCrud(event).update_record()


def auth_delete(event, context):
LambdaLoggerGenerator.remove_default_handlers()
return AuthCrud(event).delete_record()
Empty file.
50 changes: 50 additions & 0 deletions cumulus_lambda_functions/cumulus_es_setup/es_mappings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
alias_pointer = {
"actions" : [
{"add" : {"index" : "authorization_mappings_v1", "alias" : "authorization_mappings"}},
{"add" : {"index" : "unity_collections_v1", "alias" : "unity_collections"}},
{"add": {"index": "unity_granules_v1", "alias": "unity_granules_read"}},
{"add": {"index": "unity_granules_v1", "alias": "unity_granules_write"}}
]
}
unity_granules_v1 = {
"settings": {
"number_of_shards": 3,
"number_of_replicas": 2
},
"mappings": {
"properties": {
"granule_id": {"type": "keyword"}
}
}
}
authorization_mappings_v1 = {
"settings" : {
"number_of_shards" : 3,
"number_of_replicas" : 2
},
"mappings": {
"properties": {
"action": {"type": "keyword"},
"collection_map": {"type": "keyword"},
"user_group": {"type": "keyword"},
"tenant": {"type": "keyword"},
"tenant_venue": {"type": "keyword"}
}
}
}

unity_collections_v1 = {
"settings" : {
"number_of_shards" : 3,
"number_of_replicas" : 2
},
"mappings": {
"properties": {
"collection_id": {"type": "keyword"},
"bbox": {"type": "geo_shape"},
"granule_count": {"type": "integer"},
"start_time": {"type": "long"},
"end_time": {"type": "long"}
}
}
}
46 changes: 46 additions & 0 deletions cumulus_lambda_functions/cumulus_es_setup/es_setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import os

from cumulus_lambda_functions.lib.lambda_logger_generator import LambdaLoggerGenerator

from cumulus_lambda_functions.lib.aws.es_abstract import ESAbstract

from cumulus_lambda_functions.lib.aws.es_factory import ESFactory

from cumulus_lambda_functions.lib.uds_db.db_constants import DBConstants
from cumulus_lambda_functions.cumulus_es_setup import es_mappings
LOGGER = LambdaLoggerGenerator.get_logger(__name__, LambdaLoggerGenerator.get_level_from_env())


class SetupESIndexAlias:
def __init__(self):
required_env = ['ES_URL']
if not all([k in os.environ for k in required_env]):
raise EnvironmentError(f'one or more missing env: {required_env}')
self.__es: ESAbstract = ESFactory().get_instance('AWS',
index=DBConstants.collections_index,
base_url=os.getenv('ES_URL'),
port=int(os.getenv('ES_PORT', '443'))
)

def get_index_mapping(self, index_name: str):
if not hasattr(es_mappings, index_name):
raise ValueError(f'missing index_name: {index_name}')
index_json = getattr(es_mappings, index_name)
return index_json

def start(self):
if not hasattr(es_mappings, 'alias_pointer'):
raise ValueError(f'missing alias_pointer')
alias_json = getattr(es_mappings, 'alias_pointer')
alias_json = [k['add'] for k in alias_json['actions']]
for each_action in alias_json:
try:
current_index = each_action['index']
current_alias = each_action['alias']
LOGGER.debug(f'working on {current_index}')
index_json = self.get_index_mapping(current_index)
self.__es.create_index(current_index, index_json)
self.__es.create_alias(current_index, current_alias)
except:
LOGGER.exception(f'failed to create index / alias for: {each_action}')
return self
Loading