checkPlanAvailability static method
Future<void>
checkPlanAvailability(
- Client cloudApiClient, {
- required CommandLogger logger,
- required PlanProfile? plan,
Subcommand to check if the user is subscribed to a given plan, and if not whether the plan can be procured.
Throws ProcurementDeniedException if there is no subscription and the
plan cannot be procured.
Implementation
static Future<void> checkPlanAvailability(
final Client cloudApiClient, {
required final CommandLogger logger,
required final PlanProfile? plan,
}) async {
final planNames = await cloudApiClient.plans.listProcuredPlanNames();
if (plan == null &&
planNames.any((final name) => _legacyPlanNames.contains(name))) {
return;
}
final planProductName = plan?.name ?? defaultPlan;
await cloudApiClient.plans.checkPlanAvailability(
planProductName: planProductName,
);
}