UNPKG

k8ts

Version:

Powerful framework for building Kubernetes manifests in TypeScript.

3,370 lines 109 kB
// generated by cdk8s
import { ApiObject, ApiObjectMetadata, GroupVersionKind } from 'cdk8s';
import { Construct } from 'constructs';


/**
 * Kustomization is the Schema for the kustomizations API.
 *
 * @schema Kustomization
 */
export class Kustomization extends ApiObject {
  /**
   * Returns the apiVersion and kind for "Kustomization"
   */
  public static readonly GVK: GroupVersionKind = {
    apiVersion: 'kustomize.toolkit.fluxcd.io/v1',
    kind: 'Kustomization',
  }

  /**
   * Renders a Kubernetes manifest for "Kustomization".
   *
   * This can be used to inline resource manifests inside other objects (e.g. as templates).
   *
   * @param props initialization props
   */
  public static manifest(props: KustomizationProps = {}): any {
    return {
      ...Kustomization.GVK,
      ...toJson_KustomizationProps(props),
    };
  }

  /**
   * Defines a "Kustomization" API object
   * @param scope the scope in which to define this object
   * @param id a scope-local name for the object
   * @param props initialization props
   */
  public constructor(scope: Construct, id: string, props: KustomizationProps = {}) {
    super(scope, id, {
      ...Kustomization.GVK,
      ...props,
    });
  }

  /**
   * Renders the object to Kubernetes JSON.
   */
  public toJson(): any {
    const resolved = super.toJson();

    return {
      ...Kustomization.GVK,
      ...toJson_KustomizationProps(resolved),
    };
  }
}

/**
 * Kustomization is the Schema for the kustomizations API.
 *
 * @schema Kustomization
 */
export interface KustomizationProps {
  /**
   * @schema Kustomization#metadata
   */
  readonly metadata?: ApiObjectMetadata;

  /**
   * KustomizationSpec defines the configuration to calculate the desired state
   * from a Source using Kustomize.
   *
   * @schema Kustomization#spec
   */
  readonly spec?: KustomizationSpec;

}

/**
 * Converts an object of type 'KustomizationProps' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationProps(obj: KustomizationProps | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'metadata': obj.metadata,
    'spec': toJson_KustomizationSpec(obj.spec),
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * KustomizationSpec defines the configuration to calculate the desired state
 * from a Source using Kustomize.
 *
 * @schema KustomizationSpec
 */
export interface KustomizationSpec {
  /**
   * CommonMetadata specifies the common labels and annotations that are
   * applied to all resources. Any existing label or annotation will be
   * overridden if its key matches a common one.
   *
   * @schema KustomizationSpec#commonMetadata
   */
  readonly commonMetadata?: KustomizationSpecCommonMetadata;

  /**
   * Components specifies relative paths to specifications of other Components.
   *
   * @schema KustomizationSpec#components
   */
  readonly components?: string[];

  /**
   * Decrypt Kubernetes secrets before applying them on the cluster.
   *
   * @schema KustomizationSpec#decryption
   */
  readonly decryption?: KustomizationSpecDecryption;

  /**
   * DeletionPolicy can be used to control garbage collection when this
   * Kustomization is deleted. Valid values are ('MirrorPrune', 'Delete',
   * 'Orphan'). 'MirrorPrune' mirrors the Prune field (orphan if false,
   * delete if true). Defaults to 'MirrorPrune'.
   *
   * @default MirrorPrune'.
   * @schema KustomizationSpec#deletionPolicy
   */
  readonly deletionPolicy?: KustomizationSpecDeletionPolicy;

  /**
   * DependsOn may contain a meta.NamespacedObjectReference slice
   * with references to Kustomization resources that must be ready before this
   * Kustomization can be reconciled.
   *
   * @schema KustomizationSpec#dependsOn
   */
  readonly dependsOn?: KustomizationSpecDependsOn[];

  /**
   * Force instructs the controller to recreate resources
   * when patching fails due to an immutable field change.
   *
   * @schema KustomizationSpec#force
   */
  readonly force?: boolean;

  /**
   * HealthCheckExprs is a list of healthcheck expressions for evaluating the
   * health of custom resources using Common Expression Language (CEL).
   * The expressions are evaluated only when Wait or HealthChecks are specified.
   *
   * @schema KustomizationSpec#healthCheckExprs
   */
  readonly healthCheckExprs?: KustomizationSpecHealthCheckExprs[];

  /**
   * A list of resources to be included in the health assessment.
   *
   * @schema KustomizationSpec#healthChecks
   */
  readonly healthChecks?: KustomizationSpecHealthChecks[];

  /**
   * Images is a list of (image name, new name, new tag or digest)
   * for changing image names, tags or digests. This can also be achieved with a
   * patch, but this operator is simpler to specify.
   *
   * @schema KustomizationSpec#images
   */
  readonly images?: KustomizationSpecImages[];

  /**
   * The interval at which to reconcile the Kustomization.
   * This interval is approximate and may be subject to jitter to ensure
   * efficient use of resources.
   *
   * @schema KustomizationSpec#interval
   */
  readonly interval: string;

  /**
   * The KubeConfig for reconciling the Kustomization on a remote cluster.
   * When used in combination with KustomizationSpec.ServiceAccountName,
   * forces the controller to act on behalf of that Service Account at the
   * target cluster.
   * If the --default-service-account flag is set, its value will be used as
   * a controller level fallback for when KustomizationSpec.ServiceAccountName
   * is empty.
   *
   * @schema KustomizationSpec#kubeConfig
   */
  readonly kubeConfig?: KustomizationSpecKubeConfig;

  /**
   * NamePrefix will prefix the names of all managed resources.
   *
   * @schema KustomizationSpec#namePrefix
   */
  readonly namePrefix?: string;

  /**
   * NameSuffix will suffix the names of all managed resources.
   *
   * @schema KustomizationSpec#nameSuffix
   */
  readonly nameSuffix?: string;

  /**
   * Strategic merge and JSON patches, defined as inline YAML objects,
   * capable of targeting objects based on kind, label and annotation selectors.
   *
   * @schema KustomizationSpec#patches
   */
  readonly patches?: KustomizationSpecPatches[];

  /**
   * Path to the directory containing the kustomization.yaml file, or the
   * set of plain YAMLs a kustomization.yaml should be generated for.
   * Defaults to 'None', which translates to the root path of the SourceRef.
   *
   * @default None', which translates to the root path of the SourceRef.
   * @schema KustomizationSpec#path
   */
  readonly path?: string;

  /**
   * PostBuild describes which actions to perform on the YAML manifest
   * generated by building the kustomize overlay.
   *
   * @schema KustomizationSpec#postBuild
   */
  readonly postBuild?: KustomizationSpecPostBuild;

  /**
   * Prune enables garbage collection.
   *
   * @schema KustomizationSpec#prune
   */
  readonly prune: boolean;

  /**
   * The interval at which to retry a previously failed reconciliation.
   * When not specified, the controller uses the KustomizationSpec.Interval
   * value to retry failures.
   *
   * @schema KustomizationSpec#retryInterval
   */
  readonly retryInterval?: string;

  /**
   * The name of the Kubernetes service account to impersonate
   * when reconciling this Kustomization.
   *
   * @schema KustomizationSpec#serviceAccountName
   */
  readonly serviceAccountName?: string;

  /**
   * Reference of the source where the kustomization file is.
   *
   * @schema KustomizationSpec#sourceRef
   */
  readonly sourceRef: KustomizationSpecSourceRef;

  /**
   * This flag tells the controller to suspend subsequent kustomize executions,
   * it does not apply to already started executions. Defaults to false.
   *
   * @default false.
   * @schema KustomizationSpec#suspend
   */
  readonly suspend?: boolean;

  /**
   * TargetNamespace sets or overrides the namespace in the
   * kustomization.yaml file.
   *
   * @schema KustomizationSpec#targetNamespace
   */
  readonly targetNamespace?: string;

  /**
   * Timeout for validation, apply and health checking operations.
   * Defaults to 'Interval' duration.
   *
   * @default Interval' duration.
   * @schema KustomizationSpec#timeout
   */
  readonly timeout?: string;

  /**
   * Wait instructs the controller to check the health of all the reconciled
   * resources. When enabled, the HealthChecks are ignored. Defaults to false.
   *
   * @default false.
   * @schema KustomizationSpec#wait
   */
  readonly wait?: boolean;

}

/**
 * Converts an object of type 'KustomizationSpec' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationSpec(obj: KustomizationSpec | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'commonMetadata': toJson_KustomizationSpecCommonMetadata(obj.commonMetadata),
    'components': obj.components?.map(y => y),
    'decryption': toJson_KustomizationSpecDecryption(obj.decryption),
    'deletionPolicy': obj.deletionPolicy,
    'dependsOn': obj.dependsOn?.map(y => toJson_KustomizationSpecDependsOn(y)),
    'force': obj.force,
    'healthCheckExprs': obj.healthCheckExprs?.map(y => toJson_KustomizationSpecHealthCheckExprs(y)),
    'healthChecks': obj.healthChecks?.map(y => toJson_KustomizationSpecHealthChecks(y)),
    'images': obj.images?.map(y => toJson_KustomizationSpecImages(y)),
    'interval': obj.interval,
    'kubeConfig': toJson_KustomizationSpecKubeConfig(obj.kubeConfig),
    'namePrefix': obj.namePrefix,
    'nameSuffix': obj.nameSuffix,
    'patches': obj.patches?.map(y => toJson_KustomizationSpecPatches(y)),
    'path': obj.path,
    'postBuild': toJson_KustomizationSpecPostBuild(obj.postBuild),
    'prune': obj.prune,
    'retryInterval': obj.retryInterval,
    'serviceAccountName': obj.serviceAccountName,
    'sourceRef': toJson_KustomizationSpecSourceRef(obj.sourceRef),
    'suspend': obj.suspend,
    'targetNamespace': obj.targetNamespace,
    'timeout': obj.timeout,
    'wait': obj.wait,
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * CommonMetadata specifies the common labels and annotations that are
 * applied to all resources. Any existing label or annotation will be
 * overridden if its key matches a common one.
 *
 * @schema KustomizationSpecCommonMetadata
 */
export interface KustomizationSpecCommonMetadata {
  /**
   * Annotations to be added to the object's metadata.
   *
   * @schema KustomizationSpecCommonMetadata#annotations
   */
  readonly annotations?: { [key: string]: string };

  /**
   * Labels to be added to the object's metadata.
   *
   * @schema KustomizationSpecCommonMetadata#labels
   */
  readonly labels?: { [key: string]: string };

}

/**
 * Converts an object of type 'KustomizationSpecCommonMetadata' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationSpecCommonMetadata(obj: KustomizationSpecCommonMetadata | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'annotations': ((obj.annotations) === undefined) ? undefined : (Object.entries(obj.annotations).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {})),
    'labels': ((obj.labels) === undefined) ? undefined : (Object.entries(obj.labels).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {})),
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * Decrypt Kubernetes secrets before applying them on the cluster.
 *
 * @schema KustomizationSpecDecryption
 */
export interface KustomizationSpecDecryption {
  /**
   * Provider is the name of the decryption engine.
   *
   * @schema KustomizationSpecDecryption#provider
   */
  readonly provider: KustomizationSpecDecryptionProvider;

  /**
   * The secret name containing the private OpenPGP keys used for decryption.
   *
   * @schema KustomizationSpecDecryption#secretRef
   */
  readonly secretRef?: KustomizationSpecDecryptionSecretRef;

}

