nats_io_jwt/
nats_jwt_schema.rs

1#![allow(unknown_lints)]
2#![allow(clippy::all)]
3
4/// Error types.
5pub mod error {
6    /// Error from a TryFrom or FromStr implementation.
7    pub struct ConversionError(::std::borrow::Cow<'static, str>);
8    impl ::std::error::Error for ConversionError {}
9    impl ::std::fmt::Display for ConversionError {
10        fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> {
11            ::std::fmt::Display::fmt(&self.0, f)
12        }
13    }
14    impl ::std::fmt::Debug for ConversionError {
15        fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> {
16            ::std::fmt::Debug::fmt(&self.0, f)
17        }
18    }
19    impl From<&'static str> for ConversionError {
20        fn from(value: &'static str) -> Self {
21            Self(value.into())
22        }
23    }
24    impl From<String> for ConversionError {
25        fn from(value: String) -> Self {
26            Self(value.into())
27        }
28    }
29}
30///Represents the core configuration of an account, including imports, exports, limits, signing keys, default permissions, mappings, external auth, and more.
31///
32/// <details><summary>JSON schema</summary>
33///
34/// ```json
35///{
36///  "description": "Represents the core configuration of an account, including imports, exports, limits, signing keys, default permissions, mappings, external auth, and more.",
37///  "allOf": [
38///    {
39///      "$ref": "#/$defs/Info"
40///    },
41///    {
42///      "$ref": "#/$defs/GenericFields"
43///    },
44///    {
45///      "type": "object",
46///      "properties": {
47///        "authorization": {
48///          "description": "Configuration for external authorization callouts.",
49///          "$ref": "#/$defs/ExternalAuthorization"
50///        },
51///        "cluster_traffic": {
52///          "description": "Indicates how cluster traffic is handled by this account. Can be 'system' or 'owner'.",
53///          "$ref": "#/$defs/ClusterTraffic"
54///        },
55///        "default_permissions": {
56///          "description": "Default permissions applied to users of this account if no user-specific permissions are provided.",
57///          "$ref": "#/$defs/Permissions"
58///        },
59///        "exports": {
60///          "description": "Subjects exported from this account.",
61///          "$ref": "#/$defs/Exports"
62///        },
63///        "imports": {
64///          "description": "Subjects imported from other accounts.",
65///          "$ref": "#/$defs/Imports"
66///        },
67///        "limits": {
68///          "description": "Limits that apply to this account, including operator-level, NATS, and JetStream constraints.",
69///          "$ref": "#/$defs/OperatorLimits"
70///        },
71///        "mappings": {
72///          "description": "Subject mappings that redirect or distribute messages from one subject to others.",
73///          "$ref": "#/$defs/Mapping"
74///        },
75///        "revocations": {
76///          "description": "A list of revoked user or account keys associated with this account.",
77///          "$ref": "#/$defs/RevocationList"
78///        },
79///        "signing_keys": {
80///          "description": "Keys authorized to sign user JWTs on behalf of this account, along with their scopes.",
81///          "$ref": "#/$defs/SigningKeys"
82///        },
83///        "trace": {
84///          "description": "Distributed message tracing configuration for this account.",
85///          "$ref": "#/$defs/MsgTrace"
86///        },
87///        "type": {
88///          "default": "account",
89///          "const": "account",
90///          "$ref": "#/$defs/ClaimsType"
91///        }
92///      }
93///    }
94///  ]
95///}
96/// ```
97/// </details>
98#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
99pub struct Account {
100    ///Configuration for external authorization callouts.
101    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
102    pub authorization: ::std::option::Option<ExternalAuthorization>,
103    ///Indicates how cluster traffic is handled by this account. Can be 'system' or 'owner'.
104    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
105    pub cluster_traffic: ::std::option::Option<ClusterTraffic>,
106    ///Default permissions applied to users of this account if no user-specific permissions are provided.
107    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
108    pub default_permissions: ::std::option::Option<Permissions>,
109    ///A more detailed description.
110    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
111    pub description: ::std::option::Option<::std::string::String>,
112    ///Subjects exported from this account.
113    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
114    pub exports: ::std::option::Option<Exports>,
115    ///Subjects imported from other accounts.
116    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
117    pub imports: ::std::option::Option<Imports>,
118    ///URL to find extra info.
119    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
120    pub info_url: ::std::option::Option<::std::string::String>,
121    ///Limits that apply to this account, including operator-level, NATS, and JetStream constraints.
122    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
123    pub limits: ::std::option::Option<OperatorLimits>,
124    ///Subject mappings that redirect or distribute messages from one subject to others.
125    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
126    pub mappings: ::std::option::Option<Mapping>,
127    ///A list of revoked user or account keys associated with this account.
128    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
129    pub revocations: ::std::option::Option<RevocationList>,
130    ///Keys authorized to sign user JWTs on behalf of this account, along with their scopes.
131    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
132    pub signing_keys: ::std::option::Option<SigningKeys>,
133    ///Tags used to categorize or label this entity.
134    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
135    pub tags: ::std::option::Option<TagList>,
136    ///Distributed message tracing configuration for this account.
137    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
138    pub trace: ::std::option::Option<MsgTrace>,
139    #[serde(rename = "type", default = "defaults::account_type")]
140    pub type_: AccountType,
141    ///The version of the claim.
142    #[serde(default = "defaults::default_u64::<i64, 2>")]
143    pub version: i64,
144}
145impl ::std::convert::From<&Account> for Account {
146    fn from(value: &Account) -> Self {
147        value.clone()
148    }
149}
150impl ::std::default::Default for Account {
151    fn default() -> Self {
152        Self {
153            authorization: Default::default(),
154            cluster_traffic: Default::default(),
155            default_permissions: Default::default(),
156            description: Default::default(),
157            exports: Default::default(),
158            imports: Default::default(),
159            info_url: Default::default(),
160            limits: Default::default(),
161            mappings: Default::default(),
162            revocations: Default::default(),
163            signing_keys: Default::default(),
164            tags: Default::default(),
165            trace: Default::default(),
166            type_: defaults::account_type(),
167            version: defaults::default_u64::<i64, 2>(),
168        }
169    }
170}
171impl Account {
172    pub fn builder() -> builder::Account {
173        Default::default()
174    }
175}
176///Represents all operator-imposed limits on an account, including NATS limits, account limits, and JetStream limits.
177///
178/// <details><summary>JSON schema</summary>
179///
180/// ```json
181///{
182///  "description": "Represents all operator-imposed limits on an account, including NATS limits, account limits, and JetStream limits.",
183///  "type": "object",
184///  "properties": {
185///    "conn": {
186///      "description": "Max number of active connections",
187///      "default": -1,
188///      "type": "integer"
189///    },
190///    "disallow_bearer": {
191///      "description": "User JWTs cannot be used as Bearer Tokens.",
192///      "default": false,
193///      "type": "boolean"
194///    },
195///    "exports": {
196///      "description": "Max number of exports (-1 for no limit).",
197///      "default": -1,
198///      "type": "integer"
199///    },
200///    "imports": {
201///      "description": "Max number of imports (-1 for no limit).",
202///      "default": -1,
203///      "type": "integer"
204///    },
205///    "leaf": {
206///      "description": "Max number of leaf node connections (-1 for no limit).",
207///      "default": -1,
208///      "type": "integer"
209///    },
210///    "wildcards": {
211///      "description": "Whether wildcard exports are allowed.",
212///      "default": true,
213///      "type": "boolean"
214///    }
215///  }
216///}
217/// ```
218/// </details>
219#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
220pub struct AccountLimits {
221    ///Max number of active connections
222    #[serde(default = "defaults::default_i64::<i64, -1>")]
223    pub conn: i64,
224    ///User JWTs cannot be used as Bearer Tokens.
225    #[serde(default)]
226    pub disallow_bearer: bool,
227    ///Max number of exports (-1 for no limit).
228    #[serde(default = "defaults::default_i64::<i64, -1>")]
229    pub exports: i64,
230    ///Max number of imports (-1 for no limit).
231    #[serde(default = "defaults::default_i64::<i64, -1>")]
232    pub imports: i64,
233    ///Max number of leaf node connections (-1 for no limit).
234    #[serde(default = "defaults::default_i64::<i64, -1>")]
235    pub leaf: i64,
236    ///Whether wildcard exports are allowed.
237    #[serde(default = "defaults::default_bool::<true>")]
238    pub wildcards: bool,
239}
240impl ::std::convert::From<&AccountLimits> for AccountLimits {
241    fn from(value: &AccountLimits) -> Self {
242        value.clone()
243    }
244}
245impl ::std::default::Default for AccountLimits {
246    fn default() -> Self {
247        Self {
248            conn: defaults::default_i64::<i64, -1>(),
249            disallow_bearer: Default::default(),
250            exports: defaults::default_i64::<i64, -1>(),
251            imports: defaults::default_i64::<i64, -1>(),
252            leaf: defaults::default_i64::<i64, -1>(),
253            wildcards: defaults::default_bool::<true>(),
254        }
255    }
256}
257impl AccountLimits {
258    pub fn builder() -> builder::AccountLimits {
259        Default::default()
260    }
261}
262///AccountServerURL is a partial URL like 'https://host.domain.org:<port>/jwt/v1' tools will use the prefix and build queries by appending /accounts/<account_id> or /operator to the path provided. Note this assumes that the account server can handle requests in a nats-account-server compatible way. See https://github.com/nats-io/nats-account-server.
263///
264/// <details><summary>JSON schema</summary>
265///
266/// ```json
267///{
268///  "description": "AccountServerURL is a partial URL like 'https://host.domain.org:<port>/jwt/v1' tools will use the prefix and build queries by appending /accounts/<account_id> or /operator to the path provided. Note this assumes that the account server can handle requests in a nats-account-server compatible way. See https://github.com/nats-io/nats-account-server.",
269///  "type": "string"
270///}
271/// ```
272/// </details>
273#[derive(
274    ::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd,
275)]
276#[serde(transparent)]
277pub struct AccountServerUrl(pub ::std::string::String);
278impl ::std::ops::Deref for AccountServerUrl {
279    type Target = ::std::string::String;
280    fn deref(&self) -> &::std::string::String {
281        &self.0
282    }
283}
284impl ::std::convert::From<AccountServerUrl> for ::std::string::String {
285    fn from(value: AccountServerUrl) -> Self {
286        value.0
287    }
288}
289impl ::std::convert::From<&AccountServerUrl> for AccountServerUrl {
290    fn from(value: &AccountServerUrl) -> Self {
291        value.clone()
292    }
293}
294impl ::std::convert::From<::std::string::String> for AccountServerUrl {
295    fn from(value: ::std::string::String) -> Self {
296        Self(value)
297    }
298}
299impl ::std::str::FromStr for AccountServerUrl {
300    type Err = ::std::convert::Infallible;
301    fn from_str(value: &str) -> ::std::result::Result<Self, Self::Err> {
302        Ok(Self(value.to_string()))
303    }
304}
305impl ::std::fmt::Display for AccountServerUrl {
306    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
307        self.0.fmt(f)
308    }
309}
310///AccountType
311///
312/// <details><summary>JSON schema</summary>
313///
314/// ```json
315///{
316///  "enum": [
317///    "account"
318///  ]
319///}
320/// ```
321/// </details>
322#[derive(
323    ::serde::Deserialize,
324    ::serde::Serialize,
325    Clone,
326    Copy,
327    Debug,
328    Eq,
329    Hash,
330    Ord,
331    PartialEq,
332    PartialOrd,
333)]
334pub enum AccountType {
335    #[serde(rename = "account")]
336    Account,
337}
338impl ::std::convert::From<&Self> for AccountType {
339    fn from(value: &AccountType) -> Self {
340        value.clone()
341    }
342}
343impl ::std::fmt::Display for AccountType {
344    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
345        match *self {
346            Self::Account => write!(f, "account"),
347        }
348    }
349}
350impl ::std::str::FromStr for AccountType {
351    type Err = self::error::ConversionError;
352    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
353        match value {
354            "account" => Ok(Self::Account),
355            _ => Err("invalid value".into()),
356        }
357    }
358}
359impl ::std::convert::TryFrom<&str> for AccountType {
360    type Error = self::error::ConversionError;
361    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
362        value.parse()
363    }
364}
365impl ::std::convert::TryFrom<&::std::string::String> for AccountType {
366    type Error = self::error::ConversionError;
367    fn try_from(
368        value: &::std::string::String,
369    ) -> ::std::result::Result<Self, self::error::ConversionError> {
370        value.parse()
371    }
372}
373impl ::std::convert::TryFrom<::std::string::String> for AccountType {
374    type Error = self::error::ConversionError;
375    fn try_from(
376        value: ::std::string::String,
377    ) -> ::std::result::Result<Self, self::error::ConversionError> {
378        value.parse()
379    }
380}
381impl ::std::default::Default for AccountType {
382    fn default() -> Self {
383        AccountType::Account
384    }
385}
386///Defines the custom parts of an activation claim, including the imported subject and its type (stream/service).
387///
388/// <details><summary>JSON schema</summary>
389///
390/// ```json
391///{
392///  "description": "Defines the custom parts of an activation claim, including the imported subject and its type (stream/service).",
393///  "allOf": [
394///    {
395///      "$ref": "#/$defs/GenericFields"
396///    },
397///    {
398///      "type": "object",
399///      "properties": {
400///        "issuer_account": {
401///          "description": "The account public key that issued this activation (if signing key used).",
402///          "type": "string"
403///        },
404///        "kind": {
405///          "description": "The type of import the activation is for, either 'stream' or 'service'.",
406///          "$ref": "#/$defs/ExportType"
407///        },
408///        "subject": {
409///          "description": "The subject to which the activation applies.",
410///          "$ref": "#/$defs/Subject"
411///        },
412///        "type": {
413///          "default": "activation",
414///          "const": "activation",
415///          "$ref": "#/$defs/ClaimsType"
416///        }
417///      }
418///    }
419///  ]
420///}
421/// ```
422/// </details>
423#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
424pub struct Activation {
425    ///The account public key that issued this activation (if signing key used).
426    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
427    pub issuer_account: ::std::option::Option<::std::string::String>,
428    ///The type of import the activation is for, either 'stream' or 'service'.
429    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
430    pub kind: ::std::option::Option<ExportType>,
431    ///The subject to which the activation applies.
432    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
433    pub subject: ::std::option::Option<Subject>,
434    ///Tags used to categorize or label this entity.
435    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
436    pub tags: ::std::option::Option<TagList>,
437    #[serde(rename = "type", default = "defaults::activation_type")]
438    pub type_: ActivationType,
439    ///The version of the claim.
440    #[serde(default = "defaults::default_u64::<i64, 2>")]
441    pub version: i64,
442}
443impl ::std::convert::From<&Activation> for Activation {
444    fn from(value: &Activation) -> Self {
445        value.clone()
446    }
447}
448impl ::std::default::Default for Activation {
449    fn default() -> Self {
450        Self {
451            issuer_account: Default::default(),
452            kind: Default::default(),
453            subject: Default::default(),
454            tags: Default::default(),
455            type_: defaults::activation_type(),
456            version: defaults::default_u64::<i64, 2>(),
457        }
458    }
459}
460impl Activation {
461    pub fn builder() -> builder::Activation {
462        Default::default()
463    }
464}
465///ActivationType
466///
467/// <details><summary>JSON schema</summary>
468///
469/// ```json
470///{
471///  "enum": [
472///    "activation"
473///  ]
474///}
475/// ```
476/// </details>
477#[derive(
478    ::serde::Deserialize,
479    ::serde::Serialize,
480    Clone,
481    Copy,
482    Debug,
483    Eq,
484    Hash,
485    Ord,
486    PartialEq,
487    PartialOrd,
488)]
489pub enum ActivationType {
490    #[serde(rename = "activation")]
491    Activation,
492}
493impl ::std::convert::From<&Self> for ActivationType {
494    fn from(value: &ActivationType) -> Self {
495        value.clone()
496    }
497}
498impl ::std::fmt::Display for ActivationType {
499    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
500        match *self {
501            Self::Activation => write!(f, "activation"),
502        }
503    }
504}
505impl ::std::str::FromStr for ActivationType {
506    type Err = self::error::ConversionError;
507    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
508        match value {
509            "activation" => Ok(Self::Activation),
510            _ => Err("invalid value".into()),
511        }
512    }
513}
514impl ::std::convert::TryFrom<&str> for ActivationType {
515    type Error = self::error::ConversionError;
516    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
517        value.parse()
518    }
519}
520impl ::std::convert::TryFrom<&::std::string::String> for ActivationType {
521    type Error = self::error::ConversionError;
522    fn try_from(
523        value: &::std::string::String,
524    ) -> ::std::result::Result<Self, self::error::ConversionError> {
525        value.parse()
526    }
527}
528impl ::std::convert::TryFrom<::std::string::String> for ActivationType {
529    type Error = self::error::ConversionError;
530    fn try_from(
531        value: ::std::string::String,
532    ) -> ::std::result::Result<Self, self::error::ConversionError> {
533        value.parse()
534    }
535}
536impl ::std::default::Default for ActivationType {
537    fn default() -> Self {
538        ActivationType::Activation
539    }
540}
541///Min Server version.
542///
543/// <details><summary>JSON schema</summary>
544///
545/// ```json
546///{
547///  "description": "Min Server version.",
548///  "type": "string"
549///}
550/// ```
551/// </details>
552#[derive(
553    ::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd,
554)]
555#[serde(transparent)]
556pub struct AssertServerVersion(pub ::std::string::String);
557impl ::std::ops::Deref for AssertServerVersion {
558    type Target = ::std::string::String;
559    fn deref(&self) -> &::std::string::String {
560        &self.0
561    }
562}
563impl ::std::convert::From<AssertServerVersion> for ::std::string::String {
564    fn from(value: AssertServerVersion) -> Self {
565        value.0
566    }
567}
568impl ::std::convert::From<&AssertServerVersion> for AssertServerVersion {
569    fn from(value: &AssertServerVersion) -> Self {
570        value.clone()
571    }
572}
573impl ::std::convert::From<::std::string::String> for AssertServerVersion {
574    fn from(value: ::std::string::String) -> Self {
575        Self(value)
576    }
577}
578impl ::std::str::FromStr for AssertServerVersion {
579    type Err = ::std::convert::Infallible;
580    fn from_str(value: &str) -> ::std::result::Result<Self, Self::Err> {
581        Ok(Self(value.to_string()))
582    }
583}
584impl ::std::fmt::Display for AssertServerVersion {
585    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
586        self.0.fmt(f)
587    }
588}
589///A list of CIDR-notation addresses for restricting access based on IP ranges.
590///
591/// <details><summary>JSON schema</summary>
592///
593/// ```json
594///{
595///  "description": "A list of CIDR-notation addresses for restricting access based on IP ranges.",
596///  "type": "array",
597///  "items": {
598///    "description": "A CIDR (Classless Inter-Domain Routing) notation string (e.g., '192.168.0.0/16').",
599///    "type": "string"
600///  },
601///  "uniqueItems": true
602///}
603/// ```
604/// </details>
605#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
606#[serde(transparent)]
607pub struct CidrList(pub Vec<::std::string::String>);
608impl ::std::ops::Deref for CidrList {
609    type Target = Vec<::std::string::String>;
610    fn deref(&self) -> &Vec<::std::string::String> {
611        &self.0
612    }
613}
614impl ::std::convert::From<CidrList> for Vec<::std::string::String> {
615    fn from(value: CidrList) -> Self {
616        value.0
617    }
618}
619impl ::std::convert::From<&CidrList> for CidrList {
620    fn from(value: &CidrList) -> Self {
621        value.clone()
622    }
623}
624impl ::std::convert::From<Vec<::std::string::String>> for CidrList {
625    fn from(value: Vec<::std::string::String>) -> Self {
626        Self(value)
627    }
628}
629///Configuration and permission Claims.
630///
631/// <details><summary>JSON schema</summary>
632///
633/// ```json
634///{
635///  "description": "Configuration and permission Claims.",
636///  "type": "object",
637///  "oneOf": [
638///    {
639///      "description": "Operator-specific configuration and permissions.",
640///      "$ref": "#/$defs/Operator"
641///    },
642///    {
643///      "description": "User-specific configuration and permissions.",
644///      "$ref": "#/$defs/User"
645///    },
646///    {
647///      "description": "Account-specific configuration and permissions.",
648///      "$ref": "#/$defs/Account"
649///    },
650///    {
651///      "description": "Activation-specific data.",
652///      "$ref": "#/$defs/Activation"
653///    }
654///  ]
655///}
656/// ```
657/// </details>
658#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
659#[serde(untagged)]
660pub enum Claims {
661    Operator(Operator),
662    User(User),
663    Account(Account),
664    Activation(Activation),
665}
666impl ::std::convert::From<&Self> for Claims {
667    fn from(value: &Claims) -> Self {
668        value.clone()
669    }
670}
671impl ::std::convert::From<Operator> for Claims {
672    fn from(value: Operator) -> Self {
673        Self::Operator(value)
674    }
675}
676impl ::std::convert::From<User> for Claims {
677    fn from(value: User) -> Self {
678        Self::User(value)
679    }
680}
681impl ::std::convert::From<Account> for Claims {
682    fn from(value: Account) -> Self {
683        Self::Account(value)
684    }
685}
686impl ::std::convert::From<Activation> for Claims {
687    fn from(value: Activation) -> Self {
688        Self::Activation(value)
689    }
690}
691///The type of the claims.
692///
693/// <details><summary>JSON schema</summary>
694///
695/// ```json
696///{
697///  "description": "The type of the claims.",
698///  "enum": [
699///    "operator",
700///    "account",
701///    "activation",
702///    "user"
703///  ]
704///}
705/// ```
706/// </details>
707#[derive(
708    ::serde::Deserialize,
709    ::serde::Serialize,
710    Clone,
711    Copy,
712    Debug,
713    Eq,
714    Hash,
715    Ord,
716    PartialEq,
717    PartialOrd,
718)]
719pub enum ClaimsType {
720    #[serde(rename = "operator")]
721    Operator,
722    #[serde(rename = "account")]
723    Account,
724    #[serde(rename = "activation")]
725    Activation,
726    #[serde(rename = "user")]
727    User,
728}
729impl ::std::convert::From<&Self> for ClaimsType {
730    fn from(value: &ClaimsType) -> Self {
731        value.clone()
732    }
733}
734impl ::std::fmt::Display for ClaimsType {
735    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
736        match *self {
737            Self::Operator => write!(f, "operator"),
738            Self::Account => write!(f, "account"),
739            Self::Activation => write!(f, "activation"),
740            Self::User => write!(f, "user"),
741        }
742    }
743}
744impl ::std::str::FromStr for ClaimsType {
745    type Err = self::error::ConversionError;
746    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
747        match value {
748            "operator" => Ok(Self::Operator),
749            "account" => Ok(Self::Account),
750            "activation" => Ok(Self::Activation),
751            "user" => Ok(Self::User),
752            _ => Err("invalid value".into()),
753        }
754    }
755}
756impl ::std::convert::TryFrom<&str> for ClaimsType {
757    type Error = self::error::ConversionError;
758    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
759        value.parse()
760    }
761}
762impl ::std::convert::TryFrom<&::std::string::String> for ClaimsType {
763    type Error = self::error::ConversionError;
764    fn try_from(
765        value: &::std::string::String,
766    ) -> ::std::result::Result<Self, self::error::ConversionError> {
767        value.parse()
768    }
769}
770impl ::std::convert::TryFrom<::std::string::String> for ClaimsType {
771    type Error = self::error::ConversionError;
772    fn try_from(
773        value: ::std::string::String,
774    ) -> ::std::result::Result<Self, self::error::ConversionError> {
775        value.parse()
776    }
777}
778///Represents how cluster traffic should be handled. Allowed values are empty (no special handling), 'system' (use system accounts), or 'owner' (use owner accounts).
779///
780/// <details><summary>JSON schema</summary>
781///
782/// ```json
783///{
784///  "description": "Represents how cluster traffic should be handled. Allowed values are empty (no special handling), 'system' (use system accounts), or 'owner' (use owner accounts).",
785///  "type": "string",
786///  "enum": [
787///    "",
788///    "system",
789///    "owner"
790///  ]
791///}
792/// ```
793/// </details>
794#[derive(
795    ::serde::Deserialize,
796    ::serde::Serialize,
797    Clone,
798    Copy,
799    Debug,
800    Eq,
801    Hash,
802    Ord,
803    PartialEq,
804    PartialOrd,
805)]
806pub enum ClusterTraffic {
807    #[serde(rename = "")]
808    X,
809    #[serde(rename = "system")]
810    System,
811    #[serde(rename = "owner")]
812    Owner,
813}
814impl ::std::convert::From<&Self> for ClusterTraffic {
815    fn from(value: &ClusterTraffic) -> Self {
816        value.clone()
817    }
818}
819impl ::std::fmt::Display for ClusterTraffic {
820    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
821        match *self {
822            Self::X => write!(f, ""),
823            Self::System => write!(f, "system"),
824            Self::Owner => write!(f, "owner"),
825        }
826    }
827}
828impl ::std::str::FromStr for ClusterTraffic {
829    type Err = self::error::ConversionError;
830    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
831        match value {
832            "" => Ok(Self::X),
833            "system" => Ok(Self::System),
834            "owner" => Ok(Self::Owner),
835            _ => Err("invalid value".into()),
836        }
837    }
838}
839impl ::std::convert::TryFrom<&str> for ClusterTraffic {
840    type Error = self::error::ConversionError;
841    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
842        value.parse()
843    }
844}
845impl ::std::convert::TryFrom<&::std::string::String> for ClusterTraffic {
846    type Error = self::error::ConversionError;
847    fn try_from(
848        value: &::std::string::String,
849    ) -> ::std::result::Result<Self, self::error::ConversionError> {
850        value.parse()
851    }
852}
853impl ::std::convert::TryFrom<::std::string::String> for ClusterTraffic {
854    type Error = self::error::ConversionError;
855    fn try_from(
856        value: ::std::string::String,
857    ) -> ::std::result::Result<Self, self::error::ConversionError> {
858        value.parse()
859    }
860}
861///Represents a connection type used by a user, indicating how the client connects to the server.
862///
863/// <details><summary>JSON schema</summary>
864///
865/// ```json
866///{
867///  "description": "Represents a connection type used by a user, indicating how the client connects to the server.",
868///  "type": "string",
869///  "enum": [
870///    "STANDARD",
871///    "WEBSOCKET",
872///    "LEAFNODE",
873///    "LEAFNODE_WS",
874///    "MQTT",
875///    "MQTT_WS",
876///    "IN_PROCESS"
877///  ]
878///}
879/// ```
880/// </details>
881#[derive(
882    ::serde::Deserialize,
883    ::serde::Serialize,
884    Clone,
885    Copy,
886    Debug,
887    Eq,
888    Hash,
889    Ord,
890    PartialEq,
891    PartialOrd,
892)]
893pub enum ConnectionType {
894    #[serde(rename = "STANDARD")]
895    Standard,
896    #[serde(rename = "WEBSOCKET")]
897    Websocket,
898    #[serde(rename = "LEAFNODE")]
899    Leafnode,
900    #[serde(rename = "LEAFNODE_WS")]
901    LeafnodeWs,
902    #[serde(rename = "MQTT")]
903    Mqtt,
904    #[serde(rename = "MQTT_WS")]
905    MqttWs,
906    #[serde(rename = "IN_PROCESS")]
907    InProcess,
908}
909impl ::std::convert::From<&Self> for ConnectionType {
910    fn from(value: &ConnectionType) -> Self {
911        value.clone()
912    }
913}
914impl ::std::fmt::Display for ConnectionType {
915    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
916        match *self {
917            Self::Standard => write!(f, "STANDARD"),
918            Self::Websocket => write!(f, "WEBSOCKET"),
919            Self::Leafnode => write!(f, "LEAFNODE"),
920            Self::LeafnodeWs => write!(f, "LEAFNODE_WS"),
921            Self::Mqtt => write!(f, "MQTT"),
922            Self::MqttWs => write!(f, "MQTT_WS"),
923            Self::InProcess => write!(f, "IN_PROCESS"),
924        }
925    }
926}
927impl ::std::str::FromStr for ConnectionType {
928    type Err = self::error::ConversionError;
929    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
930        match value {
931            "STANDARD" => Ok(Self::Standard),
932            "WEBSOCKET" => Ok(Self::Websocket),
933            "LEAFNODE" => Ok(Self::Leafnode),
934            "LEAFNODE_WS" => Ok(Self::LeafnodeWs),
935            "MQTT" => Ok(Self::Mqtt),
936            "MQTT_WS" => Ok(Self::MqttWs),
937            "IN_PROCESS" => Ok(Self::InProcess),
938            _ => Err("invalid value".into()),
939        }
940    }
941}
942impl ::std::convert::TryFrom<&str> for ConnectionType {
943    type Error = self::error::ConversionError;
944    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
945        value.parse()
946    }
947}
948impl ::std::convert::TryFrom<&::std::string::String> for ConnectionType {
949    type Error = self::error::ConversionError;
950    fn try_from(
951        value: &::std::string::String,
952    ) -> ::std::result::Result<Self, self::error::ConversionError> {
953        value.parse()
954    }
955}
956impl ::std::convert::TryFrom<::std::string::String> for ConnectionType {
957    type Error = self::error::ConversionError;
958    fn try_from(
959        value: ::std::string::String,
960    ) -> ::std::result::Result<Self, self::error::ConversionError> {
961        value.parse()
962    }
963}
964///Represents an export that allows other accounts to import subjects from this account, possibly requiring tokens.
965///
966/// <details><summary>JSON schema</summary>
967///
968/// ```json
969///{
970///  "description": "Represents an export that allows other accounts to import subjects from this account, possibly requiring tokens.",
971///  "allOf": [
972///    {
973///      "$ref": "#/$defs/Info"
974///    },
975///    {
976///      "type": "object",
977///      "properties": {
978///        "account_token_position": {
979///          "description": "If set, references the position of an account token in a wildcard subject (public exports only).",
980///          "type": "integer"
981///        },
982///        "advertise": {
983///          "description": "Indicates if this export should be advertised to other accounts.",
984///          "type": "boolean"
985///        },
986///        "allow_trace": {
987///          "description": "Allows message tracing if this is a service export.",
988///          "type": "boolean"
989///        },
990///        "name": {
991///          "description": "A human-readable name for this export.",
992///          "type": "string"
993///        },
994///        "response_threshold": {
995///          "description": "The response threshold in nanoseconds, valid only for services.",
996///          "type": "integer"
997///        },
998///        "response_type": {
999///          "description": "The type of response pattern for a service export.",
1000///          "$ref": "#/$defs/ResponseType"
1001///        },
1002///        "revocations": {
1003///          "description": "A list of revocations for previously issued activations.",
1004///          "$ref": "#/$defs/RevocationList"
1005///        },
1006///        "service_latency": {
1007///          "description": "Configures latency tracking for services.",
1008///          "$ref": "#/$defs/ServiceLatency"
1009///        },
1010///        "subject": {
1011///          "description": "The subject being exported.",
1012///          "$ref": "#/$defs/Subject"
1013///        },
1014///        "token_req": {
1015///          "description": "Indicates if an activation token is required for imports.",
1016///          "default": false,
1017///          "type": "boolean"
1018///        },
1019///        "type": {
1020///          "description": "The type of export, either 'stream' or 'service'.",
1021///          "$ref": "#/$defs/ExportType"
1022///        }
1023///      }
1024///    }
1025///  ]
1026///}
1027/// ```
1028/// </details>
1029#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1030pub struct Export {
1031    ///If set, references the position of an account token in a wildcard subject (public exports only).
1032    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1033    pub account_token_position: ::std::option::Option<i64>,
1034    ///Indicates if this export should be advertised to other accounts.
1035    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1036    pub advertise: ::std::option::Option<bool>,
1037    ///Allows message tracing if this is a service export.
1038    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1039    pub allow_trace: ::std::option::Option<bool>,
1040    ///A more detailed description.
1041    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1042    pub description: ::std::option::Option<::std::string::String>,
1043    ///URL to find extra info.
1044    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1045    pub info_url: ::std::option::Option<::std::string::String>,
1046    ///A human-readable name for this export.
1047    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1048    pub name: ::std::option::Option<::std::string::String>,
1049    ///The response threshold in nanoseconds, valid only for services.
1050    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1051    pub response_threshold: ::std::option::Option<i64>,
1052    ///The type of response pattern for a service export.
1053    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1054    pub response_type: ::std::option::Option<ResponseType>,
1055    ///A list of revocations for previously issued activations.
1056    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1057    pub revocations: ::std::option::Option<RevocationList>,
1058    ///Configures latency tracking for services.
1059    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1060    pub service_latency: ::std::option::Option<ServiceLatency>,
1061    ///The subject being exported.
1062    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1063    pub subject: ::std::option::Option<Subject>,
1064    ///Indicates if an activation token is required for imports.
1065    #[serde(default)]
1066    pub token_req: bool,
1067    ///The type of export, either 'stream' or 'service'.
1068    #[serde(
1069        rename = "type",
1070        default,
1071        skip_serializing_if = "::std::option::Option::is_none"
1072    )]
1073    pub type_: ::std::option::Option<ExportType>,
1074}
1075impl ::std::convert::From<&Export> for Export {
1076    fn from(value: &Export) -> Self {
1077        value.clone()
1078    }
1079}
1080impl ::std::default::Default for Export {
1081    fn default() -> Self {
1082        Self {
1083            account_token_position: Default::default(),
1084            advertise: Default::default(),
1085            allow_trace: Default::default(),
1086            description: Default::default(),
1087            info_url: Default::default(),
1088            name: Default::default(),
1089            response_threshold: Default::default(),
1090            response_type: Default::default(),
1091            revocations: Default::default(),
1092            service_latency: Default::default(),
1093            subject: Default::default(),
1094            token_req: Default::default(),
1095            type_: Default::default(),
1096        }
1097    }
1098}
1099impl Export {
1100    pub fn builder() -> builder::Export {
1101        Default::default()
1102    }
1103}
1104///Represents the type of an export, determining if the export is a stream or a service.
1105///
1106/// <details><summary>JSON schema</summary>
1107///
1108/// ```json
1109///{
1110///  "description": "Represents the type of an export, determining if the export is a stream or a service.",
1111///  "type": "string",
1112///  "enum": [
1113///    "stream",
1114///    "service",
1115///    "unknown"
1116///  ]
1117///}
1118/// ```
1119/// </details>
1120#[derive(
1121    ::serde::Deserialize,
1122    ::serde::Serialize,
1123    Clone,
1124    Copy,
1125    Debug,
1126    Eq,
1127    Hash,
1128    Ord,
1129    PartialEq,
1130    PartialOrd,
1131)]
1132pub enum ExportType {
1133    #[serde(rename = "stream")]
1134    Stream,
1135    #[serde(rename = "service")]
1136    Service,
1137    #[serde(rename = "unknown")]
1138    Unknown,
1139}
1140impl ::std::convert::From<&Self> for ExportType {
1141    fn from(value: &ExportType) -> Self {
1142        value.clone()
1143    }
1144}
1145impl ::std::fmt::Display for ExportType {
1146    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1147        match *self {
1148            Self::Stream => write!(f, "stream"),
1149            Self::Service => write!(f, "service"),
1150            Self::Unknown => write!(f, "unknown"),
1151        }
1152    }
1153}
1154impl ::std::str::FromStr for ExportType {
1155    type Err = self::error::ConversionError;
1156    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1157        match value {
1158            "stream" => Ok(Self::Stream),
1159            "service" => Ok(Self::Service),
1160            "unknown" => Ok(Self::Unknown),
1161            _ => Err("invalid value".into()),
1162        }
1163    }
1164}
1165impl ::std::convert::TryFrom<&str> for ExportType {
1166    type Error = self::error::ConversionError;
1167    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1168        value.parse()
1169    }
1170}
1171impl ::std::convert::TryFrom<&::std::string::String> for ExportType {
1172    type Error = self::error::ConversionError;
1173    fn try_from(
1174        value: &::std::string::String,
1175    ) -> ::std::result::Result<Self, self::error::ConversionError> {
1176        value.parse()
1177    }
1178}
1179impl ::std::convert::TryFrom<::std::string::String> for ExportType {
1180    type Error = self::error::ConversionError;
1181    fn try_from(
1182        value: ::std::string::String,
1183    ) -> ::std::result::Result<Self, self::error::ConversionError> {
1184        value.parse()
1185    }
1186}
1187///A list of exports defining subjects that this account makes available to other accounts.
1188///
1189/// <details><summary>JSON schema</summary>
1190///
1191/// ```json
1192///{
1193///  "description": "A list of exports defining subjects that this account makes available to other accounts.",
1194///  "type": "array",
1195///  "items": {
1196///    "$ref": "#/$defs/Export"
1197///  }
1198///}
1199/// ```
1200/// </details>
1201#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1202#[serde(transparent)]
1203pub struct Exports(pub ::std::vec::Vec<Export>);
1204impl ::std::ops::Deref for Exports {
1205    type Target = ::std::vec::Vec<Export>;
1206    fn deref(&self) -> &::std::vec::Vec<Export> {
1207        &self.0
1208    }
1209}
1210impl ::std::convert::From<Exports> for ::std::vec::Vec<Export> {
1211    fn from(value: Exports) -> Self {
1212        value.0
1213    }
1214}
1215impl ::std::convert::From<&Exports> for Exports {
1216    fn from(value: &Exports) -> Self {
1217        value.clone()
1218    }
1219}
1220impl ::std::convert::From<::std::vec::Vec<Export>> for Exports {
1221    fn from(value: ::std::vec::Vec<Export>) -> Self {
1222        Self(value)
1223    }
1224}
1225///Configures external authorization for accounts, specifying which users and accounts are involved and optional encryption keys.
1226///
1227/// <details><summary>JSON schema</summary>
1228///
1229/// ```json
1230///{
1231///  "description": "Configures external authorization for accounts, specifying which users and accounts are involved and optional encryption keys.",
1232///  "type": "object",
1233///  "properties": {
1234///    "allowed_accounts": {
1235///      "description": "The list of account public keys that the external authorization service may bind users to, or '*' for any account.",
1236///      "$ref": "#/$defs/StringList"
1237///    },
1238///    "auth_users": {
1239///      "description": "The list of user public keys allowed to bypass external authorization checks.",
1240///      "$ref": "#/$defs/StringList"
1241///    },
1242///    "xkey": {
1243///      "description": "An optional public x25519 key for encrypting authorization requests.",
1244///      "type": "string"
1245///    }
1246///  },
1247///  "additionalProperties": false
1248///}
1249/// ```
1250/// </details>
1251#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1252#[serde(deny_unknown_fields)]
1253pub struct ExternalAuthorization {
1254    ///The list of account public keys that the external authorization service may bind users to, or '*' for any account.
1255    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1256    pub allowed_accounts: ::std::option::Option<StringList>,
1257    ///The list of user public keys allowed to bypass external authorization checks.
1258    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1259    pub auth_users: ::std::option::Option<StringList>,
1260    ///An optional public x25519 key for encrypting authorization requests.
1261    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1262    pub xkey: ::std::option::Option<::std::string::String>,
1263}
1264impl ::std::convert::From<&ExternalAuthorization> for ExternalAuthorization {
1265    fn from(value: &ExternalAuthorization) -> Self {
1266        value.clone()
1267    }
1268}
1269impl ::std::default::Default for ExternalAuthorization {
1270    fn default() -> Self {
1271        Self {
1272            allowed_accounts: Default::default(),
1273            auth_users: Default::default(),
1274            xkey: Default::default(),
1275        }
1276    }
1277}
1278impl ExternalAuthorization {
1279    pub fn builder() -> builder::ExternalAuthorization {
1280        Default::default()
1281    }
1282}
1283///Generic fields shared by multiple kinds of claims.
1284///
1285/// <details><summary>JSON schema</summary>
1286///
1287/// ```json
1288///{
1289///  "description": "Generic fields shared by multiple kinds of claims.",
1290///  "type": "object",
1291///  "properties": {
1292///    "tags": {
1293///      "description": "Tags used to categorize or label this entity.",
1294///      "$ref": "#/$defs/TagList"
1295///    },
1296///    "version": {
1297///      "description": "The version of the claim.",
1298///      "default": 2,
1299///      "type": "integer"
1300///    }
1301///  },
1302///  "$comment": "NOTE: type field omitted as it's const depending on the implementing entity."
1303///}
1304/// ```
1305/// </details>
1306#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1307pub struct GenericFields {
1308    ///Tags used to categorize or label this entity.
1309    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1310    pub tags: ::std::option::Option<TagList>,
1311    ///The version of the claim.
1312    #[serde(default = "defaults::default_u64::<i64, 2>")]
1313    pub version: i64,
1314}
1315impl ::std::convert::From<&GenericFields> for GenericFields {
1316    fn from(value: &GenericFields) -> Self {
1317        value.clone()
1318    }
1319}
1320impl ::std::default::Default for GenericFields {
1321    fn default() -> Self {
1322        Self {
1323            tags: Default::default(),
1324            version: defaults::default_u64::<i64, 2>(),
1325        }
1326    }
1327}
1328impl GenericFields {
1329    pub fn builder() -> builder::GenericFields {
1330        Default::default()
1331    }
1332}
1333///Represents a mapping (import) from another account's subject space into this account.
1334///
1335/// <details><summary>JSON schema</summary>
1336///
1337/// ```json
1338///{
1339///  "description": "Represents a mapping (import) from another account's subject space into this account.",
1340///  "type": "object",
1341///  "properties": {
1342///    "account": {
1343///      "description": "The public account key from which this subject is imported.",
1344///      "type": "string"
1345///    },
1346///    "allow_trace": {
1347///      "description": "Indicates if message tracing is allowed on a stream import.",
1348///      "type": "boolean"
1349///    },
1350///    "local_subject": {
1351///      "description": "The local subject name to map the imported subject to, potentially using wildcard references.",
1352///      "$ref": "#/$defs/RenamingSubject"
1353///    },
1354///    "name": {
1355///      "description": "A human-readable name for the import.",
1356///      "type": "string"
1357///    },
1358///    "share": {
1359///      "description": "Indicates if the service import supports request latency tracking (for services only).",
1360///      "type": "boolean"
1361///    },
1362///    "subject": {
1363///      "description": "The subject being imported from the exporting account.",
1364///      "$ref": "#/$defs/Subject"
1365///    },
1366///    "to": {
1367///      "description": "Deprecated: the local subject mapped to the imported subject. Use local_subject instead.",
1368///      "$ref": "#/$defs/Subject"
1369///    },
1370///    "token": {
1371///      "description": "An activation token enabling the import. May be optional.",
1372///      "type": "string"
1373///    },
1374///    "type": {
1375///      "description": "The type of import, either 'stream' or 'service'.",
1376///      "$ref": "#/$defs/ExportType"
1377///    }
1378///  },
1379///  "additionalProperties": false
1380///}
1381/// ```
1382/// </details>
1383#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1384#[serde(deny_unknown_fields)]
1385pub struct Import {
1386    ///The public account key from which this subject is imported.
1387    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1388    pub account: ::std::option::Option<::std::string::String>,
1389    ///Indicates if message tracing is allowed on a stream import.
1390    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1391    pub allow_trace: ::std::option::Option<bool>,
1392    ///The local subject name to map the imported subject to, potentially using wildcard references.
1393    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1394    pub local_subject: ::std::option::Option<RenamingSubject>,
1395    ///A human-readable name for the import.
1396    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1397    pub name: ::std::option::Option<::std::string::String>,
1398    ///Indicates if the service import supports request latency tracking (for services only).
1399    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1400    pub share: ::std::option::Option<bool>,
1401    ///The subject being imported from the exporting account.
1402    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1403    pub subject: ::std::option::Option<Subject>,
1404    ///Deprecated: the local subject mapped to the imported subject. Use local_subject instead.
1405    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1406    pub to: ::std::option::Option<Subject>,
1407    ///An activation token enabling the import. May be optional.
1408    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1409    pub token: ::std::option::Option<::std::string::String>,
1410    ///The type of import, either 'stream' or 'service'.
1411    #[serde(
1412        rename = "type",
1413        default,
1414        skip_serializing_if = "::std::option::Option::is_none"
1415    )]
1416    pub type_: ::std::option::Option<ExportType>,
1417}
1418impl ::std::convert::From<&Import> for Import {
1419    fn from(value: &Import) -> Self {
1420        value.clone()
1421    }
1422}
1423impl ::std::default::Default for Import {
1424    fn default() -> Self {
1425        Self {
1426            account: Default::default(),
1427            allow_trace: Default::default(),
1428            local_subject: Default::default(),
1429            name: Default::default(),
1430            share: Default::default(),
1431            subject: Default::default(),
1432            to: Default::default(),
1433            token: Default::default(),
1434            type_: Default::default(),
1435        }
1436    }
1437}
1438impl Import {
1439    pub fn builder() -> builder::Import {
1440        Default::default()
1441    }
1442}
1443///A list of imports, each defining an external subject mapped into this account.
1444///
1445/// <details><summary>JSON schema</summary>
1446///
1447/// ```json
1448///{
1449///  "description": "A list of imports, each defining an external subject mapped into this account.",
1450///  "type": "array",
1451///  "items": {
1452///    "$ref": "#/$defs/Import"
1453///  }
1454///}
1455/// ```
1456/// </details>
1457#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1458#[serde(transparent)]
1459pub struct Imports(pub ::std::vec::Vec<Import>);
1460impl ::std::ops::Deref for Imports {
1461    type Target = ::std::vec::Vec<Import>;
1462    fn deref(&self) -> &::std::vec::Vec<Import> {
1463        &self.0
1464    }
1465}
1466impl ::std::convert::From<Imports> for ::std::vec::Vec<Import> {
1467    fn from(value: Imports) -> Self {
1468        value.0
1469    }
1470}
1471impl ::std::convert::From<&Imports> for Imports {
1472    fn from(value: &Imports) -> Self {
1473        value.clone()
1474    }
1475}
1476impl ::std::convert::From<::std::vec::Vec<Import>> for Imports {
1477    fn from(value: ::std::vec::Vec<Import>) -> Self {
1478        Self(value)
1479    }
1480}
1481///Generic extra Info.
1482///
1483/// <details><summary>JSON schema</summary>
1484///
1485/// ```json
1486///{
1487///  "description": "Generic extra Info.",
1488///  "type": "object",
1489///  "properties": {
1490///    "description": {
1491///      "description": "A more detailed description.",
1492///      "type": "string"
1493///    },
1494///    "info_url": {
1495///      "description": "URL to find extra info.",
1496///      "type": "string"
1497///    }
1498///  }
1499///}
1500/// ```
1501/// </details>
1502#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1503pub struct Info {
1504    ///A more detailed description.
1505    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1506    pub description: ::std::option::Option<::std::string::String>,
1507    ///URL to find extra info.
1508    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1509    pub info_url: ::std::option::Option<::std::string::String>,
1510}
1511impl ::std::convert::From<&Info> for Info {
1512    fn from(value: &Info) -> Self {
1513        value.clone()
1514    }
1515}
1516impl ::std::default::Default for Info {
1517    fn default() -> Self {
1518        Self {
1519            description: Default::default(),
1520            info_url: Default::default(),
1521        }
1522    }
1523}
1524impl Info {
1525    pub fn builder() -> builder::Info {
1526        Default::default()
1527    }
1528}
1529///Defines JetStream resource limits for memory, disk, streams, consumers, and other constraints.
1530///
1531/// <details><summary>JSON schema</summary>
1532///
1533/// ```json
1534///{
1535///  "description": "Defines JetStream resource limits for memory, disk, streams, consumers, and other constraints.",
1536///  "type": "object",
1537///  "properties": {
1538///    "consumer": {
1539///      "description": "Maximum number of consumers allowed (-1 indicates no limit).",
1540///      "default": -1,
1541///      "type": "integer"
1542///    },
1543///    "disk_max_stream_bytes": {
1544///      "description": "Maximum bytes per disk-backed stream (0 means unlimited).",
1545///      "default": 0,
1546///      "type": "integer"
1547///    },
1548///    "disk_storage": {
1549///      "description": "Maximum disk storage in bytes for all streams (0 means disabled).",
1550///      "default": -1,
1551///      "type": "integer"
1552///    },
1553///    "max_ack_pending": {
1554///      "description": "Maximum ack pending limit for a stream. If negative, treated as zero.",
1555///      "default": 0,
1556///      "type": "integer"
1557///    },
1558///    "max_bytes_required": {
1559///      "description": "If true, all streams must have max_bytes set.",
1560///      "default": false,
1561///      "type": "boolean"
1562///    },
1563///    "mem_max_stream_bytes": {
1564///      "description": "Maximum bytes per memory-backed stream (0 means unlimited).",
1565///      "default": 0,
1566///      "type": "integer"
1567///    },
1568///    "mem_storage": {
1569///      "description": "Maximum memory storage in bytes for all streams (0 means disabled).",
1570///      "default": -1,
1571///      "type": "integer"
1572///    },
1573///    "streams": {
1574///      "description": "Maximum number of streams allowed (-1 indicates no limit).",
1575///      "default": -1,
1576///      "type": "integer"
1577///    }
1578///  }
1579///}
1580/// ```
1581/// </details>
1582#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1583pub struct JetStreamLimits {
1584    ///Maximum number of consumers allowed (-1 indicates no limit).
1585    #[serde(default = "defaults::default_i64::<i64, -1>")]
1586    pub consumer: i64,
1587    ///Maximum bytes per disk-backed stream (0 means unlimited).
1588    #[serde(default)]
1589    pub disk_max_stream_bytes: i64,
1590    ///Maximum disk storage in bytes for all streams (0 means disabled).
1591    #[serde(default = "defaults::default_i64::<i64, -1>")]
1592    pub disk_storage: i64,
1593    ///Maximum ack pending limit for a stream. If negative, treated as zero.
1594    #[serde(default)]
1595    pub max_ack_pending: i64,
1596    ///If true, all streams must have max_bytes set.
1597    #[serde(default)]
1598    pub max_bytes_required: bool,
1599    ///Maximum bytes per memory-backed stream (0 means unlimited).
1600    #[serde(default)]
1601    pub mem_max_stream_bytes: i64,
1602    ///Maximum memory storage in bytes for all streams (0 means disabled).
1603    #[serde(default = "defaults::default_i64::<i64, -1>")]
1604    pub mem_storage: i64,
1605    ///Maximum number of streams allowed (-1 indicates no limit).
1606    #[serde(default = "defaults::default_i64::<i64, -1>")]
1607    pub streams: i64,
1608}
1609impl ::std::convert::From<&JetStreamLimits> for JetStreamLimits {
1610    fn from(value: &JetStreamLimits) -> Self {
1611        value.clone()
1612    }
1613}
1614impl ::std::default::Default for JetStreamLimits {
1615    fn default() -> Self {
1616        Self {
1617            consumer: defaults::default_i64::<i64, -1>(),
1618            disk_max_stream_bytes: Default::default(),
1619            disk_storage: defaults::default_i64::<i64, -1>(),
1620            max_ack_pending: Default::default(),
1621            max_bytes_required: Default::default(),
1622            mem_max_stream_bytes: Default::default(),
1623            mem_storage: defaults::default_i64::<i64, -1>(),
1624            streams: defaults::default_i64::<i64, -1>(),
1625        }
1626    }
1627}
1628impl JetStreamLimits {
1629    pub fn builder() -> builder::JetStreamLimits {
1630        Default::default()
1631    }
1632}
1633///A map of tier names to JetStreamLimits, allowing tiered resource allocations for accounts.
1634///
1635/// <details><summary>JSON schema</summary>
1636///
1637/// ```json
1638///{
1639///  "description": "A map of tier names to JetStreamLimits, allowing tiered resource allocations for accounts.",
1640///  "type": "object",
1641///  "additionalProperties": {
1642///    "$ref": "#/$defs/JetStreamLimits"
1643///  }
1644///}
1645/// ```
1646/// </details>
1647#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1648#[serde(transparent)]
1649pub struct JetStreamTieredLimits(
1650    pub ::std::collections::HashMap<::std::string::String, JetStreamLimits>,
1651);
1652impl ::std::ops::Deref for JetStreamTieredLimits {
1653    type Target = ::std::collections::HashMap<::std::string::String, JetStreamLimits>;
1654    fn deref(&self) -> &::std::collections::HashMap<::std::string::String, JetStreamLimits> {
1655        &self.0
1656    }
1657}
1658impl ::std::convert::From<JetStreamTieredLimits>
1659    for ::std::collections::HashMap<::std::string::String, JetStreamLimits>
1660{
1661    fn from(value: JetStreamTieredLimits) -> Self {
1662        value.0
1663    }
1664}
1665impl ::std::convert::From<&JetStreamTieredLimits> for JetStreamTieredLimits {
1666    fn from(value: &JetStreamTieredLimits) -> Self {
1667        value.clone()
1668    }
1669}
1670impl ::std::convert::From<::std::collections::HashMap<::std::string::String, JetStreamLimits>>
1671    for JetStreamTieredLimits
1672{
1673    fn from(value: ::std::collections::HashMap<::std::string::String, JetStreamLimits>) -> Self {
1674        Self(value)
1675    }
1676}
1677///The Claims portion of a NATS JWT authorization token.
1678///
1679/// <details><summary>JSON schema</summary>
1680///
1681/// ```json
1682///{
1683///  "$id": "https://github.com/Seraph-Security/nats-jwt/blob/main/src/nats_jwt_schema.json",
1684///  "title": "Jwt",
1685///  "description": "The Claims portion of a NATS JWT authorization token.",
1686///  "type": "object",
1687///  "required": [
1688///    "iat",
1689///    "iss",
1690///    "jti",
1691///    "nats",
1692///    "sub"
1693///  ],
1694///  "properties": {
1695///    "aud": {
1696///      "description": "The intended audience of the JWT.",
1697///      "type": "string"
1698///    },
1699///    "exp": {
1700///      "description": "The expiration time (in Unix seconds) after which the JWT is invalid.",
1701///      "type": "integer"
1702///    },
1703///    "iat": {
1704///      "description": "The time (in Unix seconds) at which the JWT was issued.",
1705///      "type": "integer"
1706///    },
1707///    "iss": {
1708///      "description": "The issuer of the JWT, typically a public key.",
1709///      "type": "string"
1710///    },
1711///    "jti": {
1712///      "description": "A unique identifier for the JWT.",
1713///      "type": "string"
1714///    },
1715///    "name": {
1716///      "description": "A human-readable name for the entity described by the JWT.",
1717///      "type": "string"
1718///    },
1719///    "nats": {
1720///      "description": "NATS specific portion of the Claims.",
1721///      "$ref": "#/$defs/Claims"
1722///    },
1723///    "nbf": {
1724///      "description": "The 'not before' time (in Unix seconds) before which the JWT must not be accepted.",
1725///      "type": "integer"
1726///    },
1727///    "sub": {
1728///      "description": "The subject of the JWT, typically the public key of the entity this JWT describes.",
1729///      "type": "string"
1730///    }
1731///  },
1732///  "additionalProperties": false
1733///}
1734/// ```
1735/// </details>
1736#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1737#[serde(deny_unknown_fields)]
1738pub struct Jwt {
1739    ///The intended audience of the JWT.
1740    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1741    pub aud: ::std::option::Option<::std::string::String>,
1742    ///The expiration time (in Unix seconds) after which the JWT is invalid.
1743    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1744    pub exp: ::std::option::Option<i64>,
1745    ///The time (in Unix seconds) at which the JWT was issued.
1746    pub iat: i64,
1747    ///The issuer of the JWT, typically a public key.
1748    pub iss: ::std::string::String,
1749    ///A unique identifier for the JWT.
1750    pub jti: ::std::string::String,
1751    ///A human-readable name for the entity described by the JWT.
1752    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1753    pub name: ::std::option::Option<::std::string::String>,
1754    ///NATS specific portion of the Claims.
1755    pub nats: Claims,
1756    ///The 'not before' time (in Unix seconds) before which the JWT must not be accepted.
1757    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1758    pub nbf: ::std::option::Option<i64>,
1759    ///The subject of the JWT, typically the public key of the entity this JWT describes.
1760    pub sub: ::std::string::String,
1761}
1762impl ::std::convert::From<&Jwt> for Jwt {
1763    fn from(value: &Jwt) -> Self {
1764        value.clone()
1765    }
1766}
1767impl Jwt {
1768    pub fn builder() -> builder::Jwt {
1769        Default::default()
1770    }
1771}
1772///The limits for Users including generic NatsLimits and User specific UserLimits
1773///
1774/// <details><summary>JSON schema</summary>
1775///
1776/// ```json
1777///{
1778///  "description": "The limits for Users including generic NatsLimits and User specific UserLimits",
1779///  "allOf": [
1780///    {
1781///      "$ref": "#/$defs/UserLimits"
1782///    },
1783///    {
1784///      "$ref": "#/$defs/NatsLimits"
1785///    }
1786///  ]
1787///}
1788/// ```
1789/// </details>
1790#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1791pub struct Limits {
1792    ///Max data bytes (-1 for no limit).
1793    #[serde(default = "defaults::default_i64::<i64, -1>")]
1794    pub data: i64,
1795    ///Max message payload size in bytes (-1 for no limit).
1796    #[serde(default = "defaults::default_i64::<i64, -1>")]
1797    pub payload: i64,
1798    ///List of acceptable origin IPs for user.
1799    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1800    pub src: ::std::option::Option<CidrList>,
1801    ///Max number of subscriptions (-1 for no limit).
1802    #[serde(default = "defaults::default_i64::<i64, -1>")]
1803    pub subs: i64,
1804    ///Times when connection is allowed.
1805    #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
1806    pub times: ::std::vec::Vec<TimeRange>,
1807    ///Timezone location for the times list.
1808    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1809    pub times_location: ::std::option::Option<::std::string::String>,
1810}
1811impl ::std::convert::From<&Limits> for Limits {
1812    fn from(value: &Limits) -> Self {
1813        value.clone()
1814    }
1815}
1816impl ::std::default::Default for Limits {
1817    fn default() -> Self {
1818        Self {
1819            data: defaults::default_i64::<i64, -1>(),
1820            payload: defaults::default_i64::<i64, -1>(),
1821            src: Default::default(),
1822            subs: defaults::default_i64::<i64, -1>(),
1823            times: Default::default(),
1824            times_location: Default::default(),
1825        }
1826    }
1827}
1828impl Limits {
1829    pub fn builder() -> builder::Limits {
1830        Default::default()
1831    }
1832}
1833///A mapping from a subject to one or more weighted mappings, allowing splitting or routing messages.
1834///
1835/// <details><summary>JSON schema</summary>
1836///
1837/// ```json
1838///{
1839///  "description": "A mapping from a subject to one or more weighted mappings, allowing splitting or routing messages.",
1840///  "type": "object",
1841///  "patternProperties": {
1842///    ".*": {
1843///      "type": "array",
1844///      "items": {
1845///        "$ref": "#/$defs/WeightedMapping"
1846///      }
1847///    }
1848///  },
1849///  "additionalProperties": false
1850///}
1851/// ```
1852/// </details>
1853#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1854#[serde(transparent)]
1855pub struct Mapping(pub ::std::collections::HashMap<MappingKey, ::std::vec::Vec<WeightedMapping>>);
1856impl ::std::ops::Deref for Mapping {
1857    type Target = ::std::collections::HashMap<MappingKey, ::std::vec::Vec<WeightedMapping>>;
1858    fn deref(&self) -> &::std::collections::HashMap<MappingKey, ::std::vec::Vec<WeightedMapping>> {
1859        &self.0
1860    }
1861}
1862impl ::std::convert::From<Mapping>
1863    for ::std::collections::HashMap<MappingKey, ::std::vec::Vec<WeightedMapping>>
1864{
1865    fn from(value: Mapping) -> Self {
1866        value.0
1867    }
1868}
1869impl ::std::convert::From<&Mapping> for Mapping {
1870    fn from(value: &Mapping) -> Self {
1871        value.clone()
1872    }
1873}
1874impl ::std::convert::From<::std::collections::HashMap<MappingKey, ::std::vec::Vec<WeightedMapping>>>
1875    for Mapping
1876{
1877    fn from(
1878        value: ::std::collections::HashMap<MappingKey, ::std::vec::Vec<WeightedMapping>>,
1879    ) -> Self {
1880        Self(value)
1881    }
1882}
1883///MappingKey
1884///
1885/// <details><summary>JSON schema</summary>
1886///
1887/// ```json
1888///{
1889///  "type": "string",
1890///  "pattern": ".*"
1891///}
1892/// ```
1893/// </details>
1894#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1895#[serde(transparent)]
1896pub struct MappingKey(::std::string::String);
1897impl ::std::ops::Deref for MappingKey {
1898    type Target = ::std::string::String;
1899    fn deref(&self) -> &::std::string::String {
1900        &self.0
1901    }
1902}
1903impl ::std::convert::From<MappingKey> for ::std::string::String {
1904    fn from(value: MappingKey) -> Self {
1905        value.0
1906    }
1907}
1908impl ::std::convert::From<&MappingKey> for MappingKey {
1909    fn from(value: &MappingKey) -> Self {
1910        value.clone()
1911    }
1912}
1913impl ::std::str::FromStr for MappingKey {
1914    type Err = self::error::ConversionError;
1915    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1916        if regress::Regex::new(".*").unwrap().find(value).is_none() {
1917            return Err("doesn't match pattern \".*\"".into());
1918        }
1919        Ok(Self(value.to_string()))
1920    }
1921}
1922impl ::std::convert::TryFrom<&str> for MappingKey {
1923    type Error = self::error::ConversionError;
1924    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
1925        value.parse()
1926    }
1927}
1928impl ::std::convert::TryFrom<&::std::string::String> for MappingKey {
1929    type Error = self::error::ConversionError;
1930    fn try_from(
1931        value: &::std::string::String,
1932    ) -> ::std::result::Result<Self, self::error::ConversionError> {
1933        value.parse()
1934    }
1935}
1936impl ::std::convert::TryFrom<::std::string::String> for MappingKey {
1937    type Error = self::error::ConversionError;
1938    fn try_from(
1939        value: ::std::string::String,
1940    ) -> ::std::result::Result<Self, self::error::ConversionError> {
1941        value.parse()
1942    }
1943}
1944impl<'de> ::serde::Deserialize<'de> for MappingKey {
1945    fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
1946    where
1947        D: ::serde::Deserializer<'de>,
1948    {
1949        ::std::string::String::deserialize(deserializer)?
1950            .parse()
1951            .map_err(|e: self::error::ConversionError| {
1952                <D::Error as ::serde::de::Error>::custom(e.to_string())
1953            })
1954    }
1955}
1956///Configures distributed message tracing for an account, specifying the destination subject and sampling rate.
1957///
1958/// <details><summary>JSON schema</summary>
1959///
1960/// ```json
1961///{
1962///  "description": "Configures distributed message tracing for an account, specifying the destination subject and sampling rate.",
1963///  "type": "object",
1964///  "properties": {
1965///    "dest": {
1966///      "description": "The subject to which message traces are sent when tracing is triggered.",
1967///      "$ref": "#/$defs/Subject"
1968///    },
1969///    "sampling": {
1970///      "description": "Probability sampling rate (1-100). Defaults to 100 if not set.",
1971///      "default": 100,
1972///      "type": "integer",
1973///      "maximum": 100.0,
1974///      "minimum": 1.0
1975///    }
1976///  },
1977///  "additionalProperties": false
1978///}
1979/// ```
1980/// </details>
1981#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
1982#[serde(deny_unknown_fields)]
1983pub struct MsgTrace {
1984    ///The subject to which message traces are sent when tracing is triggered.
1985    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
1986    pub dest: ::std::option::Option<Subject>,
1987    ///Probability sampling rate (1-100). Defaults to 100 if not set.
1988    #[serde(default = "defaults::default_u64::<i64, 100>")]
1989    pub sampling: i64,
1990}
1991impl ::std::convert::From<&MsgTrace> for MsgTrace {
1992    fn from(value: &MsgTrace) -> Self {
1993        value.clone()
1994    }
1995}
1996impl ::std::default::Default for MsgTrace {
1997    fn default() -> Self {
1998        Self {
1999            dest: Default::default(),
2000            sampling: defaults::default_u64::<i64, 100>(),
2001        }
2002    }
2003}
2004impl MsgTrace {
2005    pub fn builder() -> builder::MsgTrace {
2006        Default::default()
2007    }
2008}
2009///Represents NATS server limits.
2010///
2011/// <details><summary>JSON schema</summary>
2012///
2013/// ```json
2014///{
2015///  "description": "Represents NATS server limits.",
2016///  "type": "object",
2017///  "properties": {
2018///    "data": {
2019///      "description": "Max data bytes (-1 for no limit).",
2020///      "default": -1,
2021///      "type": "integer"
2022///    },
2023///    "payload": {
2024///      "description": "Max message payload size in bytes (-1 for no limit).",
2025///      "default": -1,
2026///      "type": "integer"
2027///    },
2028///    "subs": {
2029///      "description": "Max number of subscriptions (-1 for no limit).",
2030///      "default": -1,
2031///      "type": "integer"
2032///    }
2033///  }
2034///}
2035/// ```
2036/// </details>
2037#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2038pub struct NatsLimits {
2039    ///Max data bytes (-1 for no limit).
2040    #[serde(default = "defaults::default_i64::<i64, -1>")]
2041    pub data: i64,
2042    ///Max message payload size in bytes (-1 for no limit).
2043    #[serde(default = "defaults::default_i64::<i64, -1>")]
2044    pub payload: i64,
2045    ///Max number of subscriptions (-1 for no limit).
2046    #[serde(default = "defaults::default_i64::<i64, -1>")]
2047    pub subs: i64,
2048}
2049impl ::std::convert::From<&NatsLimits> for NatsLimits {
2050    fn from(value: &NatsLimits) -> Self {
2051        value.clone()
2052    }
2053}
2054impl ::std::default::Default for NatsLimits {
2055    fn default() -> Self {
2056        Self {
2057            data: defaults::default_i64::<i64, -1>(),
2058            payload: defaults::default_i64::<i64, -1>(),
2059            subs: defaults::default_i64::<i64, -1>(),
2060        }
2061    }
2062}
2063impl NatsLimits {
2064    pub fn builder() -> builder::NatsLimits {
2065        Default::default()
2066    }
2067}
2068///Represents operator-specific configuration, including permissions, limits, and optional bearer tokens.
2069///
2070/// <details><summary>JSON schema</summary>
2071///
2072/// ```json
2073///{
2074///  "description": "Represents operator-specific configuration, including permissions, limits, and optional bearer tokens.",
2075///  "allOf": [
2076///    {
2077///      "$ref": "#/$defs/GenericFields"
2078///    },
2079///    {
2080///      "type": "object",
2081///      "properties": {
2082///        "account_server_url": {
2083///          "$ref": "#/$defs/AccountServerURL"
2084///        },
2085///        "assert_server_version": {
2086///          "$ref": "#/$defs/AssertServerVersion"
2087///        },
2088///        "operator_service_urls": {
2089///          "$ref": "#/$defs/OperatorServiceURLs"
2090///        },
2091///        "signing_keys": {
2092///          "description": "Keys authorized to sign user JWTs on behalf of this account, along with their scopes.",
2093///          "$ref": "#/$defs/SigningKeys"
2094///        },
2095///        "strict_signing_key_usage": {
2096///          "$ref": "#/$defs/StrictSigningKeyUsage"
2097///        },
2098///        "system_account": {
2099///          "$ref": "#/$defs/SystemAccount"
2100///        },
2101///        "type": {
2102///          "default": "operator",
2103///          "const": "operator",
2104///          "$ref": "#/$defs/ClaimsType"
2105///        }
2106///      }
2107///    }
2108///  ]
2109///}
2110/// ```
2111/// </details>
2112#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2113pub struct Operator {
2114    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2115    pub account_server_url: ::std::option::Option<AccountServerUrl>,
2116    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2117    pub assert_server_version: ::std::option::Option<AssertServerVersion>,
2118    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2119    pub operator_service_urls: ::std::option::Option<OperatorServiceUrLs>,
2120    ///Keys authorized to sign user JWTs on behalf of this account, along with their scopes.
2121    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2122    pub signing_keys: ::std::option::Option<SigningKeys>,
2123    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2124    pub strict_signing_key_usage: ::std::option::Option<StrictSigningKeyUsage>,
2125    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2126    pub system_account: ::std::option::Option<SystemAccount>,
2127    ///Tags used to categorize or label this entity.
2128    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2129    pub tags: ::std::option::Option<TagList>,
2130    #[serde(rename = "type", default = "defaults::operator_type")]
2131    pub type_: OperatorType,
2132    ///The version of the claim.
2133    #[serde(default = "defaults::default_u64::<i64, 2>")]
2134    pub version: i64,
2135}
2136impl ::std::convert::From<&Operator> for Operator {
2137    fn from(value: &Operator) -> Self {
2138        value.clone()
2139    }
2140}
2141impl ::std::default::Default for Operator {
2142    fn default() -> Self {
2143        Self {
2144            account_server_url: Default::default(),
2145            assert_server_version: Default::default(),
2146            operator_service_urls: Default::default(),
2147            signing_keys: Default::default(),
2148            strict_signing_key_usage: Default::default(),
2149            system_account: Default::default(),
2150            tags: Default::default(),
2151            type_: defaults::operator_type(),
2152            version: defaults::default_u64::<i64, 2>(),
2153        }
2154    }
2155}
2156impl Operator {
2157    pub fn builder() -> builder::Operator {
2158        Default::default()
2159    }
2160}
2161///Represents all operator-imposed limits on an account, including NATS limits, account limits, and JetStream limits.
2162///
2163/// <details><summary>JSON schema</summary>
2164///
2165/// ```json
2166///{
2167///  "description": "Represents all operator-imposed limits on an account, including NATS limits, account limits, and JetStream limits.",
2168///  "allOf": [
2169///    {
2170///      "$ref": "#/$defs/NatsLimits"
2171///    },
2172///    {
2173///      "$ref": "#/$defs/AccountLimits"
2174///    },
2175///    {
2176///      "$ref": "#/$defs/JetStreamLimits"
2177///    },
2178///    {
2179///      "type": "object",
2180///      "properties": {
2181///        "tiered_limits": {
2182///          "description": "Optional tiered JetStream limits.",
2183///          "$ref": "#/$defs/JetStreamTieredLimits"
2184///        }
2185///      }
2186///    }
2187///  ]
2188///}
2189/// ```
2190/// </details>
2191#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2192pub struct OperatorLimits {
2193    ///Max number of active connections
2194    #[serde(default = "defaults::default_i64::<i64, -1>")]
2195    pub conn: i64,
2196    ///Maximum number of consumers allowed (-1 indicates no limit).
2197    #[serde(default = "defaults::default_i64::<i64, -1>")]
2198    pub consumer: i64,
2199    ///Max data bytes (-1 for no limit).
2200    #[serde(default = "defaults::default_i64::<i64, -1>")]
2201    pub data: i64,
2202    ///User JWTs cannot be used as Bearer Tokens.
2203    #[serde(default)]
2204    pub disallow_bearer: bool,
2205    ///Maximum bytes per disk-backed stream (0 means unlimited).
2206    #[serde(default)]
2207    pub disk_max_stream_bytes: i64,
2208    ///Maximum disk storage in bytes for all streams (0 means disabled).
2209    #[serde(default = "defaults::default_i64::<i64, -1>")]
2210    pub disk_storage: i64,
2211    ///Max number of exports (-1 for no limit).
2212    #[serde(default = "defaults::default_i64::<i64, -1>")]
2213    pub exports: i64,
2214    ///Max number of imports (-1 for no limit).
2215    #[serde(default = "defaults::default_i64::<i64, -1>")]
2216    pub imports: i64,
2217    ///Max number of leaf node connections (-1 for no limit).
2218    #[serde(default = "defaults::default_i64::<i64, -1>")]
2219    pub leaf: i64,
2220    ///Maximum ack pending limit for a stream. If negative, treated as zero.
2221    #[serde(default)]
2222    pub max_ack_pending: i64,
2223    ///If true, all streams must have max_bytes set.
2224    #[serde(default)]
2225    pub max_bytes_required: bool,
2226    ///Maximum bytes per memory-backed stream (0 means unlimited).
2227    #[serde(default)]
2228    pub mem_max_stream_bytes: i64,
2229    ///Maximum memory storage in bytes for all streams (0 means disabled).
2230    #[serde(default = "defaults::default_i64::<i64, -1>")]
2231    pub mem_storage: i64,
2232    ///Max message payload size in bytes (-1 for no limit).
2233    #[serde(default = "defaults::default_i64::<i64, -1>")]
2234    pub payload: i64,
2235    ///Maximum number of streams allowed (-1 indicates no limit).
2236    #[serde(default = "defaults::default_i64::<i64, -1>")]
2237    pub streams: i64,
2238    ///Max number of subscriptions (-1 for no limit).
2239    #[serde(default = "defaults::default_i64::<i64, -1>")]
2240    pub subs: i64,
2241    ///Optional tiered JetStream limits.
2242    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2243    pub tiered_limits: ::std::option::Option<JetStreamTieredLimits>,
2244    ///Whether wildcard exports are allowed.
2245    #[serde(default = "defaults::default_bool::<true>")]
2246    pub wildcards: bool,
2247}
2248impl ::std::convert::From<&OperatorLimits> for OperatorLimits {
2249    fn from(value: &OperatorLimits) -> Self {
2250        value.clone()
2251    }
2252}
2253impl ::std::default::Default for OperatorLimits {
2254    fn default() -> Self {
2255        Self {
2256            conn: defaults::default_i64::<i64, -1>(),
2257            consumer: defaults::default_i64::<i64, -1>(),
2258            data: defaults::default_i64::<i64, -1>(),
2259            disallow_bearer: Default::default(),
2260            disk_max_stream_bytes: Default::default(),
2261            disk_storage: defaults::default_i64::<i64, -1>(),
2262            exports: defaults::default_i64::<i64, -1>(),
2263            imports: defaults::default_i64::<i64, -1>(),
2264            leaf: defaults::default_i64::<i64, -1>(),
2265            max_ack_pending: Default::default(),
2266            max_bytes_required: Default::default(),
2267            mem_max_stream_bytes: Default::default(),
2268            mem_storage: defaults::default_i64::<i64, -1>(),
2269            payload: defaults::default_i64::<i64, -1>(),
2270            streams: defaults::default_i64::<i64, -1>(),
2271            subs: defaults::default_i64::<i64, -1>(),
2272            tiered_limits: Default::default(),
2273            wildcards: defaults::default_bool::<true>(),
2274        }
2275    }
2276}
2277impl OperatorLimits {
2278    pub fn builder() -> builder::OperatorLimits {
2279        Default::default()
2280    }
2281}
2282///A list of NATS urls (tls://host:port) where tools can connect to the server using proper credentials.
2283///
2284/// <details><summary>JSON schema</summary>
2285///
2286/// ```json
2287///{
2288///  "description": "A list of NATS urls (tls://host:port) where tools can connect to the server using proper credentials.",
2289///  "type": "array",
2290///  "items": {
2291///    "description": "A NATS url.",
2292///    "type": "string"
2293///  },
2294///  "uniqueItems": true
2295///}
2296/// ```
2297/// </details>
2298#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2299#[serde(transparent)]
2300pub struct OperatorServiceUrLs(pub Vec<::std::string::String>);
2301impl ::std::ops::Deref for OperatorServiceUrLs {
2302    type Target = Vec<::std::string::String>;
2303    fn deref(&self) -> &Vec<::std::string::String> {
2304        &self.0
2305    }
2306}
2307impl ::std::convert::From<OperatorServiceUrLs> for Vec<::std::string::String> {
2308    fn from(value: OperatorServiceUrLs) -> Self {
2309        value.0
2310    }
2311}
2312impl ::std::convert::From<&OperatorServiceUrLs> for OperatorServiceUrLs {
2313    fn from(value: &OperatorServiceUrLs) -> Self {
2314        value.clone()
2315    }
2316}
2317impl ::std::convert::From<Vec<::std::string::String>> for OperatorServiceUrLs {
2318    fn from(value: Vec<::std::string::String>) -> Self {
2319        Self(value)
2320    }
2321}
2322///OperatorType
2323///
2324/// <details><summary>JSON schema</summary>
2325///
2326/// ```json
2327///{
2328///  "enum": [
2329///    "operator"
2330///  ]
2331///}
2332/// ```
2333/// </details>
2334#[derive(
2335    ::serde::Deserialize,
2336    ::serde::Serialize,
2337    Clone,
2338    Copy,
2339    Debug,
2340    Eq,
2341    Hash,
2342    Ord,
2343    PartialEq,
2344    PartialOrd,
2345)]
2346pub enum OperatorType {
2347    #[serde(rename = "operator")]
2348    Operator,
2349}
2350impl ::std::convert::From<&Self> for OperatorType {
2351    fn from(value: &OperatorType) -> Self {
2352        value.clone()
2353    }
2354}
2355impl ::std::fmt::Display for OperatorType {
2356    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2357        match *self {
2358            Self::Operator => write!(f, "operator"),
2359        }
2360    }
2361}
2362impl ::std::str::FromStr for OperatorType {
2363    type Err = self::error::ConversionError;
2364    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2365        match value {
2366            "operator" => Ok(Self::Operator),
2367            _ => Err("invalid value".into()),
2368        }
2369    }
2370}
2371impl ::std::convert::TryFrom<&str> for OperatorType {
2372    type Error = self::error::ConversionError;
2373    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2374        value.parse()
2375    }
2376}
2377impl ::std::convert::TryFrom<&::std::string::String> for OperatorType {
2378    type Error = self::error::ConversionError;
2379    fn try_from(
2380        value: &::std::string::String,
2381    ) -> ::std::result::Result<Self, self::error::ConversionError> {
2382        value.parse()
2383    }
2384}
2385impl ::std::convert::TryFrom<::std::string::String> for OperatorType {
2386    type Error = self::error::ConversionError;
2387    fn try_from(
2388        value: ::std::string::String,
2389    ) -> ::std::result::Result<Self, self::error::ConversionError> {
2390        value.parse()
2391    }
2392}
2393impl ::std::default::Default for OperatorType {
2394    fn default() -> Self {
2395        OperatorType::Operator
2396    }
2397}
2398///Defines per-subject publish or subscribe permissions with allow and deny lists.
2399///
2400/// <details><summary>JSON schema</summary>
2401///
2402/// ```json
2403///{
2404///  "description": "Defines per-subject publish or subscribe permissions with allow and deny lists.",
2405///  "type": "object",
2406///  "properties": {
2407///    "allow": {
2408///      "description": "A list of subjects that are explicitly allowed.",
2409///      "$ref": "#/$defs/StringList"
2410///    },
2411///    "deny": {
2412///      "description": "A list of subjects that are explicitly denied.",
2413///      "$ref": "#/$defs/StringList"
2414///    }
2415///  },
2416///  "additionalProperties": false
2417///}
2418/// ```
2419/// </details>
2420#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2421#[serde(deny_unknown_fields)]
2422pub struct Permission {
2423    ///A list of subjects that are explicitly allowed.
2424    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2425    pub allow: ::std::option::Option<StringList>,
2426    ///A list of subjects that are explicitly denied.
2427    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2428    pub deny: ::std::option::Option<StringList>,
2429}
2430impl ::std::convert::From<&Permission> for Permission {
2431    fn from(value: &Permission) -> Self {
2432        value.clone()
2433    }
2434}
2435impl ::std::default::Default for Permission {
2436    fn default() -> Self {
2437        Self {
2438            allow: Default::default(),
2439            deny: Default::default(),
2440        }
2441    }
2442}
2443impl Permission {
2444    pub fn builder() -> builder::Permission {
2445        Default::default()
2446    }
2447}
2448///Represents a set of permissions controlling what subjects can be published or subscribed to, and optional response permissions.
2449///
2450/// <details><summary>JSON schema</summary>
2451///
2452/// ```json
2453///{
2454///  "description": "Represents a set of permissions controlling what subjects can be published or subscribed to, and optional response permissions.",
2455///  "type": "object",
2456///  "properties": {
2457///    "pub": {
2458///      "description": "Publication permissions.",
2459///      "$ref": "#/$defs/Permission"
2460///    },
2461///    "resp": {
2462///      "description": "Response permissions for allowing temporary response subjects.",
2463///      "$ref": "#/$defs/ResponsePermission"
2464///    },
2465///    "sub": {
2466///      "description": "Subscription permissions.",
2467///      "$ref": "#/$defs/Permission"
2468///    }
2469///  }
2470///}
2471/// ```
2472/// </details>
2473#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2474pub struct Permissions {
2475    ///Publication permissions.
2476    #[serde(
2477        rename = "pub",
2478        default,
2479        skip_serializing_if = "::std::option::Option::is_none"
2480    )]
2481    pub pub_: ::std::option::Option<Permission>,
2482    ///Response permissions for allowing temporary response subjects.
2483    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2484    pub resp: ::std::option::Option<ResponsePermission>,
2485    ///Subscription permissions.
2486    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2487    pub sub: ::std::option::Option<Permission>,
2488}
2489impl ::std::convert::From<&Permissions> for Permissions {
2490    fn from(value: &Permissions) -> Self {
2491        value.clone()
2492    }
2493}
2494impl ::std::default::Default for Permissions {
2495    fn default() -> Self {
2496        Self {
2497            pub_: Default::default(),
2498            resp: Default::default(),
2499            sub: Default::default(),
2500        }
2501    }
2502}
2503impl Permissions {
2504    pub fn builder() -> builder::Permissions {
2505        Default::default()
2506    }
2507}
2508///Represents a subject used for renaming imported subjects. Can contain $<number> references to wildcard tokens in the original subject.
2509///
2510/// <details><summary>JSON schema</summary>
2511///
2512/// ```json
2513///{
2514///  "description": "Represents a subject used for renaming imported subjects. Can contain $<number> references to wildcard tokens in the original subject.",
2515///  "type": "string"
2516///}
2517/// ```
2518/// </details>
2519#[derive(
2520    ::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd,
2521)]
2522#[serde(transparent)]
2523pub struct RenamingSubject(pub ::std::string::String);
2524impl ::std::ops::Deref for RenamingSubject {
2525    type Target = ::std::string::String;
2526    fn deref(&self) -> &::std::string::String {
2527        &self.0
2528    }
2529}
2530impl ::std::convert::From<RenamingSubject> for ::std::string::String {
2531    fn from(value: RenamingSubject) -> Self {
2532        value.0
2533    }
2534}
2535impl ::std::convert::From<&RenamingSubject> for RenamingSubject {
2536    fn from(value: &RenamingSubject) -> Self {
2537        value.clone()
2538    }
2539}
2540impl ::std::convert::From<::std::string::String> for RenamingSubject {
2541    fn from(value: ::std::string::String) -> Self {
2542        Self(value)
2543    }
2544}
2545impl ::std::str::FromStr for RenamingSubject {
2546    type Err = ::std::convert::Infallible;
2547    fn from_str(value: &str) -> ::std::result::Result<Self, Self::Err> {
2548        Ok(Self(value.to_string()))
2549    }
2550}
2551impl ::std::fmt::Display for RenamingSubject {
2552    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2553        self.0.fmt(f)
2554    }
2555}
2556///Specifies how response permissions are handled for a user or account, limiting the number of responses and their TTL.
2557///
2558/// <details><summary>JSON schema</summary>
2559///
2560/// ```json
2561///{
2562///  "description": "Specifies how response permissions are handled for a user or account, limiting the number of responses and their TTL.",
2563///  "type": "object",
2564///  "properties": {
2565///    "max": {
2566///      "description": "The maximum number of responses allowed.",
2567///      "type": "integer"
2568///    },
2569///    "ttl": {
2570///      "description": "The time-to-live for responses, in nanoseconds.",
2571///      "type": "integer"
2572///    }
2573///  },
2574///  "additionalProperties": false
2575///}
2576/// ```
2577/// </details>
2578#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2579#[serde(deny_unknown_fields)]
2580pub struct ResponsePermission {
2581    ///The maximum number of responses allowed.
2582    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2583    pub max: ::std::option::Option<i64>,
2584    ///The time-to-live for responses, in nanoseconds.
2585    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
2586    pub ttl: ::std::option::Option<i64>,
2587}
2588impl ::std::convert::From<&ResponsePermission> for ResponsePermission {
2589    fn from(value: &ResponsePermission) -> Self {
2590        value.clone()
2591    }
2592}
2593impl ::std::default::Default for ResponsePermission {
2594    fn default() -> Self {
2595        Self {
2596            max: Default::default(),
2597            ttl: Default::default(),
2598        }
2599    }
2600}
2601impl ResponsePermission {
2602    pub fn builder() -> builder::ResponsePermission {
2603        Default::default()
2604    }
2605}
2606///Represents the response pattern for a service export: either a 'Singleton' (one response), 'Stream' (multiple responses), or 'Chunked' (one response in chunks).
2607///
2608/// <details><summary>JSON schema</summary>
2609///
2610/// ```json
2611///{
2612///  "description": "Represents the response pattern for a service export: either a 'Singleton' (one response), 'Stream' (multiple responses), or 'Chunked' (one response in chunks).",
2613///  "type": "string",
2614///  "enum": [
2615///    "Singleton",
2616///    "Stream",
2617///    "Chunked"
2618///  ]
2619///}
2620/// ```
2621/// </details>
2622#[derive(
2623    ::serde::Deserialize,
2624    ::serde::Serialize,
2625    Clone,
2626    Copy,
2627    Debug,
2628    Eq,
2629    Hash,
2630    Ord,
2631    PartialEq,
2632    PartialOrd,
2633)]
2634pub enum ResponseType {
2635    Singleton,
2636    Stream,
2637    Chunked,
2638}
2639impl ::std::convert::From<&Self> for ResponseType {
2640    fn from(value: &ResponseType) -> Self {
2641        value.clone()
2642    }
2643}
2644impl ::std::fmt::Display for ResponseType {
2645    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2646        match *self {
2647            Self::Singleton => write!(f, "Singleton"),
2648            Self::Stream => write!(f, "Stream"),
2649            Self::Chunked => write!(f, "Chunked"),
2650        }
2651    }
2652}
2653impl ::std::str::FromStr for ResponseType {
2654    type Err = self::error::ConversionError;
2655    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2656        match value {
2657            "Singleton" => Ok(Self::Singleton),
2658            "Stream" => Ok(Self::Stream),
2659            "Chunked" => Ok(Self::Chunked),
2660            _ => Err("invalid value".into()),
2661        }
2662    }
2663}
2664impl ::std::convert::TryFrom<&str> for ResponseType {
2665    type Error = self::error::ConversionError;
2666    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2667        value.parse()
2668    }
2669}
2670impl ::std::convert::TryFrom<&::std::string::String> for ResponseType {
2671    type Error = self::error::ConversionError;
2672    fn try_from(
2673        value: &::std::string::String,
2674    ) -> ::std::result::Result<Self, self::error::ConversionError> {
2675        value.parse()
2676    }
2677}
2678impl ::std::convert::TryFrom<::std::string::String> for ResponseType {
2679    type Error = self::error::ConversionError;
2680    fn try_from(
2681        value: ::std::string::String,
2682    ) -> ::std::result::Result<Self, self::error::ConversionError> {
2683        value.parse()
2684    }
2685}
2686///A mapping of public keys or '*' to revocation timestamps (Unix time). Entries here revoke previously issued JWTs.
2687///
2688/// <details><summary>JSON schema</summary>
2689///
2690/// ```json
2691///{
2692///  "description": "A mapping of public keys or '*' to revocation timestamps (Unix time). Entries here revoke previously issued JWTs.",
2693///  "type": "object",
2694///  "patternProperties": {
2695///    ".*": {
2696///      "description": "Revocation timestamp for this key or '*'.",
2697///      "type": "integer"
2698///    }
2699///  },
2700///  "additionalProperties": false
2701///}
2702/// ```
2703/// </details>
2704#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2705#[serde(transparent)]
2706pub struct RevocationList(pub ::std::collections::HashMap<RevocationListKey, i64>);
2707impl ::std::ops::Deref for RevocationList {
2708    type Target = ::std::collections::HashMap<RevocationListKey, i64>;
2709    fn deref(&self) -> &::std::collections::HashMap<RevocationListKey, i64> {
2710        &self.0
2711    }
2712}
2713impl ::std::convert::From<RevocationList> for ::std::collections::HashMap<RevocationListKey, i64> {
2714    fn from(value: RevocationList) -> Self {
2715        value.0
2716    }
2717}
2718impl ::std::convert::From<&RevocationList> for RevocationList {
2719    fn from(value: &RevocationList) -> Self {
2720        value.clone()
2721    }
2722}
2723impl ::std::convert::From<::std::collections::HashMap<RevocationListKey, i64>> for RevocationList {
2724    fn from(value: ::std::collections::HashMap<RevocationListKey, i64>) -> Self {
2725        Self(value)
2726    }
2727}
2728///RevocationListKey
2729///
2730/// <details><summary>JSON schema</summary>
2731///
2732/// ```json
2733///{
2734///  "type": "string",
2735///  "pattern": ".*"
2736///}
2737/// ```
2738/// </details>
2739#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
2740#[serde(transparent)]
2741pub struct RevocationListKey(::std::string::String);
2742impl ::std::ops::Deref for RevocationListKey {
2743    type Target = ::std::string::String;
2744    fn deref(&self) -> &::std::string::String {
2745        &self.0
2746    }
2747}
2748impl ::std::convert::From<RevocationListKey> for ::std::string::String {
2749    fn from(value: RevocationListKey) -> Self {
2750        value.0
2751    }
2752}
2753impl ::std::convert::From<&RevocationListKey> for RevocationListKey {
2754    fn from(value: &RevocationListKey) -> Self {
2755        value.clone()
2756    }
2757}
2758impl ::std::str::FromStr for RevocationListKey {
2759    type Err = self::error::ConversionError;
2760    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2761        if regress::Regex::new(".*").unwrap().find(value).is_none() {
2762            return Err("doesn't match pattern \".*\"".into());
2763        }
2764        Ok(Self(value.to_string()))
2765    }
2766}
2767impl ::std::convert::TryFrom<&str> for RevocationListKey {
2768    type Error = self::error::ConversionError;
2769    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2770        value.parse()
2771    }
2772}
2773impl ::std::convert::TryFrom<&::std::string::String> for RevocationListKey {
2774    type Error = self::error::ConversionError;
2775    fn try_from(
2776        value: &::std::string::String,
2777    ) -> ::std::result::Result<Self, self::error::ConversionError> {
2778        value.parse()
2779    }
2780}
2781impl ::std::convert::TryFrom<::std::string::String> for RevocationListKey {
2782    type Error = self::error::ConversionError;
2783    fn try_from(
2784        value: ::std::string::String,
2785    ) -> ::std::result::Result<Self, self::error::ConversionError> {
2786        value.parse()
2787    }
2788}
2789impl<'de> ::serde::Deserialize<'de> for RevocationListKey {
2790    fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
2791    where
2792        D: ::serde::Deserializer<'de>,
2793    {
2794        ::std::string::String::deserialize(deserializer)?
2795            .parse()
2796            .map_err(|e: self::error::ConversionError| {
2797                <D::Error as ::serde::de::Error>::custom(e.to_string())
2798            })
2799    }
2800}
2801///Represents the sampling rate for collecting latency metrics. May be 'headers' or an integer between 1 and 100.
2802///
2803/// <details><summary>JSON schema</summary>
2804///
2805/// ```json
2806///{
2807///  "description": "Represents the sampling rate for collecting latency metrics. May be 'headers' or an integer between 1 and 100.",
2808///  "oneOf": [
2809///    {
2810///      "description": "Indicates headers-based sampling ('headers'). If set to 'headers', the NATS server uses request headers for sampling decisions.",
2811///      "type": "string",
2812///      "enum": [
2813///        "headers"
2814///      ]
2815///    },
2816///    {
2817///      "type": "integer",
2818///      "maximum": 100.0,
2819///      "minimum": 1.0
2820///    }
2821///  ]
2822///}
2823/// ```
2824/// </details>
2825#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
2826#[serde(untagged)]
2827pub enum SamplingRate {
2828    Variant0(SamplingRateVariant0),
2829    Variant1(i64),
2830}
2831impl ::std::convert::From<&Self> for SamplingRate {
2832    fn from(value: &SamplingRate) -> Self {
2833        value.clone()
2834    }
2835}
2836impl ::std::convert::From<SamplingRateVariant0> for SamplingRate {
2837    fn from(value: SamplingRateVariant0) -> Self {
2838        Self::Variant0(value)
2839    }
2840}
2841impl ::std::convert::From<i64> for SamplingRate {
2842    fn from(value: i64) -> Self {
2843        Self::Variant1(value)
2844    }
2845}
2846///Indicates headers-based sampling ('headers'). If set to 'headers', the NATS server uses request headers for sampling decisions.
2847///
2848/// <details><summary>JSON schema</summary>
2849///
2850/// ```json
2851///{
2852///  "description": "Indicates headers-based sampling ('headers'). If set to 'headers', the NATS server uses request headers for sampling decisions.",
2853///  "type": "string",
2854///  "enum": [
2855///    "headers"
2856///  ]
2857///}
2858/// ```
2859/// </details>
2860#[derive(
2861    ::serde::Deserialize,
2862    ::serde::Serialize,
2863    Clone,
2864    Copy,
2865    Debug,
2866    Eq,
2867    Hash,
2868    Ord,
2869    PartialEq,
2870    PartialOrd,
2871)]
2872pub enum SamplingRateVariant0 {
2873    #[serde(rename = "headers")]
2874    Headers,
2875}
2876impl ::std::convert::From<&Self> for SamplingRateVariant0 {
2877    fn from(value: &SamplingRateVariant0) -> Self {
2878        value.clone()
2879    }
2880}
2881impl ::std::fmt::Display for SamplingRateVariant0 {
2882    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2883        match *self {
2884            Self::Headers => write!(f, "headers"),
2885        }
2886    }
2887}
2888impl ::std::str::FromStr for SamplingRateVariant0 {
2889    type Err = self::error::ConversionError;
2890    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2891        match value {
2892            "headers" => Ok(Self::Headers),
2893            _ => Err("invalid value".into()),
2894        }
2895    }
2896}
2897impl ::std::convert::TryFrom<&str> for SamplingRateVariant0 {
2898    type Error = self::error::ConversionError;
2899    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2900        value.parse()
2901    }
2902}
2903impl ::std::convert::TryFrom<&::std::string::String> for SamplingRateVariant0 {
2904    type Error = self::error::ConversionError;
2905    fn try_from(
2906        value: &::std::string::String,
2907    ) -> ::std::result::Result<Self, self::error::ConversionError> {
2908        value.parse()
2909    }
2910}
2911impl ::std::convert::TryFrom<::std::string::String> for SamplingRateVariant0 {
2912    type Error = self::error::ConversionError;
2913    fn try_from(
2914        value: ::std::string::String,
2915    ) -> ::std::result::Result<Self, self::error::ConversionError> {
2916        value.parse()
2917    }
2918}
2919///Represents the kind of scope for a signing key, currently supporting a 'user_scope'.
2920///
2921/// <details><summary>JSON schema</summary>
2922///
2923/// ```json
2924///{
2925///  "description": "Represents the kind of scope for a signing key, currently supporting a 'user_scope'.",
2926///  "type": "string",
2927///  "enum": [
2928///    "user_scope"
2929///  ]
2930///}
2931/// ```
2932/// </details>
2933#[derive(
2934    ::serde::Deserialize,
2935    ::serde::Serialize,
2936    Clone,
2937    Copy,
2938    Debug,
2939    Eq,
2940    Hash,
2941    Ord,
2942    PartialEq,
2943    PartialOrd,
2944)]
2945pub enum ScopeType {
2946    #[serde(rename = "user_scope")]
2947    UserScope,
2948}
2949impl ::std::convert::From<&Self> for ScopeType {
2950    fn from(value: &ScopeType) -> Self {
2951        value.clone()
2952    }
2953}
2954impl ::std::fmt::Display for ScopeType {
2955    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2956        match *self {
2957            Self::UserScope => write!(f, "user_scope"),
2958        }
2959    }
2960}
2961impl ::std::str::FromStr for ScopeType {
2962    type Err = self::error::ConversionError;
2963    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2964        match value {
2965            "user_scope" => Ok(Self::UserScope),
2966            _ => Err("invalid value".into()),
2967        }
2968    }
2969}
2970impl ::std::convert::TryFrom<&str> for ScopeType {
2971    type Error = self::error::ConversionError;
2972    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
2973        value.parse()
2974    }
2975}
2976impl ::std::convert::TryFrom<&::std::string::String> for ScopeType {
2977    type Error = self::error::ConversionError;
2978    fn try_from(
2979        value: &::std::string::String,
2980    ) -> ::std::result::Result<Self, self::error::ConversionError> {
2981        value.parse()
2982    }
2983}
2984impl ::std::convert::TryFrom<::std::string::String> for ScopeType {
2985    type Error = self::error::ConversionError;
2986    fn try_from(
2987        value: ::std::string::String,
2988    ) -> ::std::result::Result<Self, self::error::ConversionError> {
2989        value.parse()
2990    }
2991}
2992///Configures latency sampling and results reporting for exported services.
2993///
2994/// <details><summary>JSON schema</summary>
2995///
2996/// ```json
2997///{
2998///  "description": "Configures latency sampling and results reporting for exported services.",
2999///  "type": "object",
3000///  "properties": {
3001///    "results": {
3002///      "description": "Subject to which latency results are published. Cannot contain wildcards.",
3003///      "$ref": "#/$defs/Subject"
3004///    },
3005///    "sampling": {
3006///      "description": "Sampling rate for latency measurements, either 'headers' or a percentage (1-100).",
3007///      "$ref": "#/$defs/SamplingRate"
3008///    }
3009///  },
3010///  "additionalProperties": false
3011///}
3012/// ```
3013/// </details>
3014#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3015#[serde(deny_unknown_fields)]
3016pub struct ServiceLatency {
3017    ///Subject to which latency results are published. Cannot contain wildcards.
3018    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3019    pub results: ::std::option::Option<Subject>,
3020    ///Sampling rate for latency measurements, either 'headers' or a percentage (1-100).
3021    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3022    pub sampling: ::std::option::Option<SamplingRate>,
3023}
3024impl ::std::convert::From<&ServiceLatency> for ServiceLatency {
3025    fn from(value: &ServiceLatency) -> Self {
3026        value.clone()
3027    }
3028}
3029impl ::std::default::Default for ServiceLatency {
3030    fn default() -> Self {
3031        Self {
3032            results: Default::default(),
3033            sampling: Default::default(),
3034        }
3035    }
3036}
3037impl ServiceLatency {
3038    pub fn builder() -> builder::ServiceLatency {
3039        Default::default()
3040    }
3041}
3042///Represents a list of signing keys that may be simply strings (for signing keys) or objects (for scoped keys like user_scope).
3043///
3044/// <details><summary>JSON schema</summary>
3045///
3046/// ```json
3047///{
3048///  "description": "Represents a list of signing keys that may be simply strings (for signing keys) or objects (for scoped keys like user_scope).",
3049///  "type": "array",
3050///  "items": {
3051///    "oneOf": [
3052///      {
3053///        "title": "PublicKey",
3054///        "description": "A public account key string representing a non-scoped signing key.",
3055///        "type": "string"
3056///      },
3057///      {
3058///        "description": "A scoped signing key object.",
3059///        "$ref": "#/$defs/UserScope"
3060///      }
3061///    ]
3062///  }
3063///}
3064/// ```
3065/// </details>
3066#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3067#[serde(transparent)]
3068pub struct SigningKeys(pub ::std::vec::Vec<SigningKeysItem>);
3069impl ::std::ops::Deref for SigningKeys {
3070    type Target = ::std::vec::Vec<SigningKeysItem>;
3071    fn deref(&self) -> &::std::vec::Vec<SigningKeysItem> {
3072        &self.0
3073    }
3074}
3075impl ::std::convert::From<SigningKeys> for ::std::vec::Vec<SigningKeysItem> {
3076    fn from(value: SigningKeys) -> Self {
3077        value.0
3078    }
3079}
3080impl ::std::convert::From<&SigningKeys> for SigningKeys {
3081    fn from(value: &SigningKeys) -> Self {
3082        value.clone()
3083    }
3084}
3085impl ::std::convert::From<::std::vec::Vec<SigningKeysItem>> for SigningKeys {
3086    fn from(value: ::std::vec::Vec<SigningKeysItem>) -> Self {
3087        Self(value)
3088    }
3089}
3090///SigningKeysItem
3091///
3092/// <details><summary>JSON schema</summary>
3093///
3094/// ```json
3095///{
3096///  "oneOf": [
3097///    {
3098///      "title": "PublicKey",
3099///      "description": "A public account key string representing a non-scoped signing key.",
3100///      "type": "string"
3101///    },
3102///    {
3103///      "description": "A scoped signing key object.",
3104///      "$ref": "#/$defs/UserScope"
3105///    }
3106///  ]
3107///}
3108/// ```
3109/// </details>
3110#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3111#[serde(untagged)]
3112pub enum SigningKeysItem {
3113    PublicKey(::std::string::String),
3114    UserScope(UserScope),
3115}
3116impl ::std::convert::From<&Self> for SigningKeysItem {
3117    fn from(value: &SigningKeysItem) -> Self {
3118        value.clone()
3119    }
3120}
3121impl ::std::convert::From<UserScope> for SigningKeysItem {
3122    fn from(value: UserScope) -> Self {
3123        Self::UserScope(value)
3124    }
3125}
3126///Signing of subordinate objects will require signing keys.
3127///
3128/// <details><summary>JSON schema</summary>
3129///
3130/// ```json
3131///{
3132///  "description": "Signing of subordinate objects will require signing keys.",
3133///  "default": false,
3134///  "type": "boolean"
3135///}
3136/// ```
3137/// </details>
3138#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3139#[serde(transparent)]
3140pub struct StrictSigningKeyUsage(pub bool);
3141impl ::std::ops::Deref for StrictSigningKeyUsage {
3142    type Target = bool;
3143    fn deref(&self) -> &bool {
3144        &self.0
3145    }
3146}
3147impl ::std::convert::From<StrictSigningKeyUsage> for bool {
3148    fn from(value: StrictSigningKeyUsage) -> Self {
3149        value.0
3150    }
3151}
3152impl ::std::convert::From<&StrictSigningKeyUsage> for StrictSigningKeyUsage {
3153    fn from(value: &StrictSigningKeyUsage) -> Self {
3154        value.clone()
3155    }
3156}
3157impl ::std::convert::From<bool> for StrictSigningKeyUsage {
3158    fn from(value: bool) -> Self {
3159        Self(value)
3160    }
3161}
3162impl ::std::str::FromStr for StrictSigningKeyUsage {
3163    type Err = <bool as ::std::str::FromStr>::Err;
3164    fn from_str(value: &str) -> ::std::result::Result<Self, Self::Err> {
3165        Ok(Self(value.parse()?))
3166    }
3167}
3168impl ::std::convert::TryFrom<&str> for StrictSigningKeyUsage {
3169    type Error = <bool as ::std::str::FromStr>::Err;
3170    fn try_from(value: &str) -> ::std::result::Result<Self, Self::Error> {
3171        value.parse()
3172    }
3173}
3174impl ::std::convert::TryFrom<&String> for StrictSigningKeyUsage {
3175    type Error = <bool as ::std::str::FromStr>::Err;
3176    fn try_from(value: &String) -> ::std::result::Result<Self, Self::Error> {
3177        value.parse()
3178    }
3179}
3180impl ::std::convert::TryFrom<String> for StrictSigningKeyUsage {
3181    type Error = <bool as ::std::str::FromStr>::Err;
3182    fn try_from(value: String) -> ::std::result::Result<Self, Self::Error> {
3183        value.parse()
3184    }
3185}
3186impl ::std::fmt::Display for StrictSigningKeyUsage {
3187    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3188        self.0.fmt(f)
3189    }
3190}
3191///A list of arbitrary strings.
3192///
3193/// <details><summary>JSON schema</summary>
3194///
3195/// ```json
3196///{
3197///  "description": "A list of arbitrary strings.",
3198///  "type": "array",
3199///  "items": {
3200///    "type": "string"
3201///  },
3202///  "uniqueItems": false
3203///}
3204/// ```
3205/// </details>
3206#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3207#[serde(transparent)]
3208pub struct StringList(pub ::std::vec::Vec<::std::string::String>);
3209impl ::std::ops::Deref for StringList {
3210    type Target = ::std::vec::Vec<::std::string::String>;
3211    fn deref(&self) -> &::std::vec::Vec<::std::string::String> {
3212        &self.0
3213    }
3214}
3215impl ::std::convert::From<StringList> for ::std::vec::Vec<::std::string::String> {
3216    fn from(value: StringList) -> Self {
3217        value.0
3218    }
3219}
3220impl ::std::convert::From<&StringList> for StringList {
3221    fn from(value: &StringList) -> Self {
3222        value.clone()
3223    }
3224}
3225impl ::std::convert::From<::std::vec::Vec<::std::string::String>> for StringList {
3226    fn from(value: ::std::vec::Vec<::std::string::String>) -> Self {
3227        Self(value)
3228    }
3229}
3230///Represents a NATS subject, a hierarchical string separated by dots, with optional wildcards ('*' or '>').
3231///
3232/// <details><summary>JSON schema</summary>
3233///
3234/// ```json
3235///{
3236///  "description": "Represents a NATS subject, a hierarchical string separated by dots, with optional wildcards ('*' or '>').",
3237///  "type": "string"
3238///}
3239/// ```
3240/// </details>
3241#[derive(
3242    ::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd,
3243)]
3244#[serde(transparent)]
3245pub struct Subject(pub ::std::string::String);
3246impl ::std::ops::Deref for Subject {
3247    type Target = ::std::string::String;
3248    fn deref(&self) -> &::std::string::String {
3249        &self.0
3250    }
3251}
3252impl ::std::convert::From<Subject> for ::std::string::String {
3253    fn from(value: Subject) -> Self {
3254        value.0
3255    }
3256}
3257impl ::std::convert::From<&Subject> for Subject {
3258    fn from(value: &Subject) -> Self {
3259        value.clone()
3260    }
3261}
3262impl ::std::convert::From<::std::string::String> for Subject {
3263    fn from(value: ::std::string::String) -> Self {
3264        Self(value)
3265    }
3266}
3267impl ::std::str::FromStr for Subject {
3268    type Err = ::std::convert::Infallible;
3269    fn from_str(value: &str) -> ::std::result::Result<Self, Self::Err> {
3270        Ok(Self(value.to_string()))
3271    }
3272}
3273impl ::std::fmt::Display for Subject {
3274    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3275        self.0.fmt(f)
3276    }
3277}
3278///Identity of the system account.
3279///
3280/// <details><summary>JSON schema</summary>
3281///
3282/// ```json
3283///{
3284///  "description": "Identity of the system account.",
3285///  "type": "string"
3286///}
3287/// ```
3288/// </details>
3289#[derive(
3290    ::serde::Deserialize, ::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd,
3291)]
3292#[serde(transparent)]
3293pub struct SystemAccount(pub ::std::string::String);
3294impl ::std::ops::Deref for SystemAccount {
3295    type Target = ::std::string::String;
3296    fn deref(&self) -> &::std::string::String {
3297        &self.0
3298    }
3299}
3300impl ::std::convert::From<SystemAccount> for ::std::string::String {
3301    fn from(value: SystemAccount) -> Self {
3302        value.0
3303    }
3304}
3305impl ::std::convert::From<&SystemAccount> for SystemAccount {
3306    fn from(value: &SystemAccount) -> Self {
3307        value.clone()
3308    }
3309}
3310impl ::std::convert::From<::std::string::String> for SystemAccount {
3311    fn from(value: ::std::string::String) -> Self {
3312        Self(value)
3313    }
3314}
3315impl ::std::str::FromStr for SystemAccount {
3316    type Err = ::std::convert::Infallible;
3317    fn from_str(value: &str) -> ::std::result::Result<Self, Self::Err> {
3318        Ok(Self(value.to_string()))
3319    }
3320}
3321impl ::std::fmt::Display for SystemAccount {
3322    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3323        self.0.fmt(f)
3324    }
3325}
3326///A list of tags (strings) that are unique and lowercase. Used to categorize or label entities.
3327///
3328/// <details><summary>JSON schema</summary>
3329///
3330/// ```json
3331///{
3332///  "description": "A list of tags (strings) that are unique and lowercase. Used to categorize or label entities.",
3333///  "type": "array",
3334///  "items": {
3335///    "type": "string"
3336///  },
3337///  "uniqueItems": true
3338///}
3339/// ```
3340/// </details>
3341#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3342#[serde(transparent)]
3343pub struct TagList(pub Vec<::std::string::String>);
3344impl ::std::ops::Deref for TagList {
3345    type Target = Vec<::std::string::String>;
3346    fn deref(&self) -> &Vec<::std::string::String> {
3347        &self.0
3348    }
3349}
3350impl ::std::convert::From<TagList> for Vec<::std::string::String> {
3351    fn from(value: TagList) -> Self {
3352        value.0
3353    }
3354}
3355impl ::std::convert::From<&TagList> for TagList {
3356    fn from(value: &TagList) -> Self {
3357        value.clone()
3358    }
3359}
3360impl ::std::convert::From<Vec<::std::string::String>> for TagList {
3361    fn from(value: Vec<::std::string::String>) -> Self {
3362        Self(value)
3363    }
3364}
3365///Represents a daily time range with a start and end time in HH:MM:SS format.
3366///
3367/// <details><summary>JSON schema</summary>
3368///
3369/// ```json
3370///{
3371///  "description": "Represents a daily time range with a start and end time in HH:MM:SS format.",
3372///  "type": "object",
3373///  "required": [
3374///    "end",
3375///    "start"
3376///  ],
3377///  "properties": {
3378///    "end": {
3379///      "description": "The end time in HH:MM:SS format.",
3380///      "type": "string"
3381///    },
3382///    "start": {
3383///      "description": "The start time in HH:MM:SS format.",
3384///      "type": "string"
3385///    }
3386///  },
3387///  "additionalProperties": false
3388///}
3389/// ```
3390/// </details>
3391#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3392#[serde(deny_unknown_fields)]
3393pub struct TimeRange {
3394    ///The end time in HH:MM:SS format.
3395    pub end: ::std::string::String,
3396    ///The start time in HH:MM:SS format.
3397    pub start: ::std::string::String,
3398}
3399impl ::std::convert::From<&TimeRange> for TimeRange {
3400    fn from(value: &TimeRange) -> Self {
3401        value.clone()
3402    }
3403}
3404impl TimeRange {
3405    pub fn builder() -> builder::TimeRange {
3406        Default::default()
3407    }
3408}
3409///Represents user-specific configuration, including permissions, limits, issuer account, and optional bearer tokens.
3410///
3411/// <details><summary>JSON schema</summary>
3412///
3413/// ```json
3414///{
3415///  "description": "Represents user-specific configuration, including permissions, limits, issuer account, and optional bearer tokens.",
3416///  "allOf": [
3417///    {
3418///      "$ref": "#/$defs/GenericFields"
3419///    },
3420///    {
3421///      "$ref": "#/$defs/UserPermissionLimits"
3422///    },
3423///    {
3424///      "type": "object",
3425///      "properties": {
3426///        "issuer_account": {
3427///          "description": "The account identity public key if JWT signed by a signing key.",
3428///          "type": "string"
3429///        },
3430///        "type": {
3431///          "default": "user",
3432///          "const": "user",
3433///          "$ref": "#/$defs/ClaimsType"
3434///        }
3435///      }
3436///    }
3437///  ]
3438///}
3439/// ```
3440/// </details>
3441#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3442pub struct User {
3443    ///The list of connection types allowed for this user.
3444    #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
3445    pub allowed_connection_types: ::std::vec::Vec<ConnectionType>,
3446    ///If true, this user can be authenticated using a bearer token.
3447    #[serde(default = "defaults::default_bool::<true>")]
3448    pub bearer_token: bool,
3449    ///Max data bytes (-1 for no limit).
3450    #[serde(default = "defaults::default_i64::<i64, -1>")]
3451    pub data: i64,
3452    ///The account identity public key if JWT signed by a signing key.
3453    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3454    pub issuer_account: ::std::option::Option<::std::string::String>,
3455    ///Max message payload size in bytes (-1 for no limit).
3456    #[serde(default = "defaults::default_i64::<i64, -1>")]
3457    pub payload: i64,
3458    ///Publication permissions.
3459    #[serde(
3460        rename = "pub",
3461        default,
3462        skip_serializing_if = "::std::option::Option::is_none"
3463    )]
3464    pub pub_: ::std::option::Option<Permission>,
3465    ///Response permissions for allowing temporary response subjects.
3466    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3467    pub resp: ::std::option::Option<ResponsePermission>,
3468    ///List of acceptable origin IPs for user.
3469    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3470    pub src: ::std::option::Option<CidrList>,
3471    ///Subscription permissions.
3472    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3473    pub sub: ::std::option::Option<Permission>,
3474    ///Max number of subscriptions (-1 for no limit).
3475    #[serde(default = "defaults::default_i64::<i64, -1>")]
3476    pub subs: i64,
3477    ///Tags used to categorize or label this entity.
3478    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3479    pub tags: ::std::option::Option<TagList>,
3480    ///Times when connection is allowed.
3481    #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
3482    pub times: ::std::vec::Vec<TimeRange>,
3483    ///Timezone location for the times list.
3484    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3485    pub times_location: ::std::option::Option<::std::string::String>,
3486    #[serde(rename = "type", default = "defaults::user_type")]
3487    pub type_: UserType,
3488    ///The version of the claim.
3489    #[serde(default = "defaults::default_u64::<i64, 2>")]
3490    pub version: i64,
3491}
3492impl ::std::convert::From<&User> for User {
3493    fn from(value: &User) -> Self {
3494        value.clone()
3495    }
3496}
3497impl ::std::default::Default for User {
3498    fn default() -> Self {
3499        Self {
3500            allowed_connection_types: Default::default(),
3501            bearer_token: defaults::default_bool::<true>(),
3502            data: defaults::default_i64::<i64, -1>(),
3503            issuer_account: Default::default(),
3504            payload: defaults::default_i64::<i64, -1>(),
3505            pub_: Default::default(),
3506            resp: Default::default(),
3507            src: Default::default(),
3508            sub: Default::default(),
3509            subs: defaults::default_i64::<i64, -1>(),
3510            tags: Default::default(),
3511            times: Default::default(),
3512            times_location: Default::default(),
3513            type_: defaults::user_type(),
3514            version: defaults::default_u64::<i64, 2>(),
3515        }
3516    }
3517}
3518impl User {
3519    pub fn builder() -> builder::User {
3520        Default::default()
3521    }
3522}
3523///UserLimits are the limits specific to Users.
3524///
3525/// <details><summary>JSON schema</summary>
3526///
3527/// ```json
3528///{
3529///  "description": "UserLimits are the limits specific to Users.",
3530///  "type": "object",
3531///  "properties": {
3532///    "src": {
3533///      "description": "List of acceptable origin IPs for user.",
3534///      "$ref": "#/$defs/CIDRList"
3535///    },
3536///    "times": {
3537///      "description": "Times when connection is allowed.",
3538///      "type": "array",
3539///      "items": {
3540///        "$ref": "#/$defs/TimeRange"
3541///      }
3542///    },
3543///    "times_location": {
3544///      "description": "Timezone location for the times list.",
3545///      "type": "string"
3546///    }
3547///  }
3548///}
3549/// ```
3550/// </details>
3551#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3552pub struct UserLimits {
3553    ///List of acceptable origin IPs for user.
3554    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3555    pub src: ::std::option::Option<CidrList>,
3556    ///Times when connection is allowed.
3557    #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
3558    pub times: ::std::vec::Vec<TimeRange>,
3559    ///Timezone location for the times list.
3560    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3561    pub times_location: ::std::option::Option<::std::string::String>,
3562}
3563impl ::std::convert::From<&UserLimits> for UserLimits {
3564    fn from(value: &UserLimits) -> Self {
3565        value.clone()
3566    }
3567}
3568impl ::std::default::Default for UserLimits {
3569    fn default() -> Self {
3570        Self {
3571            src: Default::default(),
3572            times: Default::default(),
3573            times_location: Default::default(),
3574        }
3575    }
3576}
3577impl UserLimits {
3578    pub fn builder() -> builder::UserLimits {
3579        Default::default()
3580    }
3581}
3582///Represents the combined permissions and limits assigned to a user, including bearer token and allowed connection types.
3583///
3584/// <details><summary>JSON schema</summary>
3585///
3586/// ```json
3587///{
3588///  "description": "Represents the combined permissions and limits assigned to a user, including bearer token and allowed connection types.",
3589///  "allOf": [
3590///    {
3591///      "$ref": "#/$defs/Permissions"
3592///    },
3593///    {
3594///      "$ref": "#/$defs/Limits"
3595///    },
3596///    {
3597///      "type": "object",
3598///      "properties": {
3599///        "allowed_connection_types": {
3600///          "description": "The list of connection types allowed for this user.",
3601///          "type": "array",
3602///          "items": {
3603///            "$ref": "#/$defs/ConnectionType"
3604///          }
3605///        },
3606///        "bearer_token": {
3607///          "description": "If true, this user can be authenticated using a bearer token.",
3608///          "default": true,
3609///          "type": "boolean"
3610///        }
3611///      }
3612///    }
3613///  ]
3614///}
3615/// ```
3616/// </details>
3617#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3618pub struct UserPermissionLimits {
3619    ///The list of connection types allowed for this user.
3620    #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
3621    pub allowed_connection_types: ::std::vec::Vec<ConnectionType>,
3622    ///If true, this user can be authenticated using a bearer token.
3623    #[serde(default = "defaults::default_bool::<true>")]
3624    pub bearer_token: bool,
3625    ///Max data bytes (-1 for no limit).
3626    #[serde(default = "defaults::default_i64::<i64, -1>")]
3627    pub data: i64,
3628    ///Max message payload size in bytes (-1 for no limit).
3629    #[serde(default = "defaults::default_i64::<i64, -1>")]
3630    pub payload: i64,
3631    ///Publication permissions.
3632    #[serde(
3633        rename = "pub",
3634        default,
3635        skip_serializing_if = "::std::option::Option::is_none"
3636    )]
3637    pub pub_: ::std::option::Option<Permission>,
3638    ///Response permissions for allowing temporary response subjects.
3639    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3640    pub resp: ::std::option::Option<ResponsePermission>,
3641    ///List of acceptable origin IPs for user.
3642    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3643    pub src: ::std::option::Option<CidrList>,
3644    ///Subscription permissions.
3645    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3646    pub sub: ::std::option::Option<Permission>,
3647    ///Max number of subscriptions (-1 for no limit).
3648    #[serde(default = "defaults::default_i64::<i64, -1>")]
3649    pub subs: i64,
3650    ///Times when connection is allowed.
3651    #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
3652    pub times: ::std::vec::Vec<TimeRange>,
3653    ///Timezone location for the times list.
3654    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3655    pub times_location: ::std::option::Option<::std::string::String>,
3656}
3657impl ::std::convert::From<&UserPermissionLimits> for UserPermissionLimits {
3658    fn from(value: &UserPermissionLimits) -> Self {
3659        value.clone()
3660    }
3661}
3662impl ::std::default::Default for UserPermissionLimits {
3663    fn default() -> Self {
3664        Self {
3665            allowed_connection_types: Default::default(),
3666            bearer_token: defaults::default_bool::<true>(),
3667            data: defaults::default_i64::<i64, -1>(),
3668            payload: defaults::default_i64::<i64, -1>(),
3669            pub_: Default::default(),
3670            resp: Default::default(),
3671            src: Default::default(),
3672            sub: Default::default(),
3673            subs: defaults::default_i64::<i64, -1>(),
3674            times: Default::default(),
3675            times_location: Default::default(),
3676        }
3677    }
3678}
3679impl UserPermissionLimits {
3680    pub fn builder() -> builder::UserPermissionLimits {
3681        Default::default()
3682    }
3683}
3684///Represents a scoped signing key that can only sign user JWTs with certain predefined permission templates.
3685///
3686/// <details><summary>JSON schema</summary>
3687///
3688/// ```json
3689///{
3690///  "description": "Represents a scoped signing key that can only sign user JWTs with certain predefined permission templates.",
3691///  "type": "object",
3692///  "properties": {
3693///    "description": {
3694///      "description": "A human-readable description of this scope.",
3695///      "type": "string"
3696///    },
3697///    "key": {
3698///      "description": "The public account key that acts as a scoped signer.",
3699///      "type": "string"
3700///    },
3701///    "kind": {
3702///      "description": "The kind of scope, currently always 'user_scope'.",
3703///      "default": "user_scope",
3704///      "$ref": "#/$defs/ScopeType"
3705///    },
3706///    "role": {
3707///      "description": "A user-defined role name to label this scope.",
3708///      "type": "string"
3709///    },
3710///    "template": {
3711///      "description": "A template of user permission and limits that must not be overridden by signed JWTs.",
3712///      "$ref": "#/$defs/UserPermissionLimits"
3713///    }
3714///  },
3715///  "additionalProperties": false
3716///}
3717/// ```
3718/// </details>
3719#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3720#[serde(deny_unknown_fields)]
3721pub struct UserScope {
3722    ///A human-readable description of this scope.
3723    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3724    pub description: ::std::option::Option<::std::string::String>,
3725    ///The public account key that acts as a scoped signer.
3726    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3727    pub key: ::std::option::Option<::std::string::String>,
3728    ///The kind of scope, currently always 'user_scope'.
3729    #[serde(default = "defaults::user_scope_kind")]
3730    pub kind: ScopeType,
3731    ///A user-defined role name to label this scope.
3732    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3733    pub role: ::std::option::Option<::std::string::String>,
3734    ///A template of user permission and limits that must not be overridden by signed JWTs.
3735    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3736    pub template: ::std::option::Option<UserPermissionLimits>,
3737}
3738impl ::std::convert::From<&UserScope> for UserScope {
3739    fn from(value: &UserScope) -> Self {
3740        value.clone()
3741    }
3742}
3743impl ::std::default::Default for UserScope {
3744    fn default() -> Self {
3745        Self {
3746            description: Default::default(),
3747            key: Default::default(),
3748            kind: defaults::user_scope_kind(),
3749            role: Default::default(),
3750            template: Default::default(),
3751        }
3752    }
3753}
3754impl UserScope {
3755    pub fn builder() -> builder::UserScope {
3756        Default::default()
3757    }
3758}
3759///UserType
3760///
3761/// <details><summary>JSON schema</summary>
3762///
3763/// ```json
3764///{
3765///  "enum": [
3766///    "user"
3767///  ]
3768///}
3769/// ```
3770/// </details>
3771#[derive(
3772    ::serde::Deserialize,
3773    ::serde::Serialize,
3774    Clone,
3775    Copy,
3776    Debug,
3777    Eq,
3778    Hash,
3779    Ord,
3780    PartialEq,
3781    PartialOrd,
3782)]
3783pub enum UserType {
3784    #[serde(rename = "user")]
3785    User,
3786}
3787impl ::std::convert::From<&Self> for UserType {
3788    fn from(value: &UserType) -> Self {
3789        value.clone()
3790    }
3791}
3792impl ::std::fmt::Display for UserType {
3793    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3794        match *self {
3795            Self::User => write!(f, "user"),
3796        }
3797    }
3798}
3799impl ::std::str::FromStr for UserType {
3800    type Err = self::error::ConversionError;
3801    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
3802        match value {
3803            "user" => Ok(Self::User),
3804            _ => Err("invalid value".into()),
3805        }
3806    }
3807}
3808impl ::std::convert::TryFrom<&str> for UserType {
3809    type Error = self::error::ConversionError;
3810    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
3811        value.parse()
3812    }
3813}
3814impl ::std::convert::TryFrom<&::std::string::String> for UserType {
3815    type Error = self::error::ConversionError;
3816    fn try_from(
3817        value: &::std::string::String,
3818    ) -> ::std::result::Result<Self, self::error::ConversionError> {
3819        value.parse()
3820    }
3821}
3822impl ::std::convert::TryFrom<::std::string::String> for UserType {
3823    type Error = self::error::ConversionError;
3824    fn try_from(
3825        value: ::std::string::String,
3826    ) -> ::std::result::Result<Self, self::error::ConversionError> {
3827        value.parse()
3828    }
3829}
3830impl ::std::default::Default for UserType {
3831    fn default() -> Self {
3832        UserType::User
3833    }
3834}
3835///Defines a single weighted mapping target with a subject, optional weight, and optional cluster.
3836///
3837/// <details><summary>JSON schema</summary>
3838///
3839/// ```json
3840///{
3841///  "description": "Defines a single weighted mapping target with a subject, optional weight, and optional cluster.",
3842///  "type": "object",
3843///  "properties": {
3844///    "cluster": {
3845///      "description": "Optional cluster identifier that groups weighted mappings together.",
3846///      "type": "string"
3847///    },
3848///    "subject": {
3849///      "description": "The subject to which messages are mapped.",
3850///      "$ref": "#/$defs/Subject"
3851///    },
3852///    "weight": {
3853///      "description": "The relative weight of this mapping, defaults to 100 if not set.",
3854///      "default": 100,
3855///      "type": "integer",
3856///      "minimum": 0.0
3857///    }
3858///  },
3859///  "additionalProperties": false
3860///}
3861/// ```
3862/// </details>
3863#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
3864#[serde(deny_unknown_fields)]
3865pub struct WeightedMapping {
3866    ///Optional cluster identifier that groups weighted mappings together.
3867    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3868    pub cluster: ::std::option::Option<::std::string::String>,
3869    ///The subject to which messages are mapped.
3870    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
3871    pub subject: ::std::option::Option<Subject>,
3872    ///The relative weight of this mapping, defaults to 100 if not set.
3873    #[serde(default = "defaults::default_u64::<u64, 100>")]
3874    pub weight: u64,
3875}
3876impl ::std::convert::From<&WeightedMapping> for WeightedMapping {
3877    fn from(value: &WeightedMapping) -> Self {
3878        value.clone()
3879    }
3880}
3881impl ::std::default::Default for WeightedMapping {
3882    fn default() -> Self {
3883        Self {
3884            cluster: Default::default(),
3885            subject: Default::default(),
3886            weight: defaults::default_u64::<u64, 100>(),
3887        }
3888    }
3889}
3890impl WeightedMapping {
3891    pub fn builder() -> builder::WeightedMapping {
3892        Default::default()
3893    }
3894}
3895/// Types for composing complex structures.
3896pub mod builder {
3897    #[derive(Clone, Debug)]
3898    pub struct Account {
3899        authorization: ::std::result::Result<
3900            ::std::option::Option<super::ExternalAuthorization>,
3901            ::std::string::String,
3902        >,
3903        cluster_traffic: ::std::result::Result<
3904            ::std::option::Option<super::ClusterTraffic>,
3905            ::std::string::String,
3906        >,
3907        default_permissions:
3908            ::std::result::Result<::std::option::Option<super::Permissions>, ::std::string::String>,
3909        description: ::std::result::Result<
3910            ::std::option::Option<::std::string::String>,
3911            ::std::string::String,
3912        >,
3913        exports:
3914            ::std::result::Result<::std::option::Option<super::Exports>, ::std::string::String>,
3915        imports:
3916            ::std::result::Result<::std::option::Option<super::Imports>, ::std::string::String>,
3917        info_url: ::std::result::Result<
3918            ::std::option::Option<::std::string::String>,
3919            ::std::string::String,
3920        >,
3921        limits: ::std::result::Result<
3922            ::std::option::Option<super::OperatorLimits>,
3923            ::std::string::String,
3924        >,
3925        mappings:
3926            ::std::result::Result<::std::option::Option<super::Mapping>, ::std::string::String>,
3927        revocations: ::std::result::Result<
3928            ::std::option::Option<super::RevocationList>,
3929            ::std::string::String,
3930        >,
3931        signing_keys:
3932            ::std::result::Result<::std::option::Option<super::SigningKeys>, ::std::string::String>,
3933        tags: ::std::result::Result<::std::option::Option<super::TagList>, ::std::string::String>,
3934        trace: ::std::result::Result<::std::option::Option<super::MsgTrace>, ::std::string::String>,
3935        type_: ::std::result::Result<super::AccountType, ::std::string::String>,
3936        version: ::std::result::Result<i64, ::std::string::String>,
3937    }
3938    impl ::std::default::Default for Account {
3939        fn default() -> Self {
3940            Self {
3941                authorization: Ok(Default::default()),
3942                cluster_traffic: Ok(Default::default()),
3943                default_permissions: Ok(Default::default()),
3944                description: Ok(Default::default()),
3945                exports: Ok(Default::default()),
3946                imports: Ok(Default::default()),
3947                info_url: Ok(Default::default()),
3948                limits: Ok(Default::default()),
3949                mappings: Ok(Default::default()),
3950                revocations: Ok(Default::default()),
3951                signing_keys: Ok(Default::default()),
3952                tags: Ok(Default::default()),
3953                trace: Ok(Default::default()),
3954                type_: Ok(super::defaults::account_type()),
3955                version: Ok(super::defaults::default_u64::<i64, 2>()),
3956            }
3957        }
3958    }
3959    impl Account {
3960        pub fn authorization<T>(mut self, value: T) -> Self
3961        where
3962            T: ::std::convert::TryInto<::std::option::Option<super::ExternalAuthorization>>,
3963            T::Error: ::std::fmt::Display,
3964        {
3965            self.authorization = value
3966                .try_into()
3967                .map_err(|e| format!("error converting supplied value for authorization: {}", e));
3968            self
3969        }
3970        pub fn cluster_traffic<T>(mut self, value: T) -> Self
3971        where
3972            T: ::std::convert::TryInto<::std::option::Option<super::ClusterTraffic>>,
3973            T::Error: ::std::fmt::Display,
3974        {
3975            self.cluster_traffic = value
3976                .try_into()
3977                .map_err(|e| format!("error converting supplied value for cluster_traffic: {}", e));
3978            self
3979        }
3980        pub fn default_permissions<T>(mut self, value: T) -> Self
3981        where
3982            T: ::std::convert::TryInto<::std::option::Option<super::Permissions>>,
3983            T::Error: ::std::fmt::Display,
3984        {
3985            self.default_permissions = value.try_into().map_err(|e| {
3986                format!(
3987                    "error converting supplied value for default_permissions: {}",
3988                    e
3989                )
3990            });
3991            self
3992        }
3993        pub fn description<T>(mut self, value: T) -> Self
3994        where
3995            T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
3996            T::Error: ::std::fmt::Display,
3997        {
3998            self.description = value
3999                .try_into()
4000                .map_err(|e| format!("error converting supplied value for description: {}", e));
4001            self
4002        }
4003        pub fn exports<T>(mut self, value: T) -> Self
4004        where
4005            T: ::std::convert::TryInto<::std::option::Option<super::Exports>>,
4006            T::Error: ::std::fmt::Display,
4007        {
4008            self.exports = value
4009                .try_into()
4010                .map_err(|e| format!("error converting supplied value for exports: {}", e));
4011            self
4012        }
4013        pub fn imports<T>(mut self, value: T) -> Self
4014        where
4015            T: ::std::convert::TryInto<::std::option::Option<super::Imports>>,
4016            T::Error: ::std::fmt::Display,
4017        {
4018            self.imports = value
4019                .try_into()
4020                .map_err(|e| format!("error converting supplied value for imports: {}", e));
4021            self
4022        }
4023        pub fn info_url<T>(mut self, value: T) -> Self
4024        where
4025            T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
4026            T::Error: ::std::fmt::Display,
4027        {
4028            self.info_url = value
4029                .try_into()
4030                .map_err(|e| format!("error converting supplied value for info_url: {}", e));
4031            self
4032        }
4033        pub fn limits<T>(mut self, value: T) -> Self
4034        where
4035            T: ::std::convert::TryInto<::std::option::Option<super::OperatorLimits>>,
4036            T::Error: ::std::fmt::Display,
4037        {
4038            self.limits = value
4039                .try_into()
4040                .map_err(|e| format!("error converting supplied value for limits: {}", e));
4041            self
4042        }
4043        pub fn mappings<T>(mut self, value: T) -> Self
4044        where
4045            T: ::std::convert::TryInto<::std::option::Option<super::Mapping>>,
4046            T::Error: ::std::fmt::Display,
4047        {
4048            self.mappings = value
4049                .try_into()
4050                .map_err(|e| format!("error converting supplied value for mappings: {}", e));
4051            self
4052        }
4053        pub fn revocations<T>(mut self, value: T) -> Self
4054        where
4055            T: ::std::convert::TryInto<::std::option::Option<super::RevocationList>>,
4056            T::Error: ::std::fmt::Display,
4057        {
4058            self.revocations = value
4059                .try_into()
4060                .map_err(|e| format!("error converting supplied value for revocations: {}", e));
4061            self
4062        }
4063        pub fn signing_keys<T>(mut self, value: T) -> Self
4064        where
4065            T: ::std::convert::TryInto<::std::option::Option<super::SigningKeys>>,
4066            T::Error: ::std::fmt::Display,
4067        {
4068            self.signing_keys = value
4069                .try_into()
4070                .map_err(|e| format!("error converting supplied value for signing_keys: {}", e));
4071            self
4072        }
4073        pub fn tags<T>(mut self, value: T) -> Self
4074        where
4075            T: ::std::convert::TryInto<::std::option::Option<super::TagList>>,
4076            T::Error: ::std::fmt::Display,
4077        {
4078            self.tags = value
4079                .try_into()
4080                .map_err(|e| format!("error converting supplied value for tags: {}", e));
4081            self
4082        }
4083        pub fn trace<T>(mut self, value: T) -> Self
4084        where
4085            T: ::std::convert::TryInto<::std::option::Option<super::MsgTrace>>,
4086            T::Error: ::std::fmt::Display,
4087        {
4088            self.trace = value
4089                .try_into()
4090                .map_err(|e| format!("error converting supplied value for trace: {}", e));
4091            self
4092        }
4093        pub fn type_<T>(mut self, value: T) -> Self
4094        where
4095            T: ::std::convert::TryInto<super::AccountType>,
4096            T::Error: ::std::fmt::Display,
4097        {
4098            self.type_ = value
4099                .try_into()
4100                .map_err(|e| format!("error converting supplied value for type_: {}", e));
4101            self
4102        }
4103        pub fn version<T>(mut self, value: T) -> Self
4104        where
4105            T: ::std::convert::TryInto<i64>,
4106            T::Error: ::std::fmt::Display,
4107        {
4108            self.version = value
4109                .try_into()
4110                .map_err(|e| format!("error converting supplied value for version: {}", e));
4111            self
4112        }
4113    }
4114    impl ::std::convert::TryFrom<Account> for super::Account {
4115        type Error = super::error::ConversionError;
4116        fn try_from(value: Account) -> ::std::result::Result<Self, super::error::ConversionError> {
4117            Ok(Self {
4118                authorization: value.authorization?,
4119                cluster_traffic: value.cluster_traffic?,
4120                default_permissions: value.default_permissions?,
4121                description: value.description?,
4122                exports: value.exports?,
4123                imports: value.imports?,
4124                info_url: value.info_url?,
4125                limits: value.limits?,
4126                mappings: value.mappings?,
4127                revocations: value.revocations?,
4128                signing_keys: value.signing_keys?,
4129                tags: value.tags?,
4130                trace: value.trace?,
4131                type_: value.type_?,
4132                version: value.version?,
4133            })
4134        }
4135    }
4136    impl ::std::convert::From<super::Account> for Account {
4137        fn from(value: super::Account) -> Self {
4138            Self {
4139                authorization: Ok(value.authorization),
4140                cluster_traffic: Ok(value.cluster_traffic),
4141                default_permissions: Ok(value.default_permissions),
4142                description: Ok(value.description),
4143                exports: Ok(value.exports),
4144                imports: Ok(value.imports),
4145                info_url: Ok(value.info_url),
4146                limits: Ok(value.limits),
4147                mappings: Ok(value.mappings),
4148                revocations: Ok(value.revocations),
4149                signing_keys: Ok(value.signing_keys),
4150                tags: Ok(value.tags),
4151                trace: Ok(value.trace),
4152                type_: Ok(value.type_),
4153                version: Ok(value.version),
4154            }
4155        }
4156    }
4157    #[derive(Clone, Debug)]
4158    pub struct AccountLimits {
4159        conn: ::std::result::Result<i64, ::std::string::String>,
4160        disallow_bearer: ::std::result::Result<bool, ::std::string::String>,
4161        exports: ::std::result::Result<i64, ::std::string::String>,
4162        imports: ::std::result::Result<i64, ::std::string::String>,
4163        leaf: ::std::result::Result<i64, ::std::string::String>,
4164        wildcards: ::std::result::Result<bool, ::std::string::String>,
4165    }
4166    impl ::std::default::Default for AccountLimits {
4167        fn default() -> Self {
4168            Self {
4169                conn: Ok(super::defaults::default_i64::<i64, -1>()),
4170                disallow_bearer: Ok(Default::default()),
4171                exports: Ok(super::defaults::default_i64::<i64, -1>()),
4172                imports: Ok(super::defaults::default_i64::<i64, -1>()),
4173                leaf: Ok(super::defaults::default_i64::<i64, -1>()),
4174                wildcards: Ok(super::defaults::default_bool::<true>()),
4175            }
4176        }
4177    }
4178    impl AccountLimits {
4179        pub fn conn<T>(mut self, value: T) -> Self
4180        where
4181            T: ::std::convert::TryInto<i64>,
4182            T::Error: ::std::fmt::Display,
4183        {
4184            self.conn = value
4185                .try_into()
4186                .map_err(|e| format!("error converting supplied value for conn: {}", e));
4187            self
4188        }
4189        pub fn disallow_bearer<T>(mut self, value: T) -> Self
4190        where
4191            T: ::std::convert::TryInto<bool>,
4192            T::Error: ::std::fmt::Display,
4193        {
4194            self.disallow_bearer = value
4195                .try_into()
4196                .map_err(|e| format!("error converting supplied value for disallow_bearer: {}", e));
4197            self
4198        }
4199        pub fn exports<T>(mut self, value: T) -> Self
4200        where
4201            T: ::std::convert::TryInto<i64>,
4202            T::Error: ::std::fmt::Display,
4203        {
4204            self.exports = value
4205                .try_into()
4206                .map_err(|e| format!("error converting supplied value for exports: {}", e));
4207            self
4208        }
4209        pub fn imports<T>(mut self, value: T) -> Self
4210        where
4211            T: ::std::convert::TryInto<i64>,
4212            T::Error: ::std::fmt::Display,
4213        {
4214            self.imports = value
4215                .try_into()
4216                .map_err(|e| format!("error converting supplied value for imports: {}", e));
4217            self
4218        }
4219        pub fn leaf<T>(mut self, value: T) -> Self
4220        where
4221            T: ::std::convert::TryInto<i64>,
4222            T::Error: ::std::fmt::Display,
4223        {
4224            self.leaf = value
4225                .try_into()
4226                .map_err(|e| format!("error converting supplied value for leaf: {}", e));
4227            self
4228        }
4229        pub fn wildcards<T>(mut self, value: T) -> Self
4230        where
4231            T: ::std::convert::TryInto<bool>,
4232            T::Error: ::std::fmt::Display,
4233        {
4234            self.wildcards = value
4235                .try_into()
4236                .map_err(|e| format!("error converting supplied value for wildcards: {}", e));
4237            self
4238        }
4239    }
4240    impl ::std::convert::TryFrom<AccountLimits> for super::AccountLimits {
4241        type Error = super::error::ConversionError;
4242        fn try_from(
4243            value: AccountLimits,
4244        ) -> ::std::result::Result<Self, super::error::ConversionError> {
4245            Ok(Self {
4246                conn: value.conn?,
4247                disallow_bearer: value.disallow_bearer?,
4248                exports: value.exports?,
4249                imports: value.imports?,
4250                leaf: value.leaf?,
4251                wildcards: value.wildcards?,
4252            })
4253        }
4254    }
4255    impl ::std::convert::From<super::AccountLimits> for AccountLimits {
4256        fn from(value: super::AccountLimits) -> Self {
4257            Self {
4258                conn: Ok(value.conn),
4259                disallow_bearer: Ok(value.disallow_bearer),
4260                exports: Ok(value.exports),
4261                imports: Ok(value.imports),
4262                leaf: Ok(value.leaf),
4263                wildcards: Ok(value.wildcards),
4264            }
4265        }
4266    }
4267    #[derive(Clone, Debug)]
4268    pub struct Activation {
4269        issuer_account: ::std::result::Result<
4270            ::std::option::Option<::std::string::String>,
4271            ::std::string::String,
4272        >,
4273        kind:
4274            ::std::result::Result<::std::option::Option<super::ExportType>, ::std::string::String>,
4275        subject:
4276            ::std::result::Result<::std::option::Option<super::Subject>, ::std::string::String>,
4277        tags: ::std::result::Result<::std::option::Option<super::TagList>, ::std::string::String>,
4278        type_: ::std::result::Result<super::ActivationType, ::std::string::String>,
4279        version: ::std::result::Result<i64, ::std::string::String>,
4280    }
4281    impl ::std::default::Default for Activation {
4282        fn default() -> Self {
4283            Self {
4284                issuer_account: Ok(Default::default()),
4285                kind: Ok(Default::default()),
4286                subject: Ok(Default::default()),
4287                tags: Ok(Default::default()),
4288                type_: Ok(super::defaults::activation_type()),
4289                version: Ok(super::defaults::default_u64::<i64, 2>()),
4290            }
4291        }
4292    }
4293    impl Activation {
4294        pub fn issuer_account<T>(mut self, value: T) -> Self
4295        where
4296            T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
4297            T::Error: ::std::fmt::Display,
4298        {
4299            self.issuer_account = value
4300                .try_into()
4301                .map_err(|e| format!("error converting supplied value for issuer_account: {}", e));
4302            self
4303        }
4304        pub fn kind<T>(mut self, value: T) -> Self
4305        where
4306            T: ::std::convert::TryInto<::std::option::Option<super::ExportType>>,
4307            T::Error: ::std::fmt::Display,
4308        {
4309            self.kind = value
4310                .try_into()
4311                .map_err(|e| format!("error converting supplied value for kind: {}", e));
4312            self
4313        }
4314        pub fn subject<T>(mut self, value: T) -> Self
4315        where
4316            T: ::std::convert::TryInto<::std::option::Option<super::Subject>>,
4317            T::Error: ::std::fmt::Display,
4318        {
4319            self.subject = value
4320                .try_into()
4321                .map_err(|e| format!("error converting supplied value for subject: {}", e));
4322            self
4323        }
4324        pub fn tags<T>(mut self, value: T) -> Self
4325        where
4326            T: ::std::convert::TryInto<::std::option::Option<super::TagList>>,
4327            T::Error: ::std::fmt::Display,
4328        {
4329            self.tags = value
4330                .try_into()
4331                .map_err(|e| format!("error converting supplied value for tags: {}", e));
4332            self
4333        }
4334        pub fn type_<T>(mut self, value: T) -> Self
4335        where
4336            T: ::std::convert::TryInto<super::ActivationType>,
4337            T::Error: ::std::fmt::Display,
4338        {
4339            self.type_ = value
4340                .try_into()
4341                .map_err(|e| format!("error converting supplied value for type_: {}", e));
4342            self
4343        }
4344        pub fn version<T>(mut self, value: T) -> Self
4345        where
4346            T: ::std::convert::TryInto<i64>,
4347            T::Error: ::std::fmt::Display,
4348        {
4349            self.version = value
4350                .try_into()
4351                .map_err(|e| format!("error converting supplied value for version: {}", e));
4352            self
4353        }
4354    }
4355    impl ::std::convert::TryFrom<Activation> for super::Activation {
4356        type Error = super::error::ConversionError;
4357        fn try_from(
4358            value: Activation,
4359        ) -> ::std::result::Result<Self, super::error::ConversionError> {
4360            Ok(Self {
4361                issuer_account: value.issuer_account?,
4362                kind: value.kind?,
4363                subject: value.subject?,
4364                tags: value.tags?,
4365                type_: value.type_?,
4366                version: value.version?,
4367            })
4368        }
4369    }
4370    impl ::std::convert::From<super::Activation> for Activation {
4371        fn from(value: super::Activation) -> Self {
4372            Self {
4373                issuer_account: Ok(value.issuer_account),
4374                kind: Ok(value.kind),
4375                subject: Ok(value.subject),
4376                tags: Ok(value.tags),
4377                type_: Ok(value.type_),
4378                version: Ok(value.version),
4379            }
4380        }
4381    }
4382    #[derive(Clone, Debug)]
4383    pub struct Export {
4384        account_token_position:
4385            ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
4386        advertise: ::std::result::Result<::std::option::Option<bool>, ::std::string::String>,
4387        allow_trace: ::std::result::Result<::std::option::Option<bool>, ::std::string::String>,
4388        description: ::std::result::Result<
4389            ::std::option::Option<::std::string::String>,
4390            ::std::string::String,
4391        >,
4392        info_url: ::std::result::Result<
4393            ::std::option::Option<::std::string::String>,
4394            ::std::string::String,
4395        >,
4396        name: ::std::result::Result<
4397            ::std::option::Option<::std::string::String>,
4398            ::std::string::String,
4399        >,
4400        response_threshold:
4401            ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
4402        response_type: ::std::result::Result<
4403            ::std::option::Option<super::ResponseType>,
4404            ::std::string::String,
4405        >,
4406        revocations: ::std::result::Result<
4407            ::std::option::Option<super::RevocationList>,
4408            ::std::string::String,
4409        >,
4410        service_latency: ::std::result::Result<
4411            ::std::option::Option<super::ServiceLatency>,
4412            ::std::string::String,
4413        >,
4414        subject:
4415            ::std::result::Result<::std::option::Option<super::Subject>, ::std::string::String>,
4416        token_req: ::std::result::Result<bool, ::std::string::String>,
4417        type_:
4418            ::std::result::Result<::std::option::Option<super::ExportType>, ::std::string::String>,
4419    }
4420    impl ::std::default::Default for Export {
4421        fn default() -> Self {
4422            Self {
4423                account_token_position: Ok(Default::default()),
4424                advertise: Ok(Default::default()),
4425                allow_trace: Ok(Default::default()),
4426                description: Ok(Default::default()),
4427                info_url: Ok(Default::default()),
4428                name: Ok(Default::default()),
4429                response_threshold: Ok(Default::default()),
4430                response_type: Ok(Default::default()),
4431                revocations: Ok(Default::default()),
4432                service_latency: Ok(Default::default()),
4433                subject: Ok(Default::default()),
4434                token_req: Ok(Default::default()),
4435                type_: Ok(Default::default()),
4436            }
4437        }
4438    }
4439    impl Export {
4440        pub fn account_token_position<T>(mut self, value: T) -> Self
4441        where
4442            T: ::std::convert::TryInto<::std::option::Option<i64>>,
4443            T::Error: ::std::fmt::Display,
4444        {
4445            self.account_token_position = value.try_into().map_err(|e| {
4446                format!(
4447                    "error converting supplied value for account_token_position: {}",
4448                    e
4449                )
4450            });
4451            self
4452        }
4453        pub fn advertise<T>(mut self, value: T) -> Self
4454        where
4455            T: ::std::convert::TryInto<::std::option::Option<bool>>,
4456            T::Error: ::std::fmt::Display,
4457        {
4458            self.advertise = value
4459                .try_into()
4460                .map_err(|e| format!("error converting supplied value for advertise: {}", e));
4461            self
4462        }
4463        pub fn allow_trace<T>(mut self, value: T) -> Self
4464        where
4465            T: ::std::convert::TryInto<::std::option::Option<bool>>,
4466            T::Error: ::std::fmt::Display,
4467        {
4468            self.allow_trace = value
4469                .try_into()
4470                .map_err(|e| format!("error converting supplied value for allow_trace: {}", e));
4471            self
4472        }
4473        pub fn description<T>(mut self, value: T) -> Self
4474        where
4475            T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
4476            T::Error: ::std::fmt::Display,
4477        {
4478            self.description = value
4479                .try_into()
4480                .map_err(|e| format!("error converting supplied value for description: {}", e));
4481            self
4482        }
4483        pub fn info_url<T>(mut self, value: T) -> Self
4484        where
4485            T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
4486            T::Error: ::std::fmt::Display,
4487        {
4488            self.info_url = value
4489                .try_into()
4490                .map_err(|e| format!("error converting supplied value for info_url: {}", e));
4491            self
4492        }
4493        pub fn name<T>(mut self, value: T) -> Self
4494        where
4495            T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
4496            T::Error: ::std::fmt::Display,
4497        {
4498            self.name = value
4499                .try_into()
4500                .map_err(|e| format!("error converting supplied value for name: {}", e));
4501            self
4502        }
4503        pub fn response_threshold<T>(mut self, value: T) -> Self
4504        where
4505            T: ::std::convert::TryInto<::std::option::Option<i64>>,
4506            T::Error: ::std::fmt::Display,
4507        {
4508            self.response_threshold = value.try_into().map_err(|e| {
4509                format!(
4510                    "error converting supplied value for response_threshold: {}",
4511                    e
4512                )
4513            });
4514            self
4515        }
4516        pub fn response_type<T>(mut self, value: T) -> Self
4517        where
4518            T: ::std::convert::TryInto<::std::option::Option<super::ResponseType>>,
4519            T::Error: ::std::fmt::Display,
4520        {
4521            self.response_type = value
4522                .try_into()
4523                .map_err(|e| format!("error converting supplied value for response_type: {}", e));
4524            self
4525        }
4526        pub fn revocations<T>(mut self, value: T) -> Self
4527        where
4528            T: ::std::convert::TryInto<::std::option::Option<super::RevocationList>>,
4529            T::Error: ::std::fmt::Display,
4530        {
4531            self.revocations = value
4532                .try_into()
4533                .map_err(|e| format!("error converting supplied value for revocations: {}", e));
4534            self
4535        }
4536        pub fn service_latency<T>(mut self, value: T) -> Self
4537        where
4538            T: ::std::convert::TryInto<::std::option::Option<super::ServiceLatency>>,
4539            T::Error: ::std::fmt::Display,
4540        {
4541            self.service_latency = value
4542                .try_into()
4543                .map_err(|e| format!("error converting supplied value for service_latency: {}", e));
4544            self
4545        }
4546        pub fn subject<T>(mut self, value: T) -> Self
4547        where
4548            T: ::std::convert::TryInto<::std::option::Option<super::Subject>>,
4549            T::Error: ::std::fmt::Display,
4550        {
4551            self.subject = value
4552                .try_into()
4553                .map_err(|e| format!("error converting supplied value for subject: {}", e));
4554            self
4555        }
4556        pub fn token_req<T>(mut self, value: T) -> Self
4557        where
4558            T: ::std::convert::TryInto<bool>,
4559            T::Error: ::std::fmt::Display,
4560        {
4561            self.token_req = value
4562                .try_into()
4563                .map_err(|e| format!("error converting supplied value for token_req: {}", e));
4564            self
4565        }
4566        pub fn type_<T>(mut self, value: T) -> Self
4567        where
4568            T: ::std::convert::TryInto<::std::option::Option<super::ExportType>>,
4569            T::Error: ::std::fmt::Display,
4570        {
4571            self.type_ = value
4572                .try_into()
4573                .map_err(|e| format!("error converting supplied value for type_: {}", e));
4574            self
4575        }
4576    }
4577    impl ::std::convert::TryFrom<Export> for super::Export {
4578        type Error = super::error::ConversionError;
4579        fn try_from(value: Export) -> ::std::result::Result<Self, super::error::ConversionError> {
4580            Ok(Self {
4581                account_token_position: value.account_token_position?,
4582                advertise: value.advertise?,
4583                allow_trace: value.allow_trace?,
4584                description: value.description?,
4585                info_url: value.info_url?,
4586                name: value.name?,
4587                response_threshold: value.response_threshold?,
4588                response_type: value.response_type?,
4589                revocations: value.revocations?,
4590                service_latency: value.service_latency?,
4591                subject: value.subject?,
4592                token_req: value.token_req?,
4593                type_: value.type_?,
4594            })
4595        }
4596    }
4597    impl ::std::convert::From<super::Export> for Export {
4598        fn from(value: super::Export) -> Self {
4599            Self {
4600                account_token_position: Ok(value.account_token_position),
4601                advertise: Ok(value.advertise),
4602                allow_trace: Ok(value.allow_trace),
4603                description: Ok(value.description),
4604                info_url: Ok(value.info_url),
4605                name: Ok(value.name),
4606                response_threshold: Ok(value.response_threshold),
4607                response_type: Ok(value.response_type),
4608                revocations: Ok(value.revocations),
4609                service_latency: Ok(value.service_latency),
4610                subject: Ok(value.subject),
4611                token_req: Ok(value.token_req),
4612                type_: Ok(value.type_),
4613            }
4614        }
4615    }
4616    #[derive(Clone, Debug)]
4617    pub struct ExternalAuthorization {
4618        allowed_accounts:
4619            ::std::result::Result<::std::option::Option<super::StringList>, ::std::string::String>,
4620        auth_users:
4621            ::std::result::Result<::std::option::Option<super::StringList>, ::std::string::String>,
4622        xkey: ::std::result::Result<
4623            ::std::option::Option<::std::string::String>,
4624            ::std::string::String,
4625        >,
4626    }
4627    impl ::std::default::Default for ExternalAuthorization {
4628        fn default() -> Self {
4629            Self {
4630                allowed_accounts: Ok(Default::default()),
4631                auth_users: Ok(Default::default()),
4632                xkey: Ok(Default::default()),
4633            }
4634        }
4635    }
4636    impl ExternalAuthorization {
4637        pub fn allowed_accounts<T>(mut self, value: T) -> Self
4638        where
4639            T: ::std::convert::TryInto<::std::option::Option<super::StringList>>,
4640            T::Error: ::std::fmt::Display,
4641        {
4642            self.allowed_accounts = value.try_into().map_err(|e| {
4643                format!(
4644                    "error converting supplied value for allowed_accounts: {}",
4645                    e
4646                )
4647            });
4648            self
4649        }
4650        pub fn auth_users<T>(mut self, value: T) -> Self
4651        where
4652            T: ::std::convert::TryInto<::std::option::Option<super::StringList>>,
4653            T::Error: ::std::fmt::Display,
4654        {
4655            self.auth_users = value
4656                .try_into()
4657                .map_err(|e| format!("error converting supplied value for auth_users: {}", e));
4658            self
4659        }
4660        pub fn xkey<T>(mut self, value: T) -> Self
4661        where
4662            T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
4663            T::Error: ::std::fmt::Display,
4664        {
4665            self.xkey = value
4666                .try_into()
4667                .map_err(|e| format!("error converting supplied value for xkey: {}", e));
4668            self
4669        }
4670    }
4671    impl ::std::convert::TryFrom<ExternalAuthorization> for super::ExternalAuthorization {
4672        type Error = super::error::ConversionError;
4673        fn try_from(
4674            value: ExternalAuthorization,
4675        ) -> ::std::result::Result<Self, super::error::ConversionError> {
4676            Ok(Self {
4677                allowed_accounts: value.allowed_accounts?,
4678                auth_users: value.auth_users?,
4679                xkey: value.xkey?,
4680            })
4681        }
4682    }
4683    impl ::std::convert::From<super::ExternalAuthorization> for ExternalAuthorization {
4684        fn from(value: super::ExternalAuthorization) -> Self {
4685            Self {
4686                allowed_accounts: Ok(value.allowed_accounts),
4687                auth_users: Ok(value.auth_users),
4688                xkey: Ok(value.xkey),
4689            }
4690        }
4691    }
4692    #[derive(Clone, Debug)]
4693    pub struct GenericFields {
4694        tags: ::std::result::Result<::std::option::Option<super::TagList>, ::std::string::String>,
4695        version: ::std::result::Result<i64, ::std::string::String>,
4696    }
4697    impl ::std::default::Default for GenericFields {
4698        fn default() -> Self {
4699            Self {
4700                tags: Ok(Default::default()),
4701                version: Ok(super::defaults::default_u64::<i64, 2>()),
4702            }
4703        }
4704    }
4705    impl GenericFields {
4706        pub fn tags<T>(mut self, value: T) -> Self
4707        where
4708            T: ::std::convert::TryInto<::std::option::Option<super::TagList>>,
4709            T::Error: ::std::fmt::Display,
4710        {
4711            self.tags = value
4712                .try_into()
4713                .map_err(|e| format!("error converting supplied value for tags: {}", e));
4714            self
4715        }
4716        pub fn version<T>(mut self, value: T) -> Self
4717        where
4718            T: ::std::convert::TryInto<i64>,
4719            T::Error: ::std::fmt::Display,
4720        {
4721            self.version = value
4722                .try_into()
4723                .map_err(|e| format!("error converting supplied value for version: {}", e));
4724            self
4725        }
4726    }
4727    impl ::std::convert::TryFrom<GenericFields> for super::GenericFields {
4728        type Error = super::error::ConversionError;
4729        fn try_from(
4730            value: GenericFields,
4731        ) -> ::std::result::Result<Self, super::error::ConversionError> {
4732            Ok(Self {
4733                tags: value.tags?,
4734                version: value.version?,
4735            })
4736        }
4737    }
4738    impl ::std::convert::From<super::GenericFields> for GenericFields {
4739        fn from(value: super::GenericFields) -> Self {
4740            Self {
4741                tags: Ok(value.tags),
4742                version: Ok(value.version),
4743            }
4744        }
4745    }
4746    #[derive(Clone, Debug)]
4747    pub struct Import {
4748        account: ::std::result::Result<
4749            ::std::option::Option<::std::string::String>,
4750            ::std::string::String,
4751        >,
4752        allow_trace: ::std::result::Result<::std::option::Option<bool>, ::std::string::String>,
4753        local_subject: ::std::result::Result<
4754            ::std::option::Option<super::RenamingSubject>,
4755            ::std::string::String,
4756        >,
4757        name: ::std::result::Result<
4758            ::std::option::Option<::std::string::String>,
4759            ::std::string::String,
4760        >,
4761        share: ::std::result::Result<::std::option::Option<bool>, ::std::string::String>,
4762        subject:
4763            ::std::result::Result<::std::option::Option<super::Subject>, ::std::string::String>,
4764        to: ::std::result::Result<::std::option::Option<super::Subject>, ::std::string::String>,
4765        token: ::std::result::Result<
4766            ::std::option::Option<::std::string::String>,
4767            ::std::string::String,
4768        >,
4769        type_:
4770            ::std::result::Result<::std::option::Option<super::ExportType>, ::std::string::String>,
4771    }
4772    impl ::std::default::Default for Import {
4773        fn default() -> Self {
4774            Self {
4775                account: Ok(Default::default()),
4776                allow_trace: Ok(Default::default()),
4777                local_subject: Ok(Default::default()),
4778                name: Ok(Default::default()),
4779                share: Ok(Default::default()),
4780                subject: Ok(Default::default()),
4781                to: Ok(Default::default()),
4782                token: Ok(Default::default()),
4783                type_: Ok(Default::default()),
4784            }
4785        }
4786    }
4787    impl Import {
4788        pub fn account<T>(mut self, value: T) -> Self
4789        where
4790            T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
4791            T::Error: ::std::fmt::Display,
4792        {
4793            self.account = value
4794                .try_into()
4795                .map_err(|e| format!("error converting supplied value for account: {}", e));
4796            self
4797        }
4798        pub fn allow_trace<T>(mut self, value: T) -> Self
4799        where
4800            T: ::std::convert::TryInto<::std::option::Option<bool>>,
4801            T::Error: ::std::fmt::Display,
4802        {
4803            self.allow_trace = value
4804                .try_into()
4805                .map_err(|e| format!("error converting supplied value for allow_trace: {}", e));
4806            self
4807        }
4808        pub fn local_subject<T>(mut self, value: T) -> Self
4809        where
4810            T: ::std::convert::TryInto<::std::option::Option<super::RenamingSubject>>,
4811            T::Error: ::std::fmt::Display,
4812        {
4813            self.local_subject = value
4814                .try_into()
4815                .map_err(|e| format!("error converting supplied value for local_subject: {}", e));
4816            self
4817        }
4818        pub fn name<T>(mut self, value: T) -> Self
4819        where
4820            T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
4821            T::Error: ::std::fmt::Display,
4822        {
4823            self.name = value
4824                .try_into()
4825                .map_err(|e| format!("error converting supplied value for name: {}", e));
4826            self
4827        }
4828        pub fn share<T>(mut self, value: T) -> Self
4829        where
4830            T: ::std::convert::TryInto<::std::option::Option<bool>>,
4831            T::Error: ::std::fmt::Display,
4832        {
4833            self.share = value
4834                .try_into()
4835                .map_err(|e| format!("error converting supplied value for share: {}", e));
4836            self
4837        }
4838        pub fn subject<T>(mut self, value: T) -> Self
4839        where
4840            T: ::std::convert::TryInto<::std::option::Option<super::Subject>>,
4841            T::Error: ::std::fmt::Display,
4842        {
4843            self.subject = value
4844                .try_into()
4845                .map_err(|e| format!("error converting supplied value for subject: {}", e));
4846            self
4847        }
4848        pub fn to<T>(mut self, value: T) -> Self
4849        where
4850            T: ::std::convert::TryInto<::std::option::Option<super::Subject>>,
4851            T::Error: ::std::fmt::Display,
4852        {
4853            self.to = value
4854                .try_into()
4855                .map_err(|e| format!("error converting supplied value for to: {}", e));
4856            self
4857        }
4858        pub fn token<T>(mut self, value: T) -> Self
4859        where
4860            T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
4861            T::Error: ::std::fmt::Display,
4862        {
4863            self.token = value
4864                .try_into()
4865                .map_err(|e| format!("error converting supplied value for token: {}", e));
4866            self
4867        }
4868        pub fn type_<T>(mut self, value: T) -> Self
4869        where
4870            T: ::std::convert::TryInto<::std::option::Option<super::ExportType>>,
4871            T::Error: ::std::fmt::Display,
4872        {
4873            self.type_ = value
4874                .try_into()
4875                .map_err(|e| format!("error converting supplied value for type_: {}", e));
4876            self
4877        }
4878    }
4879    impl ::std::convert::TryFrom<Import> for super::Import {
4880        type Error = super::error::ConversionError;
4881        fn try_from(value: Import) -> ::std::result::Result<Self, super::error::ConversionError> {
4882            Ok(Self {
4883                account: value.account?,
4884                allow_trace: value.allow_trace?,
4885                local_subject: value.local_subject?,
4886                name: value.name?,
4887                share: value.share?,
4888                subject: value.subject?,
4889                to: value.to?,
4890                token: value.token?,
4891                type_: value.type_?,
4892            })
4893        }
4894    }
4895    impl ::std::convert::From<super::Import> for Import {
4896        fn from(value: super::Import) -> Self {
4897            Self {
4898                account: Ok(value.account),
4899                allow_trace: Ok(value.allow_trace),
4900                local_subject: Ok(value.local_subject),
4901                name: Ok(value.name),
4902                share: Ok(value.share),
4903                subject: Ok(value.subject),
4904                to: Ok(value.to),
4905                token: Ok(value.token),
4906                type_: Ok(value.type_),
4907            }
4908        }
4909    }
4910    #[derive(Clone, Debug)]
4911    pub struct Info {
4912        description: ::std::result::Result<
4913            ::std::option::Option<::std::string::String>,
4914            ::std::string::String,
4915        >,
4916        info_url: ::std::result::Result<
4917            ::std::option::Option<::std::string::String>,
4918            ::std::string::String,
4919        >,
4920    }
4921    impl ::std::default::Default for Info {
4922        fn default() -> Self {
4923            Self {
4924                description: Ok(Default::default()),
4925                info_url: Ok(Default::default()),
4926            }
4927        }
4928    }
4929    impl Info {
4930        pub fn description<T>(mut self, value: T) -> Self
4931        where
4932            T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
4933            T::Error: ::std::fmt::Display,
4934        {
4935            self.description = value
4936                .try_into()
4937                .map_err(|e| format!("error converting supplied value for description: {}", e));
4938            self
4939        }
4940        pub fn info_url<T>(mut self, value: T) -> Self
4941        where
4942            T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
4943            T::Error: ::std::fmt::Display,
4944        {
4945            self.info_url = value
4946                .try_into()
4947                .map_err(|e| format!("error converting supplied value for info_url: {}", e));
4948            self
4949        }
4950    }
4951    impl ::std::convert::TryFrom<Info> for super::Info {
4952        type Error = super::error::ConversionError;
4953        fn try_from(value: Info) -> ::std::result::Result<Self, super::error::ConversionError> {
4954            Ok(Self {
4955                description: value.description?,
4956                info_url: value.info_url?,
4957            })
4958        }
4959    }
4960    impl ::std::convert::From<super::Info> for Info {
4961        fn from(value: super::Info) -> Self {
4962            Self {
4963                description: Ok(value.description),
4964                info_url: Ok(value.info_url),
4965            }
4966        }
4967    }
4968    #[derive(Clone, Debug)]
4969    pub struct JetStreamLimits {
4970        consumer: ::std::result::Result<i64, ::std::string::String>,
4971        disk_max_stream_bytes: ::std::result::Result<i64, ::std::string::String>,
4972        disk_storage: ::std::result::Result<i64, ::std::string::String>,
4973        max_ack_pending: ::std::result::Result<i64, ::std::string::String>,
4974        max_bytes_required: ::std::result::Result<bool, ::std::string::String>,
4975        mem_max_stream_bytes: ::std::result::Result<i64, ::std::string::String>,
4976        mem_storage: ::std::result::Result<i64, ::std::string::String>,
4977        streams: ::std::result::Result<i64, ::std::string::String>,
4978    }
4979    impl ::std::default::Default for JetStreamLimits {
4980        fn default() -> Self {
4981            Self {
4982                consumer: Ok(super::defaults::default_i64::<i64, -1>()),
4983                disk_max_stream_bytes: Ok(Default::default()),
4984                disk_storage: Ok(super::defaults::default_i64::<i64, -1>()),
4985                max_ack_pending: Ok(Default::default()),
4986                max_bytes_required: Ok(Default::default()),
4987                mem_max_stream_bytes: Ok(Default::default()),
4988                mem_storage: Ok(super::defaults::default_i64::<i64, -1>()),
4989                streams: Ok(super::defaults::default_i64::<i64, -1>()),
4990            }
4991        }
4992    }
4993    impl JetStreamLimits {
4994        pub fn consumer<T>(mut self, value: T) -> Self
4995        where
4996            T: ::std::convert::TryInto<i64>,
4997            T::Error: ::std::fmt::Display,
4998        {
4999            self.consumer = value
5000                .try_into()
5001                .map_err(|e| format!("error converting supplied value for consumer: {}", e));
5002            self
5003        }
5004        pub fn disk_max_stream_bytes<T>(mut self, value: T) -> Self
5005        where
5006            T: ::std::convert::TryInto<i64>,
5007            T::Error: ::std::fmt::Display,
5008        {
5009            self.disk_max_stream_bytes = value.try_into().map_err(|e| {
5010                format!(
5011                    "error converting supplied value for disk_max_stream_bytes: {}",
5012                    e
5013                )
5014            });
5015            self
5016        }
5017        pub fn disk_storage<T>(mut self, value: T) -> Self
5018        where
5019            T: ::std::convert::TryInto<i64>,
5020            T::Error: ::std::fmt::Display,
5021        {
5022            self.disk_storage = value
5023                .try_into()
5024                .map_err(|e| format!("error converting supplied value for disk_storage: {}", e));
5025            self
5026        }
5027        pub fn max_ack_pending<T>(mut self, value: T) -> Self
5028        where
5029            T: ::std::convert::TryInto<i64>,
5030            T::Error: ::std::fmt::Display,
5031        {
5032            self.max_ack_pending = value
5033                .try_into()
5034                .map_err(|e| format!("error converting supplied value for max_ack_pending: {}", e));
5035            self
5036        }
5037        pub fn max_bytes_required<T>(mut self, value: T) -> Self
5038        where
5039            T: ::std::convert::TryInto<bool>,
5040            T::Error: ::std::fmt::Display,
5041        {
5042            self.max_bytes_required = value.try_into().map_err(|e| {
5043                format!(
5044                    "error converting supplied value for max_bytes_required: {}",
5045                    e
5046                )
5047            });
5048            self
5049        }
5050        pub fn mem_max_stream_bytes<T>(mut self, value: T) -> Self
5051        where
5052            T: ::std::convert::TryInto<i64>,
5053            T::Error: ::std::fmt::Display,
5054        {
5055            self.mem_max_stream_bytes = value.try_into().map_err(|e| {
5056                format!(
5057                    "error converting supplied value for mem_max_stream_bytes: {}",
5058                    e
5059                )
5060            });
5061            self
5062        }
5063        pub fn mem_storage<T>(mut self, value: T) -> Self
5064        where
5065            T: ::std::convert::TryInto<i64>,
5066            T::Error: ::std::fmt::Display,
5067        {
5068            self.mem_storage = value
5069                .try_into()
5070                .map_err(|e| format!("error converting supplied value for mem_storage: {}", e));
5071            self
5072        }
5073        pub fn streams<T>(mut self, value: T) -> Self
5074        where
5075            T: ::std::convert::TryInto<i64>,
5076            T::Error: ::std::fmt::Display,
5077        {
5078            self.streams = value
5079                .try_into()
5080                .map_err(|e| format!("error converting supplied value for streams: {}", e));
5081            self
5082        }
5083    }
5084    impl ::std::convert::TryFrom<JetStreamLimits> for super::JetStreamLimits {
5085        type Error = super::error::ConversionError;
5086        fn try_from(
5087            value: JetStreamLimits,
5088        ) -> ::std::result::Result<Self, super::error::ConversionError> {
5089            Ok(Self {
5090                consumer: value.consumer?,
5091                disk_max_stream_bytes: value.disk_max_stream_bytes?,
5092                disk_storage: value.disk_storage?,
5093                max_ack_pending: value.max_ack_pending?,
5094                max_bytes_required: value.max_bytes_required?,
5095                mem_max_stream_bytes: value.mem_max_stream_bytes?,
5096                mem_storage: value.mem_storage?,
5097                streams: value.streams?,
5098            })
5099        }
5100    }
5101    impl ::std::convert::From<super::JetStreamLimits> for JetStreamLimits {
5102        fn from(value: super::JetStreamLimits) -> Self {
5103            Self {
5104                consumer: Ok(value.consumer),
5105                disk_max_stream_bytes: Ok(value.disk_max_stream_bytes),
5106                disk_storage: Ok(value.disk_storage),
5107                max_ack_pending: Ok(value.max_ack_pending),
5108                max_bytes_required: Ok(value.max_bytes_required),
5109                mem_max_stream_bytes: Ok(value.mem_max_stream_bytes),
5110                mem_storage: Ok(value.mem_storage),
5111                streams: Ok(value.streams),
5112            }
5113        }
5114    }
5115    #[derive(Clone, Debug)]
5116    pub struct Jwt {
5117        aud: ::std::result::Result<
5118            ::std::option::Option<::std::string::String>,
5119            ::std::string::String,
5120        >,
5121        exp: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
5122        iat: ::std::result::Result<i64, ::std::string::String>,
5123        iss: ::std::result::Result<::std::string::String, ::std::string::String>,
5124        jti: ::std::result::Result<::std::string::String, ::std::string::String>,
5125        name: ::std::result::Result<
5126            ::std::option::Option<::std::string::String>,
5127            ::std::string::String,
5128        >,
5129        nats: ::std::result::Result<super::Claims, ::std::string::String>,
5130        nbf: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
5131        sub: ::std::result::Result<::std::string::String, ::std::string::String>,
5132    }
5133    impl ::std::default::Default for Jwt {
5134        fn default() -> Self {
5135            Self {
5136                aud: Ok(Default::default()),
5137                exp: Ok(Default::default()),
5138                iat: Err("no value supplied for iat".to_string()),
5139                iss: Err("no value supplied for iss".to_string()),
5140                jti: Err("no value supplied for jti".to_string()),
5141                name: Ok(Default::default()),
5142                nats: Err("no value supplied for nats".to_string()),
5143                nbf: Ok(Default::default()),
5144                sub: Err("no value supplied for sub".to_string()),
5145            }
5146        }
5147    }
5148    impl Jwt {
5149        pub fn aud<T>(mut self, value: T) -> Self
5150        where
5151            T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
5152            T::Error: ::std::fmt::Display,
5153        {
5154            self.aud = value
5155                .try_into()
5156                .map_err(|e| format!("error converting supplied value for aud: {}", e));
5157            self
5158        }
5159        pub fn exp<T>(mut self, value: T) -> Self
5160        where
5161            T: ::std::convert::TryInto<::std::option::Option<i64>>,
5162            T::Error: ::std::fmt::Display,
5163        {
5164            self.exp = value
5165                .try_into()
5166                .map_err(|e| format!("error converting supplied value for exp: {}", e));
5167            self
5168        }
5169        pub fn iat<T>(mut self, value: T) -> Self
5170        where
5171            T: ::std::convert::TryInto<i64>,
5172            T::Error: ::std::fmt::Display,
5173        {
5174            self.iat = value
5175                .try_into()
5176                .map_err(|e| format!("error converting supplied value for iat: {}", e));
5177            self
5178        }
5179        pub fn iss<T>(mut self, value: T) -> Self
5180        where
5181            T: ::std::convert::TryInto<::std::string::String>,
5182            T::Error: ::std::fmt::Display,
5183        {
5184            self.iss = value
5185                .try_into()
5186                .map_err(|e| format!("error converting supplied value for iss: {}", e));
5187            self
5188        }
5189        pub fn jti<T>(mut self, value: T) -> Self
5190        where
5191            T: ::std::convert::TryInto<::std::string::String>,
5192            T::Error: ::std::fmt::Display,
5193        {
5194            self.jti = value
5195                .try_into()
5196                .map_err(|e| format!("error converting supplied value for jti: {}", e));
5197            self
5198        }
5199        pub fn name<T>(mut self, value: T) -> Self
5200        where
5201            T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
5202            T::Error: ::std::fmt::Display,
5203        {
5204            self.name = value
5205                .try_into()
5206                .map_err(|e| format!("error converting supplied value for name: {}", e));
5207            self
5208        }
5209        pub fn nats<T>(mut self, value: T) -> Self
5210        where
5211            T: ::std::convert::TryInto<super::Claims>,
5212            T::Error: ::std::fmt::Display,
5213        {
5214            self.nats = value
5215                .try_into()
5216                .map_err(|e| format!("error converting supplied value for nats: {}", e));
5217            self
5218        }
5219        pub fn nbf<T>(mut self, value: T) -> Self
5220        where
5221            T: ::std::convert::TryInto<::std::option::Option<i64>>,
5222            T::Error: ::std::fmt::Display,
5223        {
5224            self.nbf = value
5225                .try_into()
5226                .map_err(|e| format!("error converting supplied value for nbf: {}", e));
5227            self
5228        }
5229        pub fn sub<T>(mut self, value: T) -> Self
5230        where
5231            T: ::std::convert::TryInto<::std::string::String>,
5232            T::Error: ::std::fmt::Display,
5233        {
5234            self.sub = value
5235                .try_into()
5236                .map_err(|e| format!("error converting supplied value for sub: {}", e));
5237            self
5238        }
5239    }
5240    impl ::std::convert::TryFrom<Jwt> for super::Jwt {
5241        type Error = super::error::ConversionError;
5242        fn try_from(value: Jwt) -> ::std::result::Result<Self, super::error::ConversionError> {
5243            Ok(Self {
5244                aud: value.aud?,
5245                exp: value.exp?,
5246                iat: value.iat?,
5247                iss: value.iss?,
5248                jti: value.jti?,
5249                name: value.name?,
5250                nats: value.nats?,
5251                nbf: value.nbf?,
5252                sub: value.sub?,
5253            })
5254        }
5255    }
5256    impl ::std::convert::From<super::Jwt> for Jwt {
5257        fn from(value: super::Jwt) -> Self {
5258            Self {
5259                aud: Ok(value.aud),
5260                exp: Ok(value.exp),
5261                iat: Ok(value.iat),
5262                iss: Ok(value.iss),
5263                jti: Ok(value.jti),
5264                name: Ok(value.name),
5265                nats: Ok(value.nats),
5266                nbf: Ok(value.nbf),
5267                sub: Ok(value.sub),
5268            }
5269        }
5270    }
5271    #[derive(Clone, Debug)]
5272    pub struct Limits {
5273        data: ::std::result::Result<i64, ::std::string::String>,
5274        payload: ::std::result::Result<i64, ::std::string::String>,
5275        src: ::std::result::Result<::std::option::Option<super::CidrList>, ::std::string::String>,
5276        subs: ::std::result::Result<i64, ::std::string::String>,
5277        times: ::std::result::Result<::std::vec::Vec<super::TimeRange>, ::std::string::String>,
5278        times_location: ::std::result::Result<
5279            ::std::option::Option<::std::string::String>,
5280            ::std::string::String,
5281        >,
5282    }
5283    impl ::std::default::Default for Limits {
5284        fn default() -> Self {
5285            Self {
5286                data: Ok(super::defaults::default_i64::<i64, -1>()),
5287                payload: Ok(super::defaults::default_i64::<i64, -1>()),
5288                src: Ok(Default::default()),
5289                subs: Ok(super::defaults::default_i64::<i64, -1>()),
5290                times: Ok(Default::default()),
5291                times_location: Ok(Default::default()),
5292            }
5293        }
5294    }
5295    impl Limits {
5296        pub fn data<T>(mut self, value: T) -> Self
5297        where
5298            T: ::std::convert::TryInto<i64>,
5299            T::Error: ::std::fmt::Display,
5300        {
5301            self.data = value
5302                .try_into()
5303                .map_err(|e| format!("error converting supplied value for data: {}", e));
5304            self
5305        }
5306        pub fn payload<T>(mut self, value: T) -> Self
5307        where
5308            T: ::std::convert::TryInto<i64>,
5309            T::Error: ::std::fmt::Display,
5310        {
5311            self.payload = value
5312                .try_into()
5313                .map_err(|e| format!("error converting supplied value for payload: {}", e));
5314            self
5315        }
5316        pub fn src<T>(mut self, value: T) -> Self
5317        where
5318            T: ::std::convert::TryInto<::std::option::Option<super::CidrList>>,
5319            T::Error: ::std::fmt::Display,
5320        {
5321            self.src = value
5322                .try_into()
5323                .map_err(|e| format!("error converting supplied value for src: {}", e));
5324            self
5325        }
5326        pub fn subs<T>(mut self, value: T) -> Self
5327        where
5328            T: ::std::convert::TryInto<i64>,
5329            T::Error: ::std::fmt::Display,
5330        {
5331            self.subs = value
5332                .try_into()
5333                .map_err(|e| format!("error converting supplied value for subs: {}", e));
5334            self
5335        }
5336        pub fn times<T>(mut self, value: T) -> Self
5337        where
5338            T: ::std::convert::TryInto<::std::vec::Vec<super::TimeRange>>,
5339            T::Error: ::std::fmt::Display,
5340        {
5341            self.times = value
5342                .try_into()
5343                .map_err(|e| format!("error converting supplied value for times: {}", e));
5344            self
5345        }
5346        pub fn times_location<T>(mut self, value: T) -> Self
5347        where
5348            T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
5349            T::Error: ::std::fmt::Display,
5350        {
5351            self.times_location = value
5352                .try_into()
5353                .map_err(|e| format!("error converting supplied value for times_location: {}", e));
5354            self
5355        }
5356    }
5357    impl ::std::convert::TryFrom<Limits> for super::Limits {
5358        type Error = super::error::ConversionError;
5359        fn try_from(value: Limits) -> ::std::result::Result<Self, super::error::ConversionError> {
5360            Ok(Self {
5361                data: value.data?,
5362                payload: value.payload?,
5363                src: value.src?,
5364                subs: value.subs?,
5365                times: value.times?,
5366                times_location: value.times_location?,
5367            })
5368        }
5369    }
5370    impl ::std::convert::From<super::Limits> for Limits {
5371        fn from(value: super::Limits) -> Self {
5372            Self {
5373                data: Ok(value.data),
5374                payload: Ok(value.payload),
5375                src: Ok(value.src),
5376                subs: Ok(value.subs),
5377                times: Ok(value.times),
5378                times_location: Ok(value.times_location),
5379            }
5380        }
5381    }
5382    #[derive(Clone, Debug)]
5383    pub struct MsgTrace {
5384        dest: ::std::result::Result<::std::option::Option<super::Subject>, ::std::string::String>,
5385        sampling: ::std::result::Result<i64, ::std::string::String>,
5386    }
5387    impl ::std::default::Default for MsgTrace {
5388        fn default() -> Self {
5389            Self {
5390                dest: Ok(Default::default()),
5391                sampling: Ok(super::defaults::default_u64::<i64, 100>()),
5392            }
5393        }
5394    }
5395    impl MsgTrace {
5396        pub fn dest<T>(mut self, value: T) -> Self
5397        where
5398            T: ::std::convert::TryInto<::std::option::Option<super::Subject>>,
5399            T::Error: ::std::fmt::Display,
5400        {
5401            self.dest = value
5402                .try_into()
5403                .map_err(|e| format!("error converting supplied value for dest: {}", e));
5404            self
5405        }
5406        pub fn sampling<T>(mut self, value: T) -> Self
5407        where
5408            T: ::std::convert::TryInto<i64>,
5409            T::Error: ::std::fmt::Display,
5410        {
5411            self.sampling = value
5412                .try_into()
5413                .map_err(|e| format!("error converting supplied value for sampling: {}", e));
5414            self
5415        }
5416    }
5417    impl ::std::convert::TryFrom<MsgTrace> for super::MsgTrace {
5418        type Error = super::error::ConversionError;
5419        fn try_from(value: MsgTrace) -> ::std::result::Result<Self, super::error::ConversionError> {
5420            Ok(Self {
5421                dest: value.dest?,
5422                sampling: value.sampling?,
5423            })
5424        }
5425    }
5426    impl ::std::convert::From<super::MsgTrace> for MsgTrace {
5427        fn from(value: super::MsgTrace) -> Self {
5428            Self {
5429                dest: Ok(value.dest),
5430                sampling: Ok(value.sampling),
5431            }
5432        }
5433    }
5434    #[derive(Clone, Debug)]
5435    pub struct NatsLimits {
5436        data: ::std::result::Result<i64, ::std::string::String>,
5437        payload: ::std::result::Result<i64, ::std::string::String>,
5438        subs: ::std::result::Result<i64, ::std::string::String>,
5439    }
5440    impl ::std::default::Default for NatsLimits {
5441        fn default() -> Self {
5442            Self {
5443                data: Ok(super::defaults::default_i64::<i64, -1>()),
5444                payload: Ok(super::defaults::default_i64::<i64, -1>()),
5445                subs: Ok(super::defaults::default_i64::<i64, -1>()),
5446            }
5447        }
5448    }
5449    impl NatsLimits {
5450        pub fn data<T>(mut self, value: T) -> Self
5451        where
5452            T: ::std::convert::TryInto<i64>,
5453            T::Error: ::std::fmt::Display,
5454        {
5455            self.data = value
5456                .try_into()
5457                .map_err(|e| format!("error converting supplied value for data: {}", e));
5458            self
5459        }
5460        pub fn payload<T>(mut self, value: T) -> Self
5461        where
5462            T: ::std::convert::TryInto<i64>,
5463            T::Error: ::std::fmt::Display,
5464        {
5465            self.payload = value
5466                .try_into()
5467                .map_err(|e| format!("error converting supplied value for payload: {}", e));
5468            self
5469        }
5470        pub fn subs<T>(mut self, value: T) -> Self
5471        where
5472            T: ::std::convert::TryInto<i64>,
5473            T::Error: ::std::fmt::Display,
5474        {
5475            self.subs = value
5476                .try_into()
5477                .map_err(|e| format!("error converting supplied value for subs: {}", e));
5478            self
5479        }
5480    }
5481    impl ::std::convert::TryFrom<NatsLimits> for super::NatsLimits {
5482        type Error = super::error::ConversionError;
5483        fn try_from(
5484            value: NatsLimits,
5485        ) -> ::std::result::Result<Self, super::error::ConversionError> {
5486            Ok(Self {
5487                data: value.data?,
5488                payload: value.payload?,
5489                subs: value.subs?,
5490            })
5491        }
5492    }
5493    impl ::std::convert::From<super::NatsLimits> for NatsLimits {
5494        fn from(value: super::NatsLimits) -> Self {
5495            Self {
5496                data: Ok(value.data),
5497                payload: Ok(value.payload),
5498                subs: Ok(value.subs),
5499            }
5500        }
5501    }
5502    #[derive(Clone, Debug)]
5503    pub struct Operator {
5504        account_server_url: ::std::result::Result<
5505            ::std::option::Option<super::AccountServerUrl>,
5506            ::std::string::String,
5507        >,
5508        assert_server_version: ::std::result::Result<
5509            ::std::option::Option<super::AssertServerVersion>,
5510            ::std::string::String,
5511        >,
5512        operator_service_urls: ::std::result::Result<
5513            ::std::option::Option<super::OperatorServiceUrLs>,
5514            ::std::string::String,
5515        >,
5516        signing_keys:
5517            ::std::result::Result<::std::option::Option<super::SigningKeys>, ::std::string::String>,
5518        strict_signing_key_usage: ::std::result::Result<
5519            ::std::option::Option<super::StrictSigningKeyUsage>,
5520            ::std::string::String,
5521        >,
5522        system_account: ::std::result::Result<
5523            ::std::option::Option<super::SystemAccount>,
5524            ::std::string::String,
5525        >,
5526        tags: ::std::result::Result<::std::option::Option<super::TagList>, ::std::string::String>,
5527        type_: ::std::result::Result<super::OperatorType, ::std::string::String>,
5528        version: ::std::result::Result<i64, ::std::string::String>,
5529    }
5530    impl ::std::default::Default for Operator {
5531        fn default() -> Self {
5532            Self {
5533                account_server_url: Ok(Default::default()),
5534                assert_server_version: Ok(Default::default()),
5535                operator_service_urls: Ok(Default::default()),
5536                signing_keys: Ok(Default::default()),
5537                strict_signing_key_usage: Ok(Default::default()),
5538                system_account: Ok(Default::default()),
5539                tags: Ok(Default::default()),
5540                type_: Ok(super::defaults::operator_type()),
5541                version: Ok(super::defaults::default_u64::<i64, 2>()),
5542            }
5543        }
5544    }
5545    impl Operator {
5546        pub fn account_server_url<T>(mut self, value: T) -> Self
5547        where
5548            T: ::std::convert::TryInto<::std::option::Option<super::AccountServerUrl>>,
5549            T::Error: ::std::fmt::Display,
5550        {
5551            self.account_server_url = value.try_into().map_err(|e| {
5552                format!(
5553                    "error converting supplied value for account_server_url: {}",
5554                    e
5555                )
5556            });
5557            self
5558        }
5559        pub fn assert_server_version<T>(mut self, value: T) -> Self
5560        where
5561            T: ::std::convert::TryInto<::std::option::Option<super::AssertServerVersion>>,
5562            T::Error: ::std::fmt::Display,
5563        {
5564            self.assert_server_version = value.try_into().map_err(|e| {
5565                format!(
5566                    "error converting supplied value for assert_server_version: {}",
5567                    e
5568                )
5569            });
5570            self
5571        }
5572        pub fn operator_service_urls<T>(mut self, value: T) -> Self
5573        where
5574            T: ::std::convert::TryInto<::std::option::Option<super::OperatorServiceUrLs>>,
5575            T::Error: ::std::fmt::Display,
5576        {
5577            self.operator_service_urls = value.try_into().map_err(|e| {
5578                format!(
5579                    "error converting supplied value for operator_service_urls: {}",
5580                    e
5581                )
5582            });
5583            self
5584        }
5585        pub fn signing_keys<T>(mut self, value: T) -> Self
5586        where
5587            T: ::std::convert::TryInto<::std::option::Option<super::SigningKeys>>,
5588            T::Error: ::std::fmt::Display,
5589        {
5590            self.signing_keys = value
5591                .try_into()
5592                .map_err(|e| format!("error converting supplied value for signing_keys: {}", e));
5593            self
5594        }
5595        pub fn strict_signing_key_usage<T>(mut self, value: T) -> Self
5596        where
5597            T: ::std::convert::TryInto<::std::option::Option<super::StrictSigningKeyUsage>>,
5598            T::Error: ::std::fmt::Display,
5599        {
5600            self.strict_signing_key_usage = value.try_into().map_err(|e| {
5601                format!(
5602                    "error converting supplied value for strict_signing_key_usage: {}",
5603                    e
5604                )
5605            });
5606            self
5607        }
5608        pub fn system_account<T>(mut self, value: T) -> Self
5609        where
5610            T: ::std::convert::TryInto<::std::option::Option<super::SystemAccount>>,
5611            T::Error: ::std::fmt::Display,
5612        {
5613            self.system_account = value
5614                .try_into()
5615                .map_err(|e| format!("error converting supplied value for system_account: {}", e));
5616            self
5617        }
5618        pub fn tags<T>(mut self, value: T) -> Self
5619        where
5620            T: ::std::convert::TryInto<::std::option::Option<super::TagList>>,
5621            T::Error: ::std::fmt::Display,
5622        {
5623            self.tags = value
5624                .try_into()
5625                .map_err(|e| format!("error converting supplied value for tags: {}", e));
5626            self
5627        }
5628        pub fn type_<T>(mut self, value: T) -> Self
5629        where
5630            T: ::std::convert::TryInto<super::OperatorType>,
5631            T::Error: ::std::fmt::Display,
5632        {
5633            self.type_ = value
5634                .try_into()
5635                .map_err(|e| format!("error converting supplied value for type_: {}", e));
5636            self
5637        }
5638        pub fn version<T>(mut self, value: T) -> Self
5639        where
5640            T: ::std::convert::TryInto<i64>,
5641            T::Error: ::std::fmt::Display,
5642        {
5643            self.version = value
5644                .try_into()
5645                .map_err(|e| format!("error converting supplied value for version: {}", e));
5646            self
5647        }
5648    }
5649    impl ::std::convert::TryFrom<Operator> for super::Operator {
5650        type Error = super::error::ConversionError;
5651        fn try_from(value: Operator) -> ::std::result::Result<Self, super::error::ConversionError> {
5652            Ok(Self {
5653                account_server_url: value.account_server_url?,
5654                assert_server_version: value.assert_server_version?,
5655                operator_service_urls: value.operator_service_urls?,
5656                signing_keys: value.signing_keys?,
5657                strict_signing_key_usage: value.strict_signing_key_usage?,
5658                system_account: value.system_account?,
5659                tags: value.tags?,
5660                type_: value.type_?,
5661                version: value.version?,
5662            })
5663        }
5664    }
5665    impl ::std::convert::From<super::Operator> for Operator {
5666        fn from(value: super::Operator) -> Self {
5667            Self {
5668                account_server_url: Ok(value.account_server_url),
5669                assert_server_version: Ok(value.assert_server_version),
5670                operator_service_urls: Ok(value.operator_service_urls),
5671                signing_keys: Ok(value.signing_keys),
5672                strict_signing_key_usage: Ok(value.strict_signing_key_usage),
5673                system_account: Ok(value.system_account),
5674                tags: Ok(value.tags),
5675                type_: Ok(value.type_),
5676                version: Ok(value.version),
5677            }
5678        }
5679    }
5680    #[derive(Clone, Debug)]
5681    pub struct OperatorLimits {
5682        conn: ::std::result::Result<i64, ::std::string::String>,
5683        consumer: ::std::result::Result<i64, ::std::string::String>,
5684        data: ::std::result::Result<i64, ::std::string::String>,
5685        disallow_bearer: ::std::result::Result<bool, ::std::string::String>,
5686        disk_max_stream_bytes: ::std::result::Result<i64, ::std::string::String>,
5687        disk_storage: ::std::result::Result<i64, ::std::string::String>,
5688        exports: ::std::result::Result<i64, ::std::string::String>,
5689        imports: ::std::result::Result<i64, ::std::string::String>,
5690        leaf: ::std::result::Result<i64, ::std::string::String>,
5691        max_ack_pending: ::std::result::Result<i64, ::std::string::String>,
5692        max_bytes_required: ::std::result::Result<bool, ::std::string::String>,
5693        mem_max_stream_bytes: ::std::result::Result<i64, ::std::string::String>,
5694        mem_storage: ::std::result::Result<i64, ::std::string::String>,
5695        payload: ::std::result::Result<i64, ::std::string::String>,
5696        streams: ::std::result::Result<i64, ::std::string::String>,
5697        subs: ::std::result::Result<i64, ::std::string::String>,
5698        tiered_limits: ::std::result::Result<
5699            ::std::option::Option<super::JetStreamTieredLimits>,
5700            ::std::string::String,
5701        >,
5702        wildcards: ::std::result::Result<bool, ::std::string::String>,
5703    }
5704    impl ::std::default::Default for OperatorLimits {
5705        fn default() -> Self {
5706            Self {
5707                conn: Ok(super::defaults::default_i64::<i64, -1>()),
5708                consumer: Ok(super::defaults::default_i64::<i64, -1>()),
5709                data: Ok(super::defaults::default_i64::<i64, -1>()),
5710                disallow_bearer: Ok(Default::default()),
5711                disk_max_stream_bytes: Ok(Default::default()),
5712                disk_storage: Ok(super::defaults::default_i64::<i64, -1>()),
5713                exports: Ok(super::defaults::default_i64::<i64, -1>()),
5714                imports: Ok(super::defaults::default_i64::<i64, -1>()),
5715                leaf: Ok(super::defaults::default_i64::<i64, -1>()),
5716                max_ack_pending: Ok(Default::default()),
5717                max_bytes_required: Ok(Default::default()),
5718                mem_max_stream_bytes: Ok(Default::default()),
5719                mem_storage: Ok(super::defaults::default_i64::<i64, -1>()),
5720                payload: Ok(super::defaults::default_i64::<i64, -1>()),
5721                streams: Ok(super::defaults::default_i64::<i64, -1>()),
5722                subs: Ok(super::defaults::default_i64::<i64, -1>()),
5723                tiered_limits: Ok(Default::default()),
5724                wildcards: Ok(super::defaults::default_bool::<true>()),
5725            }
5726        }
5727    }
5728    impl OperatorLimits {
5729        pub fn conn<T>(mut self, value: T) -> Self
5730        where
5731            T: ::std::convert::TryInto<i64>,
5732            T::Error: ::std::fmt::Display,
5733        {
5734            self.conn = value
5735                .try_into()
5736                .map_err(|e| format!("error converting supplied value for conn: {}", e));
5737            self
5738        }
5739        pub fn consumer<T>(mut self, value: T) -> Self
5740        where
5741            T: ::std::convert::TryInto<i64>,
5742            T::Error: ::std::fmt::Display,
5743        {
5744            self.consumer = value
5745                .try_into()
5746                .map_err(|e| format!("error converting supplied value for consumer: {}", e));
5747            self
5748        }
5749        pub fn data<T>(mut self, value: T) -> Self
5750        where
5751            T: ::std::convert::TryInto<i64>,
5752            T::Error: ::std::fmt::Display,
5753        {
5754            self.data = value
5755                .try_into()
5756                .map_err(|e| format!("error converting supplied value for data: {}", e));
5757            self
5758        }
5759        pub fn disallow_bearer<T>(mut self, value: T) -> Self
5760        where
5761            T: ::std::convert::TryInto<bool>,
5762            T::Error: ::std::fmt::Display,
5763        {
5764            self.disallow_bearer = value
5765                .try_into()
5766                .map_err(|e| format!("error converting supplied value for disallow_bearer: {}", e));
5767            self
5768        }
5769        pub fn disk_max_stream_bytes<T>(mut self, value: T) -> Self
5770        where
5771            T: ::std::convert::TryInto<i64>,
5772            T::Error: ::std::fmt::Display,
5773        {
5774            self.disk_max_stream_bytes = value.try_into().map_err(|e| {
5775                format!(
5776                    "error converting supplied value for disk_max_stream_bytes: {}",
5777                    e
5778                )
5779            });
5780            self
5781        }
5782        pub fn disk_storage<T>(mut self, value: T) -> Self
5783        where
5784            T: ::std::convert::TryInto<i64>,
5785            T::Error: ::std::fmt::Display,
5786        {
5787            self.disk_storage = value
5788                .try_into()
5789                .map_err(|e| format!("error converting supplied value for disk_storage: {}", e));
5790            self
5791        }
5792        pub fn exports<T>(mut self, value: T) -> Self
5793        where
5794            T: ::std::convert::TryInto<i64>,
5795            T::Error: ::std::fmt::Display,
5796        {
5797            self.exports = value
5798                .try_into()
5799                .map_err(|e| format!("error converting supplied value for exports: {}", e));
5800            self
5801        }
5802        pub fn imports<T>(mut self, value: T) -> Self
5803        where
5804            T: ::std::convert::TryInto<i64>,
5805            T::Error: ::std::fmt::Display,
5806        {
5807            self.imports = value
5808                .try_into()
5809                .map_err(|e| format!("error converting supplied value for imports: {}", e));
5810            self
5811        }
5812        pub fn leaf<T>(mut self, value: T) -> Self
5813        where
5814            T: ::std::convert::TryInto<i64>,
5815            T::Error: ::std::fmt::Display,
5816        {
5817            self.leaf = value
5818                .try_into()
5819                .map_err(|e| format!("error converting supplied value for leaf: {}", e));
5820            self
5821        }
5822        pub fn max_ack_pending<T>(mut self, value: T) -> Self
5823        where
5824            T: ::std::convert::TryInto<i64>,
5825            T::Error: ::std::fmt::Display,
5826        {
5827            self.max_ack_pending = value
5828                .try_into()
5829                .map_err(|e| format!("error converting supplied value for max_ack_pending: {}", e));
5830            self
5831        }
5832        pub fn max_bytes_required<T>(mut self, value: T) -> Self
5833        where
5834            T: ::std::convert::TryInto<bool>,
5835            T::Error: ::std::fmt::Display,
5836        {
5837            self.max_bytes_required = value.try_into().map_err(|e| {
5838                format!(
5839                    "error converting supplied value for max_bytes_required: {}",
5840                    e
5841                )
5842            });
5843            self
5844        }
5845        pub fn mem_max_stream_bytes<T>(mut self, value: T) -> Self
5846        where
5847            T: ::std::convert::TryInto<i64>,
5848            T::Error: ::std::fmt::Display,
5849        {
5850            self.mem_max_stream_bytes = value.try_into().map_err(|e| {
5851                format!(
5852                    "error converting supplied value for mem_max_stream_bytes: {}",
5853                    e
5854                )
5855            });
5856            self
5857        }
5858        pub fn mem_storage<T>(mut self, value: T) -> Self
5859        where
5860            T: ::std::convert::TryInto<i64>,
5861            T::Error: ::std::fmt::Display,
5862        {
5863            self.mem_storage = value
5864                .try_into()
5865                .map_err(|e| format!("error converting supplied value for mem_storage: {}", e));
5866            self
5867        }
5868        pub fn payload<T>(mut self, value: T) -> Self
5869        where
5870            T: ::std::convert::TryInto<i64>,
5871            T::Error: ::std::fmt::Display,
5872        {
5873            self.payload = value
5874                .try_into()
5875                .map_err(|e| format!("error converting supplied value for payload: {}", e));
5876            self
5877        }
5878        pub fn streams<T>(mut self, value: T) -> Self
5879        where
5880            T: ::std::convert::TryInto<i64>,
5881            T::Error: ::std::fmt::Display,
5882        {
5883            self.streams = value
5884                .try_into()
5885                .map_err(|e| format!("error converting supplied value for streams: {}", e));
5886            self
5887        }
5888        pub fn subs<T>(mut self, value: T) -> Self
5889        where
5890            T: ::std::convert::TryInto<i64>,
5891            T::Error: ::std::fmt::Display,
5892        {
5893            self.subs = value
5894                .try_into()
5895                .map_err(|e| format!("error converting supplied value for subs: {}", e));
5896            self
5897        }
5898        pub fn tiered_limits<T>(mut self, value: T) -> Self
5899        where
5900            T: ::std::convert::TryInto<::std::option::Option<super::JetStreamTieredLimits>>,
5901            T::Error: ::std::fmt::Display,
5902        {
5903            self.tiered_limits = value
5904                .try_into()
5905                .map_err(|e| format!("error converting supplied value for tiered_limits: {}", e));
5906            self
5907        }
5908        pub fn wildcards<T>(mut self, value: T) -> Self
5909        where
5910            T: ::std::convert::TryInto<bool>,
5911            T::Error: ::std::fmt::Display,
5912        {
5913            self.wildcards = value
5914                .try_into()
5915                .map_err(|e| format!("error converting supplied value for wildcards: {}", e));
5916            self
5917        }
5918    }
5919    impl ::std::convert::TryFrom<OperatorLimits> for super::OperatorLimits {
5920        type Error = super::error::ConversionError;
5921        fn try_from(
5922            value: OperatorLimits,
5923        ) -> ::std::result::Result<Self, super::error::ConversionError> {
5924            Ok(Self {
5925                conn: value.conn?,
5926                consumer: value.consumer?,
5927                data: value.data?,
5928                disallow_bearer: value.disallow_bearer?,
5929                disk_max_stream_bytes: value.disk_max_stream_bytes?,
5930                disk_storage: value.disk_storage?,
5931                exports: value.exports?,
5932                imports: value.imports?,
5933                leaf: value.leaf?,
5934                max_ack_pending: value.max_ack_pending?,
5935                max_bytes_required: value.max_bytes_required?,
5936                mem_max_stream_bytes: value.mem_max_stream_bytes?,
5937                mem_storage: value.mem_storage?,
5938                payload: value.payload?,
5939                streams: value.streams?,
5940                subs: value.subs?,
5941                tiered_limits: value.tiered_limits?,
5942                wildcards: value.wildcards?,
5943            })
5944        }
5945    }
5946    impl ::std::convert::From<super::OperatorLimits> for OperatorLimits {
5947        fn from(value: super::OperatorLimits) -> Self {
5948            Self {
5949                conn: Ok(value.conn),
5950                consumer: Ok(value.consumer),
5951                data: Ok(value.data),
5952                disallow_bearer: Ok(value.disallow_bearer),
5953                disk_max_stream_bytes: Ok(value.disk_max_stream_bytes),
5954                disk_storage: Ok(value.disk_storage),
5955                exports: Ok(value.exports),
5956                imports: Ok(value.imports),
5957                leaf: Ok(value.leaf),
5958                max_ack_pending: Ok(value.max_ack_pending),
5959                max_bytes_required: Ok(value.max_bytes_required),
5960                mem_max_stream_bytes: Ok(value.mem_max_stream_bytes),
5961                mem_storage: Ok(value.mem_storage),
5962                payload: Ok(value.payload),
5963                streams: Ok(value.streams),
5964                subs: Ok(value.subs),
5965                tiered_limits: Ok(value.tiered_limits),
5966                wildcards: Ok(value.wildcards),
5967            }
5968        }
5969    }
5970    #[derive(Clone, Debug)]
5971    pub struct Permission {
5972        allow:
5973            ::std::result::Result<::std::option::Option<super::StringList>, ::std::string::String>,
5974        deny:
5975            ::std::result::Result<::std::option::Option<super::StringList>, ::std::string::String>,
5976    }
5977    impl ::std::default::Default for Permission {
5978        fn default() -> Self {
5979            Self {
5980                allow: Ok(Default::default()),
5981                deny: Ok(Default::default()),
5982            }
5983        }
5984    }
5985    impl Permission {
5986        pub fn allow<T>(mut self, value: T) -> Self
5987        where
5988            T: ::std::convert::TryInto<::std::option::Option<super::StringList>>,
5989            T::Error: ::std::fmt::Display,
5990        {
5991            self.allow = value
5992                .try_into()
5993                .map_err(|e| format!("error converting supplied value for allow: {}", e));
5994            self
5995        }
5996        pub fn deny<T>(mut self, value: T) -> Self
5997        where
5998            T: ::std::convert::TryInto<::std::option::Option<super::StringList>>,
5999            T::Error: ::std::fmt::Display,
6000        {
6001            self.deny = value
6002                .try_into()
6003                .map_err(|e| format!("error converting supplied value for deny: {}", e));
6004            self
6005        }
6006    }
6007    impl ::std::convert::TryFrom<Permission> for super::Permission {
6008        type Error = super::error::ConversionError;
6009        fn try_from(
6010            value: Permission,
6011        ) -> ::std::result::Result<Self, super::error::ConversionError> {
6012            Ok(Self {
6013                allow: value.allow?,
6014                deny: value.deny?,
6015            })
6016        }
6017    }
6018    impl ::std::convert::From<super::Permission> for Permission {
6019        fn from(value: super::Permission) -> Self {
6020            Self {
6021                allow: Ok(value.allow),
6022                deny: Ok(value.deny),
6023            }
6024        }
6025    }
6026    #[derive(Clone, Debug)]
6027    pub struct Permissions {
6028        pub_:
6029            ::std::result::Result<::std::option::Option<super::Permission>, ::std::string::String>,
6030        resp: ::std::result::Result<
6031            ::std::option::Option<super::ResponsePermission>,
6032            ::std::string::String,
6033        >,
6034        sub: ::std::result::Result<::std::option::Option<super::Permission>, ::std::string::String>,
6035    }
6036    impl ::std::default::Default for Permissions {
6037        fn default() -> Self {
6038            Self {
6039                pub_: Ok(Default::default()),
6040                resp: Ok(Default::default()),
6041                sub: Ok(Default::default()),
6042            }
6043        }
6044    }
6045    impl Permissions {
6046        pub fn pub_<T>(mut self, value: T) -> Self
6047        where
6048            T: ::std::convert::TryInto<::std::option::Option<super::Permission>>,
6049            T::Error: ::std::fmt::Display,
6050        {
6051            self.pub_ = value
6052                .try_into()
6053                .map_err(|e| format!("error converting supplied value for pub_: {}", e));
6054            self
6055        }
6056        pub fn resp<T>(mut self, value: T) -> Self
6057        where
6058            T: ::std::convert::TryInto<::std::option::Option<super::ResponsePermission>>,
6059            T::Error: ::std::fmt::Display,
6060        {
6061            self.resp = value
6062                .try_into()
6063                .map_err(|e| format!("error converting supplied value for resp: {}", e));
6064            self
6065        }
6066        pub fn sub<T>(mut self, value: T) -> Self
6067        where
6068            T: ::std::convert::TryInto<::std::option::Option<super::Permission>>,
6069            T::Error: ::std::fmt::Display,
6070        {
6071            self.sub = value
6072                .try_into()
6073                .map_err(|e| format!("error converting supplied value for sub: {}", e));
6074            self
6075        }
6076    }
6077    impl ::std::convert::TryFrom<Permissions> for super::Permissions {
6078        type Error = super::error::ConversionError;
6079        fn try_from(
6080            value: Permissions,
6081        ) -> ::std::result::Result<Self, super::error::ConversionError> {
6082            Ok(Self {
6083                pub_: value.pub_?,
6084                resp: value.resp?,
6085                sub: value.sub?,
6086            })
6087        }
6088    }
6089    impl ::std::convert::From<super::Permissions> for Permissions {
6090        fn from(value: super::Permissions) -> Self {
6091            Self {
6092                pub_: Ok(value.pub_),
6093                resp: Ok(value.resp),
6094                sub: Ok(value.sub),
6095            }
6096        }
6097    }
6098    #[derive(Clone, Debug)]
6099    pub struct ResponsePermission {
6100        max: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
6101        ttl: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
6102    }
6103    impl ::std::default::Default for ResponsePermission {
6104        fn default() -> Self {
6105            Self {
6106                max: Ok(Default::default()),
6107                ttl: Ok(Default::default()),
6108            }
6109        }
6110    }
6111    impl ResponsePermission {
6112        pub fn max<T>(mut self, value: T) -> Self
6113        where
6114            T: ::std::convert::TryInto<::std::option::Option<i64>>,
6115            T::Error: ::std::fmt::Display,
6116        {
6117            self.max = value
6118                .try_into()
6119                .map_err(|e| format!("error converting supplied value for max: {}", e));
6120            self
6121        }
6122        pub fn ttl<T>(mut self, value: T) -> Self
6123        where
6124            T: ::std::convert::TryInto<::std::option::Option<i64>>,
6125            T::Error: ::std::fmt::Display,
6126        {
6127            self.ttl = value
6128                .try_into()
6129                .map_err(|e| format!("error converting supplied value for ttl: {}", e));
6130            self
6131        }
6132    }
6133    impl ::std::convert::TryFrom<ResponsePermission> for super::ResponsePermission {
6134        type Error = super::error::ConversionError;
6135        fn try_from(
6136            value: ResponsePermission,
6137        ) -> ::std::result::Result<Self, super::error::ConversionError> {
6138            Ok(Self {
6139                max: value.max?,
6140                ttl: value.ttl?,
6141            })
6142        }
6143    }
6144    impl ::std::convert::From<super::ResponsePermission> for ResponsePermission {
6145        fn from(value: super::ResponsePermission) -> Self {
6146            Self {
6147                max: Ok(value.max),
6148                ttl: Ok(value.ttl),
6149            }
6150        }
6151    }
6152    #[derive(Clone, Debug)]
6153    pub struct ServiceLatency {
6154        results:
6155            ::std::result::Result<::std::option::Option<super::Subject>, ::std::string::String>,
6156        sampling: ::std::result::Result<
6157            ::std::option::Option<super::SamplingRate>,
6158            ::std::string::String,
6159        >,
6160    }
6161    impl ::std::default::Default for ServiceLatency {
6162        fn default() -> Self {
6163            Self {
6164                results: Ok(Default::default()),
6165                sampling: Ok(Default::default()),
6166            }
6167        }
6168    }
6169    impl ServiceLatency {
6170        pub fn results<T>(mut self, value: T) -> Self
6171        where
6172            T: ::std::convert::TryInto<::std::option::Option<super::Subject>>,
6173            T::Error: ::std::fmt::Display,
6174        {
6175            self.results = value
6176                .try_into()
6177                .map_err(|e| format!("error converting supplied value for results: {}", e));
6178            self
6179        }
6180        pub fn sampling<T>(mut self, value: T) -> Self
6181        where
6182            T: ::std::convert::TryInto<::std::option::Option<super::SamplingRate>>,
6183            T::Error: ::std::fmt::Display,
6184        {
6185            self.sampling = value
6186                .try_into()
6187                .map_err(|e| format!("error converting supplied value for sampling: {}", e));
6188            self
6189        }
6190    }
6191    impl ::std::convert::TryFrom<ServiceLatency> for super::ServiceLatency {
6192        type Error = super::error::ConversionError;
6193        fn try_from(
6194            value: ServiceLatency,
6195        ) -> ::std::result::Result<Self, super::error::ConversionError> {
6196            Ok(Self {
6197                results: value.results?,
6198                sampling: value.sampling?,
6199            })
6200        }
6201    }
6202    impl ::std::convert::From<super::ServiceLatency> for ServiceLatency {
6203        fn from(value: super::ServiceLatency) -> Self {
6204            Self {
6205                results: Ok(value.results),
6206                sampling: Ok(value.sampling),
6207            }
6208        }
6209    }
6210    #[derive(Clone, Debug)]
6211    pub struct TimeRange {
6212        end: ::std::result::Result<::std::string::String, ::std::string::String>,
6213        start: ::std::result::Result<::std::string::String, ::std::string::String>,
6214    }
6215    impl ::std::default::Default for TimeRange {
6216        fn default() -> Self {
6217            Self {
6218                end: Err("no value supplied for end".to_string()),
6219                start: Err("no value supplied for start".to_string()),
6220            }
6221        }
6222    }
6223    impl TimeRange {
6224        pub fn end<T>(mut self, value: T) -> Self
6225        where
6226            T: ::std::convert::TryInto<::std::string::String>,
6227            T::Error: ::std::fmt::Display,
6228        {
6229            self.end = value
6230                .try_into()
6231                .map_err(|e| format!("error converting supplied value for end: {}", e));
6232            self
6233        }
6234        pub fn start<T>(mut self, value: T) -> Self
6235        where
6236            T: ::std::convert::TryInto<::std::string::String>,
6237            T::Error: ::std::fmt::Display,
6238        {
6239            self.start = value
6240                .try_into()
6241                .map_err(|e| format!("error converting supplied value for start: {}", e));
6242            self
6243        }
6244    }
6245    impl ::std::convert::TryFrom<TimeRange> for super::TimeRange {
6246        type Error = super::error::ConversionError;
6247        fn try_from(
6248            value: TimeRange,
6249        ) -> ::std::result::Result<Self, super::error::ConversionError> {
6250            Ok(Self {
6251                end: value.end?,
6252                start: value.start?,
6253            })
6254        }
6255    }
6256    impl ::std::convert::From<super::TimeRange> for TimeRange {
6257        fn from(value: super::TimeRange) -> Self {
6258            Self {
6259                end: Ok(value.end),
6260                start: Ok(value.start),
6261            }
6262        }
6263    }
6264    #[derive(Clone, Debug)]
6265    pub struct User {
6266        allowed_connection_types:
6267            ::std::result::Result<::std::vec::Vec<super::ConnectionType>, ::std::string::String>,
6268        bearer_token: ::std::result::Result<bool, ::std::string::String>,
6269        data: ::std::result::Result<i64, ::std::string::String>,
6270        issuer_account: ::std::result::Result<
6271            ::std::option::Option<::std::string::String>,
6272            ::std::string::String,
6273        >,
6274        payload: ::std::result::Result<i64, ::std::string::String>,
6275        pub_:
6276            ::std::result::Result<::std::option::Option<super::Permission>, ::std::string::String>,
6277        resp: ::std::result::Result<
6278            ::std::option::Option<super::ResponsePermission>,
6279            ::std::string::String,
6280        >,
6281        src: ::std::result::Result<::std::option::Option<super::CidrList>, ::std::string::String>,
6282        sub: ::std::result::Result<::std::option::Option<super::Permission>, ::std::string::String>,
6283        subs: ::std::result::Result<i64, ::std::string::String>,
6284        tags: ::std::result::Result<::std::option::Option<super::TagList>, ::std::string::String>,
6285        times: ::std::result::Result<::std::vec::Vec<super::TimeRange>, ::std::string::String>,
6286        times_location: ::std::result::Result<
6287            ::std::option::Option<::std::string::String>,
6288            ::std::string::String,
6289        >,
6290        type_: ::std::result::Result<super::UserType, ::std::string::String>,
6291        version: ::std::result::Result<i64, ::std::string::String>,
6292    }
6293    impl ::std::default::Default for User {
6294        fn default() -> Self {
6295            Self {
6296                allowed_connection_types: Ok(Default::default()),
6297                bearer_token: Ok(super::defaults::default_bool::<true>()),
6298                data: Ok(super::defaults::default_i64::<i64, -1>()),
6299                issuer_account: Ok(Default::default()),
6300                payload: Ok(super::defaults::default_i64::<i64, -1>()),
6301                pub_: Ok(Default::default()),
6302                resp: Ok(Default::default()),
6303                src: Ok(Default::default()),
6304                sub: Ok(Default::default()),
6305                subs: Ok(super::defaults::default_i64::<i64, -1>()),
6306                tags: Ok(Default::default()),
6307                times: Ok(Default::default()),
6308                times_location: Ok(Default::default()),
6309                type_: Ok(super::defaults::user_type()),
6310                version: Ok(super::defaults::default_u64::<i64, 2>()),
6311            }
6312        }
6313    }
6314    impl User {
6315        pub fn allowed_connection_types<T>(mut self, value: T) -> Self
6316        where
6317            T: ::std::convert::TryInto<::std::vec::Vec<super::ConnectionType>>,
6318            T::Error: ::std::fmt::Display,
6319        {
6320            self.allowed_connection_types = value.try_into().map_err(|e| {
6321                format!(
6322                    "error converting supplied value for allowed_connection_types: {}",
6323                    e
6324                )
6325            });
6326            self
6327        }
6328        pub fn bearer_token<T>(mut self, value: T) -> Self
6329        where
6330            T: ::std::convert::TryInto<bool>,
6331            T::Error: ::std::fmt::Display,
6332        {
6333            self.bearer_token = value
6334                .try_into()
6335                .map_err(|e| format!("error converting supplied value for bearer_token: {}", e));
6336            self
6337        }
6338        pub fn data<T>(mut self, value: T) -> Self
6339        where
6340            T: ::std::convert::TryInto<i64>,
6341            T::Error: ::std::fmt::Display,
6342        {
6343            self.data = value
6344                .try_into()
6345                .map_err(|e| format!("error converting supplied value for data: {}", e));
6346            self
6347        }
6348        pub fn issuer_account<T>(mut self, value: T) -> Self
6349        where
6350            T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
6351            T::Error: ::std::fmt::Display,
6352        {
6353            self.issuer_account = value
6354                .try_into()
6355                .map_err(|e| format!("error converting supplied value for issuer_account: {}", e));
6356            self
6357        }
6358        pub fn payload<T>(mut self, value: T) -> Self
6359        where
6360            T: ::std::convert::TryInto<i64>,
6361            T::Error: ::std::fmt::Display,
6362        {
6363            self.payload = value
6364                .try_into()
6365                .map_err(|e| format!("error converting supplied value for payload: {}", e));
6366            self
6367        }
6368        pub fn pub_<T>(mut self, value: T) -> Self
6369        where
6370            T: ::std::convert::TryInto<::std::option::Option<super::Permission>>,
6371            T::Error: ::std::fmt::Display,
6372        {
6373            self.pub_ = value
6374                .try_into()
6375                .map_err(|e| format!("error converting supplied value for pub_: {}", e));
6376            self
6377        }
6378        pub fn resp<T>(mut self, value: T) -> Self
6379        where
6380            T: ::std::convert::TryInto<::std::option::Option<super::ResponsePermission>>,
6381            T::Error: ::std::fmt::Display,
6382        {
6383            self.resp = value
6384                .try_into()
6385                .map_err(|e| format!("error converting supplied value for resp: {}", e));
6386            self
6387        }
6388        pub fn src<T>(mut self, value: T) -> Self
6389        where
6390            T: ::std::convert::TryInto<::std::option::Option<super::CidrList>>,
6391            T::Error: ::std::fmt::Display,
6392        {
6393            self.src = value
6394                .try_into()
6395                .map_err(|e| format!("error converting supplied value for src: {}", e));
6396            self
6397        }
6398        pub fn sub<T>(mut self, value: T) -> Self
6399        where
6400            T: ::std::convert::TryInto<::std::option::Option<super::Permission>>,
6401            T::Error: ::std::fmt::Display,
6402        {
6403            self.sub = value
6404                .try_into()
6405                .map_err(|e| format!("error converting supplied value for sub: {}", e));
6406            self
6407        }
6408        pub fn subs<T>(mut self, value: T) -> Self
6409        where
6410            T: ::std::convert::TryInto<i64>,
6411            T::Error: ::std::fmt::Display,
6412        {
6413            self.subs = value
6414                .try_into()
6415                .map_err(|e| format!("error converting supplied value for subs: {}", e));
6416            self
6417        }
6418        pub fn tags<T>(mut self, value: T) -> Self
6419        where
6420            T: ::std::convert::TryInto<::std::option::Option<super::TagList>>,
6421            T::Error: ::std::fmt::Display,
6422        {
6423            self.tags = value
6424                .try_into()
6425                .map_err(|e| format!("error converting supplied value for tags: {}", e));
6426            self
6427        }
6428        pub fn times<T>(mut self, value: T) -> Self
6429        where
6430            T: ::std::convert::TryInto<::std::vec::Vec<super::TimeRange>>,
6431            T::Error: ::std::fmt::Display,
6432        {
6433            self.times = value
6434                .try_into()
6435                .map_err(|e| format!("error converting supplied value for times: {}", e));
6436            self
6437        }
6438        pub fn times_location<T>(mut self, value: T) -> Self
6439        where
6440            T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
6441            T::Error: ::std::fmt::Display,
6442        {
6443            self.times_location = value
6444                .try_into()
6445                .map_err(|e| format!("error converting supplied value for times_location: {}", e));
6446            self
6447        }
6448        pub fn type_<T>(mut self, value: T) -> Self
6449        where
6450            T: ::std::convert::TryInto<super::UserType>,
6451            T::Error: ::std::fmt::Display,
6452        {
6453            self.type_ = value
6454                .try_into()
6455                .map_err(|e| format!("error converting supplied value for type_: {}", e));
6456            self
6457        }
6458        pub fn version<T>(mut self, value: T) -> Self
6459        where
6460            T: ::std::convert::TryInto<i64>,
6461            T::Error: ::std::fmt::Display,
6462        {
6463            self.version = value
6464                .try_into()
6465                .map_err(|e| format!("error converting supplied value for version: {}", e));
6466            self
6467        }
6468    }
6469    impl ::std::convert::TryFrom<User> for super::User {
6470        type Error = super::error::ConversionError;
6471        fn try_from(value: User) -> ::std::result::Result<Self, super::error::ConversionError> {
6472            Ok(Self {
6473                allowed_connection_types: value.allowed_connection_types?,
6474                bearer_token: value.bearer_token?,
6475                data: value.data?,
6476                issuer_account: value.issuer_account?,
6477                payload: value.payload?,
6478                pub_: value.pub_?,
6479                resp: value.resp?,
6480                src: value.src?,
6481                sub: value.sub?,
6482                subs: value.subs?,
6483                tags: value.tags?,
6484                times: value.times?,
6485                times_location: value.times_location?,
6486                type_: value.type_?,
6487                version: value.version?,
6488            })
6489        }
6490    }
6491    impl ::std::convert::From<super::User> for User {
6492        fn from(value: super::User) -> Self {
6493            Self {
6494                allowed_connection_types: Ok(value.allowed_connection_types),
6495                bearer_token: Ok(value.bearer_token),
6496                data: Ok(value.data),
6497                issuer_account: Ok(value.issuer_account),
6498                payload: Ok(value.payload),
6499                pub_: Ok(value.pub_),
6500                resp: Ok(value.resp),
6501                src: Ok(value.src),
6502                sub: Ok(value.sub),
6503                subs: Ok(value.subs),
6504                tags: Ok(value.tags),
6505                times: Ok(value.times),
6506                times_location: Ok(value.times_location),
6507                type_: Ok(value.type_),
6508                version: Ok(value.version),
6509            }
6510        }
6511    }
6512    #[derive(Clone, Debug)]
6513    pub struct UserLimits {
6514        src: ::std::result::Result<::std::option::Option<super::CidrList>, ::std::string::String>,
6515        times: ::std::result::Result<::std::vec::Vec<super::TimeRange>, ::std::string::String>,
6516        times_location: ::std::result::Result<
6517            ::std::option::Option<::std::string::String>,
6518            ::std::string::String,
6519        >,
6520    }
6521    impl ::std::default::Default for UserLimits {
6522        fn default() -> Self {
6523            Self {
6524                src: Ok(Default::default()),
6525                times: Ok(Default::default()),
6526                times_location: Ok(Default::default()),
6527            }
6528        }
6529    }
6530    impl UserLimits {
6531        pub fn src<T>(mut self, value: T) -> Self
6532        where
6533            T: ::std::convert::TryInto<::std::option::Option<super::CidrList>>,
6534            T::Error: ::std::fmt::Display,
6535        {
6536            self.src = value
6537                .try_into()
6538                .map_err(|e| format!("error converting supplied value for src: {}", e));
6539            self
6540        }
6541        pub fn times<T>(mut self, value: T) -> Self
6542        where
6543            T: ::std::convert::TryInto<::std::vec::Vec<super::TimeRange>>,
6544            T::Error: ::std::fmt::Display,
6545        {
6546            self.times = value
6547                .try_into()
6548                .map_err(|e| format!("error converting supplied value for times: {}", e));
6549            self
6550        }
6551        pub fn times_location<T>(mut self, value: T) -> Self
6552        where
6553            T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
6554            T::Error: ::std::fmt::Display,
6555        {
6556            self.times_location = value
6557                .try_into()
6558                .map_err(|e| format!("error converting supplied value for times_location: {}", e));
6559            self
6560        }
6561    }
6562    impl ::std::convert::TryFrom<UserLimits> for super::UserLimits {
6563        type Error = super::error::ConversionError;
6564        fn try_from(
6565            value: UserLimits,
6566        ) -> ::std::result::Result<Self, super::error::ConversionError> {
6567            Ok(Self {
6568                src: value.src?,
6569                times: value.times?,
6570                times_location: value.times_location?,
6571            })
6572        }
6573    }
6574    impl ::std::convert::From<super::UserLimits> for UserLimits {
6575        fn from(value: super::UserLimits) -> Self {
6576            Self {
6577                src: Ok(value.src),
6578                times: Ok(value.times),
6579                times_location: Ok(value.times_location),
6580            }
6581        }
6582    }
6583    #[derive(Clone, Debug)]
6584    pub struct UserPermissionLimits {
6585        allowed_connection_types:
6586            ::std::result::Result<::std::vec::Vec<super::ConnectionType>, ::std::string::String>,
6587        bearer_token: ::std::result::Result<bool, ::std::string::String>,
6588        data: ::std::result::Result<i64, ::std::string::String>,
6589        payload: ::std::result::Result<i64, ::std::string::String>,
6590        pub_:
6591            ::std::result::Result<::std::option::Option<super::Permission>, ::std::string::String>,
6592        resp: ::std::result::Result<
6593            ::std::option::Option<super::ResponsePermission>,
6594            ::std::string::String,
6595        >,
6596        src: ::std::result::Result<::std::option::Option<super::CidrList>, ::std::string::String>,
6597        sub: ::std::result::Result<::std::option::Option<super::Permission>, ::std::string::String>,
6598        subs: ::std::result::Result<i64, ::std::string::String>,
6599        times: ::std::result::Result<::std::vec::Vec<super::TimeRange>, ::std::string::String>,
6600        times_location: ::std::result::Result<
6601            ::std::option::Option<::std::string::String>,
6602            ::std::string::String,
6603        >,
6604    }
6605    impl ::std::default::Default for UserPermissionLimits {
6606        fn default() -> Self {
6607            Self {
6608                allowed_connection_types: Ok(Default::default()),
6609                bearer_token: Ok(super::defaults::default_bool::<true>()),
6610                data: Ok(super::defaults::default_i64::<i64, -1>()),
6611                payload: Ok(super::defaults::default_i64::<i64, -1>()),
6612                pub_: Ok(Default::default()),
6613                resp: Ok(Default::default()),
6614                src: Ok(Default::default()),
6615                sub: Ok(Default::default()),
6616                subs: Ok(super::defaults::default_i64::<i64, -1>()),
6617                times: Ok(Default::default()),
6618                times_location: Ok(Default::default()),
6619            }
6620        }
6621    }
6622    impl UserPermissionLimits {
6623        pub fn allowed_connection_types<T>(mut self, value: T) -> Self
6624        where
6625            T: ::std::convert::TryInto<::std::vec::Vec<super::ConnectionType>>,
6626            T::Error: ::std::fmt::Display,
6627        {
6628            self.allowed_connection_types = value.try_into().map_err(|e| {
6629                format!(
6630                    "error converting supplied value for allowed_connection_types: {}",
6631                    e
6632                )
6633            });
6634            self
6635        }
6636        pub fn bearer_token<T>(mut self, value: T) -> Self
6637        where
6638            T: ::std::convert::TryInto<bool>,
6639            T::Error: ::std::fmt::Display,
6640        {
6641            self.bearer_token = value
6642                .try_into()
6643                .map_err(|e| format!("error converting supplied value for bearer_token: {}", e));
6644            self
6645        }
6646        pub fn data<T>(mut self, value: T) -> Self
6647        where
6648            T: ::std::convert::TryInto<i64>,
6649            T::Error: ::std::fmt::Display,
6650        {
6651            self.data = value
6652                .try_into()
6653                .map_err(|e| format!("error converting supplied value for data: {}", e));
6654            self
6655        }
6656        pub fn payload<T>(mut self, value: T) -> Self
6657        where
6658            T: ::std::convert::TryInto<i64>,
6659            T::Error: ::std::fmt::Display,
6660        {
6661            self.payload = value
6662                .try_into()
6663                .map_err(|e| format!("error converting supplied value for payload: {}", e));
6664            self
6665        }
6666        pub fn pub_<T>(mut self, value: T) -> Self
6667        where
6668            T: ::std::convert::TryInto<::std::option::Option<super::Permission>>,
6669            T::Error: ::std::fmt::Display,
6670        {
6671            self.pub_ = value
6672                .try_into()
6673                .map_err(|e| format!("error converting supplied value for pub_: {}", e));
6674            self
6675        }
6676        pub fn resp<T>(mut self, value: T) -> Self
6677        where
6678            T: ::std::convert::TryInto<::std::option::Option<super::ResponsePermission>>,
6679            T::Error: ::std::fmt::Display,
6680        {
6681            self.resp = value
6682                .try_into()
6683                .map_err(|e| format!("error converting supplied value for resp: {}", e));
6684            self
6685        }
6686        pub fn src<T>(mut self, value: T) -> Self
6687        where
6688            T: ::std::convert::TryInto<::std::option::Option<super::CidrList>>,
6689            T::Error: ::std::fmt::Display,
6690        {
6691            self.src = value
6692                .try_into()
6693                .map_err(|e| format!("error converting supplied value for src: {}", e));
6694            self
6695        }
6696        pub fn sub<T>(mut self, value: T) -> Self
6697        where
6698            T: ::std::convert::TryInto<::std::option::Option<super::Permission>>,
6699            T::Error: ::std::fmt::Display,
6700        {
6701            self.sub = value
6702                .try_into()
6703                .map_err(|e| format!("error converting supplied value for sub: {}", e));
6704            self
6705        }
6706        pub fn subs<T>(mut self, value: T) -> Self
6707        where
6708            T: ::std::convert::TryInto<i64>,
6709            T::Error: ::std::fmt::Display,
6710        {
6711            self.subs = value
6712                .try_into()
6713                .map_err(|e| format!("error converting supplied value for subs: {}", e));
6714            self
6715        }
6716        pub fn times<T>(mut self, value: T) -> Self
6717        where
6718            T: ::std::convert::TryInto<::std::vec::Vec<super::TimeRange>>,
6719            T::Error: ::std::fmt::Display,
6720        {
6721            self.times = value
6722                .try_into()
6723                .map_err(|e| format!("error converting supplied value for times: {}", e));
6724            self
6725        }
6726        pub fn times_location<T>(mut self, value: T) -> Self
6727        where
6728            T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
6729            T::Error: ::std::fmt::Display,
6730        {
6731            self.times_location = value
6732                .try_into()
6733                .map_err(|e| format!("error converting supplied value for times_location: {}", e));
6734            self
6735        }
6736    }
6737    impl ::std::convert::TryFrom<UserPermissionLimits> for super::UserPermissionLimits {
6738        type Error = super::error::ConversionError;
6739        fn try_from(
6740            value: UserPermissionLimits,
6741        ) -> ::std::result::Result<Self, super::error::ConversionError> {
6742            Ok(Self {
6743                allowed_connection_types: value.allowed_connection_types?,
6744                bearer_token: value.bearer_token?,
6745                data: value.data?,
6746                payload: value.payload?,
6747                pub_: value.pub_?,
6748                resp: value.resp?,
6749                src: value.src?,
6750                sub: value.sub?,
6751                subs: value.subs?,
6752                times: value.times?,
6753                times_location: value.times_location?,
6754            })
6755        }
6756    }
6757    impl ::std::convert::From<super::UserPermissionLimits> for UserPermissionLimits {
6758        fn from(value: super::UserPermissionLimits) -> Self {
6759            Self {
6760                allowed_connection_types: Ok(value.allowed_connection_types),
6761                bearer_token: Ok(value.bearer_token),
6762                data: Ok(value.data),
6763                payload: Ok(value.payload),
6764                pub_: Ok(value.pub_),
6765                resp: Ok(value.resp),
6766                src: Ok(value.src),
6767                sub: Ok(value.sub),
6768                subs: Ok(value.subs),
6769                times: Ok(value.times),
6770                times_location: Ok(value.times_location),
6771            }
6772        }
6773    }
6774    #[derive(Clone, Debug)]
6775    pub struct UserScope {
6776        description: ::std::result::Result<
6777            ::std::option::Option<::std::string::String>,
6778            ::std::string::String,
6779        >,
6780        key: ::std::result::Result<
6781            ::std::option::Option<::std::string::String>,
6782            ::std::string::String,
6783        >,
6784        kind: ::std::result::Result<super::ScopeType, ::std::string::String>,
6785        role: ::std::result::Result<
6786            ::std::option::Option<::std::string::String>,
6787            ::std::string::String,
6788        >,
6789        template: ::std::result::Result<
6790            ::std::option::Option<super::UserPermissionLimits>,
6791            ::std::string::String,
6792        >,
6793    }
6794    impl ::std::default::Default for UserScope {
6795        fn default() -> Self {
6796            Self {
6797                description: Ok(Default::default()),
6798                key: Ok(Default::default()),
6799                kind: Ok(super::defaults::user_scope_kind()),
6800                role: Ok(Default::default()),
6801                template: Ok(Default::default()),
6802            }
6803        }
6804    }
6805    impl UserScope {
6806        pub fn description<T>(mut self, value: T) -> Self
6807        where
6808            T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
6809            T::Error: ::std::fmt::Display,
6810        {
6811            self.description = value
6812                .try_into()
6813                .map_err(|e| format!("error converting supplied value for description: {}", e));
6814            self
6815        }
6816        pub fn key<T>(mut self, value: T) -> Self
6817        where
6818            T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
6819            T::Error: ::std::fmt::Display,
6820        {
6821            self.key = value
6822                .try_into()
6823                .map_err(|e| format!("error converting supplied value for key: {}", e));
6824            self
6825        }
6826        pub fn kind<T>(mut self, value: T) -> Self
6827        where
6828            T: ::std::convert::TryInto<super::ScopeType>,
6829            T::Error: ::std::fmt::Display,
6830        {
6831            self.kind = value
6832                .try_into()
6833                .map_err(|e| format!("error converting supplied value for kind: {}", e));
6834            self
6835        }
6836        pub fn role<T>(mut self, value: T) -> Self
6837        where
6838            T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
6839            T::Error: ::std::fmt::Display,
6840        {
6841            self.role = value
6842                .try_into()
6843                .map_err(|e| format!("error converting supplied value for role: {}", e));
6844            self
6845        }
6846        pub fn template<T>(mut self, value: T) -> Self
6847        where
6848            T: ::std::convert::TryInto<::std::option::Option<super::UserPermissionLimits>>,
6849            T::Error: ::std::fmt::Display,
6850        {
6851            self.template = value
6852                .try_into()
6853                .map_err(|e| format!("error converting supplied value for template: {}", e));
6854            self
6855        }
6856    }
6857    impl ::std::convert::TryFrom<UserScope> for super::UserScope {
6858        type Error = super::error::ConversionError;
6859        fn try_from(
6860            value: UserScope,
6861        ) -> ::std::result::Result<Self, super::error::ConversionError> {
6862            Ok(Self {
6863                description: value.description?,
6864                key: value.key?,
6865                kind: value.kind?,
6866                role: value.role?,
6867                template: value.template?,
6868            })
6869        }
6870    }
6871    impl ::std::convert::From<super::UserScope> for UserScope {
6872        fn from(value: super::UserScope) -> Self {
6873            Self {
6874                description: Ok(value.description),
6875                key: Ok(value.key),
6876                kind: Ok(value.kind),
6877                role: Ok(value.role),
6878                template: Ok(value.template),
6879            }
6880        }
6881    }
6882    #[derive(Clone, Debug)]
6883    pub struct WeightedMapping {
6884        cluster: ::std::result::Result<
6885            ::std::option::Option<::std::string::String>,
6886            ::std::string::String,
6887        >,
6888        subject:
6889            ::std::result::Result<::std::option::Option<super::Subject>, ::std::string::String>,
6890        weight: ::std::result::Result<u64, ::std::string::String>,
6891    }
6892    impl ::std::default::Default for WeightedMapping {
6893        fn default() -> Self {
6894            Self {
6895                cluster: Ok(Default::default()),
6896                subject: Ok(Default::default()),
6897                weight: Ok(super::defaults::default_u64::<u64, 100>()),
6898            }
6899        }
6900    }
6901    impl WeightedMapping {
6902        pub fn cluster<T>(mut self, value: T) -> Self
6903        where
6904            T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
6905            T::Error: ::std::fmt::Display,
6906        {
6907            self.cluster = value
6908                .try_into()
6909                .map_err(|e| format!("error converting supplied value for cluster: {}", e));
6910            self
6911        }
6912        pub fn subject<T>(mut self, value: T) -> Self
6913        where
6914            T: ::std::convert::TryInto<::std::option::Option<super::Subject>>,
6915            T::Error: ::std::fmt::Display,
6916        {
6917            self.subject = value
6918                .try_into()
6919                .map_err(|e| format!("error converting supplied value for subject: {}", e));
6920            self
6921        }
6922        pub fn weight<T>(mut self, value: T) -> Self
6923        where
6924            T: ::std::convert::TryInto<u64>,
6925            T::Error: ::std::fmt::Display,
6926        {
6927            self.weight = value
6928                .try_into()
6929                .map_err(|e| format!("error converting supplied value for weight: {}", e));
6930            self
6931        }
6932    }
6933    impl ::std::convert::TryFrom<WeightedMapping> for super::WeightedMapping {
6934        type Error = super::error::ConversionError;
6935        fn try_from(
6936            value: WeightedMapping,
6937        ) -> ::std::result::Result<Self, super::error::ConversionError> {
6938            Ok(Self {
6939                cluster: value.cluster?,
6940                subject: value.subject?,
6941                weight: value.weight?,
6942            })
6943        }
6944    }
6945    impl ::std::convert::From<super::WeightedMapping> for WeightedMapping {
6946        fn from(value: super::WeightedMapping) -> Self {
6947            Self {
6948                cluster: Ok(value.cluster),
6949                subject: Ok(value.subject),
6950                weight: Ok(value.weight),
6951            }
6952        }
6953    }
6954}
6955/// Generation of default values for serde.
6956pub mod defaults {
6957    pub(super) fn default_bool<const V: bool>() -> bool {
6958        V
6959    }
6960    pub(super) fn default_i64<T, const V: i64>() -> T
6961    where
6962        T: std::convert::TryFrom<i64>,
6963        <T as std::convert::TryFrom<i64>>::Error: std::fmt::Debug,
6964    {
6965        T::try_from(V).unwrap()
6966    }
6967    pub(super) fn default_u64<T, const V: u64>() -> T
6968    where
6969        T: std::convert::TryFrom<u64>,
6970        <T as std::convert::TryFrom<u64>>::Error: std::fmt::Debug,
6971    {
6972        T::try_from(V).unwrap()
6973    }
6974    pub(super) fn account_type() -> super::AccountType {
6975        super::AccountType::Account
6976    }
6977    pub(super) fn activation_type() -> super::ActivationType {
6978        super::ActivationType::Activation
6979    }
6980    pub(super) fn operator_type() -> super::OperatorType {
6981        super::OperatorType::Operator
6982    }
6983    pub(super) fn user_type() -> super::UserType {
6984        super::UserType::User
6985    }
6986    pub(super) fn user_scope_kind() -> super::ScopeType {
6987        super::ScopeType::UserScope
6988    }
6989}