UNPKG

redis-cloud-api-sdk

Version:
324 lines (323 loc) 14 kB
import { CreateSubscriptionParameters, SubscriptionUpdateParameters, CidrUpdateParameters, VpcPeeringCreationParameters } from './types/parameters/subscription'; import { DatabaseImportParameters, DatabaseCreationParameters, DatabaseUpdateParameters } from './types/parameters/database'; import { CloudAccountCreationParameters, CloudAccountUpdateParameters } from './types/parameters/cloud-account'; import { SubscriptionCloudProvider, SubscriptionCidrWhitelist, SubscriptionStatus, SubscriptionVpcPeering, SubscriptionVpcPeeringStatus, SubscriptionResponse } from './types/responses/subscription'; import { AccountInformation, DatabaseModule, SystemLog, PaymentMethod, Plan, Region, DataPersistence } from './types/responses/general'; import { CloudAccountResponse, CloudAccountStatus } from './types/responses/cloud-account'; import { TaskObject, TaskResponse, TaskStatus } from './types/task'; import { DatabaseResponse, DatabaseStatus } from './types/responses/database'; import { Client } from './api/api.base'; export declare class CloudAPISDK extends Client { private general; private subscription; private database; private cloudAccount; private task; /** * Initializing the constructur with given custom parameters * @param parameters The parameters we can pass you customize our sdk client */ constructor(parameters: CloudAPISDKParameters); /** * Returning current account and related information */ getAccountInformation(): Promise<AccountInformation & { [key: string]: any; }>; /** * Returning a lookup list of data persistence values */ getDataPersistences(): Promise<DataPersistence[] & { [key: string]: any; }>; /** * Returning a lookup list of database modules supported in current account (support may differ based on subscription and database settings) */ getDatabaseModules(): Promise<DatabaseModule[] & { [key: string]: any; }>; /** * Returning system log information for current account * @param limit Maximum number of items to return * @param offset Number of items to skip */ getSystemLogs(limit: number, offset: number): Promise<SystemLog[] & { [key: string]: any; }>; /** * Returning a lookup list of current account’s payment methods */ getPaymentMethods(): Promise<PaymentMethod[] & { [key: string]: any; }>; /** * Returning a lookup list of current account's plans * @param provider The cloud provider of the plan */ getPlans(provider: SubscriptionCloudProvider): Promise<Plan[] & { [key: string]: any; }>; /** * Returning a lookup list of current account's regions * @param provider The cloud provider of the plan */ getRegions(provider: SubscriptionCloudProvider): Promise<Region[] & { [key: string]: any; }>; /** * Returning a lookup list of current account's subscriptions */ getSubscriptions(): Promise<SubscriptionResponse[] & { [key: string]: any; }>; /** * Creating a subscription * @param createParameters The given parameters given for the subscription creation */ createSubscription(createParameters: CreateSubscriptionParameters): Promise<TaskResponse & { [key: string]: any; }>; /** * Returning a subscription * @param subscriptionId The id of the subscription */ getSubscription(subscriptionId: number): Promise<SubscriptionResponse & { [key: string]: any; }>; /** * Updating a subscription * @param subscriptionId The id of the subscription * @param updateParameters The given update parameters to update the subscription with */ updateSubscription(subscriptionId: number, updateParameters: SubscriptionUpdateParameters): Promise<TaskResponse & { [key: string]: any; }>; /** * Deleting a subscription * @param subscriptionId The id of the subscription */ deleteSubscription(subscriptionId: number): Promise<TaskResponse & { [key: string]: any; }>; /** * Returning a lookup list of a subscription CIDR whitelists * @param subscriptionId The id of the subscription */ getSubscriptionCidrWhitelist(subscriptionId: number): Promise<SubscriptionCidrWhitelist & { [key: string]: any; }>; /** * Updating a subscription CIDR whitelists * @param subscriptionId The id of the subscription * @param updateParameters The parameters to update the subscription with */ updateSubscriptionCidrWhitelists(subscriptionId: number, updateParameters: CidrUpdateParameters): Promise<TaskResponse & { [key: string]: any; }>; /** * Returning a lookup list of the subscription VPC Peerings * @param subscriptionId The id of the subscription */ getVpcPeerings(subscriptionId: number): Promise<SubscriptionVpcPeering[]>; /** * Creating a subscription VPC peering * @param subscriptionId The id of the subscription * @param createParameters The create parameters to create the VPC peering with */ createSubscriptionVpcPeering(subscriptionId: number, createParameters: VpcPeeringCreationParameters): Promise<TaskResponse & { [key: string]: any; }>; /** * Deleting a subscription VPC peering * @param subscriptionId The id of the subscription * @param vpcPeeringId The id of the VPC peering */ deleteSubscriptionVpcPeering(subscriptionId: number, vpcPeeringId: number): Promise<TaskResponse & { [key: string]: any; }>; /** * Returning a lookup list of databases owned by the account * @param subscriptionId The id of the subscription */ getDatabases(subscriptionId: number): Promise<DatabaseResponse[] & { [key: string]: any; }>; /** * Creating a database * @param subscriptionId The id of the subscription * @param createParameters The create parameters to create the database */ createDatabase(subscriptionId: number, createParameters: DatabaseCreationParameters): Promise<TaskResponse & { [key: string]: any; }>; /** * Returning a database * @param subscriptionId The id of the subscription * @param databaseId The id of the database */ getDatabase(subscriptionId: number, databaseId: number): Promise<DatabaseResponse & { [key: string]: any; }>; /** * Updating a database * @param subscriptionId The id of the subscription * @param databaseId The id of the database * @param updateParameters The update parameters to update the database */ updateDatabase(subscriptionId: number, databaseId: number, updateParameters: DatabaseUpdateParameters): Promise<TaskResponse & { [key: string]: any; }>; /** * Deleting a database * @param subscriptionId The id of the subscription * @param databaseId The id of the database */ deleteDatabase(subscriptionId: number, databaseId: number): Promise<TaskResponse & { [key: string]: any; }>; /** * Backing up a database * @param subscriptionId The id of the subscription * @param databaseId The id of the database */ backupDatabase(subscriptionId: number, databaseId: number): Promise<TaskResponse & { [key: string]: any; }>; /** * Importing a dataset into a database * @param subscriptionId The id of the subscription * @param databaseId The id of the database * @param importParameters The import parameters to import into a database */ importIntoDatabase(subscriptionId: number, databaseId: number, importParameters: DatabaseImportParameters): Promise<TaskResponse & { [key: string]: any; }>; /** * Returning a lookup list of cloud accounts owned by the account */ getCloudAccounts(): Promise<CloudAccountResponse[] & { [key: string]: any; }>; /** * Returning a cloud account * @param cloudAccountId The id of the cloud account */ getCloudAccount(cloudAccountId: number): Promise<CloudAccountResponse & { [key: string]: any; }>; /** * Creating a cloud account * @param createParameters The create parameters to create a cloud account */ createCloudAccount(createParameters: CloudAccountCreationParameters): Promise<TaskResponse & { [key: string]: any; }>; /** * Updating a cloud account * @param cloudAccountId The id of the cloud account * @param updateParameters The update parameters to update a cloud account */ updateCloudAccount(cloudAccountId: number, updateParameters: CloudAccountUpdateParameters): Promise<TaskResponse & { [key: string]: any; }>; /** * Deleting a cloud account * @param cloudAccountId The id of the cloud account */ deleteCloudAccount(cloudAccountId: number): Promise<TaskResponse & { [key: string]: any; }>; getTasks(): Promise<TaskObject[] & { [key: string]: any; }>; /** * Returning a task * @param taskId The id of the task */ getTask(taskId: number): Promise<TaskObject & { [key: string]: any; }>; /** * Waiting for the subscription status to change to a given status * @param subscriptionId The id of the subscription * @param expectedStatus The expected status * @param timeoutInSeconds The timeout of waiting for the status. Default: 20 minutes * @param sleepTimeInSeconds The sleep time between requests. Default: 5 seconds */ waitForSubscriptionStatus(subscriptionId: number, expectedStatus: SubscriptionStatus, timeoutInSeconds?: number, sleepTimeInSeconds?: number): Promise<SubscriptionResponse & { [key: string]: any; }>; /** * Waiting for existing subscriptions statuses to change to a given status * @param expectedStatus The expected status * @param timeoutInSeconds The timeout of waiting for the status. Default: 20 minutes * @param sleepTimeInSeconds The sleep time between requests. Default: 5 seconds * @returns A batch of subscription responses */ waitForSubscriptionsStatus(expectedStatus: SubscriptionStatus, timeoutInSeconds?: number, sleepTimeInSeconds?: number): Promise<SubscriptionResponse[]>; /** * Waiting for the subscription VPC peering status to change to a given status * @param subscriptionId The id of the subscription * @param vpcPeeringId The id of the subscription VPC peering * @param expectedStatus The expected status * @param timeoutInSeconds The timeout of waiting for the status. Default: 5 minutes * @param sleepTimeInSeconds The sleep time between requests. Default: 5 seconds */ waitForVpcPeeringStatus(subscriptionId: number, vpcPeeringId: number, expectedStatus: SubscriptionVpcPeeringStatus, timeoutInSeconds?: number, sleepTimeInSeconds?: number): Promise<SubscriptionVpcPeering | undefined>; /** * Waiting for database status to change to a given status * @param subscriptionId The id of the subscription * @param databaseId The id of the database * @param expectedStatus The expected status * @param timeoutInSeconds The timeout of waiting for the status. Default: 5 minutes * @param sleepTimeInSeconds The sleep time between requests. Default: 5 seconds */ waitForDatabaseStatus(subscriptionId: number, databaseId: number, expectedStatus: DatabaseStatus, timeoutInSeconds?: number, sleepTimeInSeconds?: number): Promise<DatabaseResponse & { [key: string]: any; }>; /** * Waiting for all databases status under subscription to change to the expected status * @param subscriptionId The id of the subscription * @param expectedStatus The expected status * @param timeoutInSeconds The timeout of waiting for the status. Default: 5 minutes * @param sleepTimeInSeconds The sleep time between requests. Default: 5 seconds */ waitForSubscriptionDatabasesStatus(subscriptionId: number, expectedStatus?: DatabaseStatus, timeoutInSeconds?: number, sleepTimeInSeconds?: number): Promise<void>; /** * Waiting for cloud account status to change to a given status * @param cloudAccountId The id of the cloud account * @param expectedStatus The expected status * @param timeoutInSeconds The timeout of waiting for the status. Default: 5 minutes * @param sleepTimeInSeconds The sleep time between requests. Default: 5 seconds */ waitForCloudAccountStatus(cloudAccountId: number, expectedStatus: CloudAccountStatus, timeoutInSeconds?: number, sleepTimeInSeconds?: number): Promise<CloudAccountResponse & { [key: string]: any; }>; /** * Waiting for task status to change to a given status * @param taskId The id of the task * @param expectedStatus The expected status * @param timeoutInSeconds The timeout of waiting for the status. Default: 20 minutes * @param sleepTimeInSeconds The sleep time between requests. Default: 5 seconds */ waitForTaskStatus(taskId: number, expectedStatus: TaskStatus, timeoutInSeconds?: number, sleepTimeInSeconds?: number): Promise<TaskObject & { [key: string]: any; }>; } /** * The parameters used to initialize the constructor * @param accessKey Required. The Cloud API access key * @param secretKey Required. The Cloud API secret key * @param protocol Optional. The protocol of the API url * @param domain Optional. The domain of the API url * @param version Optional. The version of the API * @param debug Optional. Ability to show extra debug logs */ export interface CloudAPISDKParameters { accessKey: string; secretKey: string; protocol?: string; domain?: string; version?: string; debug?: boolean; }