CustomResourceDefinition.fromJson constructor

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

Creates a CustomResourceDefinition from JSON data.

Implementation

factory CustomResourceDefinition.fromJson(Map<String, dynamic> json) {
  final tempApiVersionJson = json['apiVersion'];
  final tempKindJson = json['kind'];
  final tempMetadataJson = json['metadata'];
  final tempSpecJson = json['spec'];
  final tempStatusJson = json['status'];

  final String? tempApiVersion = tempApiVersionJson;
  final String? tempKind = tempKindJson;
  final ObjectMeta? tempMetadata =
      tempMetadataJson != null ? ObjectMeta.fromJson(tempMetadataJson) : null;
  final CustomResourceDefinitionSpec tempSpec =
      CustomResourceDefinitionSpec.fromJson(tempSpecJson);
  final CustomResourceDefinitionStatus? tempStatus = tempStatusJson != null
      ? CustomResourceDefinitionStatus.fromJson(tempStatusJson)
      : null;

  return CustomResourceDefinition(
    apiVersion: tempApiVersion,
    kind: tempKind,
    metadata: tempMetadata,
    spec: tempSpec,
    status: tempStatus,
  );
}