fromJson static method

ContainerSpec fromJson(
  1. Map<String, dynamic> json
)

Implementation

static ContainerSpec fromJson(Map<String, dynamic> json) {
  final runAs = ServiceRunAs.fromJson(json['run_as']);
  final environment = json['environment'] == null
      ? null
      : (json['environment'] as List).map((e) => EnvironmentVariable.fromJson(e)).toList();
  if (runAs == null && environment != null && environment.any((env) => env.secret != null)) {
    throw const FormatException('container.run_as is required when using SecretValue');
  }
  return ContainerSpec(
    command: json['command'] as String?,
    workingDir: json['working_dir'] as String?,
    image: json['image'] as String,
    runAs: runAs,
    pullSecret: json['pull_secret'] == null ? null : SecretValue.fromJson(json['pull_secret']),
    environment: environment,
    storage: ContainerMountSpec.fromJson(json['storage'] as Map<String, dynamic>?),
    onDemand: json["on_demand"],
    writableRootFs: json["writable_root_fs"],
    private: json["private"],
  );
}