Skip to content
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

Consider use of AMClient #7

Open
peterVG opened this issue Jun 18, 2020 · 4 comments
Open

Consider use of AMClient #7

peterVG opened this issue Jun 18, 2020 · 4 comments
Labels
cleanup Work that can make code/data cleaner or easier to maintain

Comments

@peterVG
Copy link
Member

peterVG commented Jun 18, 2020

Ross: If we do subsume this work into our current efforts then we might consider using AMClient per the Architectural Decision Record 0009. We've started wrapping it into Archivematica and while it can be a little temperamental it's well tested and wraps a lot of what we need. Anything that isn't wrapped will give us the opportunity to fortify the client further as part of these efforts. Related issue: archivematica/Issues#1152

@mcantelon
Copy link
Member

mcantelon commented Oct 11, 2023

Looks like these files have calls to make_request which could be replaced with AMclient use:

  • AIPscan/Aggregator/tasks.py (get lists of packages via calls to the /api/v2/file endpoint)
  • AIPscan/Aggregator/database_helpers.py (gets details of individual storage locations, via a GET of the /api/v2/location/[UUID] endpoint[1], and individual pipelines, via a GET of the /api/v2/pipeline/[UUID] endpoint[2] to create AIPscan DB representations)
  • AIPscan/Aggregator/views.py (tests storage service connection by a call to the /api/v2/file endpoint)

[1] It doesn't look like there's a function in AMClient to get an individual location so something like a get_location_details function might need to be added.

[2] It doesn't look like there's a function in AMClient to get an individual pipeline so something like a get_pipeline_details function might need to be added.

@mcantelon mcantelon added the cleanup Work that can make code/data cleaner or easier to maintain label Nov 18, 2023
@mcantelon
Copy link
Member

mcantelon commented Dec 20, 2023

The following seems to get all packages (AIPs, DIPs, etc.) in a storage service:

am = AMClient()
p = am.get_all_packages({})  # The empty dict needs to be provided or nothing will be returned

The following seems to return the same structure of data as make_request called when fetching a "page" of packages (/api/v2/file/?limit=20&offset=0&username=admin&api_key=thekey):

p = am.get_package({})

@mcantelon
Copy link
Member

I've created an AMClient PR to add functionality needed for AIPscan: artefactual-labs/amclient#31

@mcantelon
Copy link
Member

The AMClient PR's been merged so I'll take another look at creating an AIPscan PR to leverage this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Work that can make code/data cleaner or easier to maintain
Projects
None yet
Development

No branches or pull requests

2 participants