drunk-pulumi-azure

SignalRBuilder Class Overview

The SignalRBuilder class is designed to build and configure an Azure SignalR instance with specific configurations such as kind, SKU, private link, allowed origins, and other options.

Constructor

Purpose:

Initializes the SignalRBuilder with the provided arguments and sets the instance name.

Sample Usage:

const signalRBuilder = new SignalRBuilder({
  name: 'mySignalR',
  group: { resourceGroupName: 'myResourceGroup' },
  // other necessary arguments
});

withKind

Purpose:

Sets the kind of the SignalR instance.

Sample Usage:

signalRBuilder.withKind('SignalR');

withSku

Purpose:

Sets the SKU for the SignalR instance.

Sample Usage:

signalRBuilder.withSku({ name: 'Standard_S1', tier: 'Standard' });

Purpose:

Sets the private link properties for the SignalR instance.

Sample Usage:

signalRBuilder.withPrivateLink({
  // PrivateLinkPropsType properties
});

allowsOrigins

Purpose:

Sets the allowed origins for CORS.

Sample Usage:

signalRBuilder.allowsOrigins('https://example.com', 'https://another.com');

withOptions

Purpose:

Sets additional options for the SignalR instance.

Sample Usage:

signalRBuilder.withOptions({
  disableAadAuth: true,
  disableLocalAuth: false,
  publicNetworkAccess: true,
  clientCertEnabled: false,
});

buildSignalR

Purpose:

Creates the SignalR instance with the specified configurations.

Sample Usage:

This method is called internally by the build method and is not typically called directly.

Purpose:

Configures the private link for the SignalR instance.

Sample Usage:

This method is called internally by the build method and is not typically called directly.

buildSecrets

Purpose:

Stores SignalR connection details in Azure Key Vault.

Sample Usage:

This method is called internally by the build method and is not typically called directly.

build

Purpose:

Builds the SignalR instance, configures private link, and stores secrets.

Sample Usage:

const resourceInfo = signalRBuilder.build();
console.log(resourceInfo);

Full Example

Here is a full example demonstrating how to use the SignalRBuilder class:

import SignalRBuilder from './Builder/SignalRBuilder';
import { SignalRBuilderArgs } from './types';

const args: SignalRBuilderArgs = {
  name: 'mySignalR',
  group: { resourceGroupName: 'myResourceGroup' },
  // other necessary arguments
};

const signalRBuilder = new SignalRBuilder(args);

signalRBuilder
  .withKind('SignalR')
  .withSku({ name: 'Standard_S1', tier: 'Standard' })
  .withPrivateLink({
    // PrivateLinkPropsType properties
  })
  .allowsOrigins('https://example.com', 'https://another.com')
  .withOptions({
    disableAadAuth: true,
    disableLocalAuth: false,
    publicNetworkAccess: true,
    clientCertEnabled: false,
  });

const resourceInfo = signalRBuilder.build();
console.log(resourceInfo);

Summary

This guideline should help developers understand and reuse the methods in the SignalRBuilder class effectively.