UNPKG

@cumulus/api-client

Version:

API client for working with the Cumulus archive API

129 lines 5.61 kB
import { NewRuleRecord, PartialRuleRecord } from '@cumulus/types/api/rules'; import { ApiGatewayLambdaHttpProxyResponse, InvokeApiFunction } from './types'; /** * Post a rule to the rules API * * @param {Object} params - params * @param {string} params.prefix - the prefix configured for the stack * @param {Object} params.rule - rule body to post * @param {Function} params.callback - async function to invoke the api lambda * that takes a prefix / user payload. Defaults * to cumulusApiClient.invokeApi * @returns {Promise<Object>} - promise that resolves to the output * of the API lambda */ export declare const postRule: (params: { prefix: string; rule: NewRuleRecord; callback?: InvokeApiFunction; }) => Promise<ApiGatewayLambdaHttpProxyResponse>; /** * Replace a rule via PUT request. Existing values will be removed if not specified * or set to null. * PUT /rules/${ruleName} * * @param {Object} params - params * @param {string} params.prefix - the prefix configured for the stack * @param {Object} params.ruleName - the rule to update * @param {Object} params.replacementRule - complete replacement rule * @param {Function} params.callback - async function to invoke the api lambda * that takes a prefix / user payload. Defaults * to cumulusApiClient.invokeApi * @returns {Promise<Object>} - promise that resolves to the output of the API lambda */ export declare const replaceRule: (params: { prefix: string; ruleName: string; replacementRule: NewRuleRecord & { action?: 'rerun'; }; callback?: InvokeApiFunction; }) => Promise<ApiGatewayLambdaHttpProxyResponse>; /** * Update a rule via PATCH request. Existing values will not be overwritten if not * specified, null values will be removed. * * @param {Object} params - params * @param {string} params.prefix - the prefix configured for the stack * @param {Object} params.ruleName - the rule to update * @param {Object} params.updateParams - key/value to update on the rule * @param {Function} params.callback - async function to invoke the api lambda * that takes a prefix / user payload. Defaults * to cumulusApiClient.invokeApi * @returns {Promise<Object>} - promise that resolves to the output of the API lambda */ export declare const updateRule: (params: { prefix: string; ruleName: string; updateParams: PartialRuleRecord & { action?: 'rerun'; }; callback?: InvokeApiFunction; }) => Promise<ApiGatewayLambdaHttpProxyResponse>; /** * Get a list of rules from the API * * @param {Object} params - params * @param {string} params.prefix - the prefix configured for the stack * @param {string} params.query - query params to use for listing rules * @param {Object} params.callback - function to invoke the api lambda * that takes a prefix / user payload * @returns {Promise<Object>} - promise that resolves to the output of the API lambda */ export declare const listRules: (params: { prefix: string; query: { [key: string]: string; }; callback?: InvokeApiFunction | undefined; }) => Promise<ApiGatewayLambdaHttpProxyResponse>; /** * Get a rule definition from the API * * @param {Object} params - params * @param {string} params.prefix - the prefix configured for the stack * @param {string} params.ruleName - name of the rule * @param {Object} params.callback - function to invoke the api lambda * that takes a prefix / user payload * @returns {Promise<Object>} - promise that resolves to the output of the * API lambda */ export declare const getRule: (params: { prefix: string; ruleName: string; callback: InvokeApiFunction; }) => Promise<ApiGatewayLambdaHttpProxyResponse>; /** * Delete a rule via the API * * @param {Object} params - params * @param {string} params.prefix - the prefix configured for the stack * @param {string} params.ruleName - name of the rule * @param {Object} params.callback - function to invoke the api lambda * that takes a prefix / user payload * @returns {Promise<Object>} - promise that resolves to the output of the API lambda */ export declare const deleteRule: (params: { prefix: string; ruleName: string; callback: InvokeApiFunction; }) => Promise<ApiGatewayLambdaHttpProxyResponse>; /** * Rerun a rule via the API. * * @param {Object} params - params * @param {string} params.prefix - the prefix configured for the stack * @param {string} params.ruleName - the name of the rule to rerun * @param {Object} params.updateParams - key/value to update on the rule * @param {Object} params.callback - function to invoke the api lambda * that takes a prefix / user payload * @returns {Promise<Object>} - promise that resolves to the output of the API * lambda */ export declare function rerunRule(params: { prefix: string; ruleName: string; updateParams?: PartialRuleRecord; callback: InvokeApiFunction; }): Promise<ApiGatewayLambdaHttpProxyResponse>; //# sourceMappingURL=rules.d.ts.map