VaultBuilder
Class OverviewThe VaultBuilder
class is designed to build and configure an Azure Key Vault instance with specific configurations such as secrets, certificates, and network settings.
VaultBuilderResults
Class OverviewThe VaultBuilderResults
class encapsulates the results of building a Key Vault, providing methods to access the vault’s information and perform additional configurations.
VaultBuilderResults
ClassInitializes the VaultBuilderResults
with the provided Key Vault information.
This constructor is private and is called internally by the from
method.
from
Creates an instance of VaultBuilderResults
from the provided Key Vault information.
const vaultInfo: KeyVaultInfo = {
name: 'myKeyVault',
id: 'vault-id',
group: { resourceGroupName: 'myResourceGroup' },
};
const vaultResults = VaultBuilderResults.from(vaultInfo);
name
Gets the name of the Key Vault.
const vaultName = vaultResults.name;
group
Gets the resource group information of the Key Vault.
const resourceGroup = vaultResults.group;
id
Gets the ID of the Key Vault.
const vaultId = vaultResults.id;
info
Gets the Key Vault information.
const vaultInfo = vaultResults.info();
linkTo
Links the Key Vault to specified subnets and IP addresses.
vaultResults.linkTo({
subnetIds: ['subnet-id-1', 'subnet-id-2'],
ipAddresses: ['192.168.1.1', '192.168.1.2'],
});
privateLinkTo
Creates a private link to the Key Vault for specified subnets.
vaultResults.privateLinkTo(['subnet-id-1', 'subnet-id-2']);
addSecrets
Adds secrets to the Key Vault.
vaultResults.addSecrets({
secretName: pulumi.secret('secretValue'),
});
addCerts
Adds certificates to the Key Vault.
vaultResults.addCerts({
certName: {
name: 'certName',
// other CertBuilderType properties
},
});
VaultBuilder
ClassInitializes the VaultBuilder
with the provided arguments.
const vaultBuilder = new VaultBuilder({
name: 'myKeyVault',
group: { resourceGroupName: 'myResourceGroup' },
// other necessary arguments
});
build
Builds the Key Vault and returns the results.
const vaultResults = vaultBuilder.build();
console.log(vaultResults);
Here is a full example demonstrating how to use the VaultBuilder
class:
import VaultBuilder from './Builder/VaultBuilder';
import { VaultBuilderArgs } from './types/vaultBuilder';
const args: VaultBuilderArgs = {
name: 'myKeyVault',
group: { resourceGroupName: 'myResourceGroup' },
// other necessary arguments
};
const vaultBuilder = new VaultBuilder(args);
const vaultResults = vaultBuilder.build();
vaultResults
.addSecrets({
secretName: pulumi.secret('secretValue'),
})
.addCerts({
certName: {
name: 'certName',
// other CertBuilderType properties
},
})
.linkTo({
subnetIds: ['subnet-id-1', 'subnet-id-2'],
ipAddresses: ['192.168.1.1', '192.168.1.2'],
})
.privateLinkTo(['subnet-id-1', 'subnet-id-2']);
console.log(vaultResults);
This guideline should help developers understand and reuse the methods in the VaultBuilder
class effectively.