ServiceAccount.fromJson constructor

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

Creates a ServiceAccount from JSON data.

Implementation

factory ServiceAccount.fromJson(Map<String, dynamic> json) {
  final tempApiVersionJson = json['apiVersion'];
  final tempAutomountServiceAccountTokenJson =
      json['automountServiceAccountToken'];
  final tempImagePullSecretsJson = json['imagePullSecrets'];
  final tempKindJson = json['kind'];
  final tempMetadataJson = json['metadata'];
  final tempSecretsJson = json['secrets'];

  final String? tempApiVersion = tempApiVersionJson;
  final bool? tempAutomountServiceAccountToken =
      tempAutomountServiceAccountTokenJson;

  final List<LocalObjectReference>? tempImagePullSecrets =
      tempImagePullSecretsJson != null
          ? List<dynamic>.from(tempImagePullSecretsJson)
              .map(
                (e) => LocalObjectReference.fromJson(
                  Map<String, dynamic>.from(e),
                ),
              )
              .toList()
          : null;

  final String? tempKind = tempKindJson;
  final ObjectMeta? tempMetadata =
      tempMetadataJson != null ? ObjectMeta.fromJson(tempMetadataJson) : null;

  final List<ObjectReference>? tempSecrets = tempSecretsJson != null
      ? List<dynamic>.from(tempSecretsJson)
          .map(
            (e) => ObjectReference.fromJson(
              Map<String, dynamic>.from(e),
            ),
          )
          .toList()
      : null;

  return ServiceAccount(
    apiVersion: tempApiVersion,
    automountServiceAccountToken: tempAutomountServiceAccountToken,
    imagePullSecrets: tempImagePullSecrets,
    kind: tempKind,
    metadata: tempMetadata,
    secrets: tempSecrets,
  );
}