VmExtensionPolicy.fromJson constructor

VmExtensionPolicy.fromJson(
  1. Object? j
)

Implementation

factory VmExtensionPolicy.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return VmExtensionPolicy(
    creationTimestamp: switch (json['creationTimestamp']) {
      null => null,
      Object $1 => decodeString($1),
    },
    description: switch (json['description']) {
      null => null,
      Object $1 => decodeString($1),
    },
    extensionPolicies: switch (json['extensionPolicies']) {
      null => {},
      Map<String, Object?> $1 => {
        for (final e in $1.entries)
          decodeString(e.key): VmExtensionPolicyExtensionPolicy.fromJson(
            e.value,
          ),
      },
      _ => throw const FormatException(
        '"extensionPolicies" is not an object',
      ),
    },
    globalResourceLink: switch (json['globalResourceLink']) {
      null => null,
      Object $1 => decodeString($1),
    },
    id: switch (json['id']) {
      null => null,
      Object $1 => decodeUint64($1),
    },
    instanceSelectors: switch (json['instanceSelectors']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) VmExtensionPolicyInstanceSelector.fromJson(i),
      ],
      _ => throw const FormatException('"instanceSelectors" is not a list'),
    },
    kind: switch (json['kind']) {
      null => null,
      Object $1 => decodeString($1),
    },
    managedByGlobal: switch (json['managedByGlobal']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    name: switch (json['name']) {
      null => null,
      Object $1 => decodeString($1),
    },
    priority: switch (json['priority']) {
      null => null,
      Object $1 => decodeInt($1),
    },
    selfLink: switch (json['selfLink']) {
      null => null,
      Object $1 => decodeString($1),
    },
    selfLinkWithId: switch (json['selfLinkWithId']) {
      null => null,
      Object $1 => decodeString($1),
    },
    state: switch (json['state']) {
      null => null,
      Object $1 => decodeString($1),
    },
    updateTimestamp: switch (json['updateTimestamp']) {
      null => null,
      Object $1 => decodeString($1),
    },
  );
}