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

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

package policycrd

import (
	apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

type CRD struct {
	ClusterImagePoliciesPolicySigstoreDevCRD *apiextensionsv1.CustomResourceDefinition
	TrustRootsPolicySigstoreDevCRD           *apiextensionsv1.CustomResourceDefinition
}

func New() CRD {
	return CRD{
		ClusterImagePoliciesPolicySigstoreDevCRD: ClusterImagePoliciesPolicySigstoreDevCRD,
		TrustRootsPolicySigstoreDevCRD:           TrustRootsPolicySigstoreDevCRD,
	}
}

var ClusterImagePoliciesPolicySigstoreDevCRD = &apiextensionsv1.CustomResourceDefinition{
	ObjectMeta: metav1.ObjectMeta{Name: "clusterimagepolicies.policy.sigstore.dev"},
	Spec: apiextensionsv1.CustomResourceDefinitionSpec{
		Conversion: &apiextensionsv1.CustomResourceConversion{
			Strategy: apiextensionsv1.ConversionStrategyType("Webhook"),
			Webhook: &apiextensionsv1.WebhookConversion{
				ClientConfig: &apiextensionsv1.WebhookClientConfig{
					Service: &apiextensionsv1.ServiceReference{
						Name:      "webhook",
						Namespace: "sigstore",
					},
				},
				ConversionReviewVersions: []string{"v1beta1", "v1alpha1"},
			},
		},
		Group: "policy.sigstore.dev",
		Names: apiextensionsv1.CustomResourceDefinitionNames{
			Categories: []string{"all", "sigstore"},
			Kind:       "ClusterImagePolicy",
			Plural:     "clusterimagepolicies",
			ShortNames: []string{"cip"},
			Singular:   "clusterimagepolicy",
		},
		Scope: apiextensionsv1.ResourceScope("Cluster"),
		Versions: []apiextensionsv1.CustomResourceDefinitionVersion{
			{
				Name: "v1alpha1",
				Schema: &apiextensionsv1.CustomResourceValidation{
					OpenAPIV3Schema: &apiextensionsv1.JSONSchemaProps{
						Properties: map[string]apiextensionsv1.JSONSchemaProps{
							"spec": {
								Description: "Spec holds the desired state of the ClusterImagePolicy (from the client).",
								Properties: map[string]apiextensionsv1.JSONSchemaProps{
									"authorities": {
										Description: "Authorities defines the rules for discovering and validating signatures.",
										Items: &apiextensionsv1.JSONSchemaPropsOrArray{
											Schema: &apiextensionsv1.JSONSchemaProps{
												Properties: map[string]apiextensionsv1.JSONSchemaProps{
													"attestations": {
														Description: "Attestations is a list of individual attestations for this authority, once the signature for this authority has been verified.",
														Items: &apiextensionsv1.JSONSchemaPropsOrArray{
															Schema: &apiextensionsv1.JSONSchemaProps{
																Properties: map[string]apiextensionsv1.JSONSchemaProps{
																	"name": {
																		Description: "Name of the attestation. These can then be referenced at the CIP level policy.",
																		Type:        "string",
																	},
																	"policy": {
																		Description: "Policy defines all of the matching signatures, and all of the matching attestations (whose attestations are verified).",
																		Properties: map[string]apiextensionsv1.JSONSchemaProps{
																			"configMapRef": {
																				Description: "ConfigMapRef defines the reference to a configMap with the policy definition.",
																				Properties: map[string]apiextensionsv1.JSONSchemaProps{
																					"key": {
																						Description: "Key defines the key to pull from the configmap.",
																						Type:        "string",
																					},
																					"name": {
																						Description: "Name is unique within a namespace to reference a configmap resource.",
																						Type:        "string",
																					},
																					"namespace": {
																						Description: "Namespace defines the space within which the configmap name must be unique.",
																						Type:        "string",
																					},
																				},
																				Type: "object",
																			},
																			"data": {
																				Description: "Data contains the policy definition.",
																				Type:        "string",
																			},
																			"fetchConfigFile": {
																				Description: "FetchConfigFile controls whether ConfigFile will be fetched and made available for CIP level policy evaluation. Note that this only gets evaluated (and hence fetched) iff at least one authority matches. The ConfigFile will then be available in this format: https://github.com/opencontainers/image-spec/blob/main/config.md",
																				Type:        "boolean",
																			},
																			"includeObjectMeta": {
																				Description: "IncludeObjectMeta controls whether the ObjectMeta will be included and made available for CIP level policy evalutation. Note that this only gets evaluated iff at least one authority matches.",
																				Type:        "boolean",
																			},
																			"includeSpec": {
																				Description: "IncludeSpec controls whether resource `Spec` will be included and made available for CIP level policy evaluation. Note that this only gets evaluated iff at least one authority matches. Also note that because Spec may be of a different shape depending on the resource being evaluatied (see MatchResource for filtering) you might want to configure these to match the policy file to ensure the shape of the Spec is what you expect when evaling the policy.",
																				Type:        "boolean",
																			},
																			"includeTypeMeta": {
																				Description: "IncludeTypeMeta controls whether the TypeMeta will be included and made available for CIP level policy evalutation. Note that this only gets evaluated iff at least one authority matches.",
																				Type:        "boolean",
																			},
																			"remote": {
																				Description: "Remote defines the url to a policy.",
																				Properties: map[string]apiextensionsv1.JSONSchemaProps{
																					"sha256sum": {
																						Description: "Sha256sum defines the exact sha256sum computed out of the 'body' of the http response.",
																						Type:        "string",
																					},
																					"url": {
																						Description: "URL to the policy data.",
																						Type:        "string",
																					},
																				},
																				Type: "object",
																			},
																			"type": {
																				Description: "Which kind of policy this is, currently only rego or cue are supported. Furthermore, only cue is tested :)",
																				Type:        "string",
																			},
																		},
																		Type: "object",
																	},
																	"predicateType": {
																		Description: "PredicateType defines which predicate type to verify. Matches cosign verify-attestation options.",
																		Type:        "string",
																	},
																},
																Type: "object",
															},
														},
														Type: "array",
													},
													"ctlog": {
														Description: "CTLog sets the configuration to verify the authority against a Rekor instance.",
														Properties: map[string]apiextensionsv1.JSONSchemaProps{
															"trustRootRef": {
																Description: "Use the Public Key from the referred TrustRoot.TLog",
																Type:        "string",
															},
															"url": {
																Description: "URL sets the url to the rekor instance (by default the public rekor.sigstore.dev)",
																Type:        "string",
															},
														},
														Type: "object",
													},
													"key": {
														Description: "Key defines the type of key to validate the image.",
														Properties: map[string]apiextensionsv1.JSONSchemaProps{
															"data": {
																Description: "Data contains the inline public key.",
																Type:        "string",
															},
															"hashAlgorithm": {
																Description: "HashAlgorithm always defaults to sha256 if the algorithm hasn't been explicitly set",
																Type:        "string",
															},
															"kms": {
																Description: "KMS contains the KMS url of the public key Supported formats differ based on the KMS system used.",
																Type:        "string",
															},
															"secretRef": {
																Description: "SecretRef sets a reference to a secret with the key.",
																Properties: map[string]apiextensionsv1.JSONSchemaProps{
																	"name": {
																		Description: "name is unique within a namespace to reference a secret resource.",
																		Type:        "string",
																	},
																	"namespace": {
																		Description: "namespace defines the space within which the secret name must be unique.",
																		Type:        "string",
																	},
																},
																Type: "object",
															},
														},
														Type: "object",
													},
													"keyless": {
														Description: "Keyless sets the configuration to verify the authority against a Fulcio instance.",
														Properties: map[string]apiextensionsv1.JSONSchemaProps{
															"ca-cert": {
																Description: "CACert sets a reference to CA certificate",
																Properties: map[string]apiextensionsv1.JSONSchemaProps{
																	"data": {
																		Description: "Data contains the inline public key.",
																		Type:        "string",
																	},
																	"hashAlgorithm": {
																		Description: "HashAlgorithm always defaults to sha256 if the algorithm hasn't been explicitly set",
																		Type:        "string",
																	},
																	"kms": {
																		Description: "KMS contains the KMS url of the public key Supported formats differ based on the KMS system used.",
																		Type:        "string",
																	},
																	"secretRef": {
																		Description: "SecretRef sets a reference to a secret with the key.",
																		Properties: map[string]apiextensionsv1.JSONSchemaProps{
																			"name": {
																				Description: "name is unique within a namespace to reference a secret resource.",
																				Type:        "string",
																			},
																			"namespace": {
																				Description: "namespace defines the space within which the secret name must be unique.",
																				Type:        "string",
																			},
																		},
																		Type: "object",
																	},
																},
																Type: "object",
															},
															"identities": {
																Description: "Identities sets a list of identities.",
																Items: &apiextensionsv1.JSONSchemaPropsOrArray{
																	Schema: &apiextensionsv1.JSONSchemaProps{
																		Properties: map[string]apiextensionsv1.JSONSchemaProps{
																			"issuer": {
																				Description: "Issuer defines the issuer for this identity.",
																				Type:        "string",
																			},
																			"issuerRegExp": {
																				Description: "IssuerRegExp specifies a regular expression to match the issuer for this identity.",
																				Type:        "string",
																			},
																			"subject": {
																				Description: "Subject defines the subject for this identity.",
																				Type:        "string",
																			},
																			"subjectRegExp": {
																				Description: "SubjectRegExp specifies a regular expression to match the subject for this identity.",
																				Type:        "string",
																			},
																		},
																		Type: "object",
																	},
																},
																Type: "array",
															},
															"insecureIgnoreSCT": {
																Description: "InsecureIgnoreSCT omits verifying if a certificate contains an embedded SCT",
																Type:        "boolean",
															},
															"trustRootRef": {
																Description: "Use the Certificate Chain from the referred TrustRoot.CertificateAuthorities and TrustRoot.CTLog",
																Type:        "string",
															},
															"url": {
																Description: "URL defines a url to the keyless instance.",
																Type:        "string",
															},
														},
														Type: "object",
													},
													"name": {
														Description: "Name is the name for this authority. Used by the CIP Policy validator to be able to reference matching signature or attestation verifications. If not specified, the name will be authority-<index in array>",
														Type:        "string",
													},
													"rfc3161timestamp": {
														Description: "RFC3161Timestamp sets the configuration to verify the signature timestamp against a RFC3161 time-stamping instance.",
														Properties: map[string]apiextensionsv1.JSONSchemaProps{
															"trustRootRef": {
																Description: "Use the Certificate Chain from the referred TrustRoot.TimeStampAuthorities",
																Type:        "string",
															},
														},
														Type: "object",
													},
													"source": {
														Description: "Sources sets the configuration to specify the sources from where to consume the signatures.",
														Items: &apiextensionsv1.JSONSchemaPropsOrArray{
															Schema: &apiextensionsv1.JSONSchemaProps{
																Properties: map[string]apiextensionsv1.JSONSchemaProps{
																	"oci": {
																		Description: "OCI defines the registry from where to pull the signature / attestations.",
																		Type:        "string",
																	},
																	"signaturePullSecrets": {
																		Description: "SignaturePullSecrets is an optional list of references to secrets in the same namespace as the deploying resource for pulling any of the signatures used by this Source.",
																		Items: &apiextensionsv1.JSONSchemaPropsOrArray{
																			Schema: &apiextensionsv1.JSONSchemaProps{
																				Properties: map[string]apiextensionsv1.JSONSchemaProps{
																					"name": {
																						Description: "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
																						Type:        "string",
																					},
																				},
																				Type: "object",
																			},
																		},
																		Type: "array",
																	},
																	"tagPrefix": {
																		Description: "TagPrefix is an optional prefix that signature and attestations have. This is the 'tag based discovery' and in the future once references are fully supported that should likely be the preferred way to handle these.",
																		Type:        "string",
																	},
																},
																Type: "object",
															},
														},
														Type: "array",
													},
													"static": {
														Description: "Static specifies that signatures / attestations are not validated but instead a static policy is applied against matching images.",
														Properties: map[string]apiextensionsv1.JSONSchemaProps{
															"action": {
																Description: "Action defines how to handle a matching policy.",
																Type:        "string",
															},
														},
														Type: "object",
													},
												},
												Type: "object",
											},
										},
										Type: "array",
									},
									"images": {
										Description: "Images defines the patterns of image names that should be subject to this policy.",
										Items: &apiextensionsv1.JSONSchemaPropsOrArray{
											Schema: &apiextensionsv1.JSONSchemaProps{
												Properties: map[string]apiextensionsv1.JSONSchemaProps{
													"glob": {
														Description: "Glob defines a globbing pattern.",
														Type:        "string",
													},
												},
												Type: "object",
											},
										},
										Type: "array",
									},
									"match": {
										Description: "Match allows selecting resources based on their properties.",
										Items: &apiextensionsv1.JSONSchemaPropsOrArray{
											Schema: &apiextensionsv1.JSONSchemaProps{
												Properties: map[string]apiextensionsv1.JSONSchemaProps{
													"group":    {Type: "string"},
													"resource": {Type: "string"},
													"selector": {
														Properties: map[string]apiextensionsv1.JSONSchemaProps{
															"matchExpressions": {
																Description: "matchExpressions is a list of label selector requirements. The requirements are ANDed.",
																Items: &apiextensionsv1.JSONSchemaPropsOrArray{
																	Schema: &apiextensionsv1.JSONSchemaProps{
																		Properties: map[string]apiextensionsv1.JSONSchemaProps{
																			"key": {
																				Description: "key is the label key that the selector applies to.",
																				Type:        "string",
																			},
																			"operator": {
																				Description: "operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.",
																				Type:        "string",
																			},
																			"values": {
																				Description: "values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.",
																				Items:       &apiextensionsv1.JSONSchemaPropsOrArray{Schema: &apiextensionsv1.JSONSchemaProps{Type: "string"}},
																				Type:        "array",
																			},
																		},
																		Type: "object",
																	},
																},
																Type: "array",
															},
															"matchLabels": {
																Description:            `matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.`,
																Type:                   "object",
																XPreserveUnknownFields: P(true),
															},
														},
														Type: "object",
													},
													"version": {Type: "string"},
												},
												Type: "object",
											},
										},
										Type: "array",
									},
									"mode": {
										Description: "Mode controls whether a failing policy will be rejected (not admitted), or if errors are converted to Warnings. enforce - Reject (default) warn - allow but warn",
										Type:        "string",
									},
									"policy": {
										Description: "Policy is an optional policy that can be applied against all the successfully validated Authorities. If no authorities pass, this does not even get evaluated, as the Policy is considered failed.",
										Properties: map[string]apiextensionsv1.JSONSchemaProps{
											"configMapRef": {
												Description: "ConfigMapRef defines the reference to a configMap with the policy definition.",
												Properties: map[string]apiextensionsv1.JSONSchemaProps{
													"key": {
														Description: "Key defines the key to pull from the configmap.",
														Type:        "string",
													},
													"name": {
														Description: "Name is unique within a namespace to reference a configmap resource.",
														Type:        "string",
													},
													"namespace": {
														Description: "Namespace defines the space within which the configmap name must be unique.",
														Type:        "string",
													},
												},
												Type: "object",
											},
											"data": {
												Description: "Data contains the policy definition.",
												Type:        "string",
											},
											"fetchConfigFile": {
												Description: "FetchConfigFile controls whether ConfigFile will be fetched and made available for CIP level policy evaluation. Note that this only gets evaluated (and hence fetched) iff at least one authority matches. The ConfigFile will then be available in this format: https://github.com/opencontainers/image-spec/blob/main/config.md",
												Type:        "boolean",
											},
											"includeObjectMeta": {
												Description: "IncludeObjectMeta controls whether the ObjectMeta will be included and made available for CIP level policy evalutation. Note that this only gets evaluated iff at least one authority matches.",
												Type:        "boolean",
											},
											"includeSpec": {
												Description: "IncludeSpec controls whether resource `Spec` will be included and made available for CIP level policy evaluation. Note that this only gets evaluated iff at least one authority matches. Also note that because Spec may be of a different shape depending on the resource being evaluatied (see MatchResource for filtering) you might want to configure these to match the policy file to ensure the shape of the Spec is what you expect when evaling the policy.",
												Type:        "boolean",
											},
											"includeTypeMeta": {
												Description: "IncludeTypeMeta controls whether the TypeMeta will be included and made available for CIP level policy evalutation. Note that this only gets evaluated iff at least one authority matches.",
												Type:        "boolean",
											},
											"remote": {
												Description: "Remote defines the url to a policy.",
												Properties: map[string]apiextensionsv1.JSONSchemaProps{
													"sha256sum": {
														Description: "Sha256sum defines the exact sha256sum computed out of the 'body' of the http response.",
														Type:        "string",
													},
													"url": {
														Description: "URL to the policy data.",
														Type:        "string",
													},
												},
												Type: "object",
											},
											"type": {
												Description: "Which kind of policy this is, currently only rego or cue are supported. Furthermore, only cue is tested :)",
												Type:        "string",
											},
										},
										Type: "object",
									},
								},
								Type: "object",
							},
							"status": {
								Description: "Status represents the current state of the ClusterImagePolicy. This data may be out of date.",
								Properties: map[string]apiextensionsv1.JSONSchemaProps{
									"annotations": {
										Description:            "Annotations is additional Status fields for the Resource to save some additional State as well as convey more information to the user. This is roughly akin to Annotations on any k8s resource, just the reconciler conveying richer information outwards.",
										Type:                   "object",
										XPreserveUnknownFields: P(true),
									},
									"conditions": {
										Description: "Conditions the latest available observations of a resource's current state.",
										Items: &apiextensionsv1.JSONSchemaPropsOrArray{
											Schema: &apiextensionsv1.JSONSchemaProps{
												Properties: map[string]apiextensionsv1.JSONSchemaProps{
													"lastTransitionTime": {
														Description: "LastTransitionTime is the last time the condition transitioned from one status to another. We use VolatileTime in place of metav1.Time to exclude this from creating equality.Semantic differences (all other things held constant).",
														Type:        "string",
													},
													"message": {
														Description: "A human readable message indicating details about the transition.",
														Type:        "string",
													},
													"reason": {
														Description: "The reason for the condition's last transition.",
														Type:        "string",
													},
													"severity": {
														Description: "Severity with which to treat failures of this type of condition. When this is not specified, it defaults to Error.",
														Type:        "string",
													},
													"status": {
														Description: "Status of the condition, one of True, False, Unknown.",
														Type:        "string",
													},
													"type": {
														Description: "Type of condition.",
														Type:        "string",
													},
												},
												Required: []string{
													"type",
													"status",
												},
												Type: "object",
											},
										},
										Type: "array",
									},
									"observedGeneration": {
										Description: "ObservedGeneration is the 'Generation' of the Service that was last processed by the controller.",
										Format:      "int64",
										Type:        "integer",
									},
								},
								Type: "object",
							},
						},
						Type: "object",
					},
				},
				Served:       true,
				Storage:      true,
				Subresources: &apiextensionsv1.CustomResourceSubresources{},
			}, {
				Name: "v1beta1",
				Schema: &apiextensionsv1.CustomResourceValidation{
					OpenAPIV3Schema: &apiextensionsv1.JSONSchemaProps{
						Properties: map[string]apiextensionsv1.JSONSchemaProps{
							"spec": {
								Description: "Spec holds the desired state of the ClusterImagePolicy (from the client).",
								Properties: map[string]apiextensionsv1.JSONSchemaProps{
									"authorities": {
										Description: "Authorities defines the rules for discovering and validating signatures.",
										Items: &apiextensionsv1.JSONSchemaPropsOrArray{
											Schema: &apiextensionsv1.JSONSchemaProps{
												Properties: map[string]apiextensionsv1.JSONSchemaProps{
													"attestations": {
														Description: "Attestations is a list of individual attestations for this authority, once the signature for this authority has been verified.",
														Items: &apiextensionsv1.JSONSchemaPropsOrArray{
															Schema: &apiextensionsv1.JSONSchemaProps{
																Properties: map[string]apiextensionsv1.JSONSchemaProps{
																	"name": {
																		Description: "Name of the attestation. These can then be referenced at the CIP level policy.",
																		Type:        "string",
																	},
																	"policy": {
																		Description: "Policy defines all of the matching signatures, and all of the matching attestations (whose attestations are verified).",
																		Properties: map[string]apiextensionsv1.JSONSchemaProps{
																			"configMapRef": {
																				Description: "ConfigMapRef defines the reference to a configMap with the policy definition.",
																				Properties: map[string]apiextensionsv1.JSONSchemaProps{
																					"key": {
																						Description: "Key defines the key to pull from the configmap.",
																						Type:        "string",
																					},
																					"name": {
																						Description: "Name is unique within a namespace to reference a configmap resource.",
																						Type:        "string",
																					},
																					"namespace": {
																						Description: "Namespace defines the space within which the configmap name must be unique.",
																						Type:        "string",
																					},
																				},
																				Type: "object",
																			},
																			"data": {
																				Description: "Data contains the policy definition.",
																				Type:        "string",
																			},
																			"fetchConfigFile": {
																				Description: "FetchConfigFile controls whether ConfigFile will be fetched and made available for CIP level policy evaluation. Note that this only gets evaluated (and hence fetched) iff at least one authority matches. The ConfigFile will then be available in this format: https://github.com/opencontainers/image-spec/blob/main/config.md",
																				Type:        "boolean",
																			},
																			"includeObjectMeta": {
																				Description: "IncludeObjectMeta controls whether the ObjectMeta will be included and made available for CIP level policy evalutation. Note that this only gets evaluated iff at least one authority matches.",
																				Type:        "boolean",
																			},
																			"includeSpec": {
																				Description: "IncludeSpec controls whether resource `Spec` will be included and made available for CIP level policy evaluation. Note that this only gets evaluated iff at least one authority matches. Also note that because Spec may be of a different shape depending on the resource being evaluatied (see MatchResource for filtering) you might want to configure these to match the policy file to ensure the shape of the Spec is what you expect when evaling the policy.",
																				Type:        "boolean",
																			},
																			"includeTypeMeta": {
																				Description: "IncludeTypeMeta controls whether the TypeMeta will be included and made available for CIP level policy evalutation. Note that this only gets evaluated iff at least one authority matches.",
																				Type:        "boolean",
																			},
																			"remote": {
																				Description: "Remote defines the url to a policy.",
																				Properties: map[string]apiextensionsv1.JSONSchemaProps{
																					"sha256sum": {
																						Description: "Sha256sum defines the exact sha256sum computed out of the 'body' of the http response.",
																						Type:        "string",
																					},
																					"url": {
																						Description: "URL to the policy data.",
																						Type:        "string",
																					},
																				},
																				Type: "object",
																			},
																			"type": {
																				Description: "Which kind of policy this is, currently only rego or cue are supported. Furthermore, only cue is tested :)",
																				Type:        "string",
																			},
																		},
																		Type: "object",
																	},
																	"predicateType": {
																		Description: "PredicateType defines which predicate type to verify. Matches cosign verify-attestation options.",
																		Type:        "string",
																	},
																},
																Type: "object",
															},
														},
														Type: "array",
													},
													"ctlog": {
														Description: "CTLog sets the configuration to verify the authority against a Rekor instance.",
														Properties: map[string]apiextensionsv1.JSONSchemaProps{
															"trustRootRef": {
																Description: "Use the Public Key from the referred TrustRoot.TLog",
																Type:        "string",
															},
															"url": {
																Description: "URL sets the url to the rekor instance (by default the public rekor.sigstore.dev)",
																Type:        "string",
															},
														},
														Type: "object",
													},
													"key": {
														Description: "Key defines the type of key to validate the image.",
														Properties: map[string]apiextensionsv1.JSONSchemaProps{
															"data": {
																Description: "Data contains the inline public key.",
																Type:        "string",
															},
															"hashAlgorithm": {
																Description: "HashAlgorithm always defaults to sha256 if the algorithm hasn't been explicitly set",
																Type:        "string",
															},
															"kms": {
																Description: "KMS contains the KMS url of the public key Supported formats differ based on the KMS system used.",
																Type:        "string",
															},
															"secretRef": {
																Description: "SecretRef sets a reference to a secret with the key.",
																Properties: map[string]apiextensionsv1.JSONSchemaProps{
																	"name": {
																		Description: "name is unique within a namespace to reference a secret resource.",
																		Type:        "string",
																	},
																	"namespace": {
																		Description: "namespace defines the space within which the secret name must be unique.",
																		Type:        "string",
																	},
																},
																Type: "object",
															},
														},
														Type: "object",
													},
													"keyless": {
														Description: "Keyless sets the configuration to verify the authority against a Fulcio instance.",
														Properties: map[string]apiextensionsv1.JSONSchemaProps{
															"ca-cert": {
																Description: "CACert sets a reference to CA certificate",
																Properties: map[string]apiextensionsv1.JSONSchemaProps{
																	"data": {
																		Description: "Data contains the inline public key.",
																		Type:        "string",
																	},
																	"hashAlgorithm": {
																		Description: "HashAlgorithm always defaults to sha256 if the algorithm hasn't been explicitly set",
																		Type:        "string",
																	},
																	"kms": {
																		Description: "KMS contains the KMS url of the public key Supported formats differ based on the KMS system used.",
																		Type:        "string",
																	},
																	"secretRef": {
																		Description: "SecretRef sets a reference to a secret with the key.",
																		Properties: map[string]apiextensionsv1.JSONSchemaProps{
																			"name": {
																				Description: "name is unique within a namespace to reference a secret resource.",
																				Type:        "string",
																			},
																			"namespace": {
																				Description: "namespace defines the space within which the secret name must be unique.",
																				Type:        "string",
																			},
																		},
																		Type: "object",
																	},
																},
																Type: "object",
															},
															"identities": {
																Description: "Identities sets a list of identities.",
																Items: &apiextensionsv1.JSONSchemaPropsOrArray{
																	Schema: &apiextensionsv1.JSONSchemaProps{
																		Properties: map[string]apiextensionsv1.JSONSchemaProps{
																			"issuer": {
																				Description: "Issuer defines the issuer for this identity.",
																				Type:        "string",
																			},
																			"issuerRegExp": {
																				Description: "IssuerRegExp specifies a regular expression to match the issuer for this identity.",
																				Type:        "string",
																			},
																			"subject": {
																				Description: "Subject defines the subject for this identity.",
																				Type:        "string",
																			},
																			"subjectRegExp": {
																				Description: "SubjectRegExp specifies a regular expression to match the subject for this identity.",
																				Type:        "string",
																			},
																		},
																		Type: "object",
																	},
																},
																Type: "array",
															},
															"insecureIgnoreSCT": {
																Description: "InsecureIgnoreSCT omits verifying if a certificate contains an embedded SCT",
																Type:        "boolean",
															},
															"trustRootRef": {
																Description: "Use the Certificate Chain from the referred TrustRoot.CertificateAuthorities and TrustRoot.CTLog",
																Type:        "string",
															},
															"url": {
																Description: "URL defines a url to the keyless instance.",
																Type:        "string",
															},
														},
														Type: "object",
													},
													"name": {
														Description: "Name is the name for this authority. Used by the CIP Policy validator to be able to reference matching signature or attestation verifications. If not specified, the name will be authority-<index in array>",
														Type:        "string",
													},
													"rfc3161timestamp": {
														Description: "RFC3161Timestamp sets the configuration to verify the signature timestamp against a RFC3161 time-stamping instance.",
														Properties: map[string]apiextensionsv1.JSONSchemaProps{
															"trustRootRef": {
																Description: "Use the Certificate Chain from the referred TrustRoot.TimeStampAuthorities",
																Type:        "string",
															},
														},
														Type: "object",
													},
													"source": {
														Description: "Sources sets the configuration to specify the sources from where to consume the signatures.",
														Items: &apiextensionsv1.JSONSchemaPropsOrArray{
															Schema: &apiextensionsv1.JSONSchemaProps{
																Properties: map[string]apiextensionsv1.JSONSchemaProps{
																	"oci": {
																		Description: "OCI defines the registry from where to pull the signature / attestations.",
																		Type:        "string",
																	},
																	"signaturePullSecrets": {
																		Description: "SignaturePullSecrets is an optional list of references to secrets in the same namespace as the deploying resource for pulling any of the signatures used by this Source.",
																		Items: &apiextensionsv1.JSONSchemaPropsOrArray{
																			Schema: &apiextensionsv1.JSONSchemaProps{
																				Properties: map[string]apiextensionsv1.JSONSchemaProps{
																					"name": {
																						Description: "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
																						Type:        "string",
																					},
																				},
																				Type: "object",
																			},
																		},
																		Type: "array",
																	},
																	"tagPrefix": {
																		Description: "TagPrefix is an optional prefix that signature and attestations have. This is the 'tag based discovery' and in the future once references are fully supported that should likely be the preferred way to handle these.",
																		Type:        "string",
																	},
																},
																Type: "object",
															},
														},
														Type: "array",
													},
													"static": {
														Description: "Static specifies that signatures / attestations are not validated but instead a static policy is applied against matching images.",
														Properties: map[string]apiextensionsv1.JSONSchemaProps{
															"action": {
																Description: "Action defines how to handle a matching policy.",
																Type:        "string",
															},
														},
														Type: "object",
													},
												},
												Type: "object",
											},
										},
										Type: "array",
									},
									"images": {
										Description: "Images defines the patterns of image names that should be subject to this policy.",
										Items: &apiextensionsv1.JSONSchemaPropsOrArray{
											Schema: &apiextensionsv1.JSONSchemaProps{
												Properties: map[string]apiextensionsv1.JSONSchemaProps{
													"glob": {
														Description: "Glob defines a globbing pattern.",
														Type:        "string",
													},
												},
												Type: "object",
											},
										},
										Type: "array",
									},
									"match": {
										Description: "Match allows selecting resources based on their properties.",
										Items: &apiextensionsv1.JSONSchemaPropsOrArray{
											Schema: &apiextensionsv1.JSONSchemaProps{
												Properties: map[string]apiextensionsv1.JSONSchemaProps{
													"group":    {Type: "string"},
													"resource": {Type: "string"},
													"selector": {
														Properties: map[string]apiextensionsv1.JSONSchemaProps{
															"matchExpressions": {
																Description: "matchExpressions is a list of label selector requirements. The requirements are ANDed.",
																Items: &apiextensionsv1.JSONSchemaPropsOrArray{
																	Schema: &apiextensionsv1.JSONSchemaProps{
																		Properties: map[string]apiextensionsv1.JSONSchemaProps{
																			"key": {
																				Description: "key is the label key that the selector applies to.",
																				Type:        "string",
																			},
																			"operator": {
																				Description: "operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.",
																				Type:        "string",
																			},
																			"values": {
																				Description: "values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.",
																				Items:       &apiextensionsv1.JSONSchemaPropsOrArray{Schema: &apiextensionsv1.JSONSchemaProps{Type: "string"}},
																				Type:        "array",
																			},
																		},
																		Type: "object",
																	},
																},
																Type: "array",
															},
															"matchLabels": {
																Description:            `matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.`,
																Type:                   "object",
																XPreserveUnknownFields: P(true),
															},
														},
														Type: "object",
													},
													"version": {Type: "string"},
												},
												Type: "object",
											},
										},
										Type: "array",
									},
									"mode": {
										Description: "Mode controls whether a failing policy will be rejected (not admitted), or if errors are converted to Warnings. enforce - Reject (default) warn - allow but warn",
										Type:        "string",
									},
									"policy": {
										Description: "Policy is an optional policy that can be applied against all the successfully validated Authorities. If no authorities pass, this does not even get evaluated, as the Policy is considered failed.",
										Properties: map[string]apiextensionsv1.JSONSchemaProps{
											"configMapRef": {
												Description: "ConfigMapRef defines the reference to a configMap with the policy definition.",
												Properties: map[string]apiextensionsv1.JSONSchemaProps{
													"key": {
														Description: "Key defines the key to pull from the configmap.",
														Type:        "string",
													},
													"name": {
														Description: "Name is unique within a namespace to reference a configmap resource.",
														Type:        "string",
													},
													"namespace": {
														Description: "Namespace defines the space within which the configmap name must be unique.",
														Type:        "string",
													},
												},
												Type: "object",
											},
											"data": {
												Description: "Data contains the policy definition.",
												Type:        "string",
											},
											"fetchConfigFile": {
												Description: "FetchConfigFile controls whether ConfigFile will be fetched and made available for CIP level policy evaluation. Note that this only gets evaluated (and hence fetched) iff at least one authority matches. The ConfigFile will then be available in this format: https://github.com/opencontainers/image-spec/blob/main/config.md",
												Type:        "boolean",
											},
											"includeObjectMeta": {
												Description: "IncludeObjectMeta controls whether the ObjectMeta will be included and made available for CIP level policy evalutation. Note that this only gets evaluated iff at least one authority matches.",
												Type:        "boolean",
											},
											"includeSpec": {
												Description: "IncludeSpec controls whether resource `Spec` will be included and made available for CIP level policy evaluation. Note that this only gets evaluated iff at least one authority matches. Also note that because Spec may be of a different shape depending on the resource being evaluatied (see MatchResource for filtering) you might want to configure these to match the policy file to ensure the shape of the Spec is what you expect when evaling the policy.",
												Type:        "boolean",
											},
											"includeTypeMeta": {
												Description: "IncludeTypeMeta controls whether the TypeMeta will be included and made available for CIP level policy evalutation. Note that this only gets evaluated iff at least one authority matches.",
												Type:        "boolean",
											},
											"remote": {
												Description: "Remote defines the url to a policy.",
												Properties: map[string]apiextensionsv1.JSONSchemaProps{
													"sha256sum": {
														Description: "Sha256sum defines the exact sha256sum computed out of the 'body' of the http response.",
														Type:        "string",
													},
													"url": {
														Description: "URL to the policy data.",
														Type:        "string",
													},
												},
												Type: "object",
											},
											"type": {
												Description: "Which kind of policy this is, currently only rego or cue are supported. Furthermore, only cue is tested :)",
												Type:        "string",
											},
										},
										Type: "object",
									},
								},
								Type: "object",
							},
							"status": {
								Description: "Status represents the current state of the ClusterImagePolicy. This data may be out of date.",
								Properties: map[string]apiextensionsv1.JSONSchemaProps{
									"annotations": {
										Description:            "Annotations is additional Status fields for the Resource to save some additional State as well as convey more information to the user. This is roughly akin to Annotations on any k8s resource, just the reconciler conveying richer information outwards.",
										Type:                   "object",
										XPreserveUnknownFields: P(true),
									},
									"conditions": {
										Description: "Conditions the latest available observations of a resource's current state.",
										Items: &apiextensionsv1.JSONSchemaPropsOrArray{
											Schema: &apiextensionsv1.JSONSchemaProps{
												Properties: map[string]apiextensionsv1.JSONSchemaProps{
													"lastTransitionTime": {
														Description: "LastTransitionTime is the last time the condition transitioned from one status to another. We use VolatileTime in place of metav1.Time to exclude this from creating equality.Semantic differences (all other things held constant).",
														Type:        "string",
													},
													"message": {
														Description: "A human readable message indicating details about the transition.",
														Type:        "string",
													},
													"reason": {
														Description: "The reason for the condition's last transition.",
														Type:        "string",
													},
													"severity": {
														Description: "Severity with which to treat failures of this type of condition. When this is not specified, it defaults to Error.",
														Type:        "string",
													},
													"status": {
														Description: "Status of the condition, one of True, False, Unknown.",
														Type:        "string",
													},
													"type": {
														Description: "Type of condition.",
														Type:        "string",
													},
												},
												Required: []string{
													"type",
													"status",
												},
												Type: "object",
											},
										},
										Type: "array",
									},
									"observedGeneration": {
										Description: "ObservedGeneration is the 'Generation' of the Service that was last processed by the controller.",
										Format:      "int64",
										Type:        "integer",
									},
								},
								Type: "object",
							},
						},
						Type: "object",
					},
				},
				Served:       true,
				Subresources: &apiextensionsv1.CustomResourceSubresources{},
			},
		},
	},
	TypeMeta: metav1.TypeMeta{
		APIVersion: "apiextensions.k8s.io/v1",
		Kind:       "CustomResourceDefinition",
	},
}

var TrustRootsPolicySigstoreDevCRD = &apiextensionsv1.CustomResourceDefinition{
	ObjectMeta: metav1.ObjectMeta{Name: "trustroots.policy.sigstore.dev"},
	Spec: apiextensionsv1.CustomResourceDefinitionSpec{
		Conversion: &apiextensionsv1.CustomResourceConversion{Strategy: apiextensionsv1.ConversionStrategyType("None")},
		Group:      "policy.sigstore.dev",
		Names: apiextensionsv1.CustomResourceDefinitionNames{
			Categories: []string{"all", "sigstore"},
			Kind:       "TrustRoot",
			Plural:     "trustroots",
			Singular:   "trustroot",
		},
		Scope: apiextensionsv1.ResourceScope("Cluster"),
		Versions: []apiextensionsv1.CustomResourceDefinitionVersion{
			{
				Name: "v1alpha1",
				Schema: &apiextensionsv1.CustomResourceValidation{
					OpenAPIV3Schema: &apiextensionsv1.JSONSchemaProps{
						Properties: map[string]apiextensionsv1.JSONSchemaProps{
							"spec": {
								Description: "Spec is the definition for a trust root. This is either a TUF root and remote or local repository. You can also bring your own keys/certs here.",
								Properties: map[string]apiextensionsv1.JSONSchemaProps{
									"remote": {
										Description: "Remote specifies initial root of trust & remote mirror.",
										Properties: map[string]apiextensionsv1.JSONSchemaProps{
											"mirror": {
												Description: "Mirror is the remote mirror, for example: https://sigstore-tuf-root.storage.googleapis.com",
												Type:        "string",
											},
											"root": {
												Description: "Root is the base64 encoded, json trusted initial root.",
												Type:        "string",
											},
											"targets": {
												Description: "Targets is where the targets live off of the root of the Remote If not specified 'targets' is defaulted.",
												Type:        "string",
											},
										},
										Type: "object",
									},
									"repository": {
										Description: "Repository contains the serialized TUF remote repository.",
										Properties: map[string]apiextensionsv1.JSONSchemaProps{
											"mirrorFS": {
												Description: "MirrorFS is the base64 tarred, gzipped, and base64 encoded remote repository that can be used for example in air-gap environments. Will not make outbound network connections, and must then be kept up to date in some other manner. The repository must contain metadata as well as targets.",
												Type:        "string",
											},
											"root": {
												Description: "Root is the base64 encoded, json trusted initial root.",
												Type:        "string",
											},
											"targets": {
												Description: "Targets is where the targets live off of the root of the Repository above. If not specified 'targets' is defaulted.",
												Type:        "string",
											},
										},
										Type: "object",
									},
									"sigstoreKeys": {
										Description: "SigstoreKeys contains the serialized keys.",
										Properties: map[string]apiextensionsv1.JSONSchemaProps{
											"certificateAuthorities": {
												Description: "Trusted certificate authorities (e.g Fulcio).",
												Items: &apiextensionsv1.JSONSchemaPropsOrArray{
													Schema: &apiextensionsv1.JSONSchemaProps{
														Properties: map[string]apiextensionsv1.JSONSchemaProps{
															"certChain": {
																Description: "The certificate chain for this CA in PEM format. Last entry in this chain is the Root certificate.",
																Type:        "string",
															},
															"subject": {
																Description: "The root certificate MUST be self-signed, and so the subject and issuer are the same.",
																Properties: map[string]apiextensionsv1.JSONSchemaProps{
																	"commonName":   {Type: "string"},
																	"organization": {Type: "string"},
																},
																Type: "object",
															},
															"uri": {
																Description: "The URI at which the CA can be accessed.",
																Type:        "string",
															},
														},
														Type: "object",
													},
												},
												Type: "array",
											},
											"ctLogs": {
												Description: "Certificate Transparency Log",
												Items: &apiextensionsv1.JSONSchemaPropsOrArray{
													Schema: &apiextensionsv1.JSONSchemaProps{
														Properties: map[string]apiextensionsv1.JSONSchemaProps{
															"baseURL": {
																Description: "The base URL which can be used for URLs for clients.",
																Type:        "string",
															},
															"hashAlgorithm": {
																Description: "/ The hash algorithm used for the Merkle Tree",
																Type:        "string",
															},
															"publicKey": {
																Description: "PEM encoded public key",
																Type:        "string",
															},
														},
														Type: "object",
													},
												},
												Type: "array",
											},
											"tLogs": {
												Description: "Rekor log specifications",
												Items: &apiextensionsv1.JSONSchemaPropsOrArray{
													Schema: &apiextensionsv1.JSONSchemaProps{
														Properties: map[string]apiextensionsv1.JSONSchemaProps{
															"baseURL": {
																Description: "The base URL which can be used for URLs for clients.",
																Type:        "string",
															},
															"hashAlgorithm": {
																Description: "/ The hash algorithm used for the Merkle Tree",
																Type:        "string",
															},
															"publicKey": {
																Description: "PEM encoded public key",
																Type:        "string",
															},
														},
														Type: "object",
													},
												},
												Type: "array",
											},
											"timestampAuthorities": {
												Description: "Trusted timestamping authorities",
												Items: &apiextensionsv1.JSONSchemaPropsOrArray{
													Schema: &apiextensionsv1.JSONSchemaProps{
														Properties: map[string]apiextensionsv1.JSONSchemaProps{
															"certChain": {
																Description: "The certificate chain for this CA in PEM format. Last entry in this chain is the Root certificate.",
																Type:        "string",
															},
															"subject": {
																Description: "The root certificate MUST be self-signed, and so the subject and issuer are the same.",
																Properties: map[string]apiextensionsv1.JSONSchemaProps{
																	"commonName":   {Type: "string"},
																	"organization": {Type: "string"},
																},
																Type: "object",
															},
															"uri": {
																Description: "The URI at which the CA can be accessed.",
																Type:        "string",
															},
														},
														Type: "object",
													},
												},
												Type: "array",
											},
										},
										Type: "object",
									},
								},
								Type: "object",
							},
							"status": {
								Description: "Status represents the current state of the TrustRoot. This data may be out of date.",
								Properties: map[string]apiextensionsv1.JSONSchemaProps{
									"annotations": {
										Description:            "Annotations is additional Status fields for the Resource to save some additional State as well as convey more information to the user. This is roughly akin to Annotations on any k8s resource, just the reconciler conveying richer information outwards.",
										Type:                   "object",
										XPreserveUnknownFields: P(true),
									},
									"conditions": {
										Description: "Conditions the latest available observations of a resource's current state.",
										Items: &apiextensionsv1.JSONSchemaPropsOrArray{
											Schema: &apiextensionsv1.JSONSchemaProps{
												Properties: map[string]apiextensionsv1.JSONSchemaProps{
													"lastTransitionTime": {
														Description: "LastTransitionTime is the last time the condition transitioned from one status to another. We use VolatileTime in place of metav1.Time to exclude this from creating equality.Semantic differences (all other things held constant).",
														Type:        "string",
													},
													"message": {
														Description: "A human readable message indicating details about the transition.",
														Type:        "string",
													},
													"reason": {
														Description: "The reason for the condition's last transition.",
														Type:        "string",
													},
													"severity": {
														Description: "Severity with which to treat failures of this type of condition. When this is not specified, it defaults to Error.",
														Type:        "string",
													},
													"status": {
														Description: "Status of the condition, one of True, False, Unknown.",
														Type:        "string",
													},
													"type": {
														Description: "Type of condition.",
														Type:        "string",
													},
												},
												Required: []string{
													"type",
													"status",
												},
												Type: "object",
											},
										},
										Type: "array",
									},
									"observedGeneration": {
										Description: "ObservedGeneration is the 'Generation' of the Service that was last processed by the controller.",
										Format:      "int64",
										Type:        "integer",
									},
								},
								Type: "object",
							},
						},
						Type: "object",
					},
				},
				Served:       true,
				Storage:      true,
				Subresources: &apiextensionsv1.CustomResourceSubresources{},
			},
		},
	},
	TypeMeta: metav1.TypeMeta{
		APIVersion: "apiextensions.k8s.io/v1",
		Kind:       "CustomResourceDefinition",
	},
}

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