Skip to content

Commit 57380ca

Browse files
authored
Add a PartialEq implementation to generated types (#53)
Signed-off-by: Ben Linsay <[email protected]>
1 parent 891ca15 commit 57380ca

16 files changed

+254
-240
lines changed

Diff for: gateway-api/src/apis/experimental/constants.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// WARNING: generated file - manual changes will be overriden
22

3-
#[derive(Debug)]
3+
#[derive(Debug, PartialEq, Eq)]
44
pub enum GatewayConditionType {
55
Programmed,
66
Accepted,
@@ -13,7 +13,7 @@ impl std::fmt::Display for GatewayConditionType {
1313
}
1414
}
1515

16-
#[derive(Debug)]
16+
#[derive(Debug, PartialEq, Eq)]
1717
pub enum GatewayConditionReason {
1818
Programmed,
1919
Invalid,
@@ -35,7 +35,7 @@ impl std::fmt::Display for GatewayConditionReason {
3535
}
3636
}
3737

38-
#[derive(Debug)]
38+
#[derive(Debug, PartialEq, Eq)]
3939
pub enum ListenerConditionType {
4040
Conflicted,
4141
Accepted,
@@ -50,7 +50,7 @@ impl std::fmt::Display for ListenerConditionType {
5050
}
5151
}
5252

53-
#[derive(Debug)]
53+
#[derive(Debug, PartialEq, Eq)]
5454
pub enum ListenerConditionReason {
5555
HostnameConflict,
5656
ProtocolConflict,

Diff for: gateway-api/src/apis/experimental/gatewayclasses.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// WARNING: generated by kopium - manual changes will be overwritten
2-
// kopium command: kopium --schema=derived --derive=JsonSchema --derive=Default --docs -f -
2+
// kopium command: kopium --schema=derived --derive=JsonSchema --derive=Default --derive=PartialEq --docs -f -
33
// kopium version: 0.20.1
44

55
#[allow(unused_imports)]
@@ -12,7 +12,7 @@ mod prelude {
1212
use self::prelude::*;
1313

1414
/// Spec defines the desired state of GatewayClass.
15-
#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, JsonSchema, Default)]
15+
#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1616
#[kube(
1717
group = "gateway.networking.k8s.io",
1818
version = "v1",
@@ -21,6 +21,7 @@ use self::prelude::*;
2121
)]
2222
#[kube(status = "GatewayClassStatus")]
2323
#[kube(derive = "Default")]
24+
#[kube(derive = "PartialEq")]
2425
pub struct GatewayClassSpec {
2526
/// ControllerName is the name of the controller that is managing Gateways of
2627
/// this class. The value of this field MUST be a domain prefixed path.
@@ -86,7 +87,7 @@ pub struct GatewayClassSpec {
8687
///
8788
///
8889
/// Support: Implementation-specific
89-
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default)]
90+
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
9091
pub struct GatewayClassParametersRef {
9192
/// Group is the group of the referent.
9293
pub group: String,
@@ -106,7 +107,7 @@ pub struct GatewayClassParametersRef {
106107
///
107108
/// Implementations MUST populate status on all GatewayClass resources which
108109
/// specify their controller name.
109-
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default)]
110+
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
110111
pub struct GatewayClassStatus {
111112
/// Conditions is the current status from the controller for
112113
/// this GatewayClass.

Diff for: gateway-api/src/apis/experimental/gateways.rs

+22-21
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// WARNING: generated by kopium - manual changes will be overwritten
2-
// kopium command: kopium --schema=derived --derive=JsonSchema --derive=Default --docs -f -
2+
// kopium command: kopium --schema=derived --derive=JsonSchema --derive=Default --derive=PartialEq --docs -f -
33
// kopium version: 0.20.1
44

55
#[allow(unused_imports)]
@@ -13,7 +13,7 @@ mod prelude {
1313
use self::prelude::*;
1414

1515
/// Spec defines the desired state of Gateway.
16-
#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, JsonSchema, Default)]
16+
#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1717
#[kube(
1818
group = "gateway.networking.k8s.io",
1919
version = "v1",
@@ -23,6 +23,7 @@ use self::prelude::*;
2323
#[kube(namespaced)]
2424
#[kube(status = "GatewayStatus")]
2525
#[kube(derive = "Default")]
26+
#[kube(derive = "PartialEq")]
2627
pub struct GatewaySpec {
2728
/// Addresses requested for this Gateway. This is optional and behavior can
2829
/// depend on the implementation. If a value is set in the spec and the
@@ -214,7 +215,7 @@ pub struct GatewaySpec {
214215
}
215216

216217
/// GatewayAddress describes an address that can be bound to a Gateway.
217-
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default)]
218+
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
218219
pub struct GatewayAddresses {
219220
/// Type of the address.
220221
#[serde(default, skip_serializing_if = "Option::is_none", rename = "type")]
@@ -234,7 +235,7 @@ pub struct GatewayAddresses {
234235
///
235236
///
236237
///
237-
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default)]
238+
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
238239
pub struct GatewayInfrastructure {
239240
/// Annotations that SHOULD be applied to any resources created in response to this Gateway.
240241
///
@@ -298,7 +299,7 @@ pub struct GatewayInfrastructure {
298299
///
299300
///
300301
/// Support: Implementation-specific
301-
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default)]
302+
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
302303
pub struct GatewayInfrastructureParametersRef {
303304
/// Group is the group of the referent.
304305
pub group: String,
@@ -310,7 +311,7 @@ pub struct GatewayInfrastructureParametersRef {
310311

311312
/// Listener embodies the concept of a logical endpoint where a Gateway accepts
312313
/// network connections.
313-
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default)]
314+
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
314315
pub struct GatewayListeners {
315316
/// AllowedRoutes defines the types of routes that MAY be attached to a
316317
/// Listener and the trusted namespaces where those Route resources MAY be
@@ -442,7 +443,7 @@ pub struct GatewayListeners {
442443
///
443444
///
444445
/// Support: Core
445-
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default)]
446+
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
446447
pub struct GatewayListenersAllowedRoutes {
447448
/// Kinds specifies the groups and kinds of Routes that are allowed to bind
448449
/// to this Gateway Listener. When unspecified or empty, the kinds of Routes
@@ -469,7 +470,7 @@ pub struct GatewayListenersAllowedRoutes {
469470
}
470471

471472
/// RouteGroupKind indicates the group and kind of a Route resource.
472-
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default)]
473+
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
473474
pub struct GatewayListenersAllowedRoutesKinds {
474475
/// Group is the group of the Route.
475476
#[serde(default, skip_serializing_if = "Option::is_none")]
@@ -483,7 +484,7 @@ pub struct GatewayListenersAllowedRoutesKinds {
483484
///
484485
///
485486
/// Support: Core
486-
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default)]
487+
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
487488
pub struct GatewayListenersAllowedRoutesNamespaces {
488489
/// From indicates where Routes will be selected for this Gateway. Possible
489490
/// values are:
@@ -513,7 +514,7 @@ pub struct GatewayListenersAllowedRoutesNamespaces {
513514
///
514515
///
515516
/// Support: Core
516-
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
517+
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
517518
pub enum GatewayListenersAllowedRoutesNamespacesFrom {
518519
All,
519520
Selector,
@@ -526,7 +527,7 @@ pub enum GatewayListenersAllowedRoutesNamespacesFrom {
526527
///
527528
///
528529
/// Support: Core
529-
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default)]
530+
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
530531
pub struct GatewayListenersAllowedRoutesNamespacesSelector {
531532
/// matchExpressions is a list of label selector requirements. The requirements are ANDed.
532533
#[serde(
@@ -549,7 +550,7 @@ pub struct GatewayListenersAllowedRoutesNamespacesSelector {
549550

550551
/// A label selector requirement is a selector that contains values, a key, and an operator that
551552
/// relates the key and values.
552-
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default)]
553+
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
553554
pub struct GatewayListenersAllowedRoutesNamespacesSelectorMatchExpressions {
554555
/// key is the label key that the selector applies to.
555556
pub key: String,
@@ -578,7 +579,7 @@ pub struct GatewayListenersAllowedRoutesNamespacesSelectorMatchExpressions {
578579
///
579580
///
580581
/// Support: Core
581-
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default)]
582+
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
582583
pub struct GatewayListenersTls {
583584
/// CertificateRefs contains a series of references to Kubernetes objects that
584585
/// contains TLS certificates and private keys. These certificates are used to
@@ -677,7 +678,7 @@ pub struct GatewayListenersTls {
677678
/// References to objects with invalid Group and Kind are not valid, and must
678679
/// be rejected by the implementation, with appropriate Conditions set
679680
/// on the containing object.
680-
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default)]
681+
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
681682
pub struct GatewayListenersTlsCertificateRefs {
682683
/// Group is the group of the referent. For example, "gateway.networking.k8s.io".
683684
/// When unspecified or empty string, core API group is inferred.
@@ -714,7 +715,7 @@ pub struct GatewayListenersTlsCertificateRefs {
714715
///
715716
///
716717
///
717-
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default)]
718+
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
718719
pub struct GatewayListenersTlsFrontendValidation {
719720
/// CACertificateRefs contains one or more references to
720721
/// Kubernetes objects that contain TLS certificates of
@@ -759,7 +760,7 @@ pub struct GatewayListenersTlsFrontendValidation {
759760
/// References to objects with invalid Group and Kind are not valid, and must
760761
/// be rejected by the implementation, with appropriate Conditions set
761762
/// on the containing object.
762-
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default)]
763+
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
763764
pub struct GatewayListenersTlsFrontendValidationCaCertificateRefs {
764765
/// Group is the group of the referent. For example, "gateway.networking.k8s.io".
765766
/// When unspecified or empty string, core API group is inferred.
@@ -797,14 +798,14 @@ pub struct GatewayListenersTlsFrontendValidationCaCertificateRefs {
797798
///
798799
///
799800
/// Support: Core
800-
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
801+
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
801802
pub enum GatewayListenersTlsMode {
802803
Terminate,
803804
Passthrough,
804805
}
805806

806807
/// Status defines the current state of Gateway.
807-
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default)]
808+
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
808809
pub struct GatewayStatus {
809810
/// Addresses lists the network addresses that have been bound to the
810811
/// Gateway.
@@ -845,7 +846,7 @@ pub struct GatewayStatus {
845846
}
846847

847848
/// GatewayStatusAddress describes a network address that is bound to a Gateway.
848-
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default)]
849+
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
849850
pub struct GatewayStatusAddresses {
850851
/// Type of the address.
851852
#[serde(default, skip_serializing_if = "Option::is_none", rename = "type")]
@@ -859,7 +860,7 @@ pub struct GatewayStatusAddresses {
859860
}
860861

861862
/// ListenerStatus is the status associated with a Listener.
862-
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default)]
863+
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
863864
pub struct GatewayStatusListeners {
864865
/// AttachedRoutes represents the total number of Routes that have been
865866
/// successfully attached to this Listener.
@@ -901,7 +902,7 @@ pub struct GatewayStatusListeners {
901902
}
902903

903904
/// RouteGroupKind indicates the group and kind of a Route resource.
904-
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default)]
905+
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
905906
pub struct GatewayStatusListenersSupportedKinds {
906907
/// Group is the group of the Route.
907908
#[serde(default, skip_serializing_if = "Option::is_none")]

0 commit comments

Comments
 (0)