Registry / aws / oci-databasemigration

oci-databasemigration

JSON →
library2.130.0jsnpmunverified

The `oci-databasemigration` package provides a Node.js client for interacting with the Oracle Cloud Infrastructure (OCI) Database Migration Service. It allows developers to programmatically manage resources related to database migrations within the OCI ecosystem, such as creating, managing, and monitoring migration jobs. This module is an integral part of the broader OCI TypeScript SDK and ships with comprehensive TypeScript type definitions, enabling robust development with full type safety. As of version 2.130.0, the SDK is actively maintained, with a rapid release cadence (typically multiple minor versions per month, as evidenced by recent release logs) that consistently introduces support for new OCI services, features, and API endpoints across various OCI components, not solely Database Migration. Its key differentiator is being the official, idiomatic client for OCI services, ensuring seamless compatibility and strict alignment with OCI's continuously evolving API landscape. Successful usage requires an existing OCI account, a configured user with appropriate IAM policies, and an API signing key pair for authentication.

npm install oci-databasemigration
INSTALL
IMPORT
SIG · OCI-DATABASEMIGRAT
O
oci-databasemigration
awsjavascriptv2.130.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

DatabaseMigrationClient
import * as databasemigration from 'oci-databasemigration'; const client = new databasemigration.DatabaseMigrationClient({...});
import { DatabaseMigrationClient } from 'oci-databasemigration';
OCI SDKs typically export modules as namespaces, requiring `import * as service from 'oci-servicename';` and then accessing `service.ServiceClient`. Direct named imports are generally not supported for client classes.
common.ConfigFileAuthenticationDetailsProvider
import * as common from 'oci-common'; const provider = new common.ConfigFileAuthenticationDetailsProvider();
import { ConfigFileAuthenticationDetailsProvider } from 'oci-databasemigration';
Authentication details providers are part of the `oci-common` package, not service-specific packages. Ensure `oci-common` is also installed.
requests.ListMigrationsRequest
import * as databasemigration from 'oci-databasemigration'; const request: databasemigration.requests.ListMigrationsRequest = { compartmentId: '...' };
import { ListMigrationsRequest } from 'oci-databasemigration/lib/request';
Request and response types are nested under the service namespace's `requests` and `responses` sub-namespaces respectively.

This quickstart demonstrates how to initialize the OCI Database Migration client and list existing migrations within a specified OCI compartment, using credentials from the default OCI config file.

