foliolib.folio.api.inventoryStorage.AsyncMigration

class foliolib.folio.api.inventoryStorage.AsyncMigration(tenant: str, okapi: Optional[foliolib.okapi.okapiClient.OkapiClient] = None)

Bases: foliolib.folio.FolioApi

Async migrations API

Running async migrations proceses for inventory enteties

Parameters
  • tenant (str) – Tenant id

  • okapi (OkapiClient, optional) – Instance of OkapiClient. Defaults to None.

Methods

delete_job(jobsId)

Cancell migration job by id

get_job(jobsId)

Get migration job by id

get_jobs()

Get migration jobs

get_migrations()

Avalilible async migrations for the inventory-storage

set_job(job)

Submit a migration job

delete_job(jobsId: str)

Cancell migration job by id

DELETE /inventory-storage/migrations/jobs/{jobsId}

Parameters

jobsId (str) –

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiFatalError – Server Error

get_job(jobsId: str)

Get migration job by id

GET /inventory-storage/migrations/jobs/{jobsId}

Parameters

jobsId (str) –

Returns

See Schema below

Return type

dict

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiFatalError – Server Error

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Get job by id response",
  "type": "object",
  "properties": {
    "id": {
      "description": "Job id",
      "type": "string",
      "$ref": "../raml-util/schemas/uuid.schema"
    },
    "migrations": {
      "description": "Name of migration procedure",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "affectedEntities": {
      "description": "List of affected entities by particular migration",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "published": {
      "description": "Number of records that was published so far",
      "type": "array",
      "items": {
        "properties": {
          "migrationName": {
            "description": "Name of migration procedure",
            "type": "string"
          },
          "count": {
            "description": "Number of records that was published so far",
            "type": "integer",
            "minimum": 0,
            "default": 0
          }
        }
      }
    },
    "processed": {
      "description": "Number of records that was processed",
      "type": "array",
      "items": {
        "properties": {
          "migrationName": {
            "description": "Name of migration procedure",
            "type": "string"
          },
          "count": {
            "description": "Number of records that was processed",
            "type": "integer",
            "minimum": 0,
            "default": 0
          }
        }
      }
    },
    "jobStatus": {
      "description": "Overall job status",
      "type": "string",
      "enum": [
        "In progress",
        "Id publishing failed",
        "Ids published",
        "Pending cancel",
        "Cancelled",
        "Completed"
      ]
    },
    "submittedDate": {
      "description": "Timestamp when the job has been submitted",
      "type": "string",
      "format": "date-time"
    },
    "finishedDate": {
      "description": "Timestamp when the job has been finished",
      "type": "string",
      "format": "date-time"
    }
  },
  "additionalProperties": false
}
get_jobs()

Get migration jobs

GET /inventory-storage/migrations/jobs

Returns

See Schema below

Return type

dict

Raises

OkapiFatalError – Server Error

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Get collection of async jobs",
  "type": "object",
  "properties": {
    "jobs": {
      "description": "List of async jobs records",
      "javaType": "java.util.List<org.folio.rest.jaxrs.model.AsyncMigrationJob>"
    },
    "totalRecords": {
      "type": "integer"
    }
  },
  "additionalProperties": false
}
get_migrations()

Avalilible async migrations for the inventory-storage

GET /inventory-storage/migrations

Returns

See Schema below

Return type

dict

Raises

OkapiFatalError – Server Error

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Post migration job request",
  "type": "object",
  "properties": {
    "asyncMigrations": {
      "description": "List of available migrations",
      "id": "asyncMigration",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "migration-job-post-request.json"
      }
    },
    "totalRecords": {
      "type": "integer",
      "default": 0
    }
  },
  "additionalProperties": false,
  "required": [
    "migrations",
    "totalRecords"
  ]
}
set_job(job: dict)

Submit a migration job

POST /inventory-storage/migrations/jobs

Parameters

job (dict) – See Schema below

Returns

See Schema below

Return type

dict

Raises

OkapiFatalError – Server Error

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Post migration job request",
  "type": "object",
  "properties": {
    "migrations": {
      "description": "Names of migration procedure",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "affectedEntities": {
      "description": "List of affected entities by particular migration",
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "INSTANCE",
          "ITEM"
        ]
      }
    }
  },
  "additionalProperties": false,
  "required": [
    "name"
  ]
}
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Get job by id response",
  "type": "object",
  "properties": {
    "id": {
      "description": "Job id",
      "type": "string",
      "$ref": "../raml-util/schemas/uuid.schema"
    },
    "migrations": {
      "description": "Name of migration procedure",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "affectedEntities": {
      "description": "List of affected entities by particular migration",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "published": {
      "description": "Number of records that was published so far",
      "type": "array",
      "items": {
        "properties": {
          "migrationName": {
            "description": "Name of migration procedure",
            "type": "string"
          },
          "count": {
            "description": "Number of records that was published so far",
            "type": "integer",
            "minimum": 0,
            "default": 0
          }
        }
      }
    },
    "processed": {
      "description": "Number of records that was processed",
      "type": "array",
      "items": {
        "properties": {
          "migrationName": {
            "description": "Name of migration procedure",
            "type": "string"
          },
          "count": {
            "description": "Number of records that was processed",
            "type": "integer",
            "minimum": 0,
            "default": 0
          }
        }
      }
    },
    "jobStatus": {
      "description": "Overall job status",
      "type": "string",
      "enum": [
        "In progress",
        "Id publishing failed",
        "Ids published",
        "Pending cancel",
        "Cancelled",
        "Completed"
      ]
    },
    "submittedDate": {
      "description": "Timestamp when the job has been submitted",
      "type": "string",
      "format": "date-time"
    },
    "finishedDate": {
      "description": "Timestamp when the job has been finished",
      "type": "string",
      "format": "date-time"
    }
  },
  "additionalProperties": false
}