| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288 |
- package types
- import (
- "github.com/porter-dev/porter/internal/kubernetes/prometheus"
- )
- const (
- URLParamCandidateID URLParam = "candidate_id"
- URLParamNodeName URLParam = "node_name"
- )
- type Cluster struct {
- ID uint `json:"id"`
- // The project that this integration belongs to
- ProjectID uint `json:"project_id"`
- // Name of the cluster
- Name string `json:"name"`
- // Server endpoint for the cluster
- Server string `json:"server"`
- // The integration service for this cluster
- Service ClusterService `json:"service"`
- // The infra id, if cluster was provisioned with Porter
- InfraID uint `json:"infra_id"`
- // (optional) The aws integration id, if available
- AWSIntegrationID uint `json:"aws_integration_id"`
- // (optional) The aws cluster id, if available
- AWSClusterID string `json:"aws_cluster_id,omitempty"`
- }
- type ClusterCandidate struct {
- ID uint `json:"id"`
- // The project that this integration belongs to
- ProjectID uint `json:"project_id"`
- // CreatedClusterID is the ID of the cluster that's eventually
- // created
- CreatedClusterID uint `json:"created_cluster_id"`
- // Name of the cluster
- Name string `json:"name"`
- // Server endpoint for the cluster
- Server string `json:"server"`
- // Name of the context that this was created from, if it exists
- ContextName string `json:"context_name"`
- // Resolvers are the list of resolvers: once all resolvers are "resolved," the
- // cluster will be created
- Resolvers []ClusterResolver `json:"resolvers"`
- // The best-guess for the AWSClusterID, which is required by aws auth mechanisms
- // See https://github.com/kubernetes-sigs/aws-iam-authenticator#what-is-a-cluster-id
- AWSClusterIDGuess string `json:"aws_cluster_id_guess"`
- }
- type ClusterResolver struct {
- ID uint `json:"id"`
- // The ClusterCandidate that this is resolving
- ClusterCandidateID uint `json:"cluster_candidate_id"`
- // One of the ClusterResolverNames
- Name ClusterResolverName `json:"name"`
- // Resolved is true if this has been resolved, false otherwise
- Resolved bool `json:"resolved"`
- // Docs is a link to documentation that helps resolve this manually
- Docs string `json:"docs"`
- // Fields is a list of fields that must be sent with the resolving request
- Fields string `json:"fields"`
- // Data is additional data for resolving the action, for example a file name,
- // context name, etc
- Data ClusterResolverData `json:"data,omitempty"`
- }
- // ClusterResolverAll is a helper type that contains the fields for
- // all possible resolvers, so that raw bytes can be unmarshaled in a single
- // read
- type ClusterResolverAll struct {
- ClusterCAData string `json:"cluster_ca_data,omitempty"`
- ClusterHostname string `json:"cluster_hostname,omitempty"`
- ClientCertData string `json:"client_cert_data,omitempty"`
- ClientKeyData string `json:"client_key_data,omitempty"`
- OIDCIssuerCAData string `json:"oidc_idp_issuer_ca_data,omitempty"`
- TokenData string `json:"token_data,omitempty"`
- GCPKeyData string `json:"gcp_key_data,omitempty"`
- AWSAccessKeyID string `json:"aws_access_key_id"`
- AWSSecretAccessKey string `json:"aws_secret_access_key"`
- AWSClusterID string `json:"aws_cluster_id"`
- }
- // ClusterResolverInfo contains the information for actions to be
- // performed in order to initialize a cluster
- type ClusterResolverInfo struct {
- // Docs is a link to documentation that helps resolve this manually
- Docs string `json:"docs"`
- // a comma-separated list of required fields to send in an action request
- Fields string `json:"fields"`
- }
- // ClusterResolverInfos is a map of the information for actions to be
- // performed in order to initialize a cluster
- var ClusterResolverInfos = map[ClusterResolverName]ClusterResolverInfo{
- ClusterCAData: {
- Docs: "https://github.com/porter-dev/porter",
- Fields: "cluster_ca_data",
- },
- ClusterLocalhost: {
- Docs: "https://github.com/porter-dev/porter",
- Fields: "cluster_hostname",
- },
- ClientCertData: {
- Docs: "https://github.com/porter-dev/porter",
- Fields: "client_cert_data",
- },
- ClientKeyData: {
- Docs: "https://github.com/porter-dev/porter",
- Fields: "client_key_data",
- },
- OIDCIssuerData: {
- Docs: "https://github.com/porter-dev/porter",
- Fields: "oidc_idp_issuer_ca_data",
- },
- TokenData: {
- Docs: "https://github.com/porter-dev/porter",
- Fields: "token_data",
- },
- GCPKeyData: {
- Docs: "https://github.com/porter-dev/porter",
- Fields: "gcp_key_data",
- },
- AWSData: {
- Docs: "https://github.com/porter-dev/porter",
- Fields: "aws_access_key_id,aws_secret_access_key,aws_cluster_id",
- },
- }
- // ClusterResolverData is a map of key names to fields, which gets marshaled from
- // the raw JSON bytes stored in the ClusterResolver
- type ClusterResolverData map[string]string
- type ClusterGetResponse struct {
- *Cluster
- // The NGINX Ingress IP to access the cluster
- IngressIP string `json:"ingress_ip"`
- // Error displayed in case couldn't get the IP
- IngressError error `json:"ingress_error"`
- }
- type ClusterService string
- const (
- EKS ClusterService = "eks"
- DOKS ClusterService = "doks"
- GKE ClusterService = "gke"
- Kube ClusterService = "kube"
- AKS ClusterService = "aks"
- )
- // ClusterResolverName is the name for a cluster resolve
- type ClusterResolverName string
- // Options for the cluster resolver names
- const (
- ClusterCAData ClusterResolverName = "upload-cluster-ca-data"
- ClusterLocalhost ClusterResolverName = "rewrite-cluster-localhost"
- ClientCertData ClusterResolverName = "upload-client-cert-data"
- ClientKeyData ClusterResolverName = "upload-client-key-data"
- OIDCIssuerData ClusterResolverName = "upload-oidc-idp-issuer-ca-data"
- TokenData ClusterResolverName = "upload-token-data"
- GCPKeyData ClusterResolverName = "upload-gcp-key-data"
- AWSData ClusterResolverName = "upload-aws-data"
- )
- // NamespaceResponse represents the response type of requests to the namespace resource
- //
- // swagger:model
- type NamespaceResponse struct {
- // the name of the namespace
- // example: default
- Name string `json:"name" form:"required"`
- // the creation timestamp in UTC of the namespace in RFC 1123 format
- // example: Mon, 13 Jun 2022 17:49:12 GMT
- CreationTimestamp string `json:"creationTimestamp" form:"required"`
- // the deletion timestamp in UTC of the namespace in RFC 1123 format, if the namespace is deleted
- // example: Mon, 13 Jun 2022 17:49:12 GMT
- DeletionTimestamp string `json:"deletionTimestamp,omitempty"`
- // the status of the namespace
- // enum: active,terminating
- // example: active
- Status string `json:"status" form:"required"`
- }
- // ListNamespacesResponse represents the list of all namespaces
- //
- // swagger:model
- type ListNamespacesResponse []*NamespaceResponse
- // CreateNamespaceRequest represents the request body to create a namespace
- //
- // swagger:model
- type CreateNamespaceRequest struct {
- // the name of the namespace to create
- // example: sampleNS
- Name string `json:"name" form:"required"`
- }
- type GetTemporaryKubeconfigResponse struct {
- Kubeconfig []byte `json:"kubeconfig"`
- }
- type ListNGINXIngressesResponse []prometheus.SimpleIngress
- type GetPodMetricsRequest struct {
- prometheus.QueryOpts
- }
- type GetPodMetricsResponse *string
- type GetPodsRequest struct {
- Namespace string `schema:"namespace"`
- Selectors []string `schema:"selectors"`
- }
- type CreateClusterManualRequest struct {
- Name string `json:"name" form:"required"`
- ProjectID uint `json:"project_id" form:"required"`
- Server string `json:"server" form:"required"`
- GCPIntegrationID uint `json:"gcp_integration_id"`
- AWSIntegrationID uint `json:"aws_integration_id"`
- CertificateAuthorityData string `json:"certificate_authority_data,omitempty"`
- }
- type CreateClusterCandidateRequest struct {
- ProjectID uint `json:"project_id"`
- Kubeconfig string `json:"kubeconfig"`
- // Represents whether the auth mechanism should be designated as
- // "local": if so, the auth mechanism uses local plugins/mechanisms purely from the
- // kubeconfig.
- IsLocal bool `json:"is_local"`
- }
- type UpdateClusterRequest struct {
- Name string `json:"name" form:"required"`
- AWSClusterID string `json:"aws_cluster_id"`
- }
- type ListClusterResponse []*Cluster
- type CreateClusterCandidateResponse []*ClusterCandidate
- type ListClusterCandidateResponse []*ClusterCandidate
- type GetIncidentsRequest struct {
- IncidentID string `schema:"incident_id"`
- ReleaseName string `schema:"release_name"`
- Namespace string `schema:"namespace"`
- }
- type GetIncidentEventLogsRequest struct {
- LogID string `schema:"log_id"`
- }
- type IncidentNotifyRequest struct {
- IncidentID string `json:"incident_id" form:"required"`
- }
|