fromJson static method
Returns a new O11yAWSTelemetryCollectionStrategy instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static O11yAWSTelemetryCollectionStrategy? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
// Ensure that the map contains the required keys.
// Note 1: the values aren't checked for validity beyond being non-null.
// Note 2: this code is stripped in release mode!
assert(() {
requiredKeys.forEach((key) {
assert(json.containsKey(key), 'Required key "O11yAWSTelemetryCollectionStrategy[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "O11yAWSTelemetryCollectionStrategy[$key]" has a null value in JSON.');
});
return true;
}());
return O11yAWSTelemetryCollectionStrategy(
logs: O11yAWSLogsCollectionStrategy.fromJson(json[r'logs']),
metrics: O11yAWSMetricsCollectionStrategy.fromJson(json[r'metrics']),
s3Buckets: json[r's3Buckets'] == null
? const {}
: (json[r's3Buckets'] as Map).map((k, v) => MapEntry(k as String, v == null ? const <String>[] : (v as List).cast<String>().toList(growable: false))),
);
}
return null;
}