// Copyright (c) 2023 Volvo Car Corporation
// SPDX-License-Identifier: Apache-2.0

// Code generated by lingon. EDIT AS MUCH AS YOU LIKE.

package promstack

import (
	"context"
	"errors"
	"os"
	"os/exec"

	"github.com/golingon/lingon/pkg/kube"
	prometheusoperatorprometheusoperatorpkgapismonitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
	admissionregistrationv1 "k8s.io/api/admissionregistration/v1"
	appsv1 "k8s.io/api/apps/v1"
	batchv1 "k8s.io/api/batch/v1"
	corev1 "k8s.io/api/core/v1"
	rbacv1 "k8s.io/api/rbac/v1"
)

// validate the struct implements the interface
var _ kube.Exporter = (*Kubeprometheusstack)(nil)

// Kubeprometheusstack contains kubernetes manifests
type Kubeprometheusstack struct {
	kube.App

	AlertmanagerKubePromtheusStackKubeAlertmanagerSecrets                 *corev1.Secret
	KubePromtheusStackGrafanaCM                                           *corev1.ConfigMap
	KubePromtheusStackGrafanaCR                                           *rbacv1.ClusterRole
	KubePromtheusStackGrafanaCRB                                          *rbacv1.ClusterRoleBinding
	KubePromtheusStackGrafanaConfigDashboardsCM                           *corev1.ConfigMap
	KubePromtheusStackGrafanaDeploy                                       *appsv1.Deployment
	KubePromtheusStackGrafanaRB                                           *rbacv1.RoleBinding
	KubePromtheusStackGrafanaRole                                         *rbacv1.Role
	KubePromtheusStackGrafanaSA                                           *corev1.ServiceAccount
	KubePromtheusStackGrafanaSVC                                          *corev1.Service
	KubePromtheusStackGrafanaSecrets                                      *corev1.Secret
	KubePromtheusStackGrafanaServiceMonitor                               *prometheusoperatorprometheusoperatorpkgapismonitoringv1.ServiceMonitor
	KubePromtheusStackGrafanaTestCM                                       *corev1.ConfigMap
	KubePromtheusStackGrafanaTestPO                                       *corev1.Pod
	KubePromtheusStackGrafanaTestSA                                       *corev1.ServiceAccount
	KubePromtheusStackKubeAdmissionCR                                     *rbacv1.ClusterRole
	KubePromtheusStackKubeAdmissionCRB                                    *rbacv1.ClusterRoleBinding
	KubePromtheusStackKubeAdmissionCreateJOBS                             *batchv1.Job
	KubePromtheusStackKubeAdmissionMutatingwebhookconfigurations          *admissionregistrationv1.MutatingWebhookConfiguration
	KubePromtheusStackKubeAdmissionPatchJOBS                              *batchv1.Job
	KubePromtheusStackKubeAdmissionRB                                     *rbacv1.RoleBinding
	KubePromtheusStackKubeAdmissionRole                                   *rbacv1.Role
	KubePromtheusStackKubeAdmissionSA                                     *corev1.ServiceAccount
	KubePromtheusStackKubeAdmissionValidatingwebhookconfigurations        *admissionregistrationv1.ValidatingWebhookConfiguration
	KubePromtheusStackKubeAlertmanagerAlertmanager                        *prometheusoperatorprometheusoperatorpkgapismonitoringv1.Alertmanager
	KubePromtheusStackKubeAlertmanagerOverviewCM                          *corev1.ConfigMap
	KubePromtheusStackKubeAlertmanagerRulesPrometheusRule                 *prometheusoperatorprometheusoperatorpkgapismonitoringv1.PrometheusRule
	KubePromtheusStackKubeAlertmanagerSA                                  *corev1.ServiceAccount
	KubePromtheusStackKubeAlertmanagerSVC                                 *corev1.Service
	KubePromtheusStackKubeAlertmanagerServiceMonitor                      *prometheusoperatorprometheusoperatorpkgapismonitoringv1.ServiceMonitor
	KubePromtheusStackKubeApiserverCM                                     *corev1.ConfigMap
	KubePromtheusStackKubeApiserverServiceMonitor                         *prometheusoperatorprometheusoperatorpkgapismonitoringv1.ServiceMonitor
	KubePromtheusStackKubeClusterTotalCM                                  *corev1.ConfigMap
	KubePromtheusStackKubeConfigReloadersPrometheusRule                   *prometheusoperatorprometheusoperatorpkgapismonitoringv1.PrometheusRule
	KubePromtheusStackKubeControllerManagerCM                             *corev1.ConfigMap
	KubePromtheusStackKubeCorednsSVC                                      *corev1.Service
	KubePromtheusStackKubeCorednsServiceMonitor                           *prometheusoperatorprometheusoperatorpkgapismonitoringv1.ServiceMonitor
	KubePromtheusStackKubeEtcdCM                                          *corev1.ConfigMap
	KubePromtheusStackKubeEtcdPrometheusRule                              *prometheusoperatorprometheusoperatorpkgapismonitoringv1.PrometheusRule
	KubePromtheusStackKubeGeneralRulesPrometheusRule                      *prometheusoperatorprometheusoperatorpkgapismonitoringv1.PrometheusRule
	KubePromtheusStackKubeGrafanaDatasourceCM                             *corev1.ConfigMap
	KubePromtheusStackKubeGrafanaOverviewCM                               *corev1.ConfigMap
	KubePromtheusStackKubeK8SCorednsCM                                    *corev1.ConfigMap
	KubePromtheusStackKubeK8SResourcesClusterCM                           *corev1.ConfigMap
	KubePromtheusStackKubeK8SResourcesMulticlusterCM                      *corev1.ConfigMap
	KubePromtheusStackKubeK8SResourcesNamespaceCM                         *corev1.ConfigMap
	KubePromtheusStackKubeK8SResourcesNodeCM                              *corev1.ConfigMap
	KubePromtheusStackKubeK8SResourcesPodCM                               *corev1.ConfigMap
	KubePromtheusStackKubeK8SResourcesWorkloadCM                          *corev1.ConfigMap
	KubePromtheusStackKubeK8SResourcesWorkloadsNamespaceCM                *corev1.ConfigMap
	KubePromtheusStackKubeK8SRulesPrometheusRule                          *prometheusoperatorprometheusoperatorpkgapismonitoringv1.PrometheusRule
	KubePromtheusStackKubeKubeApiserverAvailabilityRulesPrometheusRule    *prometheusoperatorprometheusoperatorpkgapismonitoringv1.PrometheusRule
	KubePromtheusStackKubeKubeApiserverBurnrateRulesPrometheusRule        *prometheusoperatorprometheusoperatorpkgapismonitoringv1.PrometheusRule
	KubePromtheusStackKubeKubeApiserverHistogramRulesPrometheusRule       *prometheusoperatorprometheusoperatorpkgapismonitoringv1.PrometheusRule
	KubePromtheusStackKubeKubeApiserverSlosPrometheusRule                 *prometheusoperatorprometheusoperatorpkgapismonitoringv1.PrometheusRule
	KubePromtheusStackKubeKubeControllerManagerSVC                        *corev1.Service
	KubePromtheusStackKubeKubeControllerManagerServiceMonitor             *prometheusoperatorprometheusoperatorpkgapismonitoringv1.ServiceMonitor
	KubePromtheusStackKubeKubeEtcdSVC                                     *corev1.Service
	KubePromtheusStackKubeKubeEtcdServiceMonitor                          *prometheusoperatorprometheusoperatorpkgapismonitoringv1.ServiceMonitor
	KubePromtheusStackKubeKubePrometheusGeneralRulesPrometheusRule        *prometheusoperatorprometheusoperatorpkgapismonitoringv1.PrometheusRule
	KubePromtheusStackKubeKubePrometheusNodeRecordingRulesPrometheusRule  *prometheusoperatorprometheusoperatorpkgapismonitoringv1.PrometheusRule
	KubePromtheusStackKubeKubeProxySVC                                    *corev1.Service
	KubePromtheusStackKubeKubeProxyServiceMonitor                         *prometheusoperatorprometheusoperatorpkgapismonitoringv1.ServiceMonitor
	KubePromtheusStackKubeKubeSchedulerRulesPrometheusRule                *prometheusoperatorprometheusoperatorpkgapismonitoringv1.PrometheusRule
	KubePromtheusStackKubeKubeSchedulerSVC                                *corev1.Service
	KubePromtheusStackKubeKubeSchedulerServiceMonitor                     *prometheusoperatorprometheusoperatorpkgapismonitoringv1.ServiceMonitor
	KubePromtheusStackKubeKubeStateMetricsPrometheusRule                  *prometheusoperatorprometheusoperatorpkgapismonitoringv1.PrometheusRule
	KubePromtheusStackKubeKubeletCM                                       *corev1.ConfigMap
	KubePromtheusStackKubeKubeletRulesPrometheusRule                      *prometheusoperatorprometheusoperatorpkgapismonitoringv1.PrometheusRule
	KubePromtheusStackKubeKubeletServiceMonitor                           *prometheusoperatorprometheusoperatorpkgapismonitoringv1.ServiceMonitor
	KubePromtheusStackKubeKubernetesAppsPrometheusRule                    *prometheusoperatorprometheusoperatorpkgapismonitoringv1.PrometheusRule
	KubePromtheusStackKubeKubernetesResourcesPrometheusRule               *prometheusoperatorprometheusoperatorpkgapismonitoringv1.PrometheusRule
	KubePromtheusStackKubeKubernetesStoragePrometheusRule                 *prometheusoperatorprometheusoperatorpkgapismonitoringv1.PrometheusRule
	KubePromtheusStackKubeKubernetesSystemApiserverPrometheusRule         *prometheusoperatorprometheusoperatorpkgapismonitoringv1.PrometheusRule
	KubePromtheusStackKubeKubernetesSystemControllerManagerPrometheusRule *prometheusoperatorprometheusoperatorpkgapismonitoringv1.PrometheusRule
	KubePromtheusStackKubeKubernetesSystemKubeProxyPrometheusRule         *prometheusoperatorprometheusoperatorpkgapismonitoringv1.PrometheusRule
	KubePromtheusStackKubeKubernetesSystemKubeletPrometheusRule           *prometheusoperatorprometheusoperatorpkgapismonitoringv1.PrometheusRule
	KubePromtheusStackKubeKubernetesSystemPrometheusRule                  *prometheusoperatorprometheusoperatorpkgapismonitoringv1.PrometheusRule
	KubePromtheusStackKubeKubernetesSystemSchedulerPrometheusRule         *prometheusoperatorprometheusoperatorpkgapismonitoringv1.PrometheusRule
	KubePromtheusStackKubeNamespaceByPodCM                                *corev1.ConfigMap
	KubePromtheusStackKubeNamespaceByWorkloadCM                           *corev1.ConfigMap
	KubePromtheusStackKubeNodeClusterRsrcUseCM                            *corev1.ConfigMap
	KubePromtheusStackKubeNodeExporterPrometheusRule                      *prometheusoperatorprometheusoperatorpkgapismonitoringv1.PrometheusRule
	KubePromtheusStackKubeNodeExporterRulesPrometheusRule                 *prometheusoperatorprometheusoperatorpkgapismonitoringv1.PrometheusRule
	KubePromtheusStackKubeNodeNetworkPrometheusRule                       *prometheusoperatorprometheusoperatorpkgapismonitoringv1.PrometheusRule
	KubePromtheusStackKubeNodeRsrcUseCM                                   *corev1.ConfigMap
	KubePromtheusStackKubeNodeRulesPrometheusRule                         *prometheusoperatorprometheusoperatorpkgapismonitoringv1.PrometheusRule
	KubePromtheusStackKubeNodesCM                                         *corev1.ConfigMap
	KubePromtheusStackKubeNodesDarwinCM                                   *corev1.ConfigMap
	KubePromtheusStackKubeOperatorCR                                      *rbacv1.ClusterRole
	KubePromtheusStackKubeOperatorCRB                                     *rbacv1.ClusterRoleBinding
	KubePromtheusStackKubeOperatorDeploy                                  *appsv1.Deployment
	KubePromtheusStackKubeOperatorSA                                      *corev1.ServiceAccount
	KubePromtheusStackKubeOperatorSVC                                     *corev1.Service
	KubePromtheusStackKubeOperatorServiceMonitor                          *prometheusoperatorprometheusoperatorpkgapismonitoringv1.ServiceMonitor
	KubePromtheusStackKubePersistentvolumesusageCM                        *corev1.ConfigMap
	KubePromtheusStackKubePodTotalCM                                      *corev1.ConfigMap
	KubePromtheusStackKubePrometheusCM                                    *corev1.ConfigMap
	KubePromtheusStackKubePrometheusCR                                    *rbacv1.ClusterRole
	KubePromtheusStackKubePrometheusCRB                                   *rbacv1.ClusterRoleBinding
	KubePromtheusStackKubePrometheusOperatorPrometheusRule                *prometheusoperatorprometheusoperatorpkgapismonitoringv1.PrometheusRule
	KubePromtheusStackKubePrometheusPrometheus                            *prometheusoperatorprometheusoperatorpkgapismonitoringv1.Prometheus
	KubePromtheusStackKubePrometheusPrometheusRule                        *prometheusoperatorprometheusoperatorpkgapismonitoringv1.PrometheusRule
	KubePromtheusStackKubePrometheusSA                                    *corev1.ServiceAccount
	KubePromtheusStackKubePrometheusSVC                                   *corev1.Service
	KubePromtheusStackKubePrometheusServiceMonitor                        *prometheusoperatorprometheusoperatorpkgapismonitoringv1.ServiceMonitor
	KubePromtheusStackKubeProxyCM                                         *corev1.ConfigMap
	KubePromtheusStackKubeSchedulerCM                                     *corev1.ConfigMap
	KubePromtheusStackKubeStateMetricsCR                                  *rbacv1.ClusterRole
	KubePromtheusStackKubeStateMetricsCRB                                 *rbacv1.ClusterRoleBinding
	KubePromtheusStackKubeStateMetricsDeploy                              *appsv1.Deployment
	KubePromtheusStackKubeStateMetricsSA                                  *corev1.ServiceAccount
	KubePromtheusStackKubeStateMetricsSVC                                 *corev1.Service
	KubePromtheusStackKubeStateMetricsServiceMonitor                      *prometheusoperatorprometheusoperatorpkgapismonitoringv1.ServiceMonitor
	KubePromtheusStackKubeWorkloadTotalCM                                 *corev1.ConfigMap
	KubePromtheusStackPrometheusNodeExporterDS                            *appsv1.DaemonSet
	KubePromtheusStackPrometheusNodeExporterSA                            *corev1.ServiceAccount
	KubePromtheusStackPrometheusNodeExporterSVC                           *corev1.Service
	KubePromtheusStackPrometheusNodeExporterServiceMonitor                *prometheusoperatorprometheusoperatorpkgapismonitoringv1.ServiceMonitor
}

// New creates a new Kubeprometheusstack
func New() *Kubeprometheusstack {
	return &Kubeprometheusstack{
		AlertmanagerKubePromtheusStackKubeAlertmanagerSecrets:                 AlertmanagerKubePromtheusStackKubeAlertmanagerSecrets,
		KubePromtheusStackGrafanaCM:                                           KubePromtheusStackGrafanaCM,
		KubePromtheusStackGrafanaCR:                                           KubePromtheusStackGrafanaCR,
		KubePromtheusStackGrafanaCRB:                                          KubePromtheusStackGrafanaCRB,
		KubePromtheusStackGrafanaConfigDashboardsCM:                           KubePromtheusStackGrafanaConfigDashboardsCM,
		KubePromtheusStackGrafanaDeploy:                                       KubePromtheusStackGrafanaDeploy,
		KubePromtheusStackGrafanaRB:                                           KubePromtheusStackGrafanaRB,
		KubePromtheusStackGrafanaRole:                                         KubePromtheusStackGrafanaRole,
		KubePromtheusStackGrafanaSA:                                           KubePromtheusStackGrafanaSA,
		KubePromtheusStackGrafanaSVC:                                          KubePromtheusStackGrafanaSVC,
		KubePromtheusStackGrafanaSecrets:                                      KubePromtheusStackGrafanaSecrets,
		KubePromtheusStackGrafanaServiceMonitor:                               KubePromtheusStackGrafanaServiceMonitor,
		KubePromtheusStackGrafanaTestCM:                                       KubePromtheusStackGrafanaTestCM,
		KubePromtheusStackGrafanaTestPO:                                       KubePromtheusStackGrafanaTestPO,
		KubePromtheusStackGrafanaTestSA:                                       KubePromtheusStackGrafanaTestSA,
		KubePromtheusStackKubeAdmissionCR:                                     KubePromtheusStackKubeAdmissionCR,
		KubePromtheusStackKubeAdmissionCRB:                                    KubePromtheusStackKubeAdmissionCRB,
		KubePromtheusStackKubeAdmissionCreateJOBS:                             KubePromtheusStackKubeAdmissionCreateJOBS,
		KubePromtheusStackKubeAdmissionMutatingwebhookconfigurations:          KubePromtheusStackKubeAdmissionMutatingwebhookconfigurations,
		KubePromtheusStackKubeAdmissionPatchJOBS:                              KubePromtheusStackKubeAdmissionPatchJOBS,
		KubePromtheusStackKubeAdmissionRB:                                     KubePromtheusStackKubeAdmissionRB,
		KubePromtheusStackKubeAdmissionRole:                                   KubePromtheusStackKubeAdmissionRole,
		KubePromtheusStackKubeAdmissionSA:                                     KubePromtheusStackKubeAdmissionSA,
		KubePromtheusStackKubeAdmissionValidatingwebhookconfigurations:        KubePromtheusStackKubeAdmissionValidatingwebhookconfigurations,
		KubePromtheusStackKubeAlertmanagerAlertmanager:                        KubePromtheusStackKubeAlertmanagerAlertmanager,
		KubePromtheusStackKubeAlertmanagerOverviewCM:                          KubePromtheusStackKubeAlertmanagerOverviewCM,
		KubePromtheusStackKubeAlertmanagerRulesPrometheusRule:                 KubePromtheusStackKubeAlertmanagerRulesPrometheusRule,
		KubePromtheusStackKubeAlertmanagerSA:                                  KubePromtheusStackKubeAlertmanagerSA,
		KubePromtheusStackKubeAlertmanagerSVC:                                 KubePromtheusStackKubeAlertmanagerSVC,
		KubePromtheusStackKubeAlertmanagerServiceMonitor:                      KubePromtheusStackKubeAlertmanagerServiceMonitor,
		KubePromtheusStackKubeApiserverCM:                                     KubePromtheusStackKubeApiserverCM,
		KubePromtheusStackKubeApiserverServiceMonitor:                         KubePromtheusStackKubeApiserverServiceMonitor,
		KubePromtheusStackKubeClusterTotalCM:                                  KubePromtheusStackKubeClusterTotalCM,
		KubePromtheusStackKubeConfigReloadersPrometheusRule:                   KubePromtheusStackKubeConfigReloadersPrometheusRule,
		KubePromtheusStackKubeControllerManagerCM:                             KubePromtheusStackKubeControllerManagerCM,
		KubePromtheusStackKubeCorednsSVC:                                      KubePromtheusStackKubeCorednsSVC,
		KubePromtheusStackKubeCorednsServiceMonitor:                           KubePromtheusStackKubeCorednsServiceMonitor,
		KubePromtheusStackKubeEtcdCM:                                          KubePromtheusStackKubeEtcdCM,
		KubePromtheusStackKubeEtcdPrometheusRule:                              KubePromtheusStackKubeEtcdPrometheusRule,
		KubePromtheusStackKubeGeneralRulesPrometheusRule:                      KubePromtheusStackKubeGeneralRulesPrometheusRule,
		KubePromtheusStackKubeGrafanaDatasourceCM:                             KubePromtheusStackKubeGrafanaDatasourceCM,
		KubePromtheusStackKubeGrafanaOverviewCM:                               KubePromtheusStackKubeGrafanaOverviewCM,
		KubePromtheusStackKubeK8SCorednsCM:                                    KubePromtheusStackKubeK8SCorednsCM,
		KubePromtheusStackKubeK8SResourcesClusterCM:                           KubePromtheusStackKubeK8SResourcesClusterCM,
		KubePromtheusStackKubeK8SResourcesMulticlusterCM:                      KubePromtheusStackKubeK8SResourcesMulticlusterCM,
		KubePromtheusStackKubeK8SResourcesNamespaceCM:                         KubePromtheusStackKubeK8SResourcesNamespaceCM,
		KubePromtheusStackKubeK8SResourcesNodeCM:                              KubePromtheusStackKubeK8SResourcesNodeCM,
		KubePromtheusStackKubeK8SResourcesPodCM:                               KubePromtheusStackKubeK8SResourcesPodCM,
		KubePromtheusStackKubeK8SResourcesWorkloadCM:                          KubePromtheusStackKubeK8SResourcesWorkloadCM,
		KubePromtheusStackKubeK8SResourcesWorkloadsNamespaceCM:                KubePromtheusStackKubeK8SResourcesWorkloadsNamespaceCM,
		KubePromtheusStackKubeK8SRulesPrometheusRule:                          KubePromtheusStackKubeK8SRulesPrometheusRule,
		KubePromtheusStackKubeKubeApiserverAvailabilityRulesPrometheusRule:    KubePromtheusStackKubeKubeApiserverAvailabilityRulesPrometheusRule,
		KubePromtheusStackKubeKubeApiserverBurnrateRulesPrometheusRule:        KubePromtheusStackKubeKubeApiserverBurnrateRulesPrometheusRule,
		KubePromtheusStackKubeKubeApiserverHistogramRulesPrometheusRule:       KubePromtheusStackKubeKubeApiserverHistogramRulesPrometheusRule,
		KubePromtheusStackKubeKubeApiserverSlosPrometheusRule:                 KubePromtheusStackKubeKubeApiserverSlosPrometheusRule,
		KubePromtheusStackKubeKubeControllerManagerSVC:                        KubePromtheusStackKubeKubeControllerManagerSVC,
		KubePromtheusStackKubeKubeControllerManagerServiceMonitor:             KubePromtheusStackKubeKubeControllerManagerServiceMonitor,
		KubePromtheusStackKubeKubeEtcdSVC:                                     KubePromtheusStackKubeKubeEtcdSVC,
		KubePromtheusStackKubeKubeEtcdServiceMonitor:                          KubePromtheusStackKubeKubeEtcdServiceMonitor,
		KubePromtheusStackKubeKubePrometheusGeneralRulesPrometheusRule:        KubePromtheusStackKubeKubePrometheusGeneralRulesPrometheusRule,
		KubePromtheusStackKubeKubePrometheusNodeRecordingRulesPrometheusRule:  KubePromtheusStackKubeKubePrometheusNodeRecordingRulesPrometheusRule,
		KubePromtheusStackKubeKubeProxySVC:                                    KubePromtheusStackKubeKubeProxySVC,
		KubePromtheusStackKubeKubeProxyServiceMonitor:                         KubePromtheusStackKubeKubeProxyServiceMonitor,
		KubePromtheusStackKubeKubeSchedulerRulesPrometheusRule:                KubePromtheusStackKubeKubeSchedulerRulesPrometheusRule,
		KubePromtheusStackKubeKubeSchedulerSVC:                                KubePromtheusStackKubeKubeSchedulerSVC,
		KubePromtheusStackKubeKubeSchedulerServiceMonitor:                     KubePromtheusStackKubeKubeSchedulerServiceMonitor,
		KubePromtheusStackKubeKubeStateMetricsPrometheusRule:                  KubePromtheusStackKubeKubeStateMetricsPrometheusRule,
		KubePromtheusStackKubeKubeletCM:                                       KubePromtheusStackKubeKubeletCM,
		KubePromtheusStackKubeKubeletRulesPrometheusRule:                      KubePromtheusStackKubeKubeletRulesPrometheusRule,
		KubePromtheusStackKubeKubeletServiceMonitor:                           KubePromtheusStackKubeKubeletServiceMonitor,
		KubePromtheusStackKubeKubernetesAppsPrometheusRule:                    KubePromtheusStackKubeKubernetesAppsPrometheusRule,
		KubePromtheusStackKubeKubernetesResourcesPrometheusRule:               KubePromtheusStackKubeKubernetesResourcesPrometheusRule,
		KubePromtheusStackKubeKubernetesStoragePrometheusRule:                 KubePromtheusStackKubeKubernetesStoragePrometheusRule,
		KubePromtheusStackKubeKubernetesSystemApiserverPrometheusRule:         KubePromtheusStackKubeKubernetesSystemApiserverPrometheusRule,
		KubePromtheusStackKubeKubernetesSystemControllerManagerPrometheusRule: KubePromtheusStackKubeKubernetesSystemControllerManagerPrometheusRule,
		KubePromtheusStackKubeKubernetesSystemKubeProxyPrometheusRule:         KubePromtheusStackKubeKubernetesSystemKubeProxyPrometheusRule,
		KubePromtheusStackKubeKubernetesSystemKubeletPrometheusRule:           KubePromtheusStackKubeKubernetesSystemKubeletPrometheusRule,
		KubePromtheusStackKubeKubernetesSystemPrometheusRule:                  KubePromtheusStackKubeKubernetesSystemPrometheusRule,
		KubePromtheusStackKubeKubernetesSystemSchedulerPrometheusRule:         KubePromtheusStackKubeKubernetesSystemSchedulerPrometheusRule,
		KubePromtheusStackKubeNamespaceByPodCM:                                KubePromtheusStackKubeNamespaceByPodCM,
		KubePromtheusStackKubeNamespaceByWorkloadCM:                           KubePromtheusStackKubeNamespaceByWorkloadCM,
		KubePromtheusStackKubeNodeClusterRsrcUseCM:                            KubePromtheusStackKubeNodeClusterRsrcUseCM,
		KubePromtheusStackKubeNodeExporterPrometheusRule:                      KubePromtheusStackKubeNodeExporterPrometheusRule,
		KubePromtheusStackKubeNodeExporterRulesPrometheusRule:                 KubePromtheusStackKubeNodeExporterRulesPrometheusRule,
		KubePromtheusStackKubeNodeNetworkPrometheusRule:                       KubePromtheusStackKubeNodeNetworkPrometheusRule,
		KubePromtheusStackKubeNodeRsrcUseCM:                                   KubePromtheusStackKubeNodeRsrcUseCM,
		KubePromtheusStackKubeNodeRulesPrometheusRule:                         KubePromtheusStackKubeNodeRulesPrometheusRule,
		KubePromtheusStackKubeNodesCM:                                         KubePromtheusStackKubeNodesCM,
		KubePromtheusStackKubeNodesDarwinCM:                                   KubePromtheusStackKubeNodesDarwinCM,
		KubePromtheusStackKubeOperatorCR:                                      KubePromtheusStackKubeOperatorCR,
		KubePromtheusStackKubeOperatorCRB:                                     KubePromtheusStackKubeOperatorCRB,
		KubePromtheusStackKubeOperatorDeploy:                                  KubePromtheusStackKubeOperatorDeploy,
		KubePromtheusStackKubeOperatorSA:                                      KubePromtheusStackKubeOperatorSA,
		KubePromtheusStackKubeOperatorSVC:                                     KubePromtheusStackKubeOperatorSVC,
		KubePromtheusStackKubeOperatorServiceMonitor:                          KubePromtheusStackKubeOperatorServiceMonitor,
		KubePromtheusStackKubePersistentvolumesusageCM:                        KubePromtheusStackKubePersistentvolumesusageCM,
		KubePromtheusStackKubePodTotalCM:                                      KubePromtheusStackKubePodTotalCM,
		KubePromtheusStackKubePrometheusCM:                                    KubePromtheusStackKubePrometheusCM,
		KubePromtheusStackKubePrometheusCR:                                    KubePromtheusStackKubePrometheusCR,
		KubePromtheusStackKubePrometheusCRB:                                   KubePromtheusStackKubePrometheusCRB,
		KubePromtheusStackKubePrometheusOperatorPrometheusRule:                KubePromtheusStackKubePrometheusOperatorPrometheusRule,
		KubePromtheusStackKubePrometheusPrometheus:                            KubePromtheusStackKubePrometheusPrometheus,
		KubePromtheusStackKubePrometheusPrometheusRule:                        KubePromtheusStackKubePrometheusPrometheusRule,
		KubePromtheusStackKubePrometheusSA:                                    KubePromtheusStackKubePrometheusSA,
		KubePromtheusStackKubePrometheusSVC:                                   KubePromtheusStackKubePrometheusSVC,
		KubePromtheusStackKubePrometheusServiceMonitor:                        KubePromtheusStackKubePrometheusServiceMonitor,
		KubePromtheusStackKubeProxyCM:                                         KubePromtheusStackKubeProxyCM,
		KubePromtheusStackKubeSchedulerCM:                                     KubePromtheusStackKubeSchedulerCM,
		KubePromtheusStackKubeStateMetricsCR:                                  KubePromtheusStackKubeStateMetricsCR,
		KubePromtheusStackKubeStateMetricsCRB:                                 KubePromtheusStackKubeStateMetricsCRB,
		KubePromtheusStackKubeStateMetricsDeploy:                              KubePromtheusStackKubeStateMetricsDeploy,
		KubePromtheusStackKubeStateMetricsSA:                                  KubePromtheusStackKubeStateMetricsSA,
		KubePromtheusStackKubeStateMetricsSVC:                                 KubePromtheusStackKubeStateMetricsSVC,
		KubePromtheusStackKubeStateMetricsServiceMonitor:                      KubePromtheusStackKubeStateMetricsServiceMonitor,
		KubePromtheusStackKubeWorkloadTotalCM:                                 KubePromtheusStackKubeWorkloadTotalCM,
		KubePromtheusStackPrometheusNodeExporterDS:                            KubePromtheusStackPrometheusNodeExporterDS,
		KubePromtheusStackPrometheusNodeExporterSA:                            KubePromtheusStackPrometheusNodeExporterSA,
		KubePromtheusStackPrometheusNodeExporterSVC:                           KubePromtheusStackPrometheusNodeExporterSVC,
		KubePromtheusStackPrometheusNodeExporterServiceMonitor:                KubePromtheusStackPrometheusNodeExporterServiceMonitor,
	}
}

// Apply applies the kubernetes objects to the cluster
func (a *Kubeprometheusstack) Apply(ctx context.Context) error {
	return Apply(ctx, a)
}

// Export exports the kubernetes objects to YAML files in the given directory
func (a *Kubeprometheusstack) Export(dir string) error {
	return kube.Export(a, kube.WithExportOutputDirectory(dir))
}

// Apply applies the kubernetes objects contained in Exporter to the cluster
func Apply(ctx context.Context, km kube.Exporter) error {
	cmd := exec.CommandContext(ctx, "kubectl", "apply", "-f", "-")
	cmd.Env = os.Environ()        // inherit environment in case we need to use kubectl from a container
	stdin, err := cmd.StdinPipe() // pipe to pass data to kubectl
	if err != nil {
		return err
	}

	cmd.Stdout = os.Stdout
	cmd.Stderr = os.Stderr

	go func() {
		defer func() {
			err = errors.Join(err, stdin.Close())
		}()
		if errEW := kube.Export(
			km,
			kube.WithExportWriter(stdin),
			kube.WithExportAsSingleFile("stdin"),
		); errEW != nil {
			err = errors.Join(err, errEW)
		}
	}()

	if errS := cmd.Start(); errS != nil {
		return errors.Join(err, errS)
	}

	// waits for the command to exit and waits for any copying
	// to stdin or copying from stdout or stderr to complete
	return errors.Join(err, cmd.Wait())
}

// P converts T to *T, useful for basic types
func P[T any](t T) *T {
	return &t
}