import * as databasemigration from 'oci-databasemigration'; import * as common from 'oci-common'; // IMPORTANT: Ensure your OCI configuration file (typically ~/.oci/config) is set up // and the profile is configured for API signing keys. // You can also pass authentication details directly, but a config file is common. // For sensitive keys, use environment variables or OCI Vault. // Example environment variables for authentication (not recommended for production keys): // process.env.OCI_COMPARTMENT_ID // process.env.OCI_USER_OCID // process.env.OCI_TENANCY_OCID // process.env.OCI_FINGERPRINT // process.env.OCI_PRIVATE_KEY_PATH // process.env.OCI_REGION async function listOciDatabaseMigrations() { try { // Initialize the authentication provider using the default OCI config file and profile const authProvider = new common.ConfigFileAuthenticationDetailsProvider(); // Create a client for the Database Migration Service const client = new databasemigration.DatabaseMigrationClient({ authenticationDetailsProvider: authProvider, region: authProvider.getRegion() // Use region from config or explicitly set }); // Define the compartment ID where your migrations are located const compartmentId = process.env.OCI_COMPARTMENT_ID || 'ocid1.compartment.oc1..examplecompartmentid'; if (compartmentId === 'ocid1.compartment.oc1..examplecompartmentid') { console.warn('Using a placeholder compartment ID. Please set OCI_COMPARTMENT_ID environment variable or replace it directly.'); } // Create a request object to list migrations in the specified compartment const listMigrationsRequest: databasemigration.requests.ListMigrationsRequest = { compartmentId: compartmentId, lifecycleState: databasemigration.models.Migration.LifecycleState.Active // Optional: Filter by active migrations }; console.log(`Listing OCI Database Migrations in compartment: ${compartmentId}...`); // Call the API to list migrations const response = await client.listMigrations(listMigrationsRequest); if (response.items && response.items.length > 0) { console.log(`Found ${response.items.length} migrations:`) response.items.forEach(migration => { console.log(`- ${migration.displayName} (OCID: ${migration.id}, State: ${migration.lifecycleState})`); }); } else { console.log('No database migrations found in the specified compartment.'); } } catch (error) { console.error('Error listing OCI Database Migrations:', error); if (error instanceof Error && error.message.includes('AuthNFailed')) { console.error('Authentication failed. Please check your OCI config file and API key setup.'); } else if (error instanceof Error && error.message.includes('NotFound')) { console.error('Resource not found. Check compartment ID and permissions.'); } } } listOciDatabaseMigrations();
Debug
Known issues
gotchaOCI SDKs heavily rely on a local configuration file (`~/.oci/config`) and API signing key pairs for authentication. Misconfiguration of this file or incorrect key pair setup is the most common cause of authentication failures.
fix
Refer to the OCI documentation on 'Configuring the SDK' (https://docs.cloud.oracle.com/en-us/iaas/Content/API/SDKDocs/typescriptsdkgettingstarted.htm#Configure) to ensure your `~/.oci/config` file, profile, and API key are correctly set up and permissions are granted in OCI IAM.
affects: >=1.0.0
gotchaThe `oci-databasemigration` package is a service-specific module. For full functionality, it depends on `oci-common` for shared utilities like authentication providers, retry mechanisms, and general OCI types. While `npm install oci-databasemigration` should pull `oci-common` as a dependency, explicitly understanding this relationship is crucial for debugging.
fix
Ensure `oci-common` is installed and up-to-date (`npm install oci-common`). When importing shared utilities, always use `import * as common from 'oci-common';`.
affects: >=1.0.0
gotchaOCI SDKs typically expect region to be explicitly set in the client configuration, or derived from the `authenticationDetailsProvider`. Using a mismatched region or an invalid region can lead to 'Not Found' or 'Unauthorized' errors, or even silent failures if the API endpoint doesn't exist in that region.
fix
Always ensure the `region` parameter in the client constructor matches the region where your OCI resources are deployed. You can retrieve it from `authProvider.getRegion()` if using `ConfigFileAuthenticationDetailsProvider` or explicitly pass the region string (e.g., `'us-ashburn-1'`).
affects: >=1.0.0
breakingWhile no specific breaking changes were noted in the provided recent release logs, the OCI SDKs follow the general API versioning of OCI services. Major breaking changes are typically communicated through explicit version bumps in the service-specific modules. Developers should review release notes for significant version updates.
fix
Subscribe to OCI SDK release notes and review the changelog on GitHub for any breaking changes when upgrading major versions or encountering unexpected behavior after an upgrade. Test critical paths in a staging environment before deploying to production.
affects: >=1.0.0
Errors
Common errors & fixes
Error: AuthNFailed - The client could not be authenticated.
Incorrect OCI configuration file (`~/.oci/config`), invalid API key fingerprint, private key path mismatch, or incorrect user/tenancy OCIDs.
fix
Verify all details in your `~/.oci/config` file. Ensure the private key file exists at the specified path and has correct permissions. Confirm the public key for the fingerprint is uploaded to your OCI user's API Keys.
Error: 401 Unauthorized or 404 Not Found (specific resource, but general auth/permission issue)
The OCI user attempting the API call lacks the necessary IAM permissions for the resource or action, or the resource does not exist in the specified compartment/region for that user.
fix
Check OCI IAM policies for the user and group. Ensure the policy grants `manage databasemigration-family` or specific verbs/resources within the compartment. Also, double-check the OCID of the resource and compartment.
TypeError: Cannot read properties of undefined (reading 'DatabaseMigrationClient')
Incorrect import statement. The client class is not directly exported but accessed via the `databasemigration` namespace.
fix
Change `import { DatabaseMigrationClient } from 'oci-databasemigration';` to `import * as databasemigration from 'oci-databasemigration';` and then use `new databasemigration.DatabaseMigrationClient({...});`.
Error: Region 'us-phoenix-1' is not a valid region. Valid regions are: ...
The specified OCI region in the client configuration or environment is misspelled, unsupported, or incorrect for the OCI realm.
fix
Correct the region name. Ensure it matches one of the valid regions listed in the error message or the OCI documentation for the service. For `ConfigFileAuthenticationDetailsProvider`, check the `region` setting in `~/.oci/config`.
Upgrade
Version history
2.130.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
10
Amazon
1
Resources
oci-databasemigration — npm install oci-databasemigration · libregistry