MetricSpec.fromJson constructor
Creates a MetricSpec from JSON data.
Implementation
factory MetricSpec.fromJson(Map<String, dynamic> json) {
final tempContainerResourceJson = json['containerResource'];
final tempExternalJson = json['external'];
final tempObjectJson = json['object'];
final tempPodsJson = json['pods'];
final tempResourceJson = json['resource'];
final tempTypeJson = json['type'];
final ContainerResourceMetricSource? tempContainerResource =
tempContainerResourceJson != null
? ContainerResourceMetricSource.fromJson(tempContainerResourceJson)
: null;
final ExternalMetricSource? tempExternal = tempExternalJson != null
? ExternalMetricSource.fromJson(tempExternalJson)
: null;
final ObjectMetricSource? tempObject = tempObjectJson != null
? ObjectMetricSource.fromJson(tempObjectJson)
: null;
final PodsMetricSource? tempPods =
tempPodsJson != null ? PodsMetricSource.fromJson(tempPodsJson) : null;
final ResourceMetricSource? tempResource = tempResourceJson != null
? ResourceMetricSource.fromJson(tempResourceJson)
: null;
final String tempType = tempTypeJson;
return MetricSpec(
containerResource: tempContainerResource,
external: tempExternal,
object: tempObject,
pods: tempPods,
resource: tempResource,
type: tempType,
);
}