ValidatingWebhook.fromJson constructor

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

Creates a ValidatingWebhook from JSON data.

Implementation

factory ValidatingWebhook.fromJson(Map<String, dynamic> json) {
  final tempAdmissionReviewVersionsJson = json['admissionReviewVersions'];
  final tempClientConfigJson = json['clientConfig'];
  final tempFailurePolicyJson = json['failurePolicy'];
  final tempMatchConditionsJson = json['matchConditions'];
  final tempMatchPolicyJson = json['matchPolicy'];
  final tempNameJson = json['name'];
  final tempNamespaceSelectorJson = json['namespaceSelector'];
  final tempObjectSelectorJson = json['objectSelector'];
  final tempRulesJson = json['rules'];
  final tempSideEffectsJson = json['sideEffects'];
  final tempTimeoutSecondsJson = json['timeoutSeconds'];

  final List<String> tempAdmissionReviewVersions =
      List<String>.from(tempAdmissionReviewVersionsJson);
  final WebhookClientConfig tempClientConfig =
      WebhookClientConfig.fromJson(tempClientConfigJson);
  final String? tempFailurePolicy = tempFailurePolicyJson;

  final List<MatchCondition>? tempMatchConditions =
      tempMatchConditionsJson != null
          ? List<dynamic>.from(tempMatchConditionsJson)
              .map(
                (e) => MatchCondition.fromJson(
                  Map<String, dynamic>.from(e),
                ),
              )
              .toList()
          : null;

  final String? tempMatchPolicy = tempMatchPolicyJson;
  final String tempName = tempNameJson;
  final LabelSelector? tempNamespaceSelector =
      tempNamespaceSelectorJson != null
          ? LabelSelector.fromJson(tempNamespaceSelectorJson)
          : null;
  final LabelSelector? tempObjectSelector = tempObjectSelectorJson != null
      ? LabelSelector.fromJson(tempObjectSelectorJson)
      : null;

  final List<RuleWithOperations>? tempRules = tempRulesJson != null
      ? List<dynamic>.from(tempRulesJson)
          .map(
            (e) => RuleWithOperations.fromJson(
              Map<String, dynamic>.from(e),
            ),
          )
          .toList()
      : null;

  final String tempSideEffects = tempSideEffectsJson;
  final int? tempTimeoutSeconds = tempTimeoutSecondsJson;

  return ValidatingWebhook(
    admissionReviewVersions: tempAdmissionReviewVersions,
    clientConfig: tempClientConfig,
    failurePolicy: tempFailurePolicy,
    matchConditions: tempMatchConditions,
    matchPolicy: tempMatchPolicy,
    name: tempName,
    namespaceSelector: tempNamespaceSelector,
    objectSelector: tempObjectSelector,
    rules: tempRules,
    sideEffects: tempSideEffects,
    timeoutSeconds: tempTimeoutSeconds,
  );
}