@contiva/sap-integration-suite-client
Version:
SAP Cloud Platform Integration API Client
697 lines (696 loc) • 37.4 kB
TypeScript
/**
* SAP Security Content Client
*
* This file contains a client class for interacting with the
* Security Content API of SAP Cloud Integration. This API allows management of
* security artifacts like User Credentials, OAuth2 Credentials, Keystores
* (Certificates, Key Pairs), Secure Parameters, Certificate-to-User Mappings,
* and Access Policies.
*
* @module sap-integration-suite-client/security-content
*/
import { Api as SecurityContentApi, ComSapHciApiUserCredential, ComSapHciApiUserCredentialCreate, ComSapHciApiUserCredentialUpdate, ComSapHciApiSecureParameter, ComSapHciApiSecureParameterCreate, ComSapHciApiSecureParameterUpdate, ComSapHciApiOAuth2ClientCredential, ComSapHciApiOAuth2ClientCredentialCreate, ComSapHciApiOAuth2ClientCredentialUpdate, ComSapHciApiKeystoreEntry, ComSapHciApiKeystoreEntryImported, ComSapHciApiKeyPairGenerationRequestCreate, ComSapHciApiRSAKeyGenerationRequestCreate, ComSapHciApiSSHKeyGenerationRequestCreate, ComSapHciApiSSHKeyGenerationRequestCreateResponse, ComSapHciApiChainCertificate, ComSapHciApiHistoryKeystoreEntry, ComSapHciApiCertificateUserMapping, ComSapHciApiCertificateUserMappingCreate, ComSapHciApiAccessPolicy, ComSapHciApiAccessPolicyCreate, ComSapHciApiArtifactReference, ComSapHciApiArtifactReferenceCreatesep } from '../types/sap.SecurityContent';
import { CacheManager } from '../core/cache-manager';
import { CacheInfo } from '../types/cache';
/**
* SAP Security Content Client
*
* Provides simplified access to the Security Content API.
*/
export declare class SecurityContentClient {
private api;
private normalizer;
private cacheManager;
private hostname;
/**
* Creates a new SecurityContentClient
*
* @param {SecurityContentApi<unknown>} api - The underlying API instance
* @param {CacheManager} [cacheManager] - Optional: CacheManager for cache operations
* @param {string} [hostname] - Optional: Hostname for cache key generation
*/
constructor(api: SecurityContentApi<unknown>, cacheManager?: CacheManager | null, hostname?: string);
/**
* Retrieves all deployed user credentials.
*
* @returns {Promise<ComSapHciApiUserCredential[]>} Promise resolving to a list of user credentials.
*
* @example
* const credentials = await client.getUserCredentials();
*/
getUserCredentials(): Promise<ComSapHciApiUserCredential[]>;
/**
* Adds new user credentials.
*
* @param {ComSapHciApiUserCredentialCreate} credentialData Data for the new user credential.
* @returns {Promise<void>} Promise resolving when the credential is created.
*
* @example
* await client.createUserCredential({
* Name: 'MySFTPCreds',
* Kind: 'default', // or 'successfactors', 'openconnectors'
* User: 'sftpUser',
* Password: 'sftpPassword'
* });
*/
createUserCredential(credentialData: ComSapHciApiUserCredentialCreate): Promise<void>;
/**
* Retrieves a specific user credential by its name.
*
* @param {string} name The name of the user credential.
* @returns {Promise<ComSapHciApiUserCredential | undefined>} Promise resolving to the credential or undefined.
*
* @example
* const cred = await client.getUserCredentialByName('MySFTPCreds');
*/
getUserCredentialByName(name: string): Promise<ComSapHciApiUserCredential | undefined>;
/**
* Updates an existing user credential.
*
* @param {string} name The name of the credential to update.
* @param {ComSapHciApiUserCredentialUpdate} credentialData Updated data for the credential.
* @returns {Promise<void>} Promise resolving when the credential is updated.
*
* @example
* await client.updateUserCredential('MySFTPCreds', { Password: 'newPassword' });
*/
updateUserCredential(name: string, credentialData: ComSapHciApiUserCredentialUpdate): Promise<void>;
/**
* Deletes a user credential.
*
* @param {string} name The name of the credential to delete.
* @returns {Promise<void>} Promise resolving when the credential is deleted.
*
* @example
* await client.deleteUserCredential('OldCreds');
*/
deleteUserCredential(name: string): Promise<void>;
/**
* Retrieves all deployed secure parameters (values are not returned).
* Note: This resource is only available in the Neo environment.
*
* @returns {Promise<ComSapHciApiSecureParameter[]>} Promise resolving to a list of secure parameters.
*
* @example
* const params = await client.getSecureParameters();
*/
getSecureParameters(): Promise<ComSapHciApiSecureParameter[]>;
/**
* Adds a new secure parameter.
* Note: This resource is only available in the Neo environment.
*
* @param {ComSapHciApiSecureParameterCreate} parameterData Data for the new secure parameter.
* @returns {Promise<void>} Promise resolving when the parameter is created.
*
* @example
* await client.createSecureParameter({ Name: 'MyApiKey', SecureParam: 'secretValue' });
*/
createSecureParameter(parameterData: ComSapHciApiSecureParameterCreate): Promise<void>;
/**
* Retrieves a specific secure parameter by its name (value is not returned).
* Note: This resource is only available in the Neo environment.
*
* @param {string} name The name of the secure parameter.
* @returns {Promise<ComSapHciApiSecureParameter | undefined>} Promise resolving to the parameter or undefined.
*
* @example
* const param = await client.getSecureParameterByName('MyApiKey');
*/
getSecureParameterByName(name: string): Promise<ComSapHciApiSecureParameter | undefined>;
/**
* Updates an existing secure parameter.
* Note: This resource is only available in the Neo environment.
*
* @param {string} name The name of the parameter to update.
* @param {ComSapHciApiSecureParameterUpdate} parameterData Updated data (can include Name, Description, SecureParam).
* @returns {Promise<void>} Promise resolving when the parameter is updated.
*
* @example
* await client.updateSecureParameter('MyApiKey', { SecureParam: 'newSecretValue' });
*/
updateSecureParameter(name: string, parameterData: ComSapHciApiSecureParameterUpdate): Promise<void>;
/**
* Deletes a secure parameter.
* Note: This resource is only available in the Neo environment.
*
* @param {string} name The name of the parameter to delete.
* @returns {Promise<void>} Promise resolving when the parameter is deleted.
*
* @example
* await client.deleteSecureParameter('OldApiKey');
*/
deleteSecureParameter(name: string): Promise<void>;
/**
* Retrieves all OAuth2 client credentials.
*
* @param {boolean} [expandCustomParameters=false] If true, expands custom parameters associated with the credentials.
* @returns {Promise<ComSapHciApiOAuth2ClientCredential[]>} Promise resolving to a list of OAuth2 credentials.
*
* @example
* const oauthCreds = await client.getOAuth2ClientCredentials();
* const oauthCredsWithParams = await client.getOAuth2ClientCredentials(true);
*/
getOAuth2ClientCredentials(expandCustomParameters?: boolean): Promise<ComSapHciApiOAuth2ClientCredential[]>;
/**
* Adds new OAuth2 client credentials.
*
* @param {ComSapHciApiOAuth2ClientCredentialCreate} credentialData Data for the new OAuth2 credential.
* @returns {Promise<void>} Promise resolving when the credential is created.
*
* @example
* await client.createOAuth2ClientCredential({
* Name: 'MyOAuthApp',
* TokenServiceUrl: 'https://example.com/oauth/token',
* ClientId: 'client-id',
* ClientSecret: 'client-secret'
* });
*/
createOAuth2ClientCredential(credentialData: ComSapHciApiOAuth2ClientCredentialCreate): Promise<void>;
/**
* Retrieves a specific OAuth2 client credential by its name.
*
* @param {string} name The name of the OAuth2 credential.
* @param {boolean} [expandCustomParameters=false] If true, expands custom parameters.
* @returns {Promise<ComSapHciApiOAuth2ClientCredential | undefined>} Promise resolving to the credential or undefined.
*
* @example
* const cred = await client.getOAuth2ClientCredentialByName('MyOAuthApp');
*/
getOAuth2ClientCredentialByName(name: string, expandCustomParameters?: boolean): Promise<ComSapHciApiOAuth2ClientCredential | undefined>;
/**
* Updates an existing OAuth2 client credential.
*
* @param {string} name The name of the credential to update.
* @param {ComSapHciApiOAuth2ClientCredentialUpdate} credentialData Updated data.
* @returns {Promise<void>} Promise resolving when the credential is updated.
*
* @example
* await client.updateOAuth2ClientCredential('MyOAuthApp', { ClientSecret: 'new-secret' });
*/
updateOAuth2ClientCredential(name: string, credentialData: ComSapHciApiOAuth2ClientCredentialUpdate): Promise<void>;
/**
* Deletes an OAuth2 client credential.
*
* @param {string} name The name of the credential to delete.
* @returns {Promise<void>} Promise resolving when the credential is deleted.
*
* @example
* await client.deleteOAuth2ClientCredential('OldOAuthApp');
*/
deleteOAuth2ClientCredential(name: string): Promise<void>;
/**
* Retrieves properties (like size) and optionally entries for a specified keystore.
*
* @param {('system' | 'backup_admin_system')} keystoreName Name of the keystore.
* @param {boolean} [expandEntries=false] If true, includes the list of entries in the response.
* @param {('Entries' | 'LastModifiedBy' | 'LastModifiedTime' | 'Size')[]} [select] Properties to select.
* @returns {Promise<any>} Promise resolving to the keystore properties (structure varies based on select/expand).
*
* @example
* const systemKeystoreInfo = await client.getKeystoreProperties('system');
* console.log('System Keystore Size:', systemKeystoreInfo?.Size);
*
* @example
* // Get keystore with entries expanded
* const systemKeystoreWithEntries = await client.getKeystoreProperties('system', true);
*/
getKeystoreProperties(keystoreName: 'system' | 'backup_admin_system', expandEntries?: boolean, select?: ('Entries' | 'LastModifiedBy' | 'LastModifiedTime' | 'Size')[]): Promise<any>;
/**
* Retrieves the number of entries in a specified keystore.
*
* @param {('system' | 'KeyRenewal')} keystoreName Name of the keystore.
* @returns {Promise<number>} Promise resolving to the number of entries.
*
* @example
* const systemSize = await client.getKeystoreSize('system');
*/
getKeystoreSize(keystoreName: 'system' | 'KeyRenewal'): Promise<number>;
/**
* Imports entries from a JKS or JCEKS keystore file into the system keystore.
*
* @param {File} keystoreFile Keystore file (JKS/JCEKS format).
* @param {string} password Password for the keystore file.
* @param {('replace' | 'merge' | 'overwrite')} [importOption='overwrite'] How to handle existing entries.
* @param {boolean} [returnKeystoreEntries=true] If true, returns the import status for each entry.
* @returns {Promise<ComSapHciApiKeystoreEntryImported[] | undefined>} Promise resolving to the list of imported entries with status, if requested.
*
* @example
* // Assuming 'file' is a File object from an input element
* // const file = document.getElementById('keystoreInput').files[0];
* // await client.importKeystore(file, 'keystorePassword', 'merge');
*/
importKeystore(keystoreFile: File, password: string, importOption?: 'replace' | 'merge' | 'overwrite', returnKeystoreEntries?: boolean): Promise<ComSapHciApiKeystoreEntryImported[] | undefined>;
/**
* Backs up tenant administrator-owned entries from the system keystore to the backup keystore.
* This overwrites the previous backup.
*
* @returns {Promise<void>} Promise resolving when the backup is complete.
*
* @example
* await client.backupKeystore();
*/
backupKeystore(): Promise<void>;
/**
* Exports the public content of a keystore (system or backup).
*
* Note: API returns `void`, the content is in the response body (JKS format).
*
* @param {('system' | 'backup_admin_system')} keystoreName Name of the keystore to export.
* @returns {Promise<any>} Promise resolving to the exported keystore content (JKS).
*
* @example
* const exportedKeystore = await client.exportKeystore('system');
* // Process exportedKeystore (e.g., save as file)
*/
exportKeystore(_keystoreName: 'system' | 'backup_admin_system'): Promise<any>;
/**
* Restores tenant administrator-owned entries from the backup keystore to the system keystore.
*
* @param {('replace' | 'overwrite')} [importOption='overwrite'] How to handle existing entries in the system keystore.
* @param {boolean} [returnKeystoreEntries=true] If true, returns the restore status for each entry.
* @returns {Promise<ComSapHciApiKeystoreEntryImported[] | undefined>} Promise resolving to the list of restored entries with status, if requested.
*
* @example
* await client.restoreKeystoreBackup('overwrite');
*/
restoreKeystoreBackup(importOption?: 'replace' | 'overwrite', returnKeystoreEntries?: boolean): Promise<ComSapHciApiKeystoreEntryImported[] | undefined>;
/**
* Deletes multiple specified entries (owned by tenant administrator) from the system keystore.
*
* @param {string[]} aliasesToDelete List of aliases to delete.
* @param {boolean} [returnKeystoreEntries=false] If true, returns the deletion status for each entry.
* @returns {Promise<ComSapHciApiKeystoreEntryImported[] | undefined>} Promise resolving to the list of entries with status, if requested.
*
* @example
* await client.deleteKeystoreEntries(['alias1', 'alias2']);
*/
deleteKeystoreEntries(aliasesToDelete: string[], returnKeystoreEntries?: boolean): Promise<ComSapHciApiKeystoreEntryImported[] | undefined>;
/**
* Retrieves entries from the history keystore.
*
* @param {('Alias' | 'Hexalias' | 'KeyType' | 'LastModifiedBy' | 'LastModifiedTime' | 'Owner' | 'Validity')[]} [select] Properties to select.
* @returns {Promise<ComSapHciApiHistoryKeystoreEntry[]>} Promise resolving to a list of history entries.
*
* @example
* const history = await client.getKeystoreHistoryEntries();
*/
getKeystoreHistoryEntries(select?: ('Alias' | 'Hexalias' | 'KeyType' | 'LastModifiedBy' | 'LastModifiedTime' | 'Owner' | 'Validity')[]): Promise<ComSapHciApiHistoryKeystoreEntry[]>;
/**
* Retrieves a specific entry from the history keystore by its hex-encoded alias.
*
* @param {string} hexAlias Hex-encoded alias of the history entry.
* @param {('Alias' | 'KeyType' | 'LastModifiedBy' | 'LastModifiedTime' | 'Owner' | 'Validity')[]} [select] Properties to select.
* @returns {Promise<ComSapHciApiHistoryKeystoreEntry | undefined>} Promise resolving to the history entry or undefined.
*
* @example
* const historyEntry = await client.getKeystoreHistoryEntry('historyHexAlias');
*/
getKeystoreHistoryEntry(hexAlias: string, select?: ('Alias' | 'KeyType' | 'LastModifiedBy' | 'LastModifiedTime' | 'Owner' | 'Validity')[]): Promise<ComSapHciApiHistoryKeystoreEntry | undefined>;
/**
* Restores an entry from the history keystore to the renewal keystore.
*
* @param {string} hexAlias Hex-encoded alias of the history entry to restore.
* @param {string} [destinationAlias] Optional new alias for the entry in the renewal keystore. If empty, defaults to '[number]_original_alias'.
* @returns {Promise<void>} Promise resolving when the entry is restored.
*
* @example
* await client.restoreHistoryKeystoreEntry('historyHexAlias', 'restoredAlias');
*/
restoreHistoryKeystoreEntry(hexAlias: string, destinationAlias?: string): Promise<void>;
/**
* Retrieves all certificate-to-user mappings.
* Note: This resource is only available in the Neo environment.
*
* @param {object} [options] Optional parameters for filtering, sorting, and selection.
* @param {string} [options.filter] OData filter string (only `User eq 'username'` supported).
* @param {('Id' | 'Id desc' | 'User' | 'User desc' | 'Certificate' | 'Certificate desc' | 'CreatedBy' | 'CreatedBy desc' | 'CreatedTime' | 'CreatedTime desc' | 'LastModifiedBy' | 'LastModifiedBy desc' | 'LastModifiedTime' | 'LastModifiedTime desc' | 'ValidUntil')[]} [options.orderby] Sorting order.
* @param {('Id' | 'User' | 'Certificate' | 'LastModifiedBy' | 'LastModifiedTime' | 'CreatedBy' | 'CreatedTime' | 'ValidUntil')[]} [options.select] Properties to select.
* @returns {Promise<ComSapHciApiCertificateUserMapping[]>} Promise resolving to a list of mappings.
*
* @example
* const allMappings = await client.getCertificateUserMappings();
* const userMappings = await client.getCertificateUserMappings({ filter: "User eq 'myuser'" });
*/
getCertificateUserMappings(options?: {
filter?: string;
orderby?: ('Id' | 'Id desc' | 'User' | 'User desc' | 'Certificate' | 'Certificate desc' | 'CreatedBy' | 'CreatedBy desc' | 'CreatedTime' | 'CreatedTime desc' | 'LastModifiedBy' | 'LastModifiedBy desc' | 'LastModifiedTime' | 'LastModifiedTime desc' | 'ValidUntil')[];
select?: ('Id' | 'User' | 'Certificate' | 'LastModifiedBy' | 'LastModifiedTime' | 'CreatedBy' | 'CreatedTime' | 'ValidUntil')[];
}): Promise<ComSapHciApiCertificateUserMapping[]>;
/**
* Adds a new certificate-to-user mapping.
* Note: This resource is only available in the Neo environment.
*
* @param {ComSapHciApiCertificateUserMappingCreate} mappingData Data for the new mapping (User, Certificate content).
* @returns {Promise<ComSapHciApiCertificateUserMapping | undefined>} Promise resolving to the created mapping.
*
* @example
* // Assuming 'certFile' is a File object
* // const newMapping = await client.createCertificateUserMapping({ User: 'newUser', Certificate: certFile });
*/
createCertificateUserMapping(mappingData: ComSapHciApiCertificateUserMappingCreate): Promise<ComSapHciApiCertificateUserMapping | undefined>;
/**
* Retrieves a specific certificate-to-user mapping by its ID.
* Note: This resource is only available in the Neo environment.
*
* @param {string} id The ID of the mapping.
* @param {('User' | 'Certificate' | 'LastModifiedBy' | 'LastModifiedTime' | 'CreatedBy' | 'CreatedTime')[]} [select] Properties to select.
* @returns {Promise<ComSapHciApiCertificateUserMapping | undefined>} Promise resolving to the mapping or undefined.
*
* @example
* const mapping = await client.getCertificateUserMappingById('mapping-id...');
*/
getCertificateUserMappingById(id: string, select?: ('User' | 'Certificate' | 'LastModifiedBy' | 'LastModifiedTime' | 'CreatedBy' | 'CreatedTime')[]): Promise<ComSapHciApiCertificateUserMapping | undefined>;
/**
* Deletes a certificate-to-user mapping.
* Note: This resource is only available in the Neo environment.
*
* @param {string} id The ID of the mapping to delete.
* @returns {Promise<void>} Promise resolving when the mapping is deleted.
*
* @example
* await client.deleteCertificateUserMapping('mapping-id-to-delete');
*/
deleteCertificateUserMapping(id: string): Promise<void>;
/**
* Retrieves all Access Policies.
*
* @param {object} [options] Optional parameters for filtering, pagination, sorting, selection, and expansion.
* @param {number} [options.top] Maximum number of policies to retrieve.
* @param {number} [options.skip] Number of policies to skip.
* @param {string} [options.filter] OData filter string (e.g., "RoleName eq 'Policy1'").
* @param {('Id' | 'Id desc' | 'RoleName' | 'RoleName desc')[]} [options.orderby] Sorting order.
* @param {('Id' | 'RoleName' | 'Description')[]} [options.select] Properties to select.
* @param {boolean} [options.expandArtifactReferences=false] If true, expands the associated ArtifactReferences.
* @param {boolean} [options.inlinecount=false] If true, includes the total count.
* @returns {Promise<{ policies: ComSapHciApiAccessPolicy[], count?: number }>} Promise resolving to the policies and optional count.
*
* @example
* const { policies } = await client.getAccessPolicies({ expandArtifactReferences: true });
*/
getAccessPolicies(options?: {
top?: number;
skip?: number;
filter?: string;
orderby?: ('Id' | 'Id desc' | 'RoleName' | 'RoleName desc')[];
select?: ('Id' | 'RoleName' | 'Description')[];
expandArtifactReferences?: boolean;
inlinecount?: boolean;
}): Promise<{
policies: ComSapHciApiAccessPolicy[];
count?: number;
}>;
/**
* Adds a new Access Policy, optionally with initial Artifact References.
*
* @param {ComSapHciApiAccessPolicyCreate} policyData Data for the new policy, including RoleName and optionally ArtifactReferences.
* @returns {Promise<void>} Promise resolving when the policy is created.
*
* @example
* await client.createAccessPolicy({
* RoleName: 'FlowExecutors',
* Description: 'Can execute specific flows',
* ArtifactReferences: [
* { Name: 'AllowFlow1', Type: 'INTEGRATION_FLOW', ConditionAttribute: 'Name', ConditionValue: 'Flow1', ConditionType: 'exactString' }
* ]
* });
*/
createAccessPolicy(policyData: ComSapHciApiAccessPolicyCreate): Promise<void>;
/**
* Deletes an Access Policy by its ID.
*
* @param {string} policyId The ID of the policy to delete.
* @returns {Promise<void>} Promise resolving when the policy is deleted.
*
* @example
* await client.deleteAccessPolicy('policy-id-123');
*/
deleteAccessPolicy(policyId: string): Promise<void>;
/**
* Updates an Access Policy (only PATCH is supported by the API).
* Note: This method currently only triggers the PATCH request without specific update data,
* as the generated client doesn't directly support PATCH bodies.
* A custom request might be needed for actual updates.
*
* @param {string} policyId The ID of the policy to update.
* @returns {Promise<void>}
*
* @example
* // Note: Actual update might require custom implementation
* await client.updateAccessPolicy('policy-id-123');
*/
updateAccessPolicy(policyId: string): Promise<void>;
/**
* Retrieves all Artifact References.
*
* @param {object} [options] Optional parameters for filtering, pagination, sorting, and selection.
* @param {number} [options.top] Maximum number of references to retrieve.
* @param {number} [options.skip] Number of references to skip.
* @param {string} [options.filter] OData filter string (e.g., "Id eq 'ref1'").
* @param {('Id' | 'Id desc' | 'Name' | 'Name desc')[]} [options.orderby] Sorting order.
* @param {('Id' | 'Name' | 'Description' | 'Type' | 'ConditionAttribute' | 'ConditionValue' | 'ConditionType')[]} [options.select] Properties to select.
* @param {boolean} [options.inlinecount=false] If true, includes the total count.
* @returns {Promise<{ references: ComSapHciApiArtifactReference[], count?: number }>} Promise resolving to the references and optional count.
*
* @example
* const { references } = await client.getArtifactReferences();
*/
getArtifactReferences(options?: {
top?: number;
skip?: number;
filter?: string;
orderby?: ('Id' | 'Id desc' | 'Name' | 'Name desc')[];
select?: ('Id' | 'Name' | 'Description' | 'Type' | 'ConditionAttribute' | 'ConditionValue' | 'ConditionType')[];
inlinecount?: boolean;
}): Promise<{
references: ComSapHciApiArtifactReference[];
count?: number;
}>;
/**
* Adds a new Artifact Reference to an existing Access Policy.
*
* @param {string} policyId The ID of the Access Policy to add the reference to.
* @param {Omit<ComSapHciApiArtifactReferenceCreatesep, 'AcessPolicy'>} referenceData Data for the new artifact reference.
* @returns {Promise<void>} Promise resolving when the reference is created.
*
* @example
* await client.createArtifactReference('policy-id-123', {
* Name: 'AllowFlow2', Type: 'INTEGRATION_FLOW', ConditionAttribute: 'Name', ConditionValue: 'Flow2', ConditionType: 'exactString'
* });
*/
createArtifactReference(policyId: string, referenceData: Omit<ComSapHciApiArtifactReferenceCreatesep, 'AcessPolicy'>): Promise<void>;
/**
* Deletes an Artifact Reference by its ID.
*
* @param {string} referenceId The ID of the artifact reference to delete.
* @returns {Promise<void>} Promise resolving when the reference is deleted.
*
* @example
* await client.deleteArtifactReference('ref-id-456');
*/
deleteArtifactReference(referenceId: string): Promise<void>;
/**
* Retrieves entries from a specified keystore.
*
* @param {('system' | 'backup_admin_system' | 'KeyRenewal')} keystoreName Name of the keystore.
* @param {('Alias' | 'Hexalias' | 'KeyType' | 'LastModifiedBy' | 'LastModifiedTime' | 'Owner' | 'Status' | 'Type' | 'Validity')[]} [select] Properties to select.
* @returns {Promise<ComSapHciApiKeystoreEntry[]>} Promise resolving to a list of keystore entries.
*
* @example
* const entries = await client.getKeystoreEntries('system');
*/
getKeystoreEntries(keystoreName: 'system' | 'backup_admin_system' | 'KeyRenewal', select?: ('Alias' | 'Hexalias' | 'KeyType' | 'LastModifiedBy' | 'LastModifiedTime' | 'Owner' | 'Status' | 'Type' | 'Validity')[]): Promise<ComSapHciApiKeystoreEntry[]>;
/**
* Retrieves a specific keystore entry by its hex-encoded alias.
*
* @param {string} hexAlias Hex-encoded alias of the entry.
* @param {('system' | 'backup_admin_system' | 'KeyRenewal')} [keystoreName='system'] The name of the keystore.
* @param {('Alias' | 'KeyType' | 'LastModifiedBy' | 'LastModifiedTime' | 'Owner' | 'Status' | 'Type' | 'Validity')[]} [select] Properties to select.
* @returns {Promise<ComSapHciApiKeystoreEntry | undefined>} Promise resolving to the entry or undefined.
*
* @example
* const entry = await client.getKeystoreEntry('hex...');
*/
getKeystoreEntry(hexAlias: string, keystoreName?: 'system' | 'backup_admin_system' | 'KeyRenewal', select?: ('Alias' | 'KeyType' | 'LastModifiedBy' | 'LastModifiedTime' | 'Owner' | 'Status' | 'Type' | 'Validity')[]): Promise<ComSapHciApiKeystoreEntry | undefined>;
/**
* Generates a new key pair (RSA or ECC).
*
* @param {ComSapHciApiKeyPairGenerationRequestCreate} keyPairData Details for key pair generation.
* @param {boolean} [returnKeystoreEntries=false] Return updated keystore entries in response.
* @returns {Promise<{ keyPairInfo?: any, entries?: ComSapHciApiKeystoreEntry[] }>} Promise with generated key pair info and optionally the entry list.
*
* @example
* const { keyPairInfo } = await client.generateKeyPair({
* Alias: 'myNewKeyPair',
* KeyType: 'RSA',
* KeySize: 2048,
* SignatureAlgorithm: 'SHA256/RSA',
* CommonName: 'My Common Name'
* // ... other DN components
* });
*/
generateKeyPair(keyPairData: ComSapHciApiKeyPairGenerationRequestCreate, returnKeystoreEntries?: boolean): Promise<{
keyPairInfo?: any;
entries?: ComSapHciApiKeystoreEntry[];
}>;
/**
* Generates an RSA key pair from an existing private key file (PKCS#1 PEM format).
*
* @param {ComSapHciApiRSAKeyGenerationRequestCreate} rsaData Details including Alias, RSAFile (base64 encoded private key), SignatureAlgorithm, and DN components.
* @param {boolean} [returnKeystoreEntries=false] Return updated keystore entries in response.
* @returns {Promise<{ keyPairInfo?: any, entries?: ComSapHciApiKeystoreEntry[] }>} Promise with generated key pair info and optionally the entry list.
*
* @example
* const { keyPairInfo } = await client.generateRsaKeyPair({
* Alias: 'myImportedRsaKey',
* RSAFile: 'base64PrivateKeyContent',
* SignatureAlgorithm: 'SHA256/RSA',
* CommonName: 'Imported Key'
* });
*/
generateRsaKeyPair(rsaData: ComSapHciApiRSAKeyGenerationRequestCreate, returnKeystoreEntries?: boolean): Promise<{
keyPairInfo?: any;
entries?: ComSapHciApiKeystoreEntry[];
}>;
/**
* Generates an SSH private key pair from an OpenSSH (RSA, DSA, EC) or PuTTY (RSA, DSA) file.
* Alias will be id_rsa, id_dsa, or id_ec based on algorithm.
*
* @param {ComSapHciApiSSHKeyGenerationRequestCreate} sshData Details including SSHFile (key content), optional Password, and DN components.
* @param {boolean} [update=false] Update existing SSH key pair.
* @param {boolean} [returnKeystoreEntries=false] Return updated keystore entries in response.
* @returns {Promise<{ responseInfo?: ComSapHciApiSSHKeyGenerationRequestCreateResponse, entries?: ComSapHciApiKeystoreEntry[] }>} Promise with response info (containing Alias) and optionally the entry list.
*
* @example
* const { responseInfo } = await client.generateSshKeyPair({
* SSHFile: 'ssh-rsa AAAAB3NzaC1yc2.... user@host',
* CommonName: 'My SSH Key'
* }, false);
* console.log('Generated SSH Key Alias:', responseInfo?.Alias);
*/
generateSshKeyPair(sshData: ComSapHciApiSSHKeyGenerationRequestCreate, update?: boolean, returnKeystoreEntries?: boolean): Promise<{
responseInfo?: ComSapHciApiSSHKeyGenerationRequestCreateResponse;
entries?: ComSapHciApiKeystoreEntry[];
}>;
/**
* Retrieves a certificate chain.
*
* @param {string} hexAlias Hex-encoded alias of the key pair.
* @param {('system' | 'backup_admin_system' | 'KeyRenewal' | 'KeyHistory')} [keystoreName='system'] Keystore name.
* @param {('Alias' | 'KeyType' | 'LastModifiedBy' | 'LastModifiedTime' | 'Owner' | 'Validity')[]} [select] Properties to select.
* @returns {Promise<ComSapHciApiChainCertificate[]>} Promise resolving to the list of chain certificates.
*
* @example
* const chainCertificates = await client.getCertificateChain('hex...');
*/
getCertificateChain(hexAlias: string, keystoreName?: 'system' | 'backup_admin_system' | 'KeyRenewal' | 'KeyHistory', select?: ('Alias' | 'KeyType' | 'LastModifiedBy' | 'LastModifiedTime' | 'Owner' | 'Validity')[]): Promise<ComSapHciApiChainCertificate[]>;
/**
* Retrieves all keystore entries (with Caching)
* Implements Stale-While-Revalidate Pattern
*
* @param {('system' | 'backup_admin_system' | 'KeyRenewal')} keystoreName Name of the keystore.
* @param {boolean} [forceRefresh=false] Forces fetching fresh data from SAP.
* @param {('Alias' | 'Hexalias' | 'KeyType' | 'LastModifiedBy' | 'LastModifiedTime' | 'Owner' | 'Status' | 'Type' | 'Validity')[]} [select] Properties to select.
* @returns {Promise<{ data: ComSapHciApiKeystoreEntry[]; cacheInfo: CacheInfo }>} Keystore entries with cache information.
*
* @example
* const { data, cacheInfo } = await client.getKeystoreEntriesWithCache('system');
* console.log(cacheInfo.status); // 'HIT', 'HIT-STALE', 'MISS', or 'DISABLED'
*/
getKeystoreEntriesWithCache(keystoreName: 'system' | 'backup_admin_system' | 'KeyRenewal', forceRefresh?: boolean, select?: ('Alias' | 'Hexalias' | 'KeyType' | 'LastModifiedBy' | 'LastModifiedTime' | 'Owner' | 'Status' | 'Type' | 'Validity')[]): Promise<{
data: ComSapHciApiKeystoreEntry[];
cacheInfo: CacheInfo;
}>;
/**
* Retrieves all deployed user credentials (with Caching)
* Implements Stale-While-Revalidate Pattern
*
* @param {boolean} [forceRefresh=false] Forces fetching fresh data from SAP.
* @returns {Promise<{ data: ComSapHciApiUserCredential[]; cacheInfo: CacheInfo }>} User credentials with cache information.
*
* @example
* const { data, cacheInfo } = await client.getUserCredentialsWithCache();
* console.log(cacheInfo.status); // 'HIT', 'HIT-STALE', 'MISS', or 'DISABLED'
*/
getUserCredentialsWithCache(forceRefresh?: boolean): Promise<{
data: ComSapHciApiUserCredential[];
cacheInfo: CacheInfo;
}>;
/**
* Retrieves all OAuth2 client credentials (with Caching)
* Implements Stale-While-Revalidate Pattern
*
* @param {boolean} [expandCustomParameters=false] If true, expands custom parameters.
* @param {boolean} [forceRefresh=false] Forces fetching fresh data from SAP.
* @returns {Promise<{ data: ComSapHciApiOAuth2ClientCredential[]; cacheInfo: CacheInfo }>} OAuth2 credentials with cache information.
*
* @example
* const { data, cacheInfo } = await client.getOAuth2ClientCredentialsWithCache();
* console.log(cacheInfo.status); // 'HIT', 'HIT-STALE', 'MISS', or 'DISABLED'
*/
getOAuth2ClientCredentialsWithCache(expandCustomParameters?: boolean, forceRefresh?: boolean): Promise<{
data: ComSapHciApiOAuth2ClientCredential[];
cacheInfo: CacheInfo;
}>;
/**
* Retrieves all Access Policies (with Caching)
* Implements Stale-While-Revalidate Pattern
*
* @param {object} [options] Optional parameters for filtering, pagination, sorting, selection, and expansion.
* @param {boolean} [forceRefresh=false] Forces fetching fresh data from SAP.
* @returns {Promise<{ data: { policies: ComSapHciApiAccessPolicy[], count?: number }; cacheInfo: CacheInfo }>} Access policies with cache information.
*
* @example
* const { data, cacheInfo } = await client.getAccessPoliciesWithCache({ expandArtifactReferences: true });
* console.log(data.policies);
* console.log(cacheInfo.status); // 'HIT', 'HIT-STALE', 'MISS', or 'DISABLED'
*/
getAccessPoliciesWithCache(options?: {
top?: number;
skip?: number;
filter?: string;
orderby?: ('Id' | 'Id desc' | 'RoleName' | 'RoleName desc')[];
select?: ('Id' | 'RoleName' | 'Description')[];
expandArtifactReferences?: boolean;
inlinecount?: boolean;
}, forceRefresh?: boolean): Promise<{
data: {
policies: ComSapHciApiAccessPolicy[];
count?: number;
};
cacheInfo: CacheInfo;
}>;
/**
* Retrieves a certificate chain (with Caching)
* Implements Stale-While-Revalidate Pattern
*
* @param {string} hexAlias Hex-encoded alias of the key pair.
* @param {('system' | 'backup_admin_system' | 'KeyRenewal' | 'KeyHistory')} [keystoreName='system'] Keystore name.
* @param {boolean} [forceRefresh=false] Forces fetching fresh data from SAP.
* @param {('Alias' | 'KeyType' | 'LastModifiedBy' | 'LastModifiedTime' | 'Owner' | 'Validity')[]} [select] Properties to select.
* @returns {Promise<{ data: ComSapHciApiChainCertificate[]; cacheInfo: CacheInfo }>} Certificate chain with cache information.
*
* @example
* const { data, cacheInfo } = await client.getCertificateChainWithCache('hex...');
* console.log(cacheInfo.status); // 'HIT', 'HIT-STALE', 'MISS', or 'DISABLED'
*/
getCertificateChainWithCache(hexAlias: string, keystoreName?: 'system' | 'backup_admin_system' | 'KeyRenewal' | 'KeyHistory', forceRefresh?: boolean, select?: ('Alias' | 'KeyType' | 'LastModifiedBy' | 'LastModifiedTime' | 'Owner' | 'Validity')[]): Promise<{
data: ComSapHciApiChainCertificate[];
cacheInfo: CacheInfo;
}>;
/**
* Retrieves entries from the history keystore (with Caching)
* Implements Stale-While-Revalidate Pattern
*
* @param {boolean} [forceRefresh=false] Forces fetching fresh data from SAP.
* @param {('Alias' | 'Hexalias' | 'KeyType' | 'LastModifiedBy' | 'LastModifiedTime' | 'Owner' | 'Validity')[]} [select] Properties to select.
* @returns {Promise<{ data: ComSapHciApiHistoryKeystoreEntry[]; cacheInfo: CacheInfo }>} History entries with cache information.
*
* @example
* const { data, cacheInfo } = await client.getKeystoreHistoryEntriesWithCache();
* console.log(cacheInfo.status); // 'HIT', 'HIT-STALE', 'MISS', or 'DISABLED'
*/
getKeystoreHistoryEntriesWithCache(forceRefresh?: boolean, select?: ('Alias' | 'Hexalias' | 'KeyType' | 'LastModifiedBy' | 'LastModifiedTime' | 'Owner' | 'Validity')[]): Promise<{
data: ComSapHciApiHistoryKeystoreEntry[];
cacheInfo: CacheInfo;
}>;
}