CSIDriverSpec.fromJson constructor

CSIDriverSpec.fromJson(
  1. Map<String, dynamic> json
)

Creates a CSIDriverSpec from JSON data.

Implementation

factory CSIDriverSpec.fromJson(Map<String, dynamic> json) {
  final tempAttachRequiredJson = json['attachRequired'];
  final tempFsGroupPolicyJson = json['fsGroupPolicy'];
  final tempPodInfoOnMountJson = json['podInfoOnMount'];
  final tempRequiresRepublishJson = json['requiresRepublish'];
  final tempSeLinuxMountJson = json['seLinuxMount'];
  final tempStorageCapacityJson = json['storageCapacity'];
  final tempTokenRequestsJson = json['tokenRequests'];
  final tempVolumeLifecycleModesJson = json['volumeLifecycleModes'];

  final bool? tempAttachRequired = tempAttachRequiredJson;
  final String? tempFsGroupPolicy = tempFsGroupPolicyJson;
  final bool? tempPodInfoOnMount = tempPodInfoOnMountJson;
  final bool? tempRequiresRepublish = tempRequiresRepublishJson;
  final bool? tempSeLinuxMount = tempSeLinuxMountJson;
  final bool? tempStorageCapacity = tempStorageCapacityJson;

  final List<TokenRequest>? tempTokenRequests = tempTokenRequestsJson != null
      ? List<dynamic>.from(tempTokenRequestsJson)
          .map(
            (e) => TokenRequest.fromJson(
              Map<String, dynamic>.from(e),
            ),
          )
          .toList()
      : null;

  final List<String>? tempVolumeLifecycleModes =
      tempVolumeLifecycleModesJson != null
          ? List<String>.from(tempVolumeLifecycleModesJson)
          : null;

  return CSIDriverSpec(
    attachRequired: tempAttachRequired,
    fsGroupPolicy: tempFsGroupPolicy,
    podInfoOnMount: tempPodInfoOnMount,
    requiresRepublish: tempRequiresRepublish,
    seLinuxMount: tempSeLinuxMount,
    storageCapacity: tempStorageCapacity,
    tokenRequests: tempTokenRequests,
    volumeLifecycleModes: tempVolumeLifecycleModes,
  );
}