ApimBuilderPurpose: Initializes the ApimBuilder with the provided arguments and sets up the initial state.
Usage:
const builder = new ApimBuilder({
name: 'example',
group: { resourceGroupName: 'resourceGroup' },
logInfo: { appInsight: { id: 'appInsightId', instrumentationKey: 'instrumentationKey' } },
});
disableSignInPurpose: Disables the sign-in feature for the API Management service.
Usage:
builder.disableSignIn();
withAuthPurpose: Adds an authentication provider to the API Management service.
Usage:
builder.withAuth({
type: 'aad',
clientId: 'clientId',
clientSecret: 'clientSecret',
});
withEntraIDPurpose: Enables Entra ID for the API Management service.
Usage:
builder.withEntraID();
withCACertPurpose: Adds a CA certificate to the API Management service.
Usage:
builder.withCACert({
certificate: 'encodedCertificate',
certificatePassword: 'password',
});
withRootCertPurpose: Adds a root certificate to the API Management service.
Usage:
builder.withRootCert({
certificate: 'encodedCertificate',
certificatePassword: 'password',
});
withPrivateLinkPurpose: Configures a private link for the API Management service.
Usage:
builder.withPrivateLink({
disablePublicAccess: true,
privateEndpointName: 'privateEndpoint',
});
withSubnetPurpose: Configures a subnet for the API Management service.
Usage:
builder.withSubnet({
subnetId: 'subnetId',
type: 'External',
enableGateway: true,
});
restoreFomDeletedPurpose: Restores the API Management service from a deleted state.
Usage:
builder.restoreFomDeleted();
withZonesPurpose: Configures availability zones for the API Management service.
Usage:
builder.withZones(['1', '2', '3']);
withAdditionalLocationPurpose: Adds additional locations for the API Management service.
Usage:
builder.withAdditionalLocation({
location: 'eastus',
sku: { name: 'Premium', capacity: 1 },
});
withProxyDomainPurpose: Configures a proxy domain for the API Management service.
Usage:
builder.withProxyDomain({
domain: 'proxy.example.com',
certificate: 'encodedCertificate',
certificatePassword: 'password',
});
withPublisherPurpose: Configures the publisher information for the API Management service.
Usage:
builder.withPublisher({
publisherEmail: 'publisher@example.com',
publisherName: 'Publisher Name',
});
withSkuPurpose: Configures the SKU for the API Management service.
Usage:
builder.withSku({
sku: 'Premium',
capacity: 2,
});
buildPurpose: Builds the entire API Management service, including public IP address, APIM instance, private link, sign-in settings, Entra ID, authentication providers, and insight logs.
Usage:
const resourceInfo = builder.build();
console.log(resourceInfo);
Here is a complete example that demonstrates how to use the ApimBuilder class, ensuring that the build() method is called at the end:
const builder = new ApimBuilder({
name: 'example',
group: { resourceGroupName: 'resourceGroup' },
logInfo: { appInsight: { id: 'appInsightId', instrumentationKey: 'instrumentationKey' } },
});
builder
.disableSignIn()
.withAuth({
type: 'aad',
clientId: 'clientId',
clientSecret: 'clientSecret',
})
.withEntraID()
.withCACert({
certificate: 'encodedCertificate',
certificatePassword: 'password',
})
.withRootCert({
certificate: 'encodedCertificate',
certificatePassword: 'password',
})
.withPrivateLink({
disablePublicAccess: true,
privateEndpointName: 'privateEndpoint',
})
.withSubnet({
subnetId: 'subnetId',
type: 'External',
enableGateway: true,
})
.restoreFomDeleted()
.withZones(['1', '2', '3'])
.withAdditionalLocation({
location: 'eastus',
sku: { name: 'Premium', capacity: 1 },
})
.withProxyDomain({
domain: 'proxy.example.com',
certificate: 'encodedCertificate',
certificatePassword: 'password',
})
.withPublisher({
publisherEmail: 'publisher@example.com',
publisherName: 'Publisher Name',
})
.withSku({
sku: 'Premium',
capacity: 2,
});
const resourceInfo = builder.build();
console.log(resourceInfo);
This example demonstrates how to create an ApimBuilder instance, configure it with various settings, and finally build the API Management service. The build() method is called last to ensure the service is fully constructed.