/**
 * Converts an object of type 'KustomizationSpecDecryption' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationSpecDecryption(obj: KustomizationSpecDecryption | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'provider': obj.provider,
    'secretRef': toJson_KustomizationSpecDecryptionSecretRef(obj.secretRef),
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * DeletionPolicy can be used to control garbage collection when this
 * Kustomization is deleted. Valid values are ('MirrorPrune', 'Delete',
 * 'Orphan'). 'MirrorPrune' mirrors the Prune field (orphan if false,
 * delete if true). Defaults to 'MirrorPrune'.
 *
 * @default MirrorPrune'.
 * @schema KustomizationSpecDeletionPolicy
 */
export enum KustomizationSpecDeletionPolicy {
  /** MirrorPrune */
  MIRROR_PRUNE = "MirrorPrune",
  /** Delete */
  DELETE = "Delete",
  /** Orphan */
  ORPHAN = "Orphan",
}

/**
 * NamespacedObjectReference contains enough information to locate the referenced Kubernetes resource object in any
 * namespace.
 *
 * @schema KustomizationSpecDependsOn
 */
export interface KustomizationSpecDependsOn {
  /**
   * Name of the referent.
   *
   * @schema KustomizationSpecDependsOn#name
   */
  readonly name: string;

  /**
   * Namespace of the referent, when not specified it acts as LocalObjectReference.
   *
   * @schema KustomizationSpecDependsOn#namespace
   */
  readonly namespace?: string;

}

/**
 * Converts an object of type 'KustomizationSpecDependsOn' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationSpecDependsOn(obj: KustomizationSpecDependsOn | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'name': obj.name,
    'namespace': obj.namespace,
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * CustomHealthCheck defines the health check for custom resources.
 *
 * @schema KustomizationSpecHealthCheckExprs
 */
export interface KustomizationSpecHealthCheckExprs {
  /**
   * APIVersion of the custom resource under evaluation.
   *
   * @schema KustomizationSpecHealthCheckExprs#apiVersion
   */
  readonly apiVersion: string;

  /**
   * Current is the CEL expression that determines if the status
   * of the custom resource has reached the desired state.
   *
   * @schema KustomizationSpecHealthCheckExprs#current
   */
  readonly current: string;

  /**
   * Failed is the CEL expression that determines if the status
   * of the custom resource has failed to reach the desired state.
   *
   * @schema KustomizationSpecHealthCheckExprs#failed
   */
  readonly failed?: string;

  /**
   * InProgress is the CEL expression that determines if the status
   * of the custom resource has not yet reached the desired state.
   *
   * @schema KustomizationSpecHealthCheckExprs#inProgress
   */
  readonly inProgress?: string;

  /**
   * Kind of the custom resource under evaluation.
   *
   * @schema KustomizationSpecHealthCheckExprs#kind
   */
  readonly kind: string;

}

/**
 * Converts an object of type 'KustomizationSpecHealthCheckExprs' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationSpecHealthCheckExprs(obj: KustomizationSpecHealthCheckExprs | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'apiVersion': obj.apiVersion,
    'current': obj.current,
    'failed': obj.failed,
    'inProgress': obj.inProgress,
    'kind': obj.kind,
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * NamespacedObjectKindReference contains enough information to locate the typed referenced Kubernetes resource object
 * in any namespace.
 *
 * @schema KustomizationSpecHealthChecks
 */
export interface KustomizationSpecHealthChecks {
  /**
   * API version of the referent, if not specified the Kubernetes preferred version will be used.
   *
   * @schema KustomizationSpecHealthChecks#apiVersion
   */
  readonly apiVersion?: string;

  /**
   * Kind of the referent.
   *
   * @schema KustomizationSpecHealthChecks#kind
   */
  readonly kind: string;

  /**
   * Name of the referent.
   *
   * @schema KustomizationSpecHealthChecks#name
   */
  readonly name: string;

  /**
   * Namespace of the referent, when not specified it acts as LocalObjectReference.
   *
   * @schema KustomizationSpecHealthChecks#namespace
   */
  readonly namespace?: string;

}

/**
 * Converts an object of type 'KustomizationSpecHealthChecks' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationSpecHealthChecks(obj: KustomizationSpecHealthChecks | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'apiVersion': obj.apiVersion,
    'kind': obj.kind,
    'name': obj.name,
    'namespace': obj.namespace,
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * Image contains an image name, a new name, a new tag or digest, which will replace the original name and tag.
 *
 * @schema KustomizationSpecImages
 */
export interface KustomizationSpecImages {
  /**
   * Digest is the value used to replace the original image tag.
   * If digest is present NewTag value is ignored.
   *
   * @schema KustomizationSpecImages#digest
   */
  readonly digest?: string;

  /**
   * Name is a tag-less image name.
   *
   * @schema KustomizationSpecImages#name
   */
  readonly name: string;

  /**
   * NewName is the value used to replace the original name.
   *
   * @schema KustomizationSpecImages#newName
   */
  readonly newName?: string;

  /**
   * NewTag is the value used to replace the original tag.
   *
   * @schema KustomizationSpecImages#newTag
   */
  readonly newTag?: string;

}

/**
 * Converts an object of type 'KustomizationSpecImages' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationSpecImages(obj: KustomizationSpecImages | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'digest': obj.digest,
    'name': obj.name,
    'newName': obj.newName,
    'newTag': obj.newTag,
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * The KubeConfig for reconciling the Kustomization on a remote cluster.
 * When used in combination with KustomizationSpec.ServiceAccountName,
 * forces the controller to act on behalf of that Service Account at the
 * target cluster.
 * If the --default-service-account flag is set, its value will be used as
 * a controller level fallback for when KustomizationSpec.ServiceAccountName
 * is empty.
 *
 * @schema KustomizationSpecKubeConfig
 */
export interface KustomizationSpecKubeConfig {
  /**
   * SecretRef holds the name of a secret that contains a key with
   * the kubeconfig file as the value. If no key is set, the key will default
   * to 'value'.
   * It is recommended that the kubeconfig is self-contained, and the secret
   * is regularly updated if credentials such as a cloud-access-token expire.
   * Cloud specific `cmd-path` auth helpers will not function without adding
   * binaries and credentials to the Pod that is responsible for reconciling
   * Kubernetes resources.
   *
   * @schema KustomizationSpecKubeConfig#secretRef
   */
  readonly secretRef: KustomizationSpecKubeConfigSecretRef;

}

/**
 * Converts an object of type 'KustomizationSpecKubeConfig' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationSpecKubeConfig(obj: KustomizationSpecKubeConfig | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'secretRef': toJson_KustomizationSpecKubeConfigSecretRef(obj.secretRef),
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * Patch contains an inline StrategicMerge or JSON6902 patch, and the target the patch should
 * be applied to.
 *
 * @schema KustomizationSpecPatches
 */
export interface KustomizationSpecPatches {
  /**
   * Patch contains an inline StrategicMerge patch or an inline JSON6902 patch with
   * an array of operation objects.
   *
   * @schema KustomizationSpecPatches#patch
   */
  readonly patch: string;

  /**
   * Target points to the resources that the patch document should be applied to.
   *
   * @schema KustomizationSpecPatches#target
   */
  readonly target?: KustomizationSpecPatchesTarget;

}

/**
 * Converts an object of type 'KustomizationSpecPatches' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationSpecPatches(obj: KustomizationSpecPatches | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'patch': obj.patch,
    'target': toJson_KustomizationSpecPatchesTarget(obj.target),
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * PostBuild describes which actions to perform on the YAML manifest
 * generated by building the kustomize overlay.
 *
 * @schema KustomizationSpecPostBuild
 */
export interface KustomizationSpecPostBuild {
  /**
   * Substitute holds a map of key/value pairs.
   * The variables defined in your YAML manifests that match any of the keys
   * defined in the map will be substituted with the set value.
   * Includes support for bash string replacement functions
   * e.g. ${var:=default}, ${var:position} and ${var/substring/replacement}.
   *
   * @schema KustomizationSpecPostBuild#substitute
   */
  readonly substitute?: { [key: string]: string };

  /**
   * SubstituteFrom holds references to ConfigMaps and Secrets containing
   * the variables and their values to be substituted in the YAML manifests.
   * The ConfigMap and the Secret data keys represent the var names, and they
   * must match the vars declared in the manifests for the substitution to
   * happen.
   *
   * @schema KustomizationSpecPostBuild#substituteFrom
   */
  readonly substituteFrom?: KustomizationSpecPostBuildSubstituteFrom[];

}

/**
 * Converts an object of type 'KustomizationSpecPostBuild' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationSpecPostBuild(obj: KustomizationSpecPostBuild | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'substitute': ((obj.substitute) === undefined) ? undefined : (Object.entries(obj.substitute).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {})),
    'substituteFrom': obj.substituteFrom?.map(y => toJson_KustomizationSpecPostBuildSubstituteFrom(y)),
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * Reference of the source where the kustomization file is.
 *
 * @schema KustomizationSpecSourceRef
 */
export interface KustomizationSpecSourceRef {
  /**
   * API version of the referent.
   *
   * @schema KustomizationSpecSourceRef#apiVersion
   */
  readonly apiVersion?: string;

  /**
   * Kind of the referent.
   *
   * @schema KustomizationSpecSourceRef#kind
   */
  readonly kind: KustomizationSpecSourceRefKind;

  /**
   * Name of the referent.
   *
   * @schema KustomizationSpecSourceRef#name
   */
  readonly name: string;

  /**
   * Namespace of the referent, defaults to the namespace of the Kubernetes
   * resource object that contains the reference.
   *
   * @schema KustomizationSpecSourceRef#namespace
   */
  readonly namespace?: string;

}

/**
 * Converts an object of type 'KustomizationSpecSourceRef' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationSpecSourceRef(obj: KustomizationSpecSourceRef | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'apiVersion': obj.apiVersion,
    'kind': obj.kind,
    'name': obj.name,
    'namespace': obj.namespace,
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * Provider is the name of the decryption engine.
 *
 * @schema KustomizationSpecDecryptionProvider
 */
export enum KustomizationSpecDecryptionProvider {
  /** sops */
  SOPS = "sops",
}

/**
 * The secret name containing the private OpenPGP keys used for decryption.
 *
 * @schema KustomizationSpecDecryptionSecretRef
 */
export interface KustomizationSpecDecryptionSecretRef {
  /**
   * Name of the referent.
   *
   * @schema KustomizationSpecDecryptionSecretRef#name
   */
  readonly name: string;

}

/**
 * Converts an object of type 'KustomizationSpecDecryptionSecretRef' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationSpecDecryptionSecretRef(obj: KustomizationSpecDecryptionSecretRef | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'name': obj.name,
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * SecretRef holds the name of a secret that contains a key with
 * the kubeconfig file as the value. If no key is set, the key will default
 * to 'value'.
 * It is recommended that the kubeconfig is self-contained, and the secret
 * is regularly updated if credentials such as a cloud-access-token expire.
 * Cloud specific `cmd-path` auth helpers will not function without adding
 * binaries and credentials to the Pod that is responsible for reconciling
 * Kubernetes resources.
 *
 * @schema KustomizationSpecKubeConfigSecretRef
 */
export interface KustomizationSpecKubeConfigSecretRef {
  /**
   * Key in the Secret, when not specified an implementation-specific default key is used.
   *
   * @schema KustomizationSpecKubeConfigSecretRef#key
   */
  readonly key?: string;

  /**
   * Name of the Secret.
   *
   * @schema KustomizationSpecKubeConfigSecretRef#name
   */
  readonly name: string;

}

/**
 * Converts an object of type 'KustomizationSpecKubeConfigSecretRef' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationSpecKubeConfigSecretRef(obj: KustomizationSpecKubeConfigSecretRef | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'key': obj.key,
    'name': obj.name,
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * Target points to the resources that the patch document should be applied to.
 *
 * @schema KustomizationSpecPatchesTarget
 */
export interface KustomizationSpecPatchesTarget {
  /**
   * AnnotationSelector is a string that follows the label selection expression
   * https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api
   * It matches with the resource annotations.
   *
   * @schema KustomizationSpecPatchesTarget#annotationSelector
   */
  readonly annotationSelector?: string;

  /**
   * Group is the API group to select resources from.
   * Together with Version and Kind it is capable of unambiguously identifying and/or selecting resources.
   * https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md
   *
   * @schema KustomizationSpecPatchesTarget#group
   */
  readonly group?: string;

  /**
   * Kind of the API Group to select resources from.
   * Together with Group and Version it is capable of unambiguously
   * identifying and/or selecting resources.
   * https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md
   *
   * @schema KustomizationSpecPatchesTarget#kind
   */
  readonly kind?: string;

  /**
   * LabelSelector is a string that follows the label selection expression
   * https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api
   * It matches with the resource labels.
   *
   * @schema KustomizationSpecPatchesTarget#labelSelector
   */
  readonly labelSelector?: string;

  /**
   * Name to match resources with.
   *
   * @schema KustomizationSpecPatchesTarget#name
   */
  readonly name?: string;

  /**
   * Namespace to select resources from.
   *
   * @schema KustomizationSpecPatchesTarget#namespace
   */
  readonly namespace?: string;

  /**
   * Version of the API Group to select resources from.
   * Together with Group and Kind it is capable of unambiguously identifying and/or selecting resources.
   * https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md
   *
   * @schema KustomizationSpecPatchesTarget#version
   */
  readonly version?: string;

}

/**
 * Converts an object of type 'KustomizationSpecPatchesTarget' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationSpecPatchesTarget(obj: KustomizationSpecPatchesTarget | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'annotationSelector': obj.annotationSelector,
    'group': obj.group,
    'kind': obj.kind,
    'labelSelector': obj.labelSelector,
    'name': obj.name,
    'namespace': obj.namespace,
    'version': obj.version,
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * SubstituteReference contains a reference to a resource containing
 * the variables name and value.
 *
 * @schema KustomizationSpecPostBuildSubstituteFrom
 */
export interface KustomizationSpecPostBuildSubstituteFrom {
  /**
   * Kind of the values referent, valid values are ('Secret', 'ConfigMap').
   *
   * @schema KustomizationSpecPostBuildSubstituteFrom#kind
   */
  readonly kind: KustomizationSpecPostBuildSubstituteFromKind;

  /**
   * Name of the values referent. Should reside in the same namespace as the
   * referring resource.
   *
   * @schema KustomizationSpecPostBuildSubstituteFrom#name
   */
  readonly name: string;

  /**
   * Optional indicates whether the referenced resource must exist, or whether to
   * tolerate its absence. If true and the referenced resource is absent, proceed
   * as if the resource was present but empty, without any variables defined.
   *
   * @schema KustomizationSpecPostBuildSubstituteFrom#optional
   */
  readonly optional?: boolean;

}

/**
 * Converts an object of type 'KustomizationSpecPostBuildSubstituteFrom' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationSpecPostBuildSubstituteFrom(obj: KustomizationSpecPostBuildSubstituteFrom | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'kind': obj.kind,
    'name': obj.name,
    'optional': obj.optional,
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * Kind of the referent.
 *
 * @schema KustomizationSpecSourceRefKind
 */
export enum KustomizationSpecSourceRefKind {
  /** OCIRepository */
  OCI_REPOSITORY = "OCIRepository",
  /** GitRepository */
  GIT_REPOSITORY = "GitRepository",
  /** Bucket */
  BUCKET = "Bucket",
}

/**
 * Kind of the values referent, valid values are ('Secret', 'ConfigMap').
 *
 * @schema KustomizationSpecPostBuildSubstituteFromKind
 */
export enum KustomizationSpecPostBuildSubstituteFromKind {
  /** Secret */
  SECRET = "Secret",
  /** ConfigMap */
  CONFIG_MAP = "ConfigMap",
}


/**
 * Kustomization is the Schema for the kustomizations API.
 *
 * @schema KustomizationV1Beta1
 */
export class KustomizationV1Beta1 extends ApiObject {
  /**
   * Returns the apiVersion and kind for "KustomizationV1Beta1"
   */
  public static readonly GVK: GroupVersionKind = {
    apiVersion: 'kustomize.toolkit.fluxcd.io/v1beta1',
    kind: 'Kustomization',
  }

  /**
   * Renders a Kubernetes manifest for "KustomizationV1Beta1".
   *
   * This can be used to inline resource manifests inside other objects (e.g. as templates).
   *
   * @param props initialization props
   */
  public static manifest(props: KustomizationV1Beta1Props = {}): any {
    return {
      ...KustomizationV1Beta1.GVK,
      ...toJson_KustomizationV1Beta1Props(props),
    };
  }

  /**
   * Defines a "KustomizationV1Beta1" API object
   * @param scope the scope in which to define this object
   * @param id a scope-local name for the object
   * @param props initialization props
   */
  public constructor(scope: Construct, id: string, props: KustomizationV1Beta1Props = {}) {
    super(scope, id, {
      ...KustomizationV1Beta1.GVK,
      ...props,
    });
  }

  /**
   * Renders the object to Kubernetes JSON.
   */
  public toJson(): any {
    const resolved = super.toJson();

    return {
      ...KustomizationV1Beta1.GVK,
      ...toJson_KustomizationV1Beta1Props(resolved),
    };
  }
}

/**
 * Kustomization is the Schema for the kustomizations API.
 *
 * @schema KustomizationV1Beta1
 */
export interface KustomizationV1Beta1Props {
  /**
   * @schema KustomizationV1Beta1#metadata
   */
  readonly metadata?: ApiObjectMetadata;

  /**
   * KustomizationSpec defines the desired state of a kustomization.
   *
   * @schema KustomizationV1Beta1#spec
   */
  readonly spec?: KustomizationV1Beta1Spec;

}

/**
 * Converts an object of type 'KustomizationV1Beta1Props' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationV1Beta1Props(obj: KustomizationV1Beta1Props | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'metadata': obj.metadata,
    'spec': toJson_KustomizationV1Beta1Spec(obj.spec),
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * KustomizationSpec defines the desired state of a kustomization.
 *
 * @schema KustomizationV1Beta1Spec
 */
export interface KustomizationV1Beta1Spec {
  /**
   * Decrypt Kubernetes secrets before applying them on the cluster.
   *
   * @schema KustomizationV1Beta1Spec#decryption
   */
  readonly decryption?: KustomizationV1Beta1SpecDecryption;

  /**
   * DependsOn may contain a meta.NamespacedObjectReference slice
   * with references to Kustomization resources that must be ready before this
   * Kustomization can be reconciled.
   *
   * @schema KustomizationV1Beta1Spec#dependsOn
   */
  readonly dependsOn?: KustomizationV1Beta1SpecDependsOn[];

  /**
   * Force instructs the controller to recreate resources
   * when patching fails due to an immutable field change.
   *
   * @schema KustomizationV1Beta1Spec#force
   */
  readonly force?: boolean;

  /**
   * A list of resources to be included in the health assessment.
   *
   * @schema KustomizationV1Beta1Spec#healthChecks
   */
  readonly healthChecks?: KustomizationV1Beta1SpecHealthChecks[];

  /**
   * Images is a list of (image name, new name, new tag or digest)
   * for changing image names, tags or digests. This can also be achieved with a
   * patch, but this operator is simpler to specify.
   *
   * @schema KustomizationV1Beta1Spec#images
   */
  readonly images?: KustomizationV1Beta1SpecImages[];

  /**
   * The interval at which to reconcile the Kustomization.
   *
   * @schema KustomizationV1Beta1Spec#interval
   */
  readonly interval: string;

  /**
   * The KubeConfig for reconciling the Kustomization on a remote cluster.
   * When specified, KubeConfig takes precedence over ServiceAccountName.
   *
   * @schema KustomizationV1Beta1Spec#kubeConfig
   */
  readonly kubeConfig?: KustomizationV1Beta1SpecKubeConfig;

  /**
   * Strategic merge and JSON patches, defined as inline YAML objects,
   * capable of targeting objects based on kind, label and annotation selectors.
   *
   * @schema KustomizationV1Beta1Spec#patches
   */
  readonly patches?: KustomizationV1Beta1SpecPatches[];

  /**
   * JSON 6902 patches, defined as inline YAML objects.
   *
   * @schema KustomizationV1Beta1Spec#patchesJson6902
   */
  readonly patchesJson6902?: KustomizationV1Beta1SpecPatchesJson6902[];

  /**
   * Strategic merge patches, defined as inline YAML objects.
   *
   * @schema KustomizationV1Beta1Spec#patchesStrategicMerge
   */
  readonly patchesStrategicMerge?: any[];

  /**
   * Path to the directory containing the kustomization.yaml file, or the
   * set of plain YAMLs a kustomization.yaml should be generated for.
   * Defaults to 'None', which translates to the root path of the SourceRef.
   *
   * @default None', which translates to the root path of the SourceRef.
   * @schema KustomizationV1Beta1Spec#path
   */
  readonly path?: string;

  /**
   * PostBuild describes which actions to perform on the YAML manifest
   * generated by building the kustomize overlay.
   *
   * @schema KustomizationV1Beta1Spec#postBuild
   */
  readonly postBuild?: KustomizationV1Beta1SpecPostBuild;

  /**
   * Prune enables garbage collection.
   *
   * @schema KustomizationV1Beta1Spec#prune
   */
  readonly prune: boolean;

  /**
   * The interval at which to retry a previously failed reconciliation.
   * When not specified, the controller uses the KustomizationSpec.Interval
   * value to retry failures.
   *
   * @schema KustomizationV1Beta1Spec#retryInterval
   */
  readonly retryInterval?: string;

  /**
   * The name of the Kubernetes service account to impersonate
   * when reconciling this Kustomization.
   *
   * @schema KustomizationV1Beta1Spec#serviceAccountName
   */
  readonly serviceAccountName?: string;

  /**
   * Reference of the source where the kustomization file is.
   *
   * @schema KustomizationV1Beta1Spec#sourceRef
   */
  readonly sourceRef: KustomizationV1Beta1SpecSourceRef;

  /**
   * This flag tells the controller to suspend subsequent kustomize executions,
   * it does not apply to already started executions. Defaults to false.
   *
   * @default false.
   * @schema KustomizationV1Beta1Spec#suspend
   */
  readonly suspend?: boolean;

  /**
   * TargetNamespace sets or overrides the namespace in the
   * kustomization.yaml file.
   *
   * @schema KustomizationV1Beta1Spec#targetNamespace
   */
  readonly targetNamespace?: string;

  /**
   * Timeout for validation, apply and health checking operations.
   * Defaults to 'Interval' duration.
   *
   * @default Interval' duration.
   * @schema KustomizationV1Beta1Spec#timeout
   */
  readonly timeout?: string;

  /**
   * Validate the Kubernetes objects before applying them on the cluster.
   * The validation strategy can be 'client' (local dry-run), 'server'
   * (APIServer dry-run) or 'none'.
   * When 'Force' is 'true', validation will fallback to 'client' if set to
   * 'server' because server-side validation is not supported in this scenario.
   *
   * @schema KustomizationV1Beta1Spec#validation
   */
  readonly validation?: KustomizationV1Beta1SpecValidation;

}

/**
 * Converts an object of type 'KustomizationV1Beta1Spec' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationV1Beta1Spec(obj: KustomizationV1Beta1Spec | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'decryption': toJson_KustomizationV1Beta1SpecDecryption(obj.decryption),
    'dependsOn': obj.dependsOn?.map(y => toJson_KustomizationV1Beta1SpecDependsOn(y)),
    'force': obj.force,
    'healthChecks': obj.healthChecks?.map(y => toJson_KustomizationV1Beta1SpecHealthChecks(y)),
    'images': obj.images?.map(y => toJson_KustomizationV1Beta1SpecImages(y)),
    'interval': obj.interval,
    'kubeConfig': toJson_KustomizationV1Beta1SpecKubeConfig(obj.kubeConfig),
    'patches': obj.patches?.map(y => toJson_KustomizationV1Beta1SpecPatches(y)),
    'patchesJson6902': obj.patchesJson6902?.map(y => toJson_KustomizationV1Beta1SpecPatchesJson6902(y)),
    'patchesStrategicMerge': obj.patchesStrategicMerge?.map(y => y),
    'path': obj.path,
    'postBuild': toJson_KustomizationV1Beta1SpecPostBuild(obj.postBuild),
    'prune': obj.prune,
    'retryInterval': obj.retryInterval,
    'serviceAccountName': obj.serviceAccountName,
    'sourceRef': toJson_KustomizationV1Beta1SpecSourceRef(obj.sourceRef),
    'suspend': obj.suspend,
    'targetNamespace': obj.targetNamespace,
    'timeout': obj.timeout,
    'validation': obj.validation,
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * Decrypt Kubernetes secrets before applying them on the cluster.
 *
 * @schema KustomizationV1Beta1SpecDecryption
 */
export interface KustomizationV1Beta1SpecDecryption {
  /**
   * Provider is the name of the decryption engine.
   *
   * @schema KustomizationV1Beta1SpecDecryption#provider
   */
  readonly provider: KustomizationV1Beta1SpecDecryptionProvider;

  /**
   * The secret name containing the private OpenPGP keys used for decryption.
   *
   * @schema KustomizationV1Beta1SpecDecryption#secretRef
   */
  readonly secretRef?: KustomizationV1Beta1SpecDecryptionSecretRef;

}

/**
 * Converts an object of type 'KustomizationV1Beta1SpecDecryption' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationV1Beta1SpecDecryption(obj: KustomizationV1Beta1SpecDecryption | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'provider': obj.provider,
    'secretRef': toJson_KustomizationV1Beta1SpecDecryptionSecretRef(obj.secretRef),
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * NamespacedObjectReference contains enough information to locate the referenced Kubernetes resource object in any
 * namespace.
 *
 * @schema KustomizationV1Beta1SpecDependsOn
 */
export interface KustomizationV1Beta1SpecDependsOn {
  /**
   * Name of the referent.
   *
   * @schema KustomizationV1Beta1SpecDependsOn#name
   */
  readonly name: string;

  /**
   * Namespace of the referent, when not specified it acts as LocalObjectReference.
   *
   * @schema KustomizationV1Beta1SpecDependsOn#namespace
   */
  readonly namespace?: string;

}

/**
 * Converts an object of type 'KustomizationV1Beta1SpecDependsOn' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationV1Beta1SpecDependsOn(obj: KustomizationV1Beta1SpecDependsOn | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'name': obj.name,
    'namespace': obj.namespace,
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * NamespacedObjectKindReference contains enough information to locate the typed referenced Kubernetes resource object
 * in any namespace.
 *
 * @schema KustomizationV1Beta1SpecHealthChecks
 */
export interface KustomizationV1Beta1SpecHealthChecks {
  /**
   * API version of the referent, if not specified the Kubernetes preferred version will be used.
   *
   * @schema KustomizationV1Beta1SpecHealthChecks#apiVersion
   */
  readonly apiVersion?: string;

  /**
   * Kind of the referent.
   *
   * @schema KustomizationV1Beta1SpecHealthChecks#kind
   */
  readonly kind: string;

  /**
   * Name of the referent.
   *
   * @schema KustomizationV1Beta1SpecHealthChecks#name
   */
  readonly name: string;

  /**
   * Namespace of the referent, when not specified it acts as LocalObjectReference.
   *
   * @schema KustomizationV1Beta1SpecHealthChecks#namespace
   */
  readonly namespace?: string;

}

/**
 * Converts an object of type 'KustomizationV1Beta1SpecHealthChecks' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationV1Beta1SpecHealthChecks(obj: KustomizationV1Beta1SpecHealthChecks | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'apiVersion': obj.apiVersion,
    'kind': obj.kind,
    'name': obj.name,
    'namespace': obj.namespace,
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * Image contains an image name, a new name, a new tag or digest, which will replace the original name and tag.
 *
 * @schema KustomizationV1Beta1SpecImages
 */
export interface KustomizationV1Beta1SpecImages {
  /**
   * Digest is the value used to replace the original image tag.
   * If digest is present NewTag value is ignored.
   *
   * @schema KustomizationV1Beta1SpecImages#digest
   */
  readonly digest?: string;

  /**
   * Name is a tag-less image name.
   *
   * @schema KustomizationV1Beta1SpecImages#name
   */
  readonly name: string;

  /**
   * NewName is the value used to replace the original name.
   *
   * @schema KustomizationV1Beta1SpecImages#newName
   */
  readonly newName?: string;

  /**
   * NewTag is the value used to replace the original tag.
   *
   * @schema KustomizationV1Beta1SpecImages#newTag
   */
  readonly newTag?: string;

}

/**
 * Converts an object of type 'KustomizationV1Beta1SpecImages' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationV1Beta1SpecImages(obj: KustomizationV1Beta1SpecImages | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'digest': obj.digest,
    'name': obj.name,
    'newName': obj.newName,
    'newTag': obj.newTag,
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * The KubeConfig for reconciling the Kustomization on a remote cluster.
 * When specified, KubeConfig takes precedence over ServiceAccountName.
 *
 * @schema KustomizationV1Beta1SpecKubeConfig
 */
export interface KustomizationV1Beta1SpecKubeConfig {
  /**
   * SecretRef holds the name to a secret that contains a 'value' key with
   * the kubeconfig file as the value. It must be in the same namespace as
   * the Kustomization.
   * It is recommended that the kubeconfig is self-contained, and the secret
   * is regularly updated if credentials such as a cloud-access-token expire.
   * Cloud specific `cmd-path` auth helpers will not function without adding
   * binaries and credentials to the Pod that is responsible for reconciling
   * the Kustomization.
   *
   * @schema KustomizationV1Beta1SpecKubeConfig#secretRef
   */
  readonly secretRef: KustomizationV1Beta1SpecKubeConfigSecretRef;

}

/**
 * Converts an object of type 'KustomizationV1Beta1SpecKubeConfig' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationV1Beta1SpecKubeConfig(obj: KustomizationV1Beta1SpecKubeConfig | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'secretRef': toJson_KustomizationV1Beta1SpecKubeConfigSecretRef(obj.secretRef),
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * Patch contains an inline StrategicMerge or JSON6902 patch, and the target the patch should
 * be applied to.
 *
 * @schema KustomizationV1Beta1SpecPatches
 */
export interface KustomizationV1Beta1SpecPatches {
  /**
   * Patch contains an inline StrategicMerge patch or an inline JSON6902 patch with
   * an array of operation objects.
   *
   * @schema KustomizationV1Beta1SpecPatches#patch
   */
  readonly patch: string;

  /**
   * Target points to the resources that the patch document should be applied to.
   *
   * @schema KustomizationV1Beta1SpecPatches#target
   */
  readonly target?: KustomizationV1Beta1SpecPatchesTarget;

}

/**
 * Converts an object of type 'KustomizationV1Beta1SpecPatches' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationV1Beta1SpecPatches(obj: KustomizationV1Beta1SpecPatches | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'patch': obj.patch,
    'target': toJson_KustomizationV1Beta1SpecPatchesTarget(obj.target),
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * JSON6902Patch contains a JSON6902 patch and the target the patch should be applied to.
 *
 * @schema KustomizationV1Beta1SpecPatchesJson6902
 */
export interface KustomizationV1Beta1SpecPatchesJson6902 {
  /**
   * Patch contains the JSON6902 patch document with an array of operation objects.
   *
   * @schema KustomizationV1Beta1SpecPatchesJson6902#patch
   */
  readonly patch: KustomizationV1Beta1SpecPatchesJson6902Patch[];

  /**
   * Target points to the resources that the patch document should be applied to.
   *
   * @schema KustomizationV1Beta1SpecPatchesJson6902#target
   */
  readonly target: KustomizationV1Beta1SpecPatchesJson6902Target;

}

/**
 * Converts an object of type 'KustomizationV1Beta1SpecPatchesJson6902' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationV1Beta1SpecPatchesJson6902(obj: KustomizationV1Beta1SpecPatchesJson6902 | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'patch': obj.patch?.map(y => toJson_KustomizationV1Beta1SpecPatchesJson6902Patch(y)),
    'target': toJson_KustomizationV1Beta1SpecPatchesJson6902Target(obj.target),
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * PostBuild describes which actions to perform on the YAML manifest
 * generated by building the kustomize overlay.
 *
 * @schema KustomizationV1Beta1SpecPostBuild
 */
export interface KustomizationV1Beta1SpecPostBuild {
  /**
   * Substitute holds a map of key/value pairs.
   * The variables defined in your YAML manifests
   * that match any of the keys defined in the map
   * will be substituted with the set value.
   * Includes support for bash string replacement functions
   * e.g. ${var:=default}, ${var:position} and ${var/substring/replacement}.
   *
   * @schema KustomizationV1Beta1SpecPostBuild#substitute
   */
  readonly substitute?: { [key: string]: string };

  /**
   * SubstituteFrom holds references to ConfigMaps and Secrets containing
   * the variables and their values to be substituted in the YAML manifests.
   * The ConfigMap and the Secret data keys represent the var names and they
   * must match the vars declared in the manifests for the substitution to happen.
   *
   * @schema KustomizationV1Beta1SpecPostBuild#substituteFrom
   */
  readonly substituteFrom?: KustomizationV1Beta1SpecPostBuildSubstituteFrom[];

}

/**
 * Converts an object of type 'KustomizationV1Beta1SpecPostBuild' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationV1Beta1SpecPostBuild(obj: KustomizationV1Beta1SpecPostBuild | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'substitute': ((obj.substitute) === undefined) ? undefined : (Object.entries(obj.substitute).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {})),
    'substituteFrom': obj.substituteFrom?.map(y => toJson_KustomizationV1Beta1SpecPostBuildSubstituteFrom(y)),
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * Reference of the source where the kustomization file is.
 *
 * @schema KustomizationV1Beta1SpecSourceRef
 */
export interface KustomizationV1Beta1SpecSourceRef {
  /**
   * API version of the referent
   *
   * @schema KustomizationV1Beta1SpecSourceRef#apiVersion
   */
  readonly apiVersion?: string;

  /**
   * Kind of the referent
   *
   * @schema KustomizationV1Beta1SpecSourceRef#kind
   */
  readonly kind: KustomizationV1Beta1SpecSourceRefKind;

  /**
   * Name of the referent
   *
   * @schema KustomizationV1Beta1SpecSourceRef#name
   */
  readonly name: string;

  /**
   * Namespace of the referent, defaults to the Kustomization namespace
   *
   * @schema KustomizationV1Beta1SpecSourceRef#namespace
   */
  readonly namespace?: string;

}

/**
 * Converts an object of type 'KustomizationV1Beta1SpecSourceRef' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationV1Beta1SpecSourceRef(obj: KustomizationV1Beta1SpecSourceRef | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'apiVersion': obj.apiVersion,
    'kind': obj.kind,
    'name': obj.name,
    'namespace': obj.namespace,
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * Validate the Kubernetes objects before applying them on the cluster.
 * The validation strategy can be 'client' (local dry-run), 'server'
 * (APIServer dry-run) or 'none'.
 * When 'Force' is 'true', validation will fallback to 'client' if set to
 * 'server' because server-side validation is not supported in this scenario.
 *
 * @schema KustomizationV1Beta1SpecValidation
 */
export enum KustomizationV1Beta1SpecValidation {
  /** none */
  NONE = "none",
  /** client */
  CLIENT = "client",
  /** server */
  SERVER = "server",
}

/**
 * Provider is the name of the decryption engine.
 *
 * @schema KustomizationV1Beta1SpecDecryptionProvider
 */
export enum KustomizationV1Beta1SpecDecryptionProvider {
  /** sops */
  SOPS = "sops",
}

/**
 * The secret name containing the private OpenPGP keys used for decryption.
 *
 * @schema KustomizationV1Beta1SpecDecryptionSecretRef
 */
export interface KustomizationV1Beta1SpecDecryptionSecretRef {
  /**
   * Name of the referent.
   *
   * @schema KustomizationV1Beta1SpecDecryptionSecretRef#name
   */
  readonly name: string;

}

/**
 * Converts an object of type 'KustomizationV1Beta1SpecDecryptionSecretRef' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationV1Beta1SpecDecryptionSecretRef(obj: KustomizationV1Beta1SpecDecryptionSecretRef | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'name': obj.name,
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * SecretRef holds the name to a secret that contains a 'value' key with
 * the kubeconfig file as the value. It must be in the same namespace as
 * the Kustomization.
 * It is recommended that the kubeconfig is self-contained, and the secret
 * is regularly updated if credentials such as a cloud-access-token expire.
 * Cloud specific `cmd-path` auth helpers will not function without adding
 * binaries and credentials to the Pod that is responsible for reconciling
 * the Kustomization.
 *
 * @schema KustomizationV1Beta1SpecKubeConfigSecretRef
 */
export interface KustomizationV1Beta1SpecKubeConfigSecretRef {
  /**
   * Name of the referent.
   *
   * @schema KustomizationV1Beta1SpecKubeConfigSecretRef#name
   */
  readonly name: string;

}

/**
 * Converts an object of type 'KustomizationV1Beta1SpecKubeConfigSecretRef' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationV1Beta1SpecKubeConfigSecretRef(obj: KustomizationV1Beta1SpecKubeConfigSecretRef | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'name': obj.name,
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * Target points to the resources that the patch document should be applied to.
 *
 * @schema KustomizationV1Beta1SpecPatchesTarget
 */
export interface KustomizationV1Beta1SpecPatchesTarget {
  /**
   * AnnotationSelector is a string that follows the label selection expression
   * https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api
   * It matches with the resource annotations.
   *
   * @schema KustomizationV1Beta1SpecPatchesTarget#annotationSelector
   */
  readonly annotationSelector?: string;

  /**
   * Group is the API group to select resources from.
   * Together with Version and Kind it is capable of unambiguously identifying and/or selecting resources.
   * https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md
   *
   * @schema KustomizationV1Beta1SpecPatchesTarget#group
   */
  readonly group?: string;

  /**
   * Kind of the API Group to select resources from.
   * Together with Group and Version it is capable of unambiguously
   * identifying and/or selecting resources.
   * https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md
   *
   * @schema KustomizationV1Beta1SpecPatchesTarget#kind
   */
  readonly kind?: string;

  /**
   * LabelSelector is a string that follows the label selection expression
   * https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api
   * It matches with the resource labels.
   *
   * @schema KustomizationV1Beta1SpecPatchesTarget#labelSelector
   */
  readonly labelSelector?: string;

  /**
   * Name to match resources with.
   *
   * @schema KustomizationV1Beta1SpecPatchesTarget#name
   */
  readonly name?: string;

  /**
   * Namespace to select resources from.
   *
   * @schema KustomizationV1Beta1SpecPatchesTarget#namespace
   */
  readonly namespace?: string;

  /**
   * Version of the API Group to select resources from.
   * Together with Group and Kind it is capable of unambiguously identifying and/or selecting resources.
   * https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md
   *
   * @schema KustomizationV1Beta1SpecPatchesTarget#version
   */
  readonly version?: string;

}

/**
 * Converts an object of type 'KustomizationV1Beta1SpecPatchesTarget' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationV1Beta1SpecPatchesTarget(obj: KustomizationV1Beta1SpecPatchesTarget | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'annotationSelector': obj.annotationSelector,
    'group': obj.group,
    'kind': obj.kind,
    'labelSelector': obj.labelSelector,
    'name': obj.name,
    'namespace': obj.namespace,
    'version': obj.version,
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * JSON6902 is a JSON6902 operation object.
 * https://datatracker.ietf.org/doc/html/rfc6902#section-4
 *
 * @schema KustomizationV1Beta1SpecPatchesJson6902Patch
 */
export interface KustomizationV1Beta1SpecPatchesJson6902Patch {
  /**
   * From contains a JSON-pointer value that references a location within the target document where the operation is
   * performed. The meaning of the value depends on the value of Op, and is NOT taken into account by all operations.
   *
   * @schema KustomizationV1Beta1SpecPatchesJson6902Patch#from
   */
  readonly from?: string;

  /**
   * Op indicates the operation to perform. Its value MUST be one of "add", "remove", "replace", "move", "copy", or
   * "test".
   * https://datatracker.ietf.org/doc/html/rfc6902#section-4
   *
   * @schema KustomizationV1Beta1SpecPatchesJson6902Patch#op
   */
  readonly op: KustomizationV1Beta1SpecPatchesJson6902PatchOp;

  /**
   * Path contains the JSON-pointer value that references a location within the target document where the operation
   * is performed. The meaning of the value depends on the value of Op.
   *
   * @schema KustomizationV1Beta1SpecPatchesJson6902Patch#path
   */
  readonly path: string;

  /**
   * Value contains a valid JSON structure. The meaning of the value depends on the value of Op, and is NOT taken into
   * account by all operations.
   *
   * @schema KustomizationV1Beta1SpecPatchesJson6902Patch#value
   */
  readonly value?: any;

}

/**
 * Converts an object of type 'KustomizationV1Beta1SpecPatchesJson6902Patch' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationV1Beta1SpecPatchesJson6902Patch(obj: KustomizationV1Beta1SpecPatchesJson6902Patch | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'from': obj.from,
    'op': obj.op,
    'path': obj.path,
    'value': obj.value,
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * Target points to the resources that the patch document should be applied to.
 *
 * @schema KustomizationV1Beta1SpecPatchesJson6902Target
 */
export interface KustomizationV1Beta1SpecPatchesJson6902Target {
  /**
   * AnnotationSelector is a string that follows the label selection expression
   * https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api
   * It matches with the resource annotations.
   *
   * @schema KustomizationV1Beta1SpecPatchesJson6902Target#annotationSelector
   */
  readonly annotationSelector?: string;

  /**
   * Group is the API group to select resources from.
   * Together with Version and Kind it is capable of unambiguously identifying and/or selecting resources.
   * https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md
   *
   * @schema KustomizationV1Beta1SpecPatchesJson6902Target#group
   */
  readonly group?: string;

  /**
   * Kind of the API Group to select resources from.
   * Together with Group and Version it is capable of unambiguously
   * identifying and/or selecting resources.
   * https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md
   *
   * @schema KustomizationV1Beta1SpecPatchesJson6902Target#kind
   */
  readonly kind?: string;

  /**
   * LabelSelector is a string that follows the label selection expression
   * https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api
   * It matches with the resource labels.
   *
   * @schema KustomizationV1Beta1SpecPatchesJson6902Target#labelSelector
   */
  readonly labelSelector?: string;

  /**
   * Name to match resources with.
   *
   * @schema KustomizationV1Beta1SpecPatchesJson6902Target#name
   */
  readonly name?: string;

  /**
   * Namespace to select resources from.
   *
   * @schema KustomizationV1Beta1SpecPatchesJson6902Target#namespace
   */
  readonly namespace?: string;

  /**
   * Version of the API Group to select resources from.
   * Together with Group and Kind it is capable of unambiguously identifying and/or selecting resources.
   * https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md
   *
   * @schema KustomizationV1Beta1SpecPatchesJson6902Target#version
   */
  readonly version?: string;

}

/**
 * Converts an object of type 'KustomizationV1Beta1SpecPatchesJson6902Target' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationV1Beta1SpecPatchesJson6902Target(obj: KustomizationV1Beta1SpecPatchesJson6902Target | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'annotationSelector': obj.annotationSelector,
    'group': obj.group,
    'kind': obj.kind,
    'labelSelector': obj.labelSelector,
    'name': obj.name,
    'namespace': obj.namespace,
    'version': obj.version,
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * SubstituteReference contains a reference to a resource containing
 * the variables name and value.
 *
 * @schema KustomizationV1Beta1SpecPostBuildSubstituteFrom
 */
export interface KustomizationV1Beta1SpecPostBuildSubstituteFrom {
  /**
   * Kind of the values referent, valid values are ('Secret', 'ConfigMap').
   *
   * @schema KustomizationV1Beta1SpecPostBuildSubstituteFrom#kind
   */
  readonly kind: KustomizationV1Beta1SpecPostBuildSubstituteFromKind;

  /**
   * Name of the values referent. Should reside in the same namespace as the
   * referring resource.
   *
   * @schema KustomizationV1Beta1SpecPostBuildSubstituteFrom#name
   */
  readonly name: string;

}

/**
 * Converts an object of type 'KustomizationV1Beta1SpecPostBuildSubstituteFrom' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationV1Beta1SpecPostBuildSubstituteFrom(obj: KustomizationV1Beta1SpecPostBuildSubstituteFrom | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'kind': obj.kind,
    'name': obj.name,
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * Kind of the referent
 *
 * @schema KustomizationV1Beta1SpecSourceRefKind
 */
export enum KustomizationV1Beta1SpecSourceRefKind {
  /** GitRepository */
  GIT_REPOSITORY = "GitRepository",
  /** Bucket */
  BUCKET = "Bucket",
}

/**
 * Op indicates the operation to perform. Its value MUST be one of "add", "remove", "replace", "move", "copy", or
 * "test".
 * https://datatracker.ietf.org/doc/html/rfc6902#section-4
 *
 * @schema KustomizationV1Beta1SpecPatchesJson6902PatchOp
 */
export enum KustomizationV1Beta1SpecPatchesJson6902PatchOp {
  /** test */
  TEST = "test",
  /** remove */
  REMOVE = "remove",
  /** add */
  ADD = "add",
  /** replace */
  REPLACE = "replace",
  /** move */
  MOVE = "move",
  /** copy */
  COPY = "copy",
}

/**
 * Kind of the values referent, valid values are ('Secret', 'ConfigMap').
 *
 * @schema KustomizationV1Beta1SpecPostBuildSubstituteFromKind
 */
export enum KustomizationV1Beta1SpecPostBuildSubstituteFromKind {
  /** Secret */
  SECRET = "Secret",
  /** ConfigMap */
  CONFIG_MAP = "ConfigMap",
}


/**
 * Kustomization is the Schema for the kustomizations API.
 *
 * @schema KustomizationV1Beta2
 */
export class KustomizationV1Beta2 extends ApiObject {
  /**
   * Returns the apiVersion and kind for "KustomizationV1Beta2"
   */
  public static readonly GVK: GroupVersionKind = {
    apiVersion: 'kustomize.toolkit.fluxcd.io/v1beta2',
    kind: 'Kustomization',
  }

  /**
   * Renders a Kubernetes manifest for "KustomizationV1Beta2".
   *
   * This can be used to inline resource manifests inside other objects (e.g. as templates).
   *
   * @param props initialization props
   */
  public static manifest(props: KustomizationV1Beta2Props = {}): any {
    return {
      ...KustomizationV1Beta2.GVK,
      ...toJson_KustomizationV1Beta2Props(props),
    };
  }

  /**
   * Defines a "KustomizationV1Beta2" API object
   * @param scope the scope in which to define this object
   * @param id a scope-local name for the object
   * @param props initialization props
   */
  public constructor(scope: Construct, id: string, props: KustomizationV1Beta2Props = {}) {
    super(scope, id, {
      ...KustomizationV1Beta2.GVK,
      ...props,
    });
  }

  /**
   * Renders the object to Kubernetes JSON.
   */
  public toJson(): any {
    const resolved = super.toJson();

    return {
      ...KustomizationV1Beta2.GVK,
      ...toJson_KustomizationV1Beta2Props(resolved),
    };
  }
}

/**
 * Kustomization is the Schema for the kustomizations API.
 *
 * @schema KustomizationV1Beta2
 */
export interface KustomizationV1Beta2Props {
  /**
   * @schema KustomizationV1Beta2#metadata
   */
  readonly metadata?: ApiObjectMetadata;

  /**
   * KustomizationSpec defines the configuration to calculate the desired state from a Source using Kustomize.
   *
   * @schema KustomizationV1Beta2#spec
   */
  readonly spec?: KustomizationV1Beta2Spec;

}

/**
 * Converts an object of type 'KustomizationV1Beta2Props' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationV1Beta2Props(obj: KustomizationV1Beta2Props | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'metadata': obj.metadata,
    'spec': toJson_KustomizationV1Beta2Spec(obj.spec),
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * KustomizationSpec defines the configuration to calculate the desired state from a Source using Kustomize.
 *
 * @schema KustomizationV1Beta2Spec
 */
export interface KustomizationV1Beta2Spec {
  /**
   * CommonMetadata specifies the common labels and annotations that are applied to all resources.
   * Any existing label or annotation will be overridden if its key matches a common one.
   *
   * @schema KustomizationV1Beta2Spec#commonMetadata
   */
  readonly commonMetadata?: KustomizationV1Beta2SpecCommonMetadata;

  /**
   * Components specifies relative paths to specifications of other Components.
   *
   * @schema KustomizationV1Beta2Spec#components
   */
  readonly components?: string[];

  /**
   * Decrypt Kubernetes secrets before applying them on the cluster.
   *
   * @schema KustomizationV1Beta2Spec#decryption
   */
  readonly decryption?: KustomizationV1Beta2SpecDecryption;

  /**
   * DependsOn may contain a meta.NamespacedObjectReference slice
   * with references to Kustomization resources that must be ready before this
   * Kustomization can be reconciled.
   *
   * @schema KustomizationV1Beta2Spec#dependsOn
   */
  readonly dependsOn?: KustomizationV1Beta2SpecDependsOn[];

  /**
   * Force instructs the controller to recreate resources
   * when patching fails due to an immutable field change.
   *
   * @schema KustomizationV1Beta2Spec#force
   */
  readonly force?: boolean;

  /**
   * A list of resources to be included in the health assessment.
   *
   * @schema KustomizationV1Beta2Spec#healthChecks
   */
  readonly healthChecks?: KustomizationV1Beta2SpecHealthChecks[];

  /**
   * Images is a list of (image name, new name, new tag or digest)
   * for changing image names, tags or digests. This can also be achieved with a
   * patch, but this operator is simpler to specify.
   *
   * @schema KustomizationV1Beta2Spec#images
   */
  readonly images?: KustomizationV1Beta2SpecImages[];

  /**
   * The interval at which to reconcile the Kustomization.
   *
   * @schema KustomizationV1Beta2Spec#interval
   */
  readonly interval: string;

  /**
   * The KubeConfig for reconciling the Kustomization on a remote cluster.
   * When used in combination with KustomizationSpec.ServiceAccountName,
   * forces the controller to act on behalf of that Service Account at the
   * target cluster.
   * If the --default-service-account flag is set, its value will be used as
   * a controller level fallback for when KustomizationSpec.ServiceAccountName
   * is empty.
   *
   * @schema KustomizationV1Beta2Spec#kubeConfig
   */
  readonly kubeConfig?: KustomizationV1Beta2SpecKubeConfig;

  /**
   * Strategic merge and JSON patches, defined as inline YAML objects,
   * capable of targeting objects based on kind, label and annotation selectors.
   *
   * @schema KustomizationV1Beta2Spec#patches
   */
  readonly patches?: KustomizationV1Beta2SpecPatches[];

  /**
   * JSON 6902 patches, defined as inline YAML objects.
   * Deprecated: Use Patches instead.
   *
   * @schema KustomizationV1Beta2Spec#patchesJson6902
   */
  readonly patchesJson6902?: KustomizationV1Beta2SpecPatchesJson6902[];

  /**
   * Strategic merge patches, defined as inline YAML objects.
   * Deprecated: Use Patches instead.
   *
   * @schema KustomizationV1Beta2Spec#patchesStrategicMerge
   */
  readonly patchesStrategicMerge?: any[];

  /**
   * Path to the directory containing the kustomization.yaml file, or the
   * set of plain YAMLs a kustomization.yaml should be generated for.
   * Defaults to 'None', which translates to the root path of the SourceRef.
   *
   * @default None', which translates to the root path of the SourceRef.
   * @schema KustomizationV1Beta2Spec#path
   */
  readonly path?: string;

  /**
   * PostBuild describes which actions to perform on the YAML manifest
   * generated by building the kustomize overlay.
   *
   * @schema KustomizationV1Beta2Spec#postBuild
   */
  readonly postBuild?: KustomizationV1Beta2SpecPostBuild;

  /**
   * Prune enables garbage collection.
   *
   * @schema KustomizationV1Beta2Spec#prune
   */
  readonly prune: boolean;

  /**
   * The interval at which to retry a previously failed reconciliation.
   * When not specified, the controller uses the KustomizationSpec.Interval
   * value to retry failures.
   *
   * @schema KustomizationV1Beta2Spec#retryInterval
   */
  readonly retryInterval?: string;

  /**
   * The name of the Kubernetes service account to impersonate
   * when reconciling this Kustomization.
   *
   * @schema KustomizationV1Beta2Spec#serviceAccountName
   */
  readonly serviceAccountName?: string;

  /**
   * Reference of the source where the kustomization file is.
   *
   * @schema KustomizationV1Beta2Spec#sourceRef
   */
  readonly sourceRef: KustomizationV1Beta2SpecSourceRef;

  /**
   * This flag tells the controller to suspend subsequent kustomize executions,
   * it does not apply to already started executions. Defaults to false.
   *
   * @default false.
   * @schema KustomizationV1Beta2Spec#suspend
   */
  readonly suspend?: boolean;

  /**
   * TargetNamespace sets or overrides the namespace in the
   * kustomization.yaml file.
   *
   * @schema KustomizationV1Beta2Spec#targetNamespace
   */
  readonly targetNamespace?: string;

  /**
   * Timeout for validation, apply and health checking operations.
   * Defaults to 'Interval' duration.
   *
   * @default Interval' duration.
   * @schema KustomizationV1Beta2Spec#timeout
   */
  readonly timeout?: string;

  /**
   * Deprecated: Not used in v1beta2.
   *
   * @schema KustomizationV1Beta2Spec#validation
   */
  readonly validation?: KustomizationV1Beta2SpecValidation;

  /**
   * Wait instructs the controller to check the health of all the reconciled resources.
   * When enabled, the HealthChecks are ignored. Defaults to false.
   *
   * @default false.
   * @schema KustomizationV1Beta2Spec#wait
   */
  readonly wait?: boolean;

}

/**
 * Converts an object of type 'KustomizationV1Beta2Spec' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationV1Beta2Spec(obj: KustomizationV1Beta2Spec | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'commonMetadata': toJson_KustomizationV1Beta2SpecCommonMetadata(obj.commonMetadata),
    'components': obj.components?.map(y => y),
    'decryption': toJson_KustomizationV1Beta2SpecDecryption(obj.decryption),
    'dependsOn': obj.dependsOn?.map(y => toJson_KustomizationV1Beta2SpecDependsOn(y)),
    'force': obj.force,
    'healthChecks': obj.healthChecks?.map(y => toJson_KustomizationV1Beta2SpecHealthChecks(y)),
    'images': obj.images?.map(y => toJson_KustomizationV1Beta2SpecImages(y)),
    'interval': obj.interval,
    'kubeConfig': toJson_KustomizationV1Beta2SpecKubeConfig(obj.kubeConfig),
    'patches': obj.patches?.map(y => toJson_KustomizationV1Beta2SpecPatches(y)),
    'patchesJson6902': obj.patchesJson6902?.map(y => toJson_KustomizationV1Beta2SpecPatchesJson6902(y)),
    'patchesStrategicMerge': obj.patchesStrategicMerge?.map(y => y),
    'path': obj.path,
    'postBuild': toJson_KustomizationV1Beta2SpecPostBuild(obj.postBuild),
    'prune': obj.prune,
    'retryInterval': obj.retryInterval,
    'serviceAccountName': obj.serviceAccountName,
    'sourceRef': toJson_KustomizationV1Beta2SpecSourceRef(obj.sourceRef),
    'suspend': obj.suspend,
    'targetNamespace': obj.targetNamespace,
    'timeout': obj.timeout,
    'validation': obj.validation,
    'wait': obj.wait,
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * CommonMetadata specifies the common labels and annotations that are applied to all resources.
 * Any existing label or annotation will be overridden if its key matches a common one.
 *
 * @schema KustomizationV1Beta2SpecCommonMetadata
 */
export interface KustomizationV1Beta2SpecCommonMetadata {
  /**
   * Annotations to be added to the object's metadata.
   *
   * @schema KustomizationV1Beta2SpecCommonMetadata#annotations
   */
  readonly annotations?: { [key: string]: string };

  /**
   * Labels to be added to the object's metadata.
   *
   * @schema KustomizationV1Beta2SpecCommonMetadata#labels
   */
  readonly labels?: { [key: string]: string };

}

/**
 * Converts an object of type 'KustomizationV1Beta2SpecCommonMetadata' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationV1Beta2SpecCommonMetadata(obj: KustomizationV1Beta2SpecCommonMetadata | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'annotations': ((obj.annotations) === undefined) ? undefined : (Object.entries(obj.annotations).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {})),
    'labels': ((obj.labels) === undefined) ? undefined : (Object.entries(obj.labels).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {})),
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * Decrypt Kubernetes secrets before applying them on the cluster.
 *
 * @schema KustomizationV1Beta2SpecDecryption
 */
export interface KustomizationV1Beta2SpecDecryption {
  /**
   * Provider is the name of the decryption engine.
   *
   * @schema KustomizationV1Beta2SpecDecryption#provider
   */
  readonly provider: KustomizationV1Beta2SpecDecryptionProvider;

  /**
   * The secret name containing the private OpenPGP keys used for decryption.
   *
   * @schema KustomizationV1Beta2SpecDecryption#secretRef
   */
  readonly secretRef?: KustomizationV1Beta2SpecDecryptionSecretRef;

}

/**
 * Converts an object of type 'KustomizationV1Beta2SpecDecryption' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationV1Beta2SpecDecryption(obj: KustomizationV1Beta2SpecDecryption | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'provider': obj.provider,
    'secretRef': toJson_KustomizationV1Beta2SpecDecryptionSecretRef(obj.secretRef),
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * NamespacedObjectReference contains enough information to locate the referenced Kubernetes resource object in any
 * namespace.
 *
 * @schema KustomizationV1Beta2SpecDependsOn
 */
export interface KustomizationV1Beta2SpecDependsOn {
  /**
   * Name of the referent.
   *
   * @schema KustomizationV1Beta2SpecDependsOn#name
   */
  readonly name: string;

  /**
   * Namespace of the referent, when not specified it acts as LocalObjectReference.
   *
   * @schema KustomizationV1Beta2SpecDependsOn#namespace
   */
  readonly namespace?: string;

}

/**
 * Converts an object of type 'KustomizationV1Beta2SpecDependsOn' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationV1Beta2SpecDependsOn(obj: KustomizationV1Beta2SpecDependsOn | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'name': obj.name,
    'namespace': obj.namespace,
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * NamespacedObjectKindReference contains enough information to locate the typed referenced Kubernetes resource object
 * in any namespace.
 *
 * @schema KustomizationV1Beta2SpecHealthChecks
 */
export interface KustomizationV1Beta2SpecHealthChecks {
  /**
   * API version of the referent, if not specified the Kubernetes preferred version will be used.
   *
   * @schema KustomizationV1Beta2SpecHealthChecks#apiVersion
   */
  readonly apiVersion?: string;

  /**
   * Kind of the referent.
   *
   * @schema KustomizationV1Beta2SpecHealthChecks#kind
   */
  readonly kind: string;

  /**
   * Name of the referent.
   *
   * @schema KustomizationV1Beta2SpecHealthChecks#name
   */
  readonly name: string;

  /**
   * Namespace of the referent, when not specified it acts as LocalObjectReference.
   *
   * @schema KustomizationV1Beta2SpecHealthChecks#namespace
   */
  readonly namespace?: string;

}

/**
 * Converts an object of type 'KustomizationV1Beta2SpecHealthChecks' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationV1Beta2SpecHealthChecks(obj: KustomizationV1Beta2SpecHealthChecks | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'apiVersion': obj.apiVersion,
    'kind': obj.kind,
    'name': obj.name,
    'namespace': obj.namespace,
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * Image contains an image name, a new name, a new tag or digest, which will replace the original name and tag.
 *
 * @schema KustomizationV1Beta2SpecImages
 */
export interface KustomizationV1Beta2SpecImages {
  /**
   * Digest is the value used to replace the original image tag.
   * If digest is present NewTag value is ignored.
   *
   * @schema KustomizationV1Beta2SpecImages#digest
   */
  readonly digest?: string;

  /**
   * Name is a tag-less image name.
   *
   * @schema KustomizationV1Beta2SpecImages#name
   */
  readonly name: string;

  /**
   * NewName is the value used to replace the original name.
   *
   * @schema KustomizationV1Beta2SpecImages#newName
   */
  readonly newName?: string;

  /**
   * NewTag is the value used to replace the original tag.
   *
   * @schema KustomizationV1Beta2SpecImages#newTag
   */
  readonly newTag?: string;

}

/**
 * Converts an object of type 'KustomizationV1Beta2SpecImages' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationV1Beta2SpecImages(obj: KustomizationV1Beta2SpecImages | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'digest': obj.digest,
    'name': obj.name,
    'newName': obj.newName,
    'newTag': obj.newTag,
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * The KubeConfig for reconciling the Kustomization on a remote cluster.
 * When used in combination with KustomizationSpec.ServiceAccountName,
 * forces the controller to act on behalf of that Service Account at the
 * target cluster.
 * If the --default-service-account flag is set, its value will be used as
 * a controller level fallback for when KustomizationSpec.ServiceAccountName
 * is empty.
 *
 * @schema KustomizationV1Beta2SpecKubeConfig
 */
export interface KustomizationV1Beta2SpecKubeConfig {
  /**
   * SecretRef holds the name of a secret that contains a key with
   * the kubeconfig file as the value. If no key is set, the key will default
   * to 'value'.
   * It is recommended that the kubeconfig is self-contained, and the secret
   * is regularly updated if credentials such as a cloud-access-token expire.
   * Cloud specific `cmd-path` auth helpers will not function without adding
   * binaries and credentials to the Pod that is responsible for reconciling
   * Kubernetes resources.
   *
   * @schema KustomizationV1Beta2SpecKubeConfig#secretRef
   */
  readonly secretRef: KustomizationV1Beta2SpecKubeConfigSecretRef;

}

/**
 * Converts an object of type 'KustomizationV1Beta2SpecKubeConfig' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationV1Beta2SpecKubeConfig(obj: KustomizationV1Beta2SpecKubeConfig | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'secretRef': toJson_KustomizationV1Beta2SpecKubeConfigSecretRef(obj.secretRef),
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * Patch contains an inline StrategicMerge or JSON6902 patch, and the target the patch should
 * be applied to.
 *
 * @schema KustomizationV1Beta2SpecPatches
 */
export interface KustomizationV1Beta2SpecPatches {
  /**
   * Patch contains an inline StrategicMerge patch or an inline JSON6902 patch with
   * an array of operation objects.
   *
   * @schema KustomizationV1Beta2SpecPatches#patch
   */
  readonly patch: string;

  /**
   * Target points to the resources that the patch document should be applied to.
   *
   * @schema KustomizationV1Beta2SpecPatches#target
   */
  readonly target?: KustomizationV1Beta2SpecPatchesTarget;

}

/**
 * Converts an object of type 'KustomizationV1Beta2SpecPatches' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationV1Beta2SpecPatches(obj: KustomizationV1Beta2SpecPatches | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'patch': obj.patch,
    'target': toJson_KustomizationV1Beta2SpecPatchesTarget(obj.target),
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * JSON6902Patch contains a JSON6902 patch and the target the patch should be applied to.
 *
 * @schema KustomizationV1Beta2SpecPatchesJson6902
 */
export interface KustomizationV1Beta2SpecPatchesJson6902 {
  /**
   * Patch contains the JSON6902 patch document with an array of operation objects.
   *
   * @schema KustomizationV1Beta2SpecPatchesJson6902#patch
   */
  readonly patch: KustomizationV1Beta2SpecPatchesJson6902Patch[];

  /**
   * Target points to the resources that the patch document should be applied to.
   *
   * @schema KustomizationV1Beta2SpecPatchesJson6902#target
   */
  readonly target: KustomizationV1Beta2SpecPatchesJson6902Target;

}

/**
 * Converts an object of type 'KustomizationV1Beta2SpecPatchesJson6902' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationV1Beta2SpecPatchesJson6902(obj: KustomizationV1Beta2SpecPatchesJson6902 | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'patch': obj.patch?.map(y => toJson_KustomizationV1Beta2SpecPatchesJson6902Patch(y)),
    'target': toJson_KustomizationV1Beta2SpecPatchesJson6902Target(obj.target),
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * PostBuild describes which actions to perform on the YAML manifest
 * generated by building the kustomize overlay.
 *
 * @schema KustomizationV1Beta2SpecPostBuild
 */
export interface KustomizationV1Beta2SpecPostBuild {
  /**
   * Substitute holds a map of key/value pairs.
   * The variables defined in your YAML manifests
   * that match any of the keys defined in the map
   * will be substituted with the set value.
   * Includes support for bash string replacement functions
   * e.g. ${var:=default}, ${var:position} and ${var/substring/replacement}.
   *
   * @schema KustomizationV1Beta2SpecPostBuild#substitute
   */
  readonly substitute?: { [key: string]: string };

  /**
   * SubstituteFrom holds references to ConfigMaps and Secrets containing
   * the variables and their values to be substituted in the YAML manifests.
   * The ConfigMap and the Secret data keys represent the var names and they
   * must match the vars declared in the manifests for the substitution to happen.
   *
   * @schema KustomizationV1Beta2SpecPostBuild#substituteFrom
   */
  readonly substituteFrom?: KustomizationV1Beta2SpecPostBuildSubstituteFrom[];

}

/**
 * Converts an object of type 'KustomizationV1Beta2SpecPostBuild' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationV1Beta2SpecPostBuild(obj: KustomizationV1Beta2SpecPostBuild | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'substitute': ((obj.substitute) === undefined) ? undefined : (Object.entries(obj.substitute).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {})),
    'substituteFrom': obj.substituteFrom?.map(y => toJson_KustomizationV1Beta2SpecPostBuildSubstituteFrom(y)),
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * Reference of the source where the kustomization file is.
 *
 * @schema KustomizationV1Beta2SpecSourceRef
 */
export interface KustomizationV1Beta2SpecSourceRef {
  /**
   * API version of the referent.
   *
   * @schema KustomizationV1Beta2SpecSourceRef#apiVersion
   */
  readonly apiVersion?: string;

  /**
   * Kind of the referent.
   *
   * @schema KustomizationV1Beta2SpecSourceRef#kind
   */
  readonly kind: KustomizationV1Beta2SpecSourceRefKind;

  /**
   * Name of the referent.
   *
   * @schema KustomizationV1Beta2SpecSourceRef#name
   */
  readonly name: string;

  /**
   * Namespace of the referent, defaults to the namespace of the Kubernetes resource object that contains the reference.
   *
   * @schema KustomizationV1Beta2SpecSourceRef#namespace
   */
  readonly namespace?: string;

}

/**
 * Converts an object of type 'KustomizationV1Beta2SpecSourceRef' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationV1Beta2SpecSourceRef(obj: KustomizationV1Beta2SpecSourceRef | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'apiVersion': obj.apiVersion,
    'kind': obj.kind,
    'name': obj.name,
    'namespace': obj.namespace,
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * Deprecated: Not used in v1beta2.
 *
 * @schema KustomizationV1Beta2SpecValidation
 */
export enum KustomizationV1Beta2SpecValidation {
  /** none */
  NONE = "none",
  /** client */
  CLIENT = "client",
  /** server */
  SERVER = "server",
}

/**
 * Provider is the name of the decryption engine.
 *
 * @schema KustomizationV1Beta2SpecDecryptionProvider
 */
export enum KustomizationV1Beta2SpecDecryptionProvider {
  /** sops */
  SOPS = "sops",
}

/**
 * The secret name containing the private OpenPGP keys used for decryption.
 *
 * @schema KustomizationV1Beta2SpecDecryptionSecretRef
 */
export interface KustomizationV1Beta2SpecDecryptionSecretRef {
  /**
   * Name of the referent.
   *
   * @schema KustomizationV1Beta2SpecDecryptionSecretRef#name
   */
  readonly name: string;

}

/**
 * Converts an object of type 'KustomizationV1Beta2SpecDecryptionSecretRef' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationV1Beta2SpecDecryptionSecretRef(obj: KustomizationV1Beta2SpecDecryptionSecretRef | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'name': obj.name,
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * SecretRef holds the name of a secret that contains a key with
 * the kubeconfig file as the value. If no key is set, the key will default
 * to 'value'.
 * It is recommended that the kubeconfig is self-contained, and the secret
 * is regularly updated if credentials such as a cloud-access-token expire.
 * Cloud specific `cmd-path` auth helpers will not function without adding
 * binaries and credentials to the Pod that is responsible for reconciling
 * Kubernetes resources.
 *
 * @schema KustomizationV1Beta2SpecKubeConfigSecretRef
 */
export interface KustomizationV1Beta2SpecKubeConfigSecretRef {
  /**
   * Key in the Secret, when not specified an implementation-specific default key is used.
   *
   * @schema KustomizationV1Beta2SpecKubeConfigSecretRef#key
   */
  readonly key?: string;

  /**
   * Name of the Secret.
   *
   * @schema KustomizationV1Beta2SpecKubeConfigSecretRef#name
   */
  readonly name: string;

}

/**
 * Converts an object of type 'KustomizationV1Beta2SpecKubeConfigSecretRef' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationV1Beta2SpecKubeConfigSecretRef(obj: KustomizationV1Beta2SpecKubeConfigSecretRef | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'key': obj.key,
    'name': obj.name,
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * Target points to the resources that the patch document should be applied to.
 *
 * @schema KustomizationV1Beta2SpecPatchesTarget
 */
export interface KustomizationV1Beta2SpecPatchesTarget {
  /**
   * AnnotationSelector is a string that follows the label selection expression
   * https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api
   * It matches with the resource annotations.
   *
   * @schema KustomizationV1Beta2SpecPatchesTarget#annotationSelector
   */
  readonly annotationSelector?: string;

  /**
   * Group is the API group to select resources from.
   * Together with Version and Kind it is capable of unambiguously identifying and/or selecting resources.
   * https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md
   *
   * @schema KustomizationV1Beta2SpecPatchesTarget#group
   */
  readonly group?: string;

  /**
   * Kind of the API Group to select resources from.
   * Together with Group and Version it is capable of unambiguously
   * identifying and/or selecting resources.
   * https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md
   *
   * @schema KustomizationV1Beta2SpecPatchesTarget#kind
   */
  readonly kind?: string;

  /**
   * LabelSelector is a string that follows the label selection expression
   * https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api
   * It matches with the resource labels.
   *
   * @schema KustomizationV1Beta2SpecPatchesTarget#labelSelector
   */
  readonly labelSelector?: string;

  /**
   * Name to match resources with.
   *
   * @schema KustomizationV1Beta2SpecPatchesTarget#name
   */
  readonly name?: string;

  /**
   * Namespace to select resources from.
   *
   * @schema KustomizationV1Beta2SpecPatchesTarget#namespace
   */
  readonly namespace?: string;

  /**
   * Version of the API Group to select resources from.
   * Together with Group and Kind it is capable of unambiguously identifying and/or selecting resources.
   * https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md
   *
   * @schema KustomizationV1Beta2SpecPatchesTarget#version
   */
  readonly version?: string;

}

/**
 * Converts an object of type 'KustomizationV1Beta2SpecPatchesTarget' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationV1Beta2SpecPatchesTarget(obj: KustomizationV1Beta2SpecPatchesTarget | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'annotationSelector': obj.annotationSelector,
    'group': obj.group,
    'kind': obj.kind,
    'labelSelector': obj.labelSelector,
    'name': obj.name,
    'namespace': obj.namespace,
    'version': obj.version,
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * JSON6902 is a JSON6902 operation object.
 * https://datatracker.ietf.org/doc/html/rfc6902#section-4
 *
 * @schema KustomizationV1Beta2SpecPatchesJson6902Patch
 */
export interface KustomizationV1Beta2SpecPatchesJson6902Patch {
  /**
   * From contains a JSON-pointer value that references a location within the target document where the operation is
   * performed. The meaning of the value depends on the value of Op, and is NOT taken into account by all operations.
   *
   * @schema KustomizationV1Beta2SpecPatchesJson6902Patch#from
   */
  readonly from?: string;

  /**
   * Op indicates the operation to perform. Its value MUST be one of "add", "remove", "replace", "move", "copy", or
   * "test".
   * https://datatracker.ietf.org/doc/html/rfc6902#section-4
   *
   * @schema KustomizationV1Beta2SpecPatchesJson6902Patch#op
   */
  readonly op: KustomizationV1Beta2SpecPatchesJson6902PatchOp;

  /**
   * Path contains the JSON-pointer value that references a location within the target document where the operation
   * is performed. The meaning of the value depends on the value of Op.
   *
   * @schema KustomizationV1Beta2SpecPatchesJson6902Patch#path
   */
  readonly path: string;

  /**
   * Value contains a valid JSON structure. The meaning of the value depends on the value of Op, and is NOT taken into
   * account by all operations.
   *
   * @schema KustomizationV1Beta2SpecPatchesJson6902Patch#value
   */
  readonly value?: any;

}

/**
 * Converts an object of type 'KustomizationV1Beta2SpecPatchesJson6902Patch' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationV1Beta2SpecPatchesJson6902Patch(obj: KustomizationV1Beta2SpecPatchesJson6902Patch | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'from': obj.from,
    'op': obj.op,
    'path': obj.path,
    'value': obj.value,
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * Target points to the resources that the patch document should be applied to.
 *
 * @schema KustomizationV1Beta2SpecPatchesJson6902Target
 */
export interface KustomizationV1Beta2SpecPatchesJson6902Target {
  /**
   * AnnotationSelector is a string that follows the label selection expression
   * https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api
   * It matches with the resource annotations.
   *
   * @schema KustomizationV1Beta2SpecPatchesJson6902Target#annotationSelector
   */
  readonly annotationSelector?: string;

  /**
   * Group is the API group to select resources from.
   * Together with Version and Kind it is capable of unambiguously identifying and/or selecting resources.
   * https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md
   *
   * @schema KustomizationV1Beta2SpecPatchesJson6902Target#group
   */
  readonly group?: string;

  /**
   * Kind of the API Group to select resources from.
   * Together with Group and Version it is capable of unambiguously
   * identifying and/or selecting resources.
   * https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md
   *
   * @schema KustomizationV1Beta2SpecPatchesJson6902Target#kind
   */
  readonly kind?: string;

  /**
   * LabelSelector is a string that follows the label selection expression
   * https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api
   * It matches with the resource labels.
   *
   * @schema KustomizationV1Beta2SpecPatchesJson6902Target#labelSelector
   */
  readonly labelSelector?: string;

  /**
   * Name to match resources with.
   *
   * @schema KustomizationV1Beta2SpecPatchesJson6902Target#name
   */
  readonly name?: string;

  /**
   * Namespace to select resources from.
   *
   * @schema KustomizationV1Beta2SpecPatchesJson6902Target#namespace
   */
  readonly namespace?: string;

  /**
   * Version of the API Group to select resources from.
   * Together with Group and Kind it is capable of unambiguously identifying and/or selecting resources.
   * https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md
   *
   * @schema KustomizationV1Beta2SpecPatchesJson6902Target#version
   */
  readonly version?: string;

}

/**
 * Converts an object of type 'KustomizationV1Beta2SpecPatchesJson6902Target' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationV1Beta2SpecPatchesJson6902Target(obj: KustomizationV1Beta2SpecPatchesJson6902Target | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'annotationSelector': obj.annotationSelector,
    'group': obj.group,
    'kind': obj.kind,
    'labelSelector': obj.labelSelector,
    'name': obj.name,
    'namespace': obj.namespace,
    'version': obj.version,
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * SubstituteReference contains a reference to a resource containing
 * the variables name and value.
 *
 * @schema KustomizationV1Beta2SpecPostBuildSubstituteFrom
 */
export interface KustomizationV1Beta2SpecPostBuildSubstituteFrom {
  /**
   * Kind of the values referent, valid values are ('Secret', 'ConfigMap').
   *
   * @schema KustomizationV1Beta2SpecPostBuildSubstituteFrom#kind
   */
  readonly kind: KustomizationV1Beta2SpecPostBuildSubstituteFromKind;

  /**
   * Name of the values referent. Should reside in the same namespace as the
   * referring resource.
   *
   * @schema KustomizationV1Beta2SpecPostBuildSubstituteFrom#name
   */
  readonly name: string;

  /**
   * Optional indicates whether the referenced resource must exist, or whether to
   * tolerate its absence. If true and the referenced resource is absent, proceed
   * as if the resource was present but empty, without any variables defined.
   *
   * @schema KustomizationV1Beta2SpecPostBuildSubstituteFrom#optional
   */
  readonly optional?: boolean;

}

/**
 * Converts an object of type 'KustomizationV1Beta2SpecPostBuildSubstituteFrom' to JSON representation.
 */
/* eslint-disable max-len, quote-props */
export function toJson_KustomizationV1Beta2SpecPostBuildSubstituteFrom(obj: KustomizationV1Beta2SpecPostBuildSubstituteFrom | undefined): Record<string, any> | undefined {
  if (obj === undefined) { return undefined; }
  const result = {
    'kind': obj.kind,
    'name': obj.name,
    'optional': obj.optional,
  };
  // filter undefined values
  return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
}
/* eslint-enable max-len, quote-props */

/**
 * Kind of the referent.
 *
 * @schema KustomizationV1Beta2SpecSourceRefKind
 */
export enum KustomizationV1Beta2SpecSourceRefKind {
  /** OCIRepository */
  OCI_REPOSITORY = "OCIRepository",
  /** GitRepository */
  GIT_REPOSITORY = "GitRepository",
  /** Bucket */
  BUCKET = "Bucket",
}

/**
 * Op indicates the operation to perform. Its value MUST be one of "add", "remove", "replace", "move", "copy", or
 * "test".
 * https://datatracker.ietf.org/doc/html/rfc6902#section-4
 *
 * @schema KustomizationV1Beta2SpecPatchesJson6902PatchOp
 */
export enum KustomizationV1Beta2SpecPatchesJson6902PatchOp {
  /** test */
  TEST = "test",
  /** remove */
  REMOVE = "remove",
  /** add */
  ADD = "add",
  /** replace */
  REPLACE = "replace",
  /** move */
  MOVE = "move",
  /** copy */
  COPY = "copy",
}

/**
 * Kind of the values referent, valid values are ('Secret', 'ConfigMap').
 *
 * @schema KustomizationV1Beta2SpecPostBuildSubstituteFromKind
 */
export enum KustomizationV1Beta2SpecPostBuildSubstituteFromKind {
  /** Secret */
  SECRET = "Secret",
  /** ConfigMap */
  CONFIG_MAP = "ConfigMap",
}