findVariable static method

Future<Map<String, Object?>> findVariable(
  1. Client cloudApiClient, {
  2. required String baseCommand,
  3. required String projectId,
  4. required String name,
})

Implementation

static Future<Map<String, Object?>> findVariable(
  final Client cloudApiClient, {
  required final String baseCommand,
  required final String projectId,
  required final String name,
}) async {
  _validateName(baseCommand, name);

  final listed = await _fetch(cloudApiClient, projectId);
  final existingStore = _storeOf(
    name,
    unmasked: listed.unmasked,
    secrets: listed.secrets,
  );

  if (existingStore == null) {
    throw FailureException(
      error: 'The environment variable "$name" was not found.',
    );
  }

  return {'name': name, 'secret': existingStore == _VariableStore.secret};
}