showSchedule static method

Future<void> showSchedule(
  1. Client cloudApiClient, {
  2. required CommandLogger logger,
  3. required String projectId,
})

Shows the automated backup schedule for the project's database.

Implementation

static Future<void> showSchedule(
  final Client cloudApiClient, {
  required final CommandLogger logger,
  required final String projectId,
}) async {
  final BackupSchedule? schedule;
  try {
    schedule = await cloudApiClient.database.getBackupSchedule(
      cloudCapsuleId: projectId,
    );
  } on Exception catch (e, s) {
    throw FailureException.nested(e, s, 'Failed to get backup schedule');
  }

  if (schedule == null) {
    logger.info('No backup schedule is configured for project "$projectId".');
    logger.terminalCommand(
      message: 'Set a schedule with:',
      'scloud db schedule set --project $projectId --frequency daily',
    );
    return;
  }

  _scheduleTable(schedule).writeLines(logger.line);
}