From 19d044ca1ad4a62307ac281cd8348238e97d625a Mon Sep 17 00:00:00 2001 From: Eric Powers Date: Thu, 24 Aug 2023 16:38:39 -0700 Subject: [PATCH] New: Add EndpointSlices kind for k8ssourceattrs (#931) --- doc/documentation.md | 2 +- k8sasset.go | 9 ++++++--- k8sresource.go | 9 ++++++--- openapi3_autogen/k8sasset.json | 1 + specs/@k8sresourceattrs.abs | 1 + 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/doc/documentation.md b/doc/documentation.md index 2edb0d380..d380439fe 100644 --- a/doc/documentation.md +++ b/doc/documentation.md @@ -15642,7 +15642,7 @@ The k8s Namespace of the resource. ##### `kind` [`required`] -Type: `enum(Cluster | DaemonSet | Deployment | Endpoints | Namespace | NetworkPolicy | Node | ReplicaSet | Service | StatefulSet)` +Type: `enum(Cluster | DaemonSet | Deployment | Endpoints | EndpointSlices | Namespace | NetworkPolicy | Node | ReplicaSet | Service | StatefulSet)` The specific kind of the k8s resource. diff --git a/k8sasset.go b/k8sasset.go index 46e9d5e4c..7f25ebd55 100644 --- a/k8sasset.go +++ b/k8sasset.go @@ -42,6 +42,9 @@ const ( // K8sAssetKindDeployment represents the value Deployment. K8sAssetKindDeployment K8sAssetKindValue = "Deployment" + // K8sAssetKindEndpointSlices represents the value EndpointSlices. + K8sAssetKindEndpointSlices K8sAssetKindValue = "EndpointSlices" + // K8sAssetKindEndpoints represents the value Endpoints. K8sAssetKindEndpoints K8sAssetKindValue = "Endpoints" @@ -635,7 +638,7 @@ func (o *K8sAsset) Validate() error { requiredErrors = requiredErrors.Append(err) } - if err := elemental.ValidateStringInList("kind", string(o.Kind), []string{"Cluster", "DaemonSet", "Deployment", "Endpoints", "Namespace", "NetworkPolicy", "Node", "ReplicaSet", "Service", "StatefulSet"}, false); err != nil { + if err := elemental.ValidateStringInList("kind", string(o.Kind), []string{"Cluster", "DaemonSet", "Deployment", "Endpoints", "EndpointSlices", "Namespace", "NetworkPolicy", "Node", "ReplicaSet", "Service", "StatefulSet"}, false); err != nil { errors = errors.Append(err) } @@ -857,7 +860,7 @@ var K8sAssetAttributesMap = map[string]elemental.AttributeSpecification{ Type: "string", }, "Kind": { - AllowedChoices: []string{"Cluster", "DaemonSet", "Deployment", "Endpoints", "Namespace", "NetworkPolicy", "Node", "ReplicaSet", "Service", "StatefulSet"}, + AllowedChoices: []string{"Cluster", "DaemonSet", "Deployment", "Endpoints", "EndpointSlices", "Namespace", "NetworkPolicy", "Node", "ReplicaSet", "Service", "StatefulSet"}, BSONFieldName: "kind", ConvertedName: "Kind", Description: `The specific kind of the k8s resource.`, @@ -1126,7 +1129,7 @@ var K8sAssetLowerCaseAttributesMap = map[string]elemental.AttributeSpecification Type: "string", }, "kind": { - AllowedChoices: []string{"Cluster", "DaemonSet", "Deployment", "Endpoints", "Namespace", "NetworkPolicy", "Node", "ReplicaSet", "Service", "StatefulSet"}, + AllowedChoices: []string{"Cluster", "DaemonSet", "Deployment", "Endpoints", "EndpointSlices", "Namespace", "NetworkPolicy", "Node", "ReplicaSet", "Service", "StatefulSet"}, BSONFieldName: "kind", ConvertedName: "Kind", Description: `The specific kind of the k8s resource.`, diff --git a/k8sresource.go b/k8sresource.go index d01722388..dd4f51f56 100644 --- a/k8sresource.go +++ b/k8sresource.go @@ -42,6 +42,9 @@ const ( // K8sResourceKindDeployment represents the value Deployment. K8sResourceKindDeployment K8sResourceKindValue = "Deployment" + // K8sResourceKindEndpointSlices represents the value EndpointSlices. + K8sResourceKindEndpointSlices K8sResourceKindValue = "EndpointSlices" + // K8sResourceKindEndpoints represents the value Endpoints. K8sResourceKindEndpoints K8sResourceKindValue = "Endpoints" @@ -635,7 +638,7 @@ func (o *K8sResource) Validate() error { requiredErrors = requiredErrors.Append(err) } - if err := elemental.ValidateStringInList("kind", string(o.Kind), []string{"Cluster", "DaemonSet", "Deployment", "Endpoints", "Namespace", "NetworkPolicy", "Node", "ReplicaSet", "Service", "StatefulSet"}, false); err != nil { + if err := elemental.ValidateStringInList("kind", string(o.Kind), []string{"Cluster", "DaemonSet", "Deployment", "Endpoints", "EndpointSlices", "Namespace", "NetworkPolicy", "Node", "ReplicaSet", "Service", "StatefulSet"}, false); err != nil { errors = errors.Append(err) } @@ -857,7 +860,7 @@ var K8sResourceAttributesMap = map[string]elemental.AttributeSpecification{ Type: "string", }, "Kind": { - AllowedChoices: []string{"Cluster", "DaemonSet", "Deployment", "Endpoints", "Namespace", "NetworkPolicy", "Node", "ReplicaSet", "Service", "StatefulSet"}, + AllowedChoices: []string{"Cluster", "DaemonSet", "Deployment", "Endpoints", "EndpointSlices", "Namespace", "NetworkPolicy", "Node", "ReplicaSet", "Service", "StatefulSet"}, BSONFieldName: "kind", ConvertedName: "Kind", Description: `The specific kind of the k8s resource.`, @@ -1126,7 +1129,7 @@ var K8sResourceLowerCaseAttributesMap = map[string]elemental.AttributeSpecificat Type: "string", }, "kind": { - AllowedChoices: []string{"Cluster", "DaemonSet", "Deployment", "Endpoints", "Namespace", "NetworkPolicy", "Node", "ReplicaSet", "Service", "StatefulSet"}, + AllowedChoices: []string{"Cluster", "DaemonSet", "Deployment", "Endpoints", "EndpointSlices", "Namespace", "NetworkPolicy", "Node", "ReplicaSet", "Service", "StatefulSet"}, BSONFieldName: "kind", ConvertedName: "Kind", Description: `The specific kind of the k8s resource.`, diff --git a/openapi3_autogen/k8sasset.json b/openapi3_autogen/k8sasset.json index 825975aef..0aad0b21f 100644 --- a/openapi3_autogen/k8sasset.json +++ b/openapi3_autogen/k8sasset.json @@ -80,6 +80,7 @@ "DaemonSet", "Deployment", "Endpoints", + "EndpointSlices", "Namespace", "NetworkPolicy", "Node", diff --git a/specs/@k8sresourceattrs.abs b/specs/@k8sresourceattrs.abs index 8444f9d1c..6f52af8fc 100644 --- a/specs/@k8sresourceattrs.abs +++ b/specs/@k8sresourceattrs.abs @@ -98,6 +98,7 @@ attributes: - DaemonSet - Deployment - Endpoints + - EndpointSlices - Namespace - NetworkPolicy - Node