MetricDescriptor_MetricDescriptorMetadata.fromJson constructor

MetricDescriptor_MetricDescriptorMetadata.fromJson(
  1. Object? j
)

Implementation

factory MetricDescriptor_MetricDescriptorMetadata.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return MetricDescriptor_MetricDescriptorMetadata(
    launchStage: switch (json['launchStage']) {
      null => LaunchStage.$default,
      Object $1 => LaunchStage.fromJson($1),
    },
    samplePeriod: switch (json['samplePeriod']) {
      null => null,
      Object $1 => Duration.fromJson($1),
    },
    ingestDelay: switch (json['ingestDelay']) {
      null => null,
      Object $1 => Duration.fromJson($1),
    },
    timeSeriesResourceHierarchyLevel:
        switch (json['timeSeriesResourceHierarchyLevel']) {
          null => [],
          List<Object?> $1 => [
            for (final i in $1)
              MetricDescriptor_MetricDescriptorMetadata_TimeSeriesResourceHierarchyLevel.fromJson(
                i,
              ),
          ],
          _ => throw const FormatException(
            '"timeSeriesResourceHierarchyLevel" is not a list',
          ),
        },
  );
}