IotHubBuilderPurpose: Initializes the IotHubBuilder with the provided arguments and sets up the initial state.
Usage:
const builder = new IotHubBuilder({
name: 'example',
group: { resourceGroupName: 'resourceGroup' },
envUIDInfo: { id: 'userAssignedIdentityId', clientId: 'clientId' },
vaultInfo: { id: 'vaultId' },
enableEncryption: true,
dependsOn: [],
});
withSkuPurpose: Sets the SKU for the IoT Hub.
Usage:
builder.withSku({
name: 'S1',
capacity: 1,
});
withBusPurpose: Sets the Service Bus configuration for the IoT Hub.
Usage:
builder.withBus({
queueMessageConnectionString: 'queueConnectionString',
topicMessageConnectionString: 'topicConnectionString',
});
withStoragePurpose: Sets the storage configuration for the IoT Hub.
Usage:
builder.withStorage({
connectionString: 'storageConnectionString',
messageContainerName: 'messageContainer',
eventContainerName: 'eventContainer',
fileContainerName: 'fileContainer',
});
buildPurpose: Builds the entire IoT Hub resource with the configured properties.
Usage:
const resourceInfo = builder.build();
console.log(resourceInfo);
Here is a complete example that demonstrates how to use the IotHubBuilder class, ensuring that the build() method is called at the end:
const builder = new IotHubBuilder({
name: 'example',
group: { resourceGroupName: 'resourceGroup' },
envUIDInfo: { id: 'userAssignedIdentityId', clientId: 'clientId' },
vaultInfo: { id: 'vaultId' },
enableEncryption: true,
dependsOn: [],
});
builder
.withSku({
name: 'S1',
capacity: 1,
})
.withBus({
queueMessageConnectionString: 'queueConnectionString',
topicMessageConnectionString: 'topicConnectionString',
})
.withStorage({
connectionString: 'storageConnectionString',
messageContainerName: 'messageContainer',
eventContainerName: 'eventContainer',
fileContainerName: 'fileContainer',
});
const resourceInfo = builder.build();
console.log(resourceInfo);
Purpose: Initializes the IotHubBuilder with the provided arguments and sets up the initial state.
Usage:
const builder = new IotHubBuilder({
name: 'example',
group: { resourceGroupName: 'resourceGroup' },
envUIDInfo: { id: 'userAssignedIdentityId', clientId: 'clientId' },
vaultInfo: { id: 'vaultId' },
enableEncryption: true,
dependsOn: [],
});
withSkuPurpose: Sets the SKU for the IoT Hub.
Usage:
builder.withSku({
name: 'S1',
capacity: 1,
});
withBusPurpose: Sets the Service Bus configuration for the IoT Hub.
Usage:
builder.withBus({
queueMessageConnectionString: 'queueConnectionString',
topicMessageConnectionString: 'topicConnectionString',
});
withStoragePurpose: Sets the storage configuration for the IoT Hub.
Usage:
builder.withStorage({
connectionString: 'storageConnectionString',
messageContainerName: 'messageContainer',
eventContainerName: 'eventContainer',
fileContainerName: 'fileContainer',
});
buildPurpose: Builds the entire IoT Hub resource with the configured properties.
Usage:
const resourceInfo = builder.build();
console.log(resourceInfo);
Here is a complete example that demonstrates how to use the IotHubBuilder class, ensuring that the build() method is called at the end:
const builder = new IotHubBuilder({
name: 'example',
group: { resourceGroupName: 'resourceGroup' },
envUIDInfo: { id: 'userAssignedIdentityId', clientId: 'clientId' },
vaultInfo: { id: 'vaultId' },
enableEncryption: true,
dependsOn: [],
});
builder
.withSku({
name: 'S1',
capacity: 1,
})
.withBus({
queueMessageConnectionString: 'queueConnectionString',
topicMessageConnectionString: 'topicConnectionString',
})
.withStorage({
connectionString: 'storageConnectionString',
messageContainerName: 'messageContainer',
eventContainerName: 'eventContainer',
fileContainerName: 'fileContainer',
});
const resourceInfo = builder.build();
console.log(resourceInfo);
This example demonstrates how to create an IotHubBuilder instance, configure it with various settings, and finally build the IoT Hub resource. The build() method is called last to ensure the resource is fully constructed.