kmip_protocol/types/
response.rs

1//! Rust types for deserializing KMIP responses.
2use serde_derive::Deserialize;
3
4use enum_display_derive::Display;
5use std::fmt::Display;
6
7use super::common::{
8    AttributeIndex, AttributeName, AttributeValue, CertificateType, CryptographicAlgorithm, KeyCompressionType,
9    KeyFormatType, KeyMaterial, NameType, NameValue, ObjectType, Operation, UniqueBatchItemID, UniqueIdentifier,
10};
11
12///  See KMIP 1.0 section 2.1.3 [Key Block](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581157).
13#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
14#[serde(rename = "0x420040")]
15pub struct KeyBlock {
16    #[serde(rename = "0x420042")]
17    pub key_format_type: KeyFormatType,
18
19    #[serde(rename = "0x420041")]
20    pub key_compression_type: Option<KeyCompressionType>,
21
22    #[serde(rename = "0x420045")]
23    pub key_value: KeyValue,
24
25    #[serde(rename = "0x420028")]
26    pub cryptographic_algorithm: Option<CryptographicAlgorithm>,
27
28    #[serde(rename = "0x42002A")]
29    pub cryptographic_length: Option<i32>,
30
31    #[serde(rename = "0x420046")]
32    pub key_wrapping_data: Option<()>, // TODO
33}
34
35///  See KMIP 1.0 section 2.1.4 [Key Value](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581158).
36#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
37#[serde(rename = "0x420045")]
38pub struct KeyValue {
39    pub key_material: KeyMaterial,
40    pub attributes: Option<Vec<Attribute>>,
41}
42
43///  See KMIP 1.0 section 2.1.8 [Template Attribute](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581162).
44#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
45#[serde(rename = "0x420091")]
46pub struct TemplateAttribute {
47    pub name: KeyMaterial,
48    pub attributes: Option<Vec<Attribute>>,
49}
50
51///  See KMIP 1.0 section 2.2 [Managed Objects](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581163).
52#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
53#[non_exhaustive]
54pub enum ManagedObject {
55    #[serde(rename = "if 0x420057==0x00000001")]
56    Certificate(Certificate),
57
58    #[serde(rename = "if 0x420057==0x00000002")]
59    SymmetricKey(SymmetricKey),
60
61    #[serde(rename = "if 0x420057==0x00000003")]
62    PublicKey(PublicKey),
63
64    #[serde(rename = "if 0x420057==0x00000004")]
65    PrivateKey(PrivateKey),
66    // TODO:
67    // #[serde(rename = "if 0x420057==0x00000005")]
68    // SplitKey(SplitKey),
69
70    // #[serde(rename = "if 0x420057==0x00000006")]
71    // Template(Template),
72
73    // #[serde(rename = "if 0x420057==0x00000007")]
74    // SecretData(SecretData),
75
76    // #[serde(rename = "if 0x420057==0x00000008")]
77    // OpaqueObject(OpaqueObject),
78}
79
80///  See KMIP 1.0 section 2.2.1 [Certificate](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581164).
81#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
82#[serde(rename = "0x420013")]
83pub struct Certificate {
84    pub certificate_type: CertificateType,
85    #[serde(with = "serde_bytes")]
86    pub certificate_value: Vec<u8>,
87}
88
89///  See KMIP 1.0 section 2.2.2 [Symmetric Key](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581165).
90#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
91#[serde(rename = "0x42008F")]
92pub struct SymmetricKey {
93    pub key_block: KeyBlock,
94}
95
96///  See KMIP 1.0 section 2.2.3 [Public Key](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581166).
97#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
98#[serde(rename = "0x42006D")]
99pub struct PublicKey {
100    pub key_block: KeyBlock,
101}
102
103///  See KMIP 1.0 section 2.2.4 [Private Key](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581167).
104#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
105#[serde(rename = "0x420064")]
106pub struct PrivateKey {
107    pub key_block: KeyBlock,
108}
109
110///  See KMIP 1.0 section 3.2 [Name](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581174).
111#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
112#[serde(rename = "0x420053")]
113pub struct Name {
114    pub name: NameValue,
115    pub r#type: NameType,
116}
117
118///  See KMIP 1.0 section 4.1 [Create](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581209).
119#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
120#[serde(rename = "0x42007C")]
121pub struct CreateResponsePayload {
122    pub object_type: ObjectType,
123    pub unique_identifier: UniqueIdentifier,
124    pub object_attributes: Option<Vec<Attribute>>,
125}
126
127///  See KMIP 1.0 section 4.2 [Create Key Pair](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581210).
128#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
129#[serde(rename = "0x42007C")]
130pub struct CreateKeyPairResponsePayload {
131    #[serde(rename = "0x420066")]
132    pub private_key_unique_identifier: UniqueIdentifier,
133
134    #[serde(rename = "0x42006F")]
135    pub public_key_unique_identifier: UniqueIdentifier,
136    // TODO: Add the optional response field that lists attributes for the private key
137
138    // TODO: Add the optional response field that lists attributes for the public key
139}
140
141///  See KMIP 1.0 section 4.3 [Register](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581211).
142#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
143#[serde(rename = "0x42007C")]
144pub struct RegisterResponsePayload {
145    #[serde(rename = "0x420094")]
146    pub unique_identifier: UniqueIdentifier,
147
148    #[serde(rename = "0x420091")]
149    pub template_attributes: Option<Vec<TemplateAttribute>>,
150}
151
152///  See KMIP 1.0 section 4.8 [Locate](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581216).
153#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
154#[serde(rename = "0x42007C")]
155pub struct LocateResponsePayload {
156    #[serde(rename = "0x420094")]
157    #[serde(default = "Vec::new")]
158    // This should be Option<Vec<..>> but changing that would require a breaking release. Using
159    // `#[serde(default = "Vec::new")]` works around the case when the Locate response is completely empty without
160    // breaking compatibility with clients who currently expect this to be a Vec and not an Option.
161    pub unique_identifiers: Vec<UniqueIdentifier>,
162}
163
164///  See KMIP 1.0 section 4.10 [Get](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581218).
165#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
166#[serde(rename = "0x42007C")]
167pub struct GetResponsePayload {
168    pub object_type: ObjectType,
169    pub unique_identifier: UniqueIdentifier,
170    pub cryptographic_object: ManagedObject,
171}
172
173///  See KMIP 1.0 section 4.11 [Get Attributes](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581219).
174#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
175#[serde(rename = "0x42007C")]
176pub struct GetAttributesResponsePayload {
177    #[serde(rename = "0x420094")]
178    pub unique_identifier: UniqueIdentifier,
179
180    #[serde(rename = "0x420008")]
181    pub attributes: Option<Vec<Attribute>>,
182}
183
184///  See KMIP 1.0 section 4.12 [Get Attribute List](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581220).
185#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
186#[serde(rename = "0x42007C")]
187pub struct GetAttributeListResponsePayload {
188    #[serde(rename = "0x420094")]
189    pub unique_identifier: UniqueIdentifier,
190
191    #[serde(rename = "0x42000A")]
192    pub attributes: Vec<AttributeName>,
193}
194
195/// Fields common to sections 4.18 [Activate](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581226),
196/// 4.19 [Revoke](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581227)
197/// and 4.20 [Destroy](http://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581228) responses.
198#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
199#[serde(rename = "0x42007C")]
200pub struct UniqueIdentifierResponsePayload {
201    #[serde(rename = "0x420094")]
202    pub unique_identifier: UniqueIdentifier,
203}
204
205///  See KMIP 1.0 section 4.18 [Activate](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581226).
206pub type ActivateResponsePayload = UniqueIdentifierResponsePayload;
207
208///  See KMIP 1.0 section 4.19 [Revoke](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581227).
209pub type RevokeResponsePayload = UniqueIdentifierResponsePayload;
210
211///  See KMIP 1.0 section 4.20 [Destroy](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581228).
212pub type DestroyResponsePayload = UniqueIdentifierResponsePayload;
213
214/// Fields common to sections 4.13 [Add](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581221),
215/// 4.14 [Modify](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581222) and 4.15
216/// [Delete](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581223) Attribute responses.
217#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
218#[serde(rename = "0x42007C")]
219pub struct AttributeEditResponsePayload {
220    #[serde(rename = "0x420094")]
221    pub unique_identifier: UniqueIdentifier,
222
223    #[serde(rename = "0x420008")]
224    pub attribute: Attribute,
225}
226
227///  See KMIP 1.0 section 4.13 [Add Attribute](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581221).
228pub type AddAttributeResponsePayload = AttributeEditResponsePayload;
229
230///  See KMIP 1.0 section 4.14 [Modify Attribute](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581222).
231pub type ModifyAttributeResponsePayload = AttributeEditResponsePayload;
232
233///  See KMIP 1.0 section 4.15 [Delete Attribute](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581223).
234pub type DeleteAttributeResponsePayload = AttributeEditResponsePayload;
235
236///  See KMIP 1.0 section 4.24 [Query](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581232).
237#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
238#[serde(rename = "0x42007C")]
239pub struct QueryResponsePayload {
240    #[serde(rename = "0x42005C")]
241    pub operations: Option<Vec<Operation>>,
242
243    #[serde(rename = "0x420057")]
244    pub object_types: Option<Vec<ObjectType>>,
245
246    #[serde(rename = "0x42009D")]
247    pub vendor_identification: Option<String>,
248
249    #[serde(rename = "0x420088")]
250    #[serde(skip_deserializing)] // We don't support this yet
251    #[serde(default)]
252    pub server_information: Option<ServerInformation>,
253}
254
255///  See KMIP 1.0 section 4.24 [Query](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581232).
256#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
257#[serde(rename = "0x42007C")]
258pub struct RNGRetrieveResponsePayload {
259    #[serde(with = "serde_bytes")]
260    pub data: Vec<u8>,
261}
262
263///  See KMIP 1.0 section 4.24 [Server Information](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581232).
264#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Default)]
265#[serde(rename = "0x420088")]
266pub struct ServerInformation;
267
268///  See KMIP 1.1 section 4.26 [Discover Versions](https://docs.oasis-open.org/kmip/spec/v1.1/cs01/kmip-spec-v1.1-cs01.html#_Toc332787652).
269#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
270#[serde(rename = "0x42007C")]
271pub struct DiscoverVersionsResponsePayload {
272    #[serde(rename = "0x420069")]
273    pub supported_versions: Option<Vec<ProtocolVersion>>,
274}
275
276///  See KMIP 1.2 section 4.31 [Sign](https://docs.oasis-open.org/kmip/spec/v1.2/os/kmip-spec-v1.2-os.html#_Toc409613558).
277#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
278#[serde(rename = "0x42007C")]
279pub struct SignResponsePayload {
280    #[serde(rename = "0x420094")]
281    pub unique_identifier: UniqueIdentifier,
282
283    #[serde(rename = "0x4200C3")]
284    #[serde(with = "serde_bytes")]
285    pub signature_data: Vec<u8>,
286}
287
288///  See KMIP 1.0 section 6.1 [Protocol Version](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581239).
289#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Eq)]
290#[serde(rename = "0x420069")]
291pub struct ProtocolVersion {
292    #[serde(rename = "0x42006A")]
293    pub major: i32,
294
295    #[serde(rename = "0x42006B")]
296    pub minor: i32,
297}
298
299///  See KMIP 1.0 section 6.9 [Result Status](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581247).
300#[derive(Clone, Copy, Debug, Deserialize, Display, PartialEq, Eq)]
301#[non_exhaustive]
302pub enum ResultStatus {
303    #[serde(rename = "0x00000000")]
304    Success,
305
306    #[serde(rename = "0x00000001")]
307    OperationFailed,
308
309    #[serde(rename = "0x00000002")]
310    OperationPending,
311
312    #[serde(rename = "0x00000003")]
313    OperationUndone,
314}
315
316///  See KMIP 1.0 section 6.10 [Result Reason](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581248).
317#[derive(Clone, Copy, Debug, Deserialize, Display, PartialEq, Eq)]
318#[non_exhaustive]
319pub enum ResultReason {
320    #[serde(rename = "0x00000001")]
321    ItemNotFound,
322
323    #[serde(rename = "0x00000002")]
324    ResponseTooLarge,
325
326    #[serde(rename = "0x00000003")]
327    AuthenticationNotSuccessful,
328
329    #[serde(rename = "0x00000004")]
330    InvalidMessage,
331
332    #[serde(rename = "0x00000005")]
333    OperationNotSupported,
334
335    #[serde(rename = "0x00000006")]
336    MissingData,
337
338    #[serde(rename = "0x00000007")]
339    InvalidField,
340
341    #[serde(rename = "0x00000008")]
342    FeatureNotSupported,
343
344    #[serde(rename = "0x00000009")]
345    OperationCanceledByRequester,
346
347    #[serde(rename = "0x0000000A")]
348    CryptographicFailure,
349
350    #[serde(rename = "0x0000000B")]
351    IllegalOperation,
352
353    #[serde(rename = "0x0000000C")]
354    PermissionDenied,
355
356    #[serde(rename = "0x0000000D")]
357    ObjectArchived,
358
359    #[serde(rename = "0x0000000E")]
360    IndexOutOfBounds,
361
362    #[serde(rename = "0x0000000F")]
363    ApplicationNamespaceNotSupported,
364
365    #[serde(rename = "0x00000010")]
366    KeyFormatTypeNotSupported,
367
368    #[serde(rename = "0x00000011")]
369    KeyCompressionTypeNotSupported,
370
371    #[serde(rename = "0x00000100")]
372    GeneralFailure,
373}
374
375///  See KMIP 1.0 section 6.16 [Message Extension](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581254).
376#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
377#[serde(rename = "0x420051")]
378pub struct MessageExtension {
379    #[serde(rename = "0x42007D")]
380    pub vendor_identification: String,
381
382    #[serde(rename = "0x420026")]
383    pub criticality_indicator: bool,
384
385    #[serde(rename = "0x42009C")]
386    #[serde(skip_deserializing)] // We don't support this yet
387    #[serde(default)]
388    pub vendor_extension: VendorExtension,
389}
390
391///  See KMIP 1.0 section 6.16 [Message Extension](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581254).
392#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Default)]
393// #[serde(rename = "0x42009C", transparent)]
394#[serde(rename = "0x42009C")]
395pub struct VendorExtension;
396
397///  See KMIP 1.0 section 7.1 [Message Structure](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581256).
398#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
399#[serde(rename = "0x42007B")]
400pub struct ResponseMessage {
401    #[serde(rename = "0x42007A")]
402    pub header: ResponseHeader,
403
404    #[serde(rename = "0x42000F")]
405    pub batch_items: Vec<BatchItem>,
406}
407
408///  See KMIP 1.0 section 7.2 [Operations](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581257).
409#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Eq)]
410#[serde(rename = "0x42007A")]
411pub struct ResponseHeader {
412    #[serde(rename = "0x420069")]
413    pub protocol_version: ProtocolVersion,
414
415    #[serde(rename = "0x420092")]
416    pub timestamp: i64,
417
418    #[serde(rename = "0x42000D")]
419    pub batch_count: i32,
420}
421
422///  See KMIP 1.0 section 6.15 [Batch Item](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581253).
423#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
424#[serde(rename = "0x42000F")]
425pub struct BatchItem {
426    #[serde(rename = "0x42005C")]
427    pub operation: Option<Operation>,
428
429    #[serde(rename = "0x420093")]
430    pub unique_batch_item_id: Option<UniqueBatchItemID>,
431
432    #[serde(rename = "0x42007F")]
433    pub result_status: ResultStatus,
434
435    #[serde(rename = "0x42007E")]
436    pub result_reason: Option<ResultReason>,
437
438    #[serde(rename = "0x42007D")]
439    pub result_message: Option<String>,
440
441    // #[serde(rename = "0x420006")]
442    // pub asynchronous_correlation_value: Option<??>,
443    #[serde(rename = "0x42007C")]
444    pub payload: Option<ResponsePayload>,
445
446    #[serde(rename = "0x420051")]
447    pub message_extension: Option<MessageExtension>,
448}
449
450///  See KMIP 1.0 section 7.2 [Operations](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581257).
451#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
452#[non_exhaustive]
453#[allow(clippy::large_enum_variant)]
454pub enum ResponsePayload {
455    // ///  See KMIP 1.0 section 4.1 Create.
456    // See: https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581209
457    #[serde(rename = "if 0x42005C==0x00000001")]
458    Create(CreateResponsePayload),
459
460    // ///  See KMIP 1.0 section 4.2 Create Key Pair.
461    // See: https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581210
462    #[serde(rename = "if 0x42005C==0x00000002")]
463    CreateKeyPair(CreateKeyPairResponsePayload),
464
465    // ///  See KMIP 1.0 section 4.3 Register.
466    // See: https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581211
467    #[serde(rename = "if 0x42005C==0x00000003")]
468    Register(RegisterResponsePayload),
469
470    // ///  See KMIP 1.0 section 4.8 Locate.
471    // See: https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581216
472    #[serde(rename = "if 0x42005C==0x00000008")]
473    Locate(LocateResponsePayload),
474
475    // ///  See KMIP 1.0 section 4.10 Get.
476    // See: https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581218
477    #[serde(rename = "if 0x42005C==0x0000000A")]
478    Get(GetResponsePayload),
479
480    // ///  See KMIP 1.0 section 4.11 Get Attributes.
481    // See: https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581219
482    #[serde(rename = "if 0x42005C==0x0000000B")]
483    GetAttributes(GetAttributesResponsePayload),
484
485    // ///  See KMIP 1.0 section 4.12 Get Attribute List.
486    // See: https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581220
487    #[serde(rename = "if 0x42005C==0x0000000C")]
488    GetAttributeList(GetAttributeListResponsePayload),
489
490    // ///  See KMIP 1.0 section 4.13 Add Attribute.
491    // See: https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581221
492    #[serde(rename = "if 0x42005C==0x0000000D")]
493    AddAttribute(AddAttributeResponsePayload),
494
495    // ///  See KMIP 1.0 section 4.14 Modify Attribute.
496    // See: https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581222
497    #[serde(rename = "if 0x42005C==0x0000000E")]
498    ModifyAttribute(ModifyAttributeResponsePayload),
499
500    // ///  See KMIP 1.0 section 4.15 Delete Attribute.
501    // See: https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581223
502    #[serde(rename = "if 0x42005C==0x0000000F")]
503    DeleteAttribute(DeleteAttributeResponsePayload),
504
505    // ///  See KMIP 1.0 section 4.18 Activate.
506    // See: https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581226
507    #[serde(rename = "if 0x42005C==0x00000012")]
508    Activate(ActivateResponsePayload),
509
510    // ///  See KMIP 1.0 section 4.19 Revoke.
511    // See: https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581227
512    #[serde(rename = "if 0x42005C==0x00000013")]
513    Revoke(RevokeResponsePayload),
514
515    // ///  See KMIP 1.0 section 4.20 Destroy.
516    // See: https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581228
517    #[serde(rename = "if 0x42005C==0x00000014")]
518    Destroy(DestroyResponsePayload),
519
520    // ///  See KMIP 1.0 section 4.24 Query.
521    // See: https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581232
522    #[serde(rename = "if 0x42005C==0x00000018")]
523    Query(QueryResponsePayload),
524
525    // ///  See KMIP 1.1 section 4.26 Discover Versions.
526    // See: https://docs.oasis-open.org/kmip/spec/v1.1/cs01/kmip-spec-v1.1-cs01.html#_Toc332787652
527    #[serde(rename = "if 0x42005C==0x0000001E")]
528    DiscoverVersions(DiscoverVersionsResponsePayload),
529
530    // ///  See KMIP 1.2 section 4.31 Sign.
531    // See: https://docs.oasis-open.org/kmip/spec/v1.2/os/kmip-spec-v1.2-os.html#_Toc409613558
532    #[serde(rename = "if 0x42005C==0x00000021")]
533    Sign(SignResponsePayload),
534
535    // ///  See KMIP 1.2 section 4.35 RNG Retrieve.
536    // See: https://docs.oasis-open.org/kmip/spec/v1.2/os/kmip-spec-v1.2-os.html#_Toc409613562
537    #[serde(rename = "if 0x42005C==0x00000025")]
538    RNGRetrieve(RNGRetrieveResponsePayload),
539    // Note: This set of enum variants is deliberately limited to those that we currently support.
540}
541
542///  See KMIP 1.0 section 2.1.1 [Attribute](https://docs.oasis-open.org/kmip/spec/v1.0/os/kmip-spec-1.0-os.html#_Toc262581155).
543#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
544#[serde(rename = "0x420008")]
545pub struct Attribute {
546    #[serde(rename = "0x42000A")]
547    pub name: AttributeName,
548
549    #[serde(rename = "0x420009")]
550    pub index: Option<AttributeIndex>,
551
552    #[serde(rename = "0x42000B")]
553    pub value: AttributeValue,
554}