...

Source file src/edge-infra.dev/pkg/edge/api/graph/mapper/mapper_log_request.go

Documentation: edge-infra.dev/pkg/edge/api/graph/mapper

     1  package mapper
     2  
     3  import (
     4  	goext "github.com/external-secrets/external-secrets/apis/externalsecrets/v1beta1"
     5  	helmApi "github.com/fluxcd/helm-controller/api/v2"
     6  	helmRepositoryApi "github.com/fluxcd/source-controller/api/v1"
     7  	v1 "k8s.io/api/core/v1"
     8  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
     9  
    10  	"edge-infra.dev/pkg/edge/api/graph/model"
    11  	"edge-infra.dev/pkg/edge/bsl"
    12  	"edge-infra.dev/pkg/edge/ctlfish"
    13  )
    14  
    15  func GetHelmRepositories() model.LoqRequest {
    16  	return BuildLogRequest(helmRepositoryApi.HelmRepositoryKind, helmRepositoryApi.GroupVersion.Group, helmRepositoryApi.GroupVersion.Version, nil, nil)
    17  }
    18  
    19  func GetHelmReleases() model.LoqRequest {
    20  	return BuildLogRequest("HelmRelease", helmApi.GroupVersion.Group, helmApi.GroupVersion.Version, nil, nil)
    21  }
    22  
    23  func GetHelmRelease(name, ns *string) model.LoqRequest {
    24  	return BuildLogRequest("HelmRelease", helmApi.GroupVersion.Group, helmApi.GroupVersion.Version, name, ns)
    25  }
    26  
    27  func GetSecrets(name, ns *string) model.LoqRequest {
    28  	return BuildLogRequest("Secret", v1.GroupName, v1.SchemeGroupVersion.String(), name, ns)
    29  }
    30  
    31  func GetExternalSecrets(name, ns *string) model.LoqRequest {
    32  	return BuildLogRequest("ExternalSecret", goext.ExtSecretGroupVersionKind.Group, goext.ExtSecretGroupVersionKind.Version, name, ns)
    33  }
    34  
    35  func GetNamespaces() model.LoqRequest {
    36  	return BuildLogRequest("Namespace", v1.GroupName, v1.SchemeGroupVersion.String(), nil, nil)
    37  }
    38  
    39  func GetStore(name *string) model.LoqRequest {
    40  	return BuildLogRequest("Store", "edge.ncr.com", "v1alpha1", name, name)
    41  }
    42  
    43  func GetCluster(name *string) model.LoqRequest {
    44  	return BuildLogRequest("Cluster", "edge.ncr.com", "v1alpha1", name, nil)
    45  }
    46  
    47  func GetGKeCluster(name *string) model.LoqRequest {
    48  	return BuildLogRequest("GKECluster", "edge.ncr.com", "v1alpha1", name, nil)
    49  }
    50  
    51  func GetBanner(name *string) model.LoqRequest {
    52  	return BuildLogRequest("Banner", "edge.ncr.com", "v1alpha1", name, nil)
    53  }
    54  
    55  func GetStoreStatus(cid string) model.LoqRequest {
    56  	return BuildLogRequest("StoreStatus", "edge.ncr.com", "v1", &cid, nil)
    57  }
    58  
    59  func GetBSLInfoConfigMap() model.LoqRequest {
    60  	name := bsl.BSLInfoConfigMapName
    61  	ns := metav1.NamespacePublic
    62  	return BuildLogRequest("ConfigMap", v1.GroupName, v1.SchemeGroupVersion.String(), &name, &ns)
    63  }
    64  
    65  func GetClusterStatus() model.LoqRequest {
    66  	name := ctlfish.ClusterStatusName
    67  	namespace := ctlfish.ClusterStatusNamespace
    68  	return BuildLogRequest(ctlfish.ClusterStatusKind, ctlfish.ClusterStatusGroup, ctlfish.ClusterStatusVersion, &name, &namespace)
    69  }
    70  
    71  func GetNodes() model.LoqRequest {
    72  	return BuildLogRequest("Node", "", "v1", nil, nil)
    73  }
    74  
    75  func BuildLogRequest(kind, group, version string, name, namespace *string) model.LoqRequest {
    76  	return model.LoqRequest{
    77  		Kind:             kind,
    78  		Group:            group,
    79  		Version:          version,
    80  		Name:             name,
    81  		Namespace:        namespace,
    82  		GetClusterEdgeID: false,
    83  	}
    84  }
    85  

View as plain text