Documentation
¶
Index ¶
- func ChecksumCreate(c *gin.Context)
- func ChecksumFromJson(req *api.Request) (*pgmodels.Checksum, error)
- func CoerceFileStorageOption(existingFile, submittedFile *pgmodels.GenericFile)
- func CoerceObjectStorageOption(existingObject, submittedObject *pgmodels.IntellectualObject)
- func CreateChecksum(c *gin.Context) (*pgmodels.Checksum, error)
- func CreateOrUpdateFile(c *gin.Context) (*pgmodels.GenericFile, error)
- func CreateOrUpdateItem(c *gin.Context) (*pgmodels.WorkItem, error)
- func CreateOrUpdateObject(c *gin.Context) (*pgmodels.IntellectualObject, error)
- func CreateStorageRecord(c *gin.Context) (*pgmodels.StorageRecord, error)
- func DeletionRequestShow(c *gin.Context)
- func GenericFileCreate(c *gin.Context)
- func GenericFileCreateBatch(c *gin.Context)
- func GenericFileDelete(c *gin.Context)
- func GenericFileFromJson(req *api.Request) (*pgmodels.GenericFile, error)
- func GenericFileIndex(c *gin.Context)
- func GenericFileUpdate(c *gin.Context)
- func InstitutionIndex(c *gin.Context)
- func InstitutionShow(c *gin.Context)
- func IntellectualObjectCreate(c *gin.Context)
- func IntellectualObjectDelete(c *gin.Context)
- func IntellectualObjectFromJson(req *api.Request) (*pgmodels.IntellectualObject, error)
- func IntellectualObjectInitBatchDelete(c *gin.Context)
- func IntellectualObjectInitRestore(c *gin.Context)
- func IntellectualObjectUpdate(c *gin.Context)
- func PremisEventCreate(c *gin.Context)
- func PrepareFileDelete(c *gin.Context)
- func PrepareObjectDelete(c *gin.Context)
- func StorageRecordCreate(c *gin.Context)
- func StorageRecordFromJson(req *api.Request) (*pgmodels.StorageRecord, error)
- func StorageRecordIndex(c *gin.Context)
- func StorageRecordShow(c *gin.Context)
- func StringSliceToInt64Slice(strSlice []string) ([]int64, error)
- func WorkItemCreate(c *gin.Context)
- func WorkItemFromJson(req *api.Request) (*pgmodels.WorkItem, error)
- func WorkItemRedisDelete(c *gin.Context)
- func WorkItemRequeue(c *gin.Context)
- func WorkItemUpdate(c *gin.Context)
- type ObjectBatchDeleteParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChecksumCreate ¶
ChecksumCreate creates a new Checksum. We only do this when ingesting a newer a version of a previously ingested file. On first ingest, we call GenericFileCreateBatch, and the initial checksum is saved there, as part of a batch transaction.
POST /admin-api/v3/checsums/create/:institution_id
func ChecksumFromJson ¶
ChecksumFromJson returns the Checksum from the JSON in the request body and the existing file record from the database (if there is one). It returns an error if the JSON can't be parsed, if the existing file can't be found, or if changes made to the existing object are not allowed.
func CoerceFileStorageOption ¶
func CoerceFileStorageOption(existingFile, submittedFile *pgmodels.GenericFile)
CoerceFileStorageOption forces submittedFile.StorageOption to match existingFile.StorageOption if existingFile.State is Active. The reason for this is documented in the special note under allowed storage option values at https://aptrust.github.io/userguide/bagging/#allowed-storage-option-values
func CoerceObjectStorageOption ¶
func CoerceObjectStorageOption(existingObject, submittedObject *pgmodels.IntellectualObject)
CoerceObjectStorageOption forces submittedObject.StorageOption to match existingObject.StorageOption if existingObject.State is Active. The reason for this is documented in the special note under allowed storage option values at https://aptrust.github.io/userguide/bagging/#allowed-storage-option-values
func CreateOrUpdateFile ¶
func CreateOrUpdateFile(c *gin.Context) (*pgmodels.GenericFile, error)
func CreateOrUpdateObject ¶
func CreateOrUpdateObject(c *gin.Context) (*pgmodels.IntellectualObject, error)
func CreateStorageRecord ¶
func CreateStorageRecord(c *gin.Context) (*pgmodels.StorageRecord, error)
func DeletionRequestShow ¶
DeletionRequestShow shows the deletion request with the specified id.
GET /admin-api/v3/deletions/show/:id
func GenericFileCreate ¶
GenericFileCreate creates a new GenericFile.
TODO: Change institution_id to object_id? POST /admin-api/v3/files/create/:institution_id
func GenericFileCreateBatch ¶
GenericFileCreateBatch creates a batch of now GenericFiles and also saves their related records (PremisEvents, Checksums, and StorageRecords). Items in the batch must be new. This won't updated existing records.
TODO: Change institution_id to object_id? POST /admin-api/v3/files/create_batch/:institution_id
func GenericFileDelete ¶
GenericFileDelete marks a generic file record as deleted. It also creates a deletion premis event. Before it does any of that, it checks a number of pre-conditions. See the GenericFile model for more info.
DELETE /admin-api/v3/files/delete/:id
func GenericFileFromJson ¶
func GenericFileFromJson(req *api.Request) (*pgmodels.GenericFile, error)
GenericFileFromJson returns the GenericFile from the JSON in the request body and the existing file record from the database (if there is one). It returns an error if the JSON can't be parsed, if the existing file can't be found, or if changes made to the existing object are not allowed.
func GenericFileIndex ¶
GenericFileIndex shows list of files. Unlike the member API, which returns a list of GenericFileView objects, this returns a list of GenericFile objects, complete with checksums, events and storage records. Some of our API workers depend on the related records.
GET /admin-api/v3/files
func GenericFileUpdate ¶
GenericFileUpdate updates an existing GenericFile.
PUT /admin-api/v3/files/update/:id
func InstitutionShow ¶
InstitutionShow returns the institution with the specified id.
GET /admin-api/v3/objects/show/:id
func IntellectualObjectCreate ¶
IntellectualObjectCreate creates a new object record.
POST /admin-api/v3/objects/create/:institution_id
func IntellectualObjectDelete ¶
IntellectualObjectDelete marks an object record as deleted. It also creates a deletion premis event. Before it does any of that, it checks a number of pre-conditions. See the IntellectualObject model for more info.
DELETE /admin-api/v3/objects/delete/:id
func IntellectualObjectFromJson ¶
func IntellectualObjectFromJson(req *api.Request) (*pgmodels.IntellectualObject, error)
IntellectualObjectFromJson returns the IntellectualObject from the JSON in the request body and the existing object record from the database (if there is one). It returns an error if the JSON can't be parsed, if the existing object can't be found, or if changes made to the existing object are not allowed.
func IntellectualObjectInitBatchDelete ¶
IntellectualObjectInitBatchDelete creates an deletion request for multiple objects. This request must be approved by an administrator at the depositing institution before the deletion will actually be queued.
Note that becaue this is part of the admin API, access to this call is restricted to APTrust admins.
POST /objects/init_batch_delete
func IntellectualObjectInitRestore ¶
IntellectualObjectInitRestore creates an object restoration request, which is really just a WorkItem that gets queued. Restoration can take seconds or hours, depending on where the object is stored and how big it is. POST /admin-api/v3/objects/init_restore/:id
func IntellectualObjectUpdate ¶
IntellectualObjectUpdate updates an existing intellectual object record.
PUT /admin-api/v3/objects/update/:id
func PremisEventCreate ¶
PremisEventCreate creates a new Premis Event. This function is open to sys admin only. Note that Premis Events cannot be updated or deleted. Also note that this expects a JSON body, not form values.
POST /admin-api/v3/events/create
func PrepareFileDelete ¶
PrepareFileDelete is not implemented, except in test and integration builds.
POST /admin-api/v3/prepare_file_delete/:id
func PrepareObjectDelete ¶
PrepareObjectDelete is not implemented, except in test and integration builds.
POST /admin-api/v3/prepare_object_delete/:id
func StorageRecordCreate ¶
StorageRecordCreate creates a new StorageRecord. We only do this when ingesting a newer a version of a previously ingested file. On first ingest, we call GenericFileCreateBatch, and the initial checksum is saved there, as part of a batch transaction.
POST /admin-api/v3/storage_records/create/:institution_id
func StorageRecordFromJson ¶
func StorageRecordFromJson(req *api.Request) (*pgmodels.StorageRecord, error)
StorageRecordFromJson returns the StorageRecord from the JSON in the request body and the existing file record from the database (if there is one). It returns an error if the JSON can't be parsed, if the existing file can't be found, or if changes made to the existing object are not allowed.
func StorageRecordIndex ¶
StorageRecordIndex shows list of objects.
GET /admin-api/v3/storage_records
func StorageRecordShow ¶
StorageRecordShow returns the object with the specified id.
GET /admin-api/v3/storage_records/show/:id
func StringSliceToInt64Slice ¶
func WorkItemCreate ¶
WorkItemCreate creates a new WorkItem.
POST /admin-api/v3/items/create/:institution_id
func WorkItemFromJson ¶
WorkItemFromJson returns the WorkItem from the JSON in the request body and the existing file record from the database (if there is one). It returns an error if the JSON can't be parsed, if the existing file can't be found, or if changes made to the existing object are not allowed.
func WorkItemRedisDelete ¶
WorkItemRedisDelete deletes a WorkItem's Redis record. This is an admin-only feature.
DELETE /admin-api/v3/items/redis_delete/:id
func WorkItemRequeue ¶
WorkItemRequeue requeues a WorkItem to the specified stage.
PUT /admin-api/v3/items/requeue/:id
func WorkItemUpdate ¶
WorkItemUpdate updates an existing WorkItem record.
PUT /admin-api/v3/items/update/:id
Types ¶
type ObjectBatchDeleteParams ¶
type ObjectBatchDeleteParams struct { InstitutionID int64 `json:"institutionId"` RequestorID int64 `json:"requestorId"` ObjectIDs []int64 `json:"objectIds"` SecretKey string `json:"secretKey"` }
ObjectBatchDeleteParams contains info about which objects to delete in an object batch delete operation.
We use this struct for two reasons:
1. JSON is easier to craft than a form with a thousand values.
- Because the httptest library is lame and cannot properly create multiple form values with the same name due to a problem with the underlying github.com/ajg/form library. It turns all params into a flat map. This is documented. So instead of getting objectIds = [1,2,3,4] as url.Values would give it to us, we get objectIds.0 = 1, objectIds.1 = 2, objectIds.3 = 2, etc. That's worthless in a testing library that needs to be able to pass values in the standard format that the back end expects.