55//! Interface for making API requests to the Oxide control plane at large
66//! from within the control plane
77
8- use std:: collections:: HashMap ;
9-
108progenitor:: generate_api!(
119 spec = "../../openapi/nexus-internal.json" ,
1210 interface = Positional ,
@@ -28,31 +26,11 @@ progenitor::generate_api!(
2826 "oxnet" = "0.1.0" ,
2927 } ,
3028 replace = {
31- // It's kind of unfortunate to pull in such a complex and unstable type
32- // as "blueprint" this way, but we have really useful functionality
33- // (e.g., diff'ing) that's implemented on our local type.
34- Blueprint = nexus_types:: deployment:: Blueprint ,
35- BlueprintPhysicalDiskConfig = nexus_types:: deployment:: BlueprintPhysicalDiskConfig ,
36- BlueprintPhysicalDiskDisposition = nexus_types:: deployment:: BlueprintPhysicalDiskDisposition ,
37- BlueprintZoneImageSource = nexus_types:: deployment:: BlueprintZoneImageSource ,
38- Certificate = omicron_common:: api:: internal:: nexus:: Certificate ,
39- DatasetKind = omicron_common:: api:: internal:: shared:: DatasetKind ,
40- DnsConfigParams = nexus_types:: internal_api:: params:: DnsConfigParams ,
41- DnsConfigZone = nexus_types:: internal_api:: params:: DnsConfigZone ,
42- DnsRecord = nexus_types:: internal_api:: params:: DnsRecord ,
4329 Generation = omicron_common:: api:: external:: Generation ,
44- ImportExportPolicy = omicron_common:: api:: external:: ImportExportPolicy ,
4530 MacAddr = omicron_common:: api:: external:: MacAddr ,
4631 Name = omicron_common:: api:: external:: Name ,
4732 NetworkInterface = omicron_common:: api:: internal:: shared:: NetworkInterface ,
4833 NetworkInterfaceKind = omicron_common:: api:: internal:: shared:: NetworkInterfaceKind ,
49- NewPasswordHash = omicron_passwords:: NewPasswordHash ,
50- OximeterReadMode = nexus_types:: deployment:: OximeterReadMode ,
51- PendingMgsUpdate = nexus_types:: deployment:: PendingMgsUpdate ,
52- PlannerConfig = nexus_types:: deployment:: PlannerConfig ,
53- RecoverySiloConfig = nexus_sled_agent_shared:: recovery_silo:: RecoverySiloConfig ,
54- Srv = nexus_types:: internal_api:: params:: Srv ,
55- ZpoolName = omicron_common:: zpool_name:: ZpoolName ,
5634 } ,
5735 patch = {
5836 SledAgentInfo = { derives = [ PartialEq , Eq ] } ,
@@ -250,131 +228,6 @@ impl From<types::Duration> for std::time::Duration {
250228 }
251229}
252230
253- impl From < omicron_common:: address:: IpRange > for types:: IpRange {
254- fn from ( r : omicron_common:: address:: IpRange ) -> Self {
255- use omicron_common:: address:: IpRange ;
256- match r {
257- IpRange :: V4 ( r) => types:: IpRange :: V4 ( r. into ( ) ) ,
258- IpRange :: V6 ( r) => types:: IpRange :: V6 ( r. into ( ) ) ,
259- }
260- }
261- }
262-
263- impl From < omicron_common:: address:: Ipv4Range > for types:: Ipv4Range {
264- fn from ( r : omicron_common:: address:: Ipv4Range ) -> Self {
265- Self { first : r. first , last : r. last }
266- }
267- }
268-
269- impl From < omicron_common:: address:: Ipv6Range > for types:: Ipv6Range {
270- fn from ( r : omicron_common:: address:: Ipv6Range ) -> Self {
271- Self { first : r. first , last : r. last }
272- }
273- }
274-
275- impl From < & omicron_common:: api:: internal:: shared:: SourceNatConfig >
276- for types:: SourceNatConfig
277- {
278- fn from (
279- r : & omicron_common:: api:: internal:: shared:: SourceNatConfig ,
280- ) -> Self {
281- let ( first_port, last_port) = r. port_range_raw ( ) ;
282- Self { ip : r. ip , first_port, last_port }
283- }
284- }
285-
286- impl From < omicron_common:: api:: internal:: shared:: PortSpeed >
287- for types:: PortSpeed
288- {
289- fn from ( value : omicron_common:: api:: internal:: shared:: PortSpeed ) -> Self {
290- match value {
291- omicron_common:: api:: internal:: shared:: PortSpeed :: Speed0G => {
292- types:: PortSpeed :: Speed0G
293- }
294- omicron_common:: api:: internal:: shared:: PortSpeed :: Speed1G => {
295- types:: PortSpeed :: Speed1G
296- }
297- omicron_common:: api:: internal:: shared:: PortSpeed :: Speed10G => {
298- types:: PortSpeed :: Speed10G
299- }
300- omicron_common:: api:: internal:: shared:: PortSpeed :: Speed25G => {
301- types:: PortSpeed :: Speed25G
302- }
303- omicron_common:: api:: internal:: shared:: PortSpeed :: Speed40G => {
304- types:: PortSpeed :: Speed40G
305- }
306- omicron_common:: api:: internal:: shared:: PortSpeed :: Speed50G => {
307- types:: PortSpeed :: Speed50G
308- }
309- omicron_common:: api:: internal:: shared:: PortSpeed :: Speed100G => {
310- types:: PortSpeed :: Speed100G
311- }
312- omicron_common:: api:: internal:: shared:: PortSpeed :: Speed200G => {
313- types:: PortSpeed :: Speed200G
314- }
315- omicron_common:: api:: internal:: shared:: PortSpeed :: Speed400G => {
316- types:: PortSpeed :: Speed400G
317- }
318- }
319- }
320- }
321-
322- impl From < omicron_common:: api:: internal:: shared:: PortFec > for types:: PortFec {
323- fn from ( value : omicron_common:: api:: internal:: shared:: PortFec ) -> Self {
324- match value {
325- omicron_common:: api:: internal:: shared:: PortFec :: Firecode => {
326- types:: PortFec :: Firecode
327- }
328- omicron_common:: api:: internal:: shared:: PortFec :: None => {
329- types:: PortFec :: None
330- }
331- omicron_common:: api:: internal:: shared:: PortFec :: Rs => {
332- types:: PortFec :: Rs
333- }
334- }
335- }
336- }
337-
338- impl From < omicron_common:: api:: internal:: shared:: SwitchLocation >
339- for types:: SwitchLocation
340- {
341- fn from (
342- value : omicron_common:: api:: internal:: shared:: SwitchLocation ,
343- ) -> Self {
344- match value {
345- omicron_common:: api:: internal:: shared:: SwitchLocation :: Switch0 => {
346- types:: SwitchLocation :: Switch0
347- }
348- omicron_common:: api:: internal:: shared:: SwitchLocation :: Switch1 => {
349- types:: SwitchLocation :: Switch1
350- }
351- }
352- }
353- }
354-
355- impl From < omicron_common:: api:: internal:: shared:: ExternalPortDiscovery >
356- for types:: ExternalPortDiscovery
357- {
358- fn from (
359- value : omicron_common:: api:: internal:: shared:: ExternalPortDiscovery ,
360- ) -> Self {
361- match value {
362- omicron_common:: api:: internal:: shared:: ExternalPortDiscovery :: Auto ( val) => {
363- let new: HashMap < _ , _ > = val. iter ( ) . map ( |( slot, addr) | {
364- ( slot. to_string ( ) , * addr)
365- } ) . collect ( ) ;
366- types:: ExternalPortDiscovery :: Auto ( new)
367- } ,
368- omicron_common:: api:: internal:: shared:: ExternalPortDiscovery :: Static ( val) => {
369- let new: HashMap < _ , _ > = val. iter ( ) . map ( |( slot, ports) | {
370- ( slot. to_string ( ) , ports. clone ( ) )
371- } ) . collect ( ) ;
372- types:: ExternalPortDiscovery :: Static ( new)
373- } ,
374- }
375- }
376- }
377-
378231impl From < types:: ProducerKind >
379232 for omicron_common:: api:: internal:: nexus:: ProducerKind
380233{
@@ -408,17 +261,3 @@ impl TryFrom<types::ProducerEndpoint>
408261 } )
409262 }
410263}
411-
412- impl From < & omicron_common:: api:: external:: AllowedSourceIps >
413- for types:: AllowedSourceIps
414- {
415- fn from ( ips : & omicron_common:: api:: external:: AllowedSourceIps ) -> Self {
416- use omicron_common:: api:: external:: AllowedSourceIps ;
417- match ips {
418- AllowedSourceIps :: Any => types:: AllowedSourceIps :: Any ,
419- AllowedSourceIps :: List ( list) => {
420- types:: AllowedSourceIps :: List ( list. iter ( ) . cloned ( ) . collect ( ) )
421- }
422- }
423- }
424- }
0 commit comments