toJson method

Map<String, Object> toJson()

Converts a VolumeMount instance to JSON data.

Implementation

Map<String, Object> toJson() {
  final jsonData = <String, Object>{};

  final tempMountPath = mountPath;
  final tempMountPropagation = mountPropagation;
  final tempName = name;
  final tempReadOnly = readOnly;
  final tempSubPath = subPath;
  final tempSubPathExpr = subPathExpr;

  jsonData['mountPath'] = tempMountPath;

  if (tempMountPropagation != null) {
    jsonData['mountPropagation'] = tempMountPropagation;
  }

  jsonData['name'] = tempName;

  if (tempReadOnly != null) {
    jsonData['readOnly'] = tempReadOnly;
  }

  if (tempSubPath != null) {
    jsonData['subPath'] = tempSubPath;
  }

  if (tempSubPathExpr != null) {
    jsonData['subPathExpr'] = tempSubPathExpr;
  }

  return jsonData;
}