import pRetry from 'p-retry'; import { ApiGranuleRecord, ApiGranule, GranuleId, GranuleStatus } from '@cumulus/types/api/granules'; import { CollectionId } from '@cumulus/types/api/collections'; import { ApiGatewayLambdaHttpProxyResponse, InvokeApiFunction } from './types'; declare type AssociateExecutionRequest = { granuleId: string; collectionId: string; executionArn: string; }; declare type BulkPatchGranuleCollection = { apiGranules: ApiGranuleRecord[]; collectionId: string; }; declare type BulkPatch = { apiGranules: ApiGranuleRecord[]; dbConcurrency: number; dbMaxPool: number; }; declare type InvalidBehavior = 'error' | 'skip'; declare type CmrGranuleUrlType = 'http' | 's3' | 'both'; /** * GET raw response from /granules/{granuleId} or /granules/{collectionId}/{granuleId} * * @param params - params * @param params.prefix - the prefix configured for the stack * @param params.granuleId - a granule ID * @param [params.collectionId] - a collection ID * @param [params.query] - query to pass the API lambda * @param params.expectedStatusCodes - the statusCodes which the granule API is * is expecting for the invokeApi Response, * default is 200 * @param params.callback - async function to invoke the api lambda * that takes a prefix / user payload, * cumulusApiClient.invokeApifunction * is the default to invoke the api lambda * @returns - the granule fetched by the API */ export declare const getGranuleResponse: (params: { prefix: string; granuleId: GranuleId; collectionId?: string | undefined; expectedStatusCodes?: number | number[] | undefined; query?: { [key: string]: string; } | undefined; callback?: InvokeApiFunction | undefined; }) => Promise; /** * GET granule record from /granules/{granuleId} or /granules/{collectionId}/{granuleId} * * @param params - params * @param params.prefix - the prefix configured for the stack * @param params.granuleId - a granule ID * @param [params.collectionId] - a collection ID * @param [params.query] - query to pass the API lambda * @param params.callback - async function to invoke the api lambda * that takes a prefix / user payload. Defaults * to cumulusApiClient.invokeApifunction to * invoke the * api lambda * @returns - the granule fetched by the API */ export declare const getGranule: (params: { prefix: string; granuleId: GranuleId; collectionId?: string | undefined; query?: { [key: string]: string; } | undefined; callback?: InvokeApiFunction | undefined; }) => Promise; /** * Wait for a granule to be present in the database (using pRetry) * * @param params - params * @param params.prefix - the prefix configured for the stack * @param params.granuleId - granuleId to wait for * @param [params.status] - expected granule status * @param [params.retries] - number of times to retry * @param [params.pRetryOptions] - options for pRetry * @param [params.callback] - async function to invoke the api lambda * that takes a prefix / user payload. Defaults * to cumulusApiClient.invokeApifunction to invoke the * api lambda */ export declare const waitForGranule: (params: { prefix: string; granuleId: GranuleId; status?: GranuleStatus; retries?: number; pRetryOptions?: pRetry.Options; callback?: InvokeApiFunction; }) => Promise; /** * Reingest a granule from the Cumulus API * PATCH /granules/{} * * @param params - params * @param params.prefix - the prefix configured for the stack * @param params.granuleId - a granule ID * @param [params.collectionId] - a collection ID * @param params.workflowName - Optional WorkflowName * @param params.executionArn - Optional executionArn * @param params.callback - async function to invoke the api lambda * that takes a prefix / user payload. Defaults * to cumulusApiClient.invokeApifunction to invoke the * api lambda * @returns - the granule fetched by the API */ export declare const reingestGranule: (params: { prefix: string; granuleId: GranuleId; collectionId?: CollectionId; workflowName?: string | undefined; executionArn?: string | undefined; callback?: InvokeApiFunction; }) => Promise; /** * Removes a granule from CMR via the Cumulus API * PATCH /granules/{granuleId} * * @param params - params * @param params.prefix - the prefix configured for the stack * @param params.granuleId - a granule ID * @param [params.collectionId] - a collection ID * @param params.callback - async function to invoke the api lambda * that takes a prefix / user payload. Defaults * to cumulusApiClient.invokeApifunction to invoke the * api lambda * @returns - the granule fetched by the API */ export declare const removeFromCMR: (params: { prefix: string; granuleId: GranuleId; collectionId?: CollectionId; callback?: InvokeApiFunction; }) => Promise; /** * Run a workflow with the given granule as the payload * PATCH /granules/{granuleId} * * @param params - params * @param params.prefix - the prefix configured for the stack * @param params.granuleId - a granule ID * @param [params.collectionId] - a collection ID * @param params.workflow - workflow to be run with given granule * @param params.callback - async function to invoke the api lambda * that takes a prefix / user payload. Defaults * to cumulusApiClient.invokeApifunction to invoke the * api lambda * @param [params.meta] - metadata * @returns - the granule fetched by the API */ export declare const applyWorkflow: (params: { prefix: string; granuleId: GranuleId; collectionId?: CollectionId; workflow: string; meta?: object; callback?: InvokeApiFunction; }) => Promise; /** * Delete a granule from Cumulus via the API lambda * DELETE /granules/${granuleId} * * @param params - params * @param params.pRetryOptions - pRetry options object * @param params.prefix - the prefix configured for the stack * @param params.granuleId - a granule ID * @param [params.collectionId] - a collection ID * @param params.callback - async function to invoke the api lambda * that takes a prefix / user payload. Defaults * to cumulusApiClient.invokeApifunction to invoke the * api lambda * @returns - the delete confirmation from the API */ export declare const deleteGranule: (params: { prefix: string; granuleId: GranuleId; collectionId?: CollectionId; pRetryOptions?: pRetry.Options; callback?: InvokeApiFunction; }) => Promise; /** * Move a granule via the API * PATCH /granules/{granuleId} * * @param params - params * @param params.prefix - the prefix configured for the stack * @param params.granuleId - a granule ID * @param [params.collectionId] - a collection ID * @param params.destinations - move granule destinations * @param params.callback - async function to invoke the api lambda * that takes a prefix / user payload. Defaults * to cumulusApiClient.invokeApifunction to invoke * the api lambda * @returns - the move response from the API */ export declare const moveGranule: (params: { prefix: string; granuleId: GranuleId; collectionId?: CollectionId; destinations: unknown[]; callback?: InvokeApiFunction; }) => Promise; /** * Removed a granule from CMR and delete from Cumulus via the API * * @param params - params * @param params.prefix - the prefix configured for the stack * @param params.granuleId - a granule ID * @param [params.collectionId] - a collection ID * @param params.callback - async function to invoke the api lambda * that takes a prefix / user payload. Defaults * to cumulusApiClient.invokeApifunction to invoke the * api lambda * @returns - the delete confirmation from the API */ export declare const removePublishedGranule: (params: { prefix: string; granuleId: GranuleId; collectionId?: CollectionId; callback?: InvokeApiFunction; }) => Promise; /** * Query granules stored in cumulus * GET /granules * * @param params - params * @param params.prefix - the prefix configured for the stack * @param [params.query] - query to pass the API lambda * @param [params.query.fields] * @param params.callback - async function to invoke the api lambda * that takes a prefix / user payload. Defaults * to cumulusApiClient.invokeApifunction to invoke the * api lambda * @returns - the response from the callback */ export declare const listGranules: (params: { prefix: string; query?: { [key: string]: string | string[] | undefined; fields?: string[] | undefined; } | undefined; callback?: InvokeApiFunction | undefined; }) => Promise; /** * Create granule into cumulus. * POST /granules * * @param params - params * @param params.prefix - the prefix configured for the stack * @param [params.body] - granule to pass the API lambda * @param params.callback - async function to invoke the api lambda * that takes a prefix / user payload. Defaults * to cumulusApiClient.invokeApifunction to invoke the * api lambda * @returns - the response from the callback */ export declare const createGranule: (params: { prefix: string; body: ApiGranuleRecord; callback?: InvokeApiFunction; }) => Promise; /** * Update/create granule in cumulus via PUT request. Existing values will * be removed if not specified and in some cases replaced with defaults. * Granule execution association history will be retained. * PUT /granules/{collectionId}/{granuleId} * * @param params - params * @param params.prefix - the prefix configured for the stack * @param [params.body] - granule to pass the API lambda * @param params.callback - async function to invoke the api lambda * that takes a prefix / user payload. Defaults * to cumulusApiClient.invokeApifunction to invoke the * api lambda * @returns - the response from the callback */ export declare const replaceGranule: (params: { prefix: string; body: ApiGranuleRecord; callback?: InvokeApiFunction; }) => Promise; /** * Update granule in cumulus via PATCH request. Existing values will * not be overwritten if not specified, null values will be removed and in * some cases replaced with defaults. * PATCH /granules/{granuleId} * * @param params - params * @param params.prefix - the prefix configured for the stack * @param [params.body] - granule to pass the API lambda * @param params.granuleId - a granule ID * @param [params.collectionId] - a collection ID * @param params.callback - async function to invoke the api lambda * that takes a prefix / user payload. Defaults * to cumulusApiClient.invokeApifunction to invoke the * api lambda * @returns - the response from the callback */ export declare const updateGranule: (params: { prefix: string; body: ApiGranuleRecord; granuleId: GranuleId; collectionId?: CollectionId; callback?: InvokeApiFunction; }) => Promise; /** * Associate an execution with a granule in cumulus. * POST /granules/{granuleId}/execution * * @param params - params * @param params.prefix - the prefix configured for the stack * @param [params.body] - granule and execution info to pass the API lambda * @param params.callback - async function to invoke the api lambda * that takes a prefix / user payload. Defaults * to cumulusApiClient.invokeApifunction to invoke the * api lambda * @returns - the response from the callback */ export declare const associateExecutionWithGranule: (params: { prefix: string; body: AssociateExecutionRequest; callback?: InvokeApiFunction; }) => Promise; /** * Update a list of granules' to a new collectionId in postgres and elasticsearch * PATCH /granules/bulkPatchGranuleCollection * * @param params - params * @param params.prefix - the prefix configured for the stack * @param params.body - body to pass the API lambda * @param params.callback - async function to invoke the api lambda * that takes a prefix / user payload. Defaults * to cumulusApiClient.invokeApifunction to invoke the * api lambda * @returns - the response from the callback */ export declare const bulkPatchGranuleCollection: (params: { prefix: string; body: BulkPatchGranuleCollection; callback?: InvokeApiFunction; }) => Promise; /** * Apply PATCH to a list of granules * POST /granules/bulkPatch * * @param params - params * @param params.prefix - the prefix configured for the stack * @param params.body - body to pass the API lambda * @param params.callback - async function to invoke the api lambda * that takes a prefix / user payload. Defaults * to cumulusApiClient.invokeApifunction to invoke the * api lambda * @returns - the response from the callback */ export declare const bulkPatch: (params: { prefix: string; body: BulkPatch; callback?: InvokeApiFunction; }) => Promise; /** * Bulk operations on granules stored in cumulus * POST /granules/bulk * * @param params - params * @param params.prefix - the prefix configured for the stack * @param params.body - body to pass the API lambda * @param params.callback - async function to invoke the api lambda * that takes a prefix / user payload. Defaults * to cumulusApiClient.invokeApifunction to invoke the * api lambda * @returns - the response from the callback */ export declare const bulkGranules: (params: { prefix: string; body: unknown; callback?: InvokeApiFunction; }) => Promise; /** * Bulk delete granules stored in cumulus * POST /granules/bulkDelete * * @param params - params * @param params.prefix - the prefix configured for the stack * @param params.body - body to pass the API lambda * @param params.callback - async function to invoke the api lambda * that takes a prefix / user payload. Defaults * to cumulusApiClient.invokeApifunction to invoke the * api lambda * @returns - the response from the callback */ export declare const bulkDeleteGranules: (params: { prefix: string; body: unknown; callback?: InvokeApiFunction; }) => Promise; export declare const getFileGranuleAndCollectionByBucketAndKey: (params: { prefix: string; bucket: string; key: string; pRetryOptions?: pRetry.Options; callback?: InvokeApiFunction; }) => Promise; export declare const bulkReingestGranules: (params: { prefix: string; body: unknown; callback?: InvokeApiFunction; }) => Promise; /** * Bulk Granule Operations * POST /granules/bulk * * @param params - params * @param params.prefix - the prefix configured for the stack * @param params.granules - the granules to have bulk operation on * @param params.workflowName - workflowName for the bulk operation execution * @param params.callback - async function to invoke the api lambda * that takes a prefix / user payload. Defaults * to cumulusApiClient.invokeApifunction to invoke the * api lambda * @returns - the response from the callback */ export declare const bulkOperation: (params: { prefix: string; granules: ApiGranule[]; workflowName: string; callback?: InvokeApiFunction; }) => Promise; export declare const bulkArchiveGranules: (params: { prefix: string; body: { batchSize?: number; expirationDays?: number; updateLimit?: number; }; callback?: InvokeApiFunction; }) => Promise; /** * Bulk Granule Operations * POST /granules/bulkChangeCollection */ export declare const bulkChangeCollection: (params: { prefix: string; body: { sourceCollectionId: string; targetCollectionId: string; batchSize?: number; concurrency?: number; s3Concurrency?: number; listGranulesConcurrency?: number; dbMaxPool?: number; maxRequestGranules?: number; invalidGranuleBehavior?: InvalidBehavior; cmrGranuleUrlType?: CmrGranuleUrlType; s3MultipartChunkSizeMb?: number; executionName?: string; }; callback?: InvokeApiFunction; }) => Promise; export {}; //# sourceMappingURL=granules.d.ts.map