@@ -446,14 +446,17 @@ pub struct Job {
446
446
/// Serialized span context for trace propagation.
447
447
pub span_context : Option < String > ,
448
448
/// Encryption configuration for this job's payload (if encrypted).
449
+ #[ cfg( feature = "encryption" ) ]
449
450
pub encryption_config : Option < crate :: encryption:: EncryptionConfig > ,
450
451
/// List of field names that contain PII and should be encrypted.
451
452
pub pii_fields : Vec < String > ,
452
453
/// Retention policy for encrypted data (overrides default if specified).
454
+ #[ cfg( feature = "encryption" ) ]
453
455
pub retention_policy : Option < crate :: encryption:: RetentionPolicy > ,
454
456
/// Whether the payload is currently encrypted.
455
457
pub is_encrypted : bool ,
456
458
/// Encrypted payload data (if job is encrypted).
459
+ #[ cfg( feature = "encryption" ) ]
457
460
pub encrypted_payload : Option < crate :: encryption:: EncryptedPayload > ,
458
461
}
459
462
@@ -528,10 +531,13 @@ impl Job {
528
531
correlation_id : None ,
529
532
parent_span_id : None ,
530
533
span_context : None ,
534
+ #[ cfg( feature = "encryption" ) ]
531
535
encryption_config : None ,
532
536
pii_fields : Vec :: new ( ) ,
537
+ #[ cfg( feature = "encryption" ) ]
533
538
retention_policy : None ,
534
539
is_encrypted : false ,
540
+ #[ cfg( feature = "encryption" ) ]
535
541
encrypted_payload : None ,
536
542
}
537
543
}
@@ -611,10 +617,13 @@ impl Job {
611
617
correlation_id : None ,
612
618
parent_span_id : None ,
613
619
span_context : None ,
620
+ #[ cfg( feature = "encryption" ) ]
614
621
encryption_config : None ,
615
622
pii_fields : Vec :: new ( ) ,
623
+ #[ cfg( feature = "encryption" ) ]
616
624
retention_policy : None ,
617
625
is_encrypted : false ,
626
+ #[ cfg( feature = "encryption" ) ]
618
627
encrypted_payload : None ,
619
628
}
620
629
}
@@ -968,10 +977,13 @@ impl Job {
968
977
correlation_id : None ,
969
978
parent_span_id : None ,
970
979
span_context : None ,
980
+ #[ cfg( feature = "encryption" ) ]
971
981
encryption_config : None ,
972
982
pii_fields : Vec :: new ( ) ,
983
+ #[ cfg( feature = "encryption" ) ]
973
984
retention_policy : None ,
974
985
is_encrypted : false ,
986
+ #[ cfg( feature = "encryption" ) ]
975
987
encrypted_payload : None ,
976
988
} )
977
989
}
@@ -1722,6 +1734,7 @@ impl Job {
1722
1734
/// assert!(job.has_encryption());
1723
1735
/// # }
1724
1736
/// ```
1737
+ #[ cfg( feature = "encryption" ) ]
1725
1738
pub fn with_encryption ( mut self , config : crate :: encryption:: EncryptionConfig ) -> Self {
1726
1739
self . encryption_config = Some ( config) ;
1727
1740
self
@@ -1780,6 +1793,7 @@ impl Job {
1780
1793
/// .with_retention_policy(RetentionPolicy::DeleteAfter(Duration::from_secs(3600)));
1781
1794
/// # }
1782
1795
/// ```
1796
+ #[ cfg( feature = "encryption" ) ]
1783
1797
pub fn with_retention_policy ( mut self , policy : crate :: encryption:: RetentionPolicy ) -> Self {
1784
1798
self . retention_policy = Some ( policy) ;
1785
1799
self
@@ -1805,7 +1819,14 @@ impl Job {
1805
1819
/// }
1806
1820
/// ```
1807
1821
pub fn has_encryption ( & self ) -> bool {
1808
- self . encryption_config . is_some ( )
1822
+ #[ cfg( feature = "encryption" ) ]
1823
+ {
1824
+ self . encryption_config . is_some ( )
1825
+ }
1826
+ #[ cfg( not( feature = "encryption" ) ) ]
1827
+ {
1828
+ false
1829
+ }
1809
1830
}
1810
1831
1811
1832
/// Checks if this job has PII fields configured.
@@ -1879,6 +1900,7 @@ impl Job {
1879
1900
/// assert_eq!(retrieved_config.algorithm, EncryptionAlgorithm::AES256GCM);
1880
1901
/// # }
1881
1902
/// ```
1903
+ #[ cfg( feature = "encryption" ) ]
1882
1904
pub fn get_encryption_config ( & self ) -> Option < & crate :: encryption:: EncryptionConfig > {
1883
1905
self . encryption_config . as_ref ( )
1884
1906
}
@@ -1901,6 +1923,7 @@ impl Job {
1901
1923
/// assert_eq!(job.get_retention_policy(), Some(&policy));
1902
1924
/// # }
1903
1925
/// ```
1926
+ #[ cfg( feature = "encryption" ) ]
1904
1927
pub fn get_retention_policy ( & self ) -> Option < & crate :: encryption:: RetentionPolicy > {
1905
1928
self . retention_policy . as_ref ( )
1906
1929
}
@@ -1920,17 +1943,24 @@ impl Job {
1920
1943
/// assert!(!job.should_cleanup_encrypted_data());
1921
1944
/// ```
1922
1945
pub fn should_cleanup_encrypted_data ( & self ) -> bool {
1923
- if let Some ( encrypted_payload) = & self . encrypted_payload {
1924
- encrypted_payload. should_delete_now ( )
1925
- } else if let Some ( retention_policy) = & self . retention_policy {
1926
- retention_policy. should_delete_now (
1927
- self . created_at ,
1928
- self . completed_at ,
1929
- self . encryption_config
1930
- . as_ref ( )
1931
- . and_then ( |c| c. default_retention ) ,
1932
- )
1933
- } else {
1946
+ #[ cfg( feature = "encryption" ) ]
1947
+ {
1948
+ if let Some ( encrypted_payload) = & self . encrypted_payload {
1949
+ encrypted_payload. should_delete_now ( )
1950
+ } else if let Some ( retention_policy) = & self . retention_policy {
1951
+ retention_policy. should_delete_now (
1952
+ self . created_at ,
1953
+ self . completed_at ,
1954
+ self . encryption_config
1955
+ . as_ref ( )
1956
+ . and_then ( |c| c. default_retention ) ,
1957
+ )
1958
+ } else {
1959
+ false
1960
+ }
1961
+ }
1962
+ #[ cfg( not( feature = "encryption" ) ) ]
1963
+ {
1934
1964
false
1935
1965
}
1936
1966
}
0 commit comments