ServiceTemplateSpec.fromJson constructor

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

Implementation

factory ServiceTemplateSpec.fromJson(Map<String, dynamic> json) {
  return ServiceTemplateSpec(
    version: json['version'] as String? ?? 'v1',
    kind: json['kind'] as String? ?? 'ServiceTemplate',
    variables: (json['variables'] as List<dynamic>?)?.map((e) => ServiceTemplateVariable.fromJson(e as Map<String, dynamic>)).toList(),
    environment:
        (json['environment'] as List<dynamic>?)
            ?.map((e) => ServiceTemplateEnvironmentVariable.fromJson(e as Map<String, dynamic>))
            .toList(),
    name: json['name'] as String,
    image: json['image'] as String?,
    description: json['description'] as String?,
    ports: (json['ports'] as List<dynamic>? ?? []).map((e) => ServicePortSpec.fromJson(e as Map<String, dynamic>)).toList(),
    command: json['command'] as String?,
    role: json['role'] as String? ?? 'agent',
    secrets: (json['secrets'] as List<dynamic>? ?? []).cast<String>(),
    roomStoragePath: json['room_storage_path'] as String?,
    roomStorageSubpath: json['room_storage_subpath'] as String?,
  );
}