ResourceClass.fromJson constructor

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

Creates a ResourceClass from JSON data.

Implementation

factory ResourceClass.fromJson(Map<String, dynamic> json) {
  final tempApiVersionJson = json['apiVersion'];
  final tempDriverNameJson = json['driverName'];
  final tempKindJson = json['kind'];
  final tempMetadataJson = json['metadata'];
  final tempParametersRefJson = json['parametersRef'];
  final tempSuitableNodesJson = json['suitableNodes'];

  final String? tempApiVersion = tempApiVersionJson;
  final String tempDriverName = tempDriverNameJson;
  final String? tempKind = tempKindJson;
  final ObjectMeta? tempMetadata =
      tempMetadataJson != null ? ObjectMeta.fromJson(tempMetadataJson) : null;
  final ResourceClassParametersReference? tempParametersRef =
      tempParametersRefJson != null
          ? ResourceClassParametersReference.fromJson(tempParametersRefJson)
          : null;
  final NodeSelector? tempSuitableNodes = tempSuitableNodesJson != null
      ? NodeSelector.fromJson(tempSuitableNodesJson)
      : null;

  return ResourceClass(
    apiVersion: tempApiVersion,
    driverName: tempDriverName,
    kind: tempKind,
    metadata: tempMetadata,
    parametersRef: tempParametersRef,
    suitableNodes: tempSuitableNodes,
  );
}