diff --git a/Cargo.lock b/Cargo.lock index c05e935..22a7155 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2025,7 +2025,7 @@ checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" [[package]] name = "typify" version = "0.0.11-dev" -source = "git+https://github.com/oxidecomputer/typify#c18d0452db86d57318eec40a14c5aca5a079e6f8" +source = "git+https://github.com/oxidecomputer/typify#cd1f95b66b0d0fbb33537d66043f26512ee3268b" dependencies = [ "typify-impl", "typify-macro", @@ -2034,7 +2034,7 @@ dependencies = [ [[package]] name = "typify-impl" version = "0.0.11-dev" -source = "git+https://github.com/oxidecomputer/typify#c18d0452db86d57318eec40a14c5aca5a079e6f8" +source = "git+https://github.com/oxidecomputer/typify#cd1f95b66b0d0fbb33537d66043f26512ee3268b" dependencies = [ "heck", "log", @@ -2052,7 +2052,7 @@ dependencies = [ [[package]] name = "typify-macro" version = "0.0.11-dev" -source = "git+https://github.com/oxidecomputer/typify#c18d0452db86d57318eec40a14c5aca5a079e6f8" +source = "git+https://github.com/oxidecomputer/typify#cd1f95b66b0d0fbb33537d66043f26512ee3268b" dependencies = [ "proc-macro2", "quote", diff --git a/progenitor-impl/tests/output/nexus-builder-tagged.out b/progenitor-impl/tests/output/nexus-builder-tagged.out index e40f252..0324676 100644 --- a/progenitor-impl/tests/output/nexus-builder-tagged.out +++ b/progenitor-impl/tests/output/nexus-builder-tagged.out @@ -234,6 +234,13 @@ pub mod types { } } + impl std::convert::TryFrom for DatumType { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct DerEncodedKeyPair { ///request signing private key (base64 encoded der file) @@ -409,6 +416,13 @@ pub mod types { } } + impl std::convert::TryFrom for DiskMetricName { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize)] pub struct DiskResultsPage { @@ -599,6 +613,13 @@ pub mod types { } } + impl std::convert::TryFrom for FieldSource { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///The `FieldType` identifies the data type of a target or metric field. #[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] pub enum FieldType { @@ -654,6 +675,13 @@ pub mod types { } } + impl std::convert::TryFrom for FieldType { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + #[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] pub enum FleetRole { #[serde(rename = "admin")] @@ -700,6 +728,13 @@ pub mod types { } } + impl std::convert::TryFrom for FleetRole { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///Client view of a [`Policy`], which describes how this resource may be /// accessed /// @@ -959,6 +994,13 @@ pub mod types { } } + impl std::convert::TryFrom for IdSortMode { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///Client view of an [`IdentityProvider`] #[derive(Clone, Debug, Deserialize, Serialize)] pub struct IdentityProvider { @@ -1036,6 +1078,13 @@ pub mod types { } } + impl std::convert::TryFrom for IdentityProviderType { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///Describes what kind of identity is described by an id #[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] pub enum IdentityType { @@ -1075,6 +1124,13 @@ pub mod types { } } + impl std::convert::TryFrom for IdentityType { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(tag = "type")] pub enum IdpMetadataSource { @@ -1407,6 +1463,13 @@ pub mod types { } } + impl std::convert::TryFrom for InstanceState { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///The kind of an external IP address for an instance #[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] pub enum IpKind { @@ -1450,6 +1513,13 @@ pub mod types { } } + impl std::convert::TryFrom for IpKind { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(untagged)] pub enum IpNet { @@ -1484,6 +1554,13 @@ pub mod types { } } + impl std::convert::TryFrom for IpNet { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + impl ToString for IpNet { fn to_string(&self) -> String { match self { @@ -1635,6 +1712,13 @@ pub mod types { } } + impl std::convert::TryFrom for Ipv4Net { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + impl<'de> serde::Deserialize<'de> for Ipv4Net { fn deserialize(deserializer: D) -> Result where @@ -1693,6 +1777,13 @@ pub mod types { } } + impl std::convert::TryFrom for Ipv6Net { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + impl<'de> serde::Deserialize<'de> for Ipv6Net { fn deserialize(deserializer: D) -> Result where @@ -1764,6 +1855,13 @@ pub mod types { } } + impl std::convert::TryFrom for L4PortRange { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + impl<'de> serde::Deserialize<'de> for L4PortRange { fn deserialize(deserializer: D) -> Result where @@ -1819,6 +1917,13 @@ pub mod types { } } + impl std::convert::TryFrom for MacAddr { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + impl<'de> serde::Deserialize<'de> for MacAddr { fn deserialize(deserializer: D) -> Result where @@ -1896,6 +2001,13 @@ pub mod types { } } + impl std::convert::TryFrom for Name { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + impl<'de> serde::Deserialize<'de> for Name { fn deserialize(deserializer: D) -> Result where @@ -1954,6 +2066,13 @@ pub mod types { } } + impl std::convert::TryFrom for NameOrIdSortMode { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///Supported set of sort modes for scanning by name only /// ///Currently, we only support scanning in ascending order. @@ -1995,6 +2114,13 @@ pub mod types { } } + impl std::convert::TryFrom for NameSortMode { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///A `NetworkInterface` represents a virtual network interface device. #[derive(Clone, Debug, Deserialize, Serialize)] pub struct NetworkInterface { @@ -2196,6 +2322,13 @@ pub mod types { } } + impl std::convert::TryFrom for OrganizationRole { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///Client view of a [`Policy`], which describes how this resource may be /// accessed /// @@ -2347,6 +2480,13 @@ pub mod types { } } + impl std::convert::TryFrom for ProjectRole { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///Client view of a [`Policy`], which describes how this resource may be /// accessed /// @@ -2487,6 +2627,13 @@ pub mod types { } } + impl std::convert::TryFrom for RoleName { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + impl<'de> serde::Deserialize<'de> for RoleName { fn deserialize(deserializer: D) -> Result where @@ -2657,6 +2804,13 @@ pub mod types { } } + impl std::convert::TryFrom for RouterRouteKind { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize)] pub struct RouterRouteResultsPage { @@ -2914,6 +3068,13 @@ pub mod types { } } + impl std::convert::TryFrom for SiloRole { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///Client view of a [`Policy`], which describes how this resource may be /// accessed /// @@ -3151,6 +3312,13 @@ pub mod types { } } + impl std::convert::TryFrom for TimeseriesName { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + impl<'de> serde::Deserialize<'de> for TimeseriesName { fn deserialize(deserializer: D) -> Result where @@ -3290,6 +3458,13 @@ pub mod types { } } + impl std::convert::TryFrom for UserProvisionType { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize)] pub struct UserResultsPage { @@ -3434,6 +3609,13 @@ pub mod types { } } + impl std::convert::TryFrom for VpcFirewallRuleAction { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + #[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] pub enum VpcFirewallRuleDirection { #[serde(rename = "inbound")] @@ -3476,6 +3658,13 @@ pub mod types { } } + impl std::convert::TryFrom for VpcFirewallRuleDirection { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///Filter for a firewall rule. A given packet must match every field that /// is present for the rule to apply to it. A packet matches a field if any /// entry in that field matches the packet. @@ -3568,6 +3757,13 @@ pub mod types { } } + impl std::convert::TryFrom for VpcFirewallRuleProtocol { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + #[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] pub enum VpcFirewallRuleStatus { #[serde(rename = "disabled")] @@ -3610,6 +3806,13 @@ pub mod types { } } + impl std::convert::TryFrom for VpcFirewallRuleStatus { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///A `VpcFirewallRuleTarget` is used to specify the set of [`Instance`]s to /// which a firewall rule applies. #[derive(Clone, Debug, Deserialize, Serialize)] @@ -3782,6 +3985,13 @@ pub mod types { } } + impl std::convert::TryFrom for VpcRouterKind { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize)] pub struct VpcRouterResultsPage { diff --git a/progenitor-impl/tests/output/nexus-builder.out b/progenitor-impl/tests/output/nexus-builder.out index 7a16d8e..ee5db28 100644 --- a/progenitor-impl/tests/output/nexus-builder.out +++ b/progenitor-impl/tests/output/nexus-builder.out @@ -236,6 +236,13 @@ pub mod types { } } + impl std::convert::TryFrom for DatumType { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct DerEncodedKeyPair { ///request signing private key (base64 encoded der file) @@ -413,6 +420,13 @@ pub mod types { } } + impl std::convert::TryFrom for DiskMetricName { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct DiskResultsPage { @@ -605,6 +619,13 @@ pub mod types { } } + impl std::convert::TryFrom for FieldSource { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///The `FieldType` identifies the data type of a target or metric field. #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, @@ -662,6 +683,13 @@ pub mod types { } } + impl std::convert::TryFrom for FieldType { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, )] @@ -710,6 +738,13 @@ pub mod types { } } + impl std::convert::TryFrom for FleetRole { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///Client view of a [`Policy`], which describes how this resource may be /// accessed /// @@ -971,6 +1006,13 @@ pub mod types { } } + impl std::convert::TryFrom for IdSortMode { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///Client view of an [`IdentityProvider`] #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct IdentityProvider { @@ -1050,6 +1092,13 @@ pub mod types { } } + impl std::convert::TryFrom for IdentityProviderType { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///Describes what kind of identity is described by an id #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, @@ -1091,6 +1140,13 @@ pub mod types { } } + impl std::convert::TryFrom for IdentityType { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] #[serde(tag = "type")] pub enum IdpMetadataSource { @@ -1425,6 +1481,13 @@ pub mod types { } } + impl std::convert::TryFrom for InstanceState { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///The kind of an external IP address for an instance #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, @@ -1470,6 +1533,13 @@ pub mod types { } } + impl std::convert::TryFrom for IpKind { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] #[serde(untagged)] pub enum IpNet { @@ -1504,6 +1574,13 @@ pub mod types { } } + impl std::convert::TryFrom for IpNet { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + impl ToString for IpNet { fn to_string(&self) -> String { match self { @@ -1655,6 +1732,13 @@ pub mod types { } } + impl std::convert::TryFrom for Ipv4Net { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + impl<'de> serde::Deserialize<'de> for Ipv4Net { fn deserialize(deserializer: D) -> Result where @@ -1713,6 +1797,13 @@ pub mod types { } } + impl std::convert::TryFrom for Ipv6Net { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + impl<'de> serde::Deserialize<'de> for Ipv6Net { fn deserialize(deserializer: D) -> Result where @@ -1784,6 +1875,13 @@ pub mod types { } } + impl std::convert::TryFrom for L4PortRange { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + impl<'de> serde::Deserialize<'de> for L4PortRange { fn deserialize(deserializer: D) -> Result where @@ -1839,6 +1937,13 @@ pub mod types { } } + impl std::convert::TryFrom for MacAddr { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + impl<'de> serde::Deserialize<'de> for MacAddr { fn deserialize(deserializer: D) -> Result where @@ -1916,6 +2021,13 @@ pub mod types { } } + impl std::convert::TryFrom for Name { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + impl<'de> serde::Deserialize<'de> for Name { fn deserialize(deserializer: D) -> Result where @@ -1976,6 +2088,13 @@ pub mod types { } } + impl std::convert::TryFrom for NameOrIdSortMode { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///Supported set of sort modes for scanning by name only /// ///Currently, we only support scanning in ascending order. @@ -2019,6 +2138,13 @@ pub mod types { } } + impl std::convert::TryFrom for NameSortMode { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///A `NetworkInterface` represents a virtual network interface device. #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct NetworkInterface { @@ -2222,6 +2348,13 @@ pub mod types { } } + impl std::convert::TryFrom for OrganizationRole { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///Client view of a [`Policy`], which describes how this resource may be /// accessed /// @@ -2375,6 +2508,13 @@ pub mod types { } } + impl std::convert::TryFrom for ProjectRole { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///Client view of a [`Policy`], which describes how this resource may be /// accessed /// @@ -2515,6 +2655,13 @@ pub mod types { } } + impl std::convert::TryFrom for RoleName { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + impl<'de> serde::Deserialize<'de> for RoleName { fn deserialize(deserializer: D) -> Result where @@ -2687,6 +2834,13 @@ pub mod types { } } + impl std::convert::TryFrom for RouterRouteKind { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct RouterRouteResultsPage { @@ -2946,6 +3100,13 @@ pub mod types { } } + impl std::convert::TryFrom for SiloRole { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///Client view of a [`Policy`], which describes how this resource may be /// accessed /// @@ -3183,6 +3344,13 @@ pub mod types { } } + impl std::convert::TryFrom for TimeseriesName { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + impl<'de> serde::Deserialize<'de> for TimeseriesName { fn deserialize(deserializer: D) -> Result where @@ -3324,6 +3492,13 @@ pub mod types { } } + impl std::convert::TryFrom for UserProvisionType { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct UserResultsPage { @@ -3470,6 +3645,13 @@ pub mod types { } } + impl std::convert::TryFrom for VpcFirewallRuleAction { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, )] @@ -3514,6 +3696,13 @@ pub mod types { } } + impl std::convert::TryFrom for VpcFirewallRuleDirection { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///Filter for a firewall rule. A given packet must match every field that /// is present for the rule to apply to it. A packet matches a field if any /// entry in that field matches the packet. @@ -3608,6 +3797,13 @@ pub mod types { } } + impl std::convert::TryFrom for VpcFirewallRuleProtocol { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, )] @@ -3652,6 +3848,13 @@ pub mod types { } } + impl std::convert::TryFrom for VpcFirewallRuleStatus { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///A `VpcFirewallRuleTarget` is used to specify the set of [`Instance`]s to /// which a firewall rule applies. #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] @@ -3826,6 +4029,13 @@ pub mod types { } } + impl std::convert::TryFrom for VpcRouterKind { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct VpcRouterResultsPage { diff --git a/progenitor-impl/tests/output/nexus-positional.out b/progenitor-impl/tests/output/nexus-positional.out index c8b9312..a424c95 100644 --- a/progenitor-impl/tests/output/nexus-positional.out +++ b/progenitor-impl/tests/output/nexus-positional.out @@ -210,6 +210,13 @@ pub mod types { } } + impl std::convert::TryFrom for DatumType { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct DerEncodedKeyPair { ///request signing private key (base64 encoded der file) @@ -343,6 +350,13 @@ pub mod types { } } + impl std::convert::TryFrom for DiskMetricName { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize)] pub struct DiskResultsPage { @@ -497,6 +511,13 @@ pub mod types { } } + impl std::convert::TryFrom for FieldSource { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///The `FieldType` identifies the data type of a target or metric field. #[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] pub enum FieldType { @@ -552,6 +573,13 @@ pub mod types { } } + impl std::convert::TryFrom for FieldType { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + #[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] pub enum FleetRole { #[serde(rename = "admin")] @@ -598,6 +626,13 @@ pub mod types { } } + impl std::convert::TryFrom for FleetRole { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///Client view of a [`Policy`], which describes how this resource may be /// accessed /// @@ -815,6 +850,13 @@ pub mod types { } } + impl std::convert::TryFrom for IdSortMode { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///Client view of an [`IdentityProvider`] #[derive(Clone, Debug, Deserialize, Serialize)] pub struct IdentityProvider { @@ -880,6 +922,13 @@ pub mod types { } } + impl std::convert::TryFrom for IdentityProviderType { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///Describes what kind of identity is described by an id #[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] pub enum IdentityType { @@ -919,6 +968,13 @@ pub mod types { } } + impl std::convert::TryFrom for IdentityType { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(tag = "type")] pub enum IdpMetadataSource { @@ -1203,6 +1259,13 @@ pub mod types { } } + impl std::convert::TryFrom for InstanceState { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///The kind of an external IP address for an instance #[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] pub enum IpKind { @@ -1246,6 +1309,13 @@ pub mod types { } } + impl std::convert::TryFrom for IpKind { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(untagged)] pub enum IpNet { @@ -1280,6 +1350,13 @@ pub mod types { } } + impl std::convert::TryFrom for IpNet { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + impl ToString for IpNet { fn to_string(&self) -> String { match self { @@ -1395,6 +1472,13 @@ pub mod types { } } + impl std::convert::TryFrom for Ipv4Net { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + impl<'de> serde::Deserialize<'de> for Ipv4Net { fn deserialize(deserializer: D) -> Result where @@ -1447,6 +1531,13 @@ pub mod types { } } + impl std::convert::TryFrom for Ipv6Net { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + impl<'de> serde::Deserialize<'de> for Ipv6Net { fn deserialize(deserializer: D) -> Result where @@ -1512,6 +1603,13 @@ pub mod types { } } + impl std::convert::TryFrom for L4PortRange { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + impl<'de> serde::Deserialize<'de> for L4PortRange { fn deserialize(deserializer: D) -> Result where @@ -1567,6 +1665,13 @@ pub mod types { } } + impl std::convert::TryFrom for MacAddr { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + impl<'de> serde::Deserialize<'de> for MacAddr { fn deserialize(deserializer: D) -> Result where @@ -1632,6 +1737,13 @@ pub mod types { } } + impl std::convert::TryFrom for Name { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + impl<'de> serde::Deserialize<'de> for Name { fn deserialize(deserializer: D) -> Result where @@ -1690,6 +1802,13 @@ pub mod types { } } + impl std::convert::TryFrom for NameOrIdSortMode { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///Supported set of sort modes for scanning by name only /// ///Currently, we only support scanning in ascending order. @@ -1731,6 +1850,13 @@ pub mod types { } } + impl std::convert::TryFrom for NameSortMode { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///A `NetworkInterface` represents a virtual network interface device. #[derive(Clone, Debug, Deserialize, Serialize)] pub struct NetworkInterface { @@ -1890,6 +2016,13 @@ pub mod types { } } + impl std::convert::TryFrom for OrganizationRole { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///Client view of a [`Policy`], which describes how this resource may be /// accessed /// @@ -2005,6 +2138,13 @@ pub mod types { } } + impl std::convert::TryFrom for ProjectRole { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///Client view of a [`Policy`], which describes how this resource may be /// accessed /// @@ -2109,6 +2249,13 @@ pub mod types { } } + impl std::convert::TryFrom for RoleName { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + impl<'de> serde::Deserialize<'de> for RoleName { fn deserialize(deserializer: D) -> Result where @@ -2261,6 +2408,13 @@ pub mod types { } } + impl std::convert::TryFrom for RouterRouteKind { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize)] pub struct RouterRouteResultsPage { @@ -2464,6 +2618,13 @@ pub mod types { } } + impl std::convert::TryFrom for SiloRole { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///Client view of a [`Policy`], which describes how this resource may be /// accessed /// @@ -2635,6 +2796,13 @@ pub mod types { } } + impl std::convert::TryFrom for TimeseriesName { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + impl<'de> serde::Deserialize<'de> for TimeseriesName { fn deserialize(deserializer: D) -> Result where @@ -2744,6 +2912,13 @@ pub mod types { } } + impl std::convert::TryFrom for UserProvisionType { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize)] pub struct UserResultsPage { @@ -2864,6 +3039,13 @@ pub mod types { } } + impl std::convert::TryFrom for VpcFirewallRuleAction { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + #[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] pub enum VpcFirewallRuleDirection { #[serde(rename = "inbound")] @@ -2906,6 +3088,13 @@ pub mod types { } } + impl std::convert::TryFrom for VpcFirewallRuleDirection { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///Filter for a firewall rule. A given packet must match every field that /// is present for the rule to apply to it. A packet matches a field if any /// entry in that field matches the packet. @@ -2992,6 +3181,13 @@ pub mod types { } } + impl std::convert::TryFrom for VpcFirewallRuleProtocol { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + #[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] pub enum VpcFirewallRuleStatus { #[serde(rename = "disabled")] @@ -3034,6 +3230,13 @@ pub mod types { } } + impl std::convert::TryFrom for VpcFirewallRuleStatus { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///A `VpcFirewallRuleTarget` is used to specify the set of [`Instance`]s to /// which a firewall rule applies. #[derive(Clone, Debug, Deserialize, Serialize)] @@ -3170,6 +3373,13 @@ pub mod types { } } + impl std::convert::TryFrom for VpcRouterKind { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + ///A single page of results #[derive(Clone, Debug, Deserialize, Serialize)] pub struct VpcRouterResultsPage { diff --git a/progenitor-impl/tests/output/propolis-server-builder-tagged.out b/progenitor-impl/tests/output/propolis-server-builder-tagged.out index 28a7c37..92ab28b 100644 --- a/progenitor-impl/tests/output/propolis-server-builder-tagged.out +++ b/progenitor-impl/tests/output/propolis-server-builder-tagged.out @@ -276,6 +276,13 @@ pub mod types { } } + impl std::convert::TryFrom for InstanceState { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct InstanceStateMonitorRequest { pub gen: u64, @@ -345,6 +352,13 @@ pub mod types { } } + impl std::convert::TryFrom for InstanceStateRequested { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + #[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] pub enum MigrationState { Sync, @@ -409,6 +423,13 @@ pub mod types { } } + impl std::convert::TryFrom for MigrationState { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct NetworkInterface { pub attachment: NetworkInterfaceAttachmentState, diff --git a/progenitor-impl/tests/output/propolis-server-builder.out b/progenitor-impl/tests/output/propolis-server-builder.out index 63937ae..61a456c 100644 --- a/progenitor-impl/tests/output/propolis-server-builder.out +++ b/progenitor-impl/tests/output/propolis-server-builder.out @@ -278,6 +278,13 @@ pub mod types { } } + impl std::convert::TryFrom for InstanceState { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct InstanceStateMonitorRequest { pub gen: u64, @@ -349,6 +356,13 @@ pub mod types { } } + impl std::convert::TryFrom for InstanceStateRequested { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + #[derive( Clone, Copy, Debug, Deserialize, Eq, Hash, JsonSchema, Ord, PartialEq, PartialOrd, Serialize, )] @@ -415,6 +429,13 @@ pub mod types { } } + impl std::convert::TryFrom for MigrationState { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)] pub struct NetworkInterface { pub attachment: NetworkInterfaceAttachmentState, diff --git a/progenitor-impl/tests/output/propolis-server-positional.out b/progenitor-impl/tests/output/propolis-server-positional.out index d8b2b0e..6a649e3 100644 --- a/progenitor-impl/tests/output/propolis-server-positional.out +++ b/progenitor-impl/tests/output/propolis-server-positional.out @@ -198,6 +198,13 @@ pub mod types { } } + impl std::convert::TryFrom for InstanceState { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct InstanceStateMonitorRequest { pub gen: u64, @@ -255,6 +262,13 @@ pub mod types { } } + impl std::convert::TryFrom for InstanceStateRequested { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + #[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] pub enum MigrationState { Sync, @@ -319,6 +333,13 @@ pub mod types { } } + impl std::convert::TryFrom for MigrationState { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } + } + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct NetworkInterface { pub attachment: NetworkInterfaceAttachmentState,