SecurityPolicy.fromJson constructor
SecurityPolicy.fromJson(
- Object? j
Implementation
factory SecurityPolicy.fromJson(Object? j) {
final json = j as Map<String, Object?>;
return SecurityPolicy(
adaptiveProtectionConfig: switch (json['adaptiveProtectionConfig']) {
null => null,
Object $1 => SecurityPolicyAdaptiveProtectionConfig.fromJson($1),
},
advancedOptionsConfig: switch (json['advancedOptionsConfig']) {
null => null,
Object $1 => SecurityPolicyAdvancedOptionsConfig.fromJson($1),
},
associations: switch (json['associations']) {
null => [],
List<Object?> $1 => [
for (final i in $1) SecurityPolicyAssociation.fromJson(i),
],
_ => throw const FormatException('"associations" is not a list'),
},
creationTimestamp: switch (json['creationTimestamp']) {
null => null,
Object $1 => decodeString($1),
},
ddosProtectionConfig: switch (json['ddosProtectionConfig']) {
null => null,
Object $1 => SecurityPolicyDdosProtectionConfig.fromJson($1),
},
description: switch (json['description']) {
null => null,
Object $1 => decodeString($1),
},
fingerprint: switch (json['fingerprint']) {
null => null,
Object $1 => decodeString($1),
},
id: switch (json['id']) {
null => null,
Object $1 => decodeUint64($1),
},
kind: switch (json['kind']) {
null => null,
Object $1 => decodeString($1),
},
labelFingerprint: switch (json['labelFingerprint']) {
null => null,
Object $1 => decodeString($1),
},
labels: switch (json['labels']) {
null => {},
Map<String, Object?> $1 => {
for (final e in $1.entries)
decodeString(e.key): decodeString(e.value),
},
_ => throw const FormatException('"labels" is not an object'),
},
name: switch (json['name']) {
null => null,
Object $1 => decodeString($1),
},
parent: switch (json['parent']) {
null => null,
Object $1 => decodeString($1),
},
recaptchaOptionsConfig: switch (json['recaptchaOptionsConfig']) {
null => null,
Object $1 => SecurityPolicyRecaptchaOptionsConfig.fromJson($1),
},
region: switch (json['region']) {
null => null,
Object $1 => decodeString($1),
},
rules: switch (json['rules']) {
null => [],
List<Object?> $1 => [
for (final i in $1) SecurityPolicyRule.fromJson(i),
],
_ => throw const FormatException('"rules" is not a list'),
},
selfLink: switch (json['selfLink']) {
null => null,
Object $1 => decodeString($1),
},
shortName: switch (json['shortName']) {
null => null,
Object $1 => decodeString($1),
},
type: switch (json['type']) {
null => null,
Object $1 => decodeString($1),
},
userDefinedFields: switch (json['userDefinedFields']) {
null => [],
List<Object?> $1 => [
for (final i in $1) SecurityPolicyUserDefinedField.fromJson(i),
],
_ => throw const FormatException('"userDefinedFields" is not a list'),
},
);
}