From ba25cea346c8e091161bf1b296dc0bda99e780be Mon Sep 17 00:00:00 2001 From: Levon Tarver Date: Thu, 29 Aug 2024 19:28:15 +0000 Subject: [PATCH 1/8] WIP: refactor network operator APIs --- cli/src/cli_builder.rs | 81 +- cli/src/cmd_net.rs | 32 +- cli/src/generated_cli.rs | 4527 +++++++++++++++++------- oxide.json | 1133 +++++- sdk-httpmock/src/generated_httpmock.rs | 1829 +++++++++- sdk/src/generated_sdk.rs | 2880 +++++++++++++-- 6 files changed, 8606 insertions(+), 1876 deletions(-) diff --git a/cli/src/cli_builder.rs b/cli/src/cli_builder.rs index 2dbe80b4..d4adf74f 100644 --- a/cli/src/cli_builder.rs +++ b/cli/src/cli_builder.rs @@ -429,9 +429,15 @@ fn xxx<'a>(command: CliCommand) -> Option<&'a str> { CliCommand::NetworkingAddressLotList => Some("system networking address-lot list"), CliCommand::NetworkingAddressLotCreate => Some("system networking address-lot create"), CliCommand::NetworkingAddressLotDelete => Some("system networking address-lot delete"), + CliCommand::NetworkingAddressLotBlockList => { Some("system networking address-lot block list") } + CliCommand::NetworkingAddressLotBlockAdd => Some("system networking address-lot block add"), + CliCommand::NetworkingAddressLotBlockRemove => { + Some("system networking address-lot block remove") + } + CliCommand::NetworkingLoopbackAddressList => { Some("system networking loopback-address list") } @@ -442,25 +448,76 @@ fn xxx<'a>(command: CliCommand) -> Option<&'a str> { Some("system networking loopback-address delete") } + CliCommand::NetworkingSwitchPortList => Some("system hardware switch-port list"), + CliCommand::NetworkingSwitchPortStatus => Some("system hardware switch-port status"), + CliCommand::NetworkingSwitchPortApplySettings => { - Some("system hardware switch-port apply-settings") + Some("system hardware switch-port configuration apply") } CliCommand::NetworkingSwitchPortClearSettings => { - Some("system hardware switch-port clear-settings") + Some("system hardware switch-port configuration remove") } - CliCommand::NetworkingSwitchPortList => Some("system hardware switch-port list"), - CliCommand::NetworkingSwitchPortStatus => Some("system hardware switch-port status"), - CliCommand::NetworkingSwitchPortSettingsList => { - Some("system networking switch-port-settings list") + CliCommand::NetworkingSwitchPortConfigurationList => { + Some("system networking switch-port configuration list") + } + CliCommand::NetworkingSwitchPortConfigurationCreate => { + Some("system networking switch-port configuration create") + } + CliCommand::NetworkingSwitchPortConfigurationDelete => { + Some("system networking switch-port configuration delete") + } + CliCommand::NetworkingSwitchPortConfigurationView => { + Some("system networking switch-port configuration view") + } + + CliCommand::NetworkingSwitchPortConfigurationGeometryView => { + Some("system networking switch-port configuration geometry view") + } + CliCommand::NetworkingSwitchPortConfigurationGeometrySet => { + Some("system networking switch-port configuration geometry set") + } + + CliCommand::NetworkingSwitchPortConfigurationInterfaceAddressList => { + Some("system networking switch-port configuration interface address list") + } + CliCommand::NetworkingSwitchPortConfigurationInterfaceAddressAdd => { + Some("system networking switch-port configuration interface address add") + } + CliCommand::NetworkingSwitchPortConfigurationInterfaceAddressRemove => { + Some("system networking switch-port configuration interface address remove") + } + + CliCommand::NetworkingSwitchPortConfigurationInterfaceBgpPeerList => { + Some("system networking switch-port configuration interface bgp peer list") + } + CliCommand::NetworkingSwitchPortConfigurationInterfaceBgpPeerAdd => { + Some("system networking switch-port configuration interface bgp peer add") + } + CliCommand::NetworkingSwitchPortConfigurationInterfaceBgpPeerRemove => { + Some("system networking switch-port configuration interface bgp peer remove") + } + + CliCommand::NetworkingSwitchPortConfigurationInterfaceRouteList => { + Some("system networking switch-port configuration interface route list") + } + CliCommand::NetworkingSwitchPortConfigurationInterfaceRouteAdd => { + Some("system networking switch-port configuration interface route add") + } + CliCommand::NetworkingSwitchPortConfigurationInterfaceRouteRemove => { + Some("system networking switch-port configuration interface route remove") + } + + CliCommand::NetworkingSwitchPortConfigurationLinkList => { + Some("system networking switch-port configuration link list") } - CliCommand::NetworkingSwitchPortSettingsCreate => { - Some("system networking switch-port-settings create") + CliCommand::NetworkingSwitchPortConfigurationLinkCreate => { + Some("system networking switch-port configuration link create") } - CliCommand::NetworkingSwitchPortSettingsDelete => { - Some("system networking switch-port-settings delete") + CliCommand::NetworkingSwitchPortConfigurationLinkView => { + Some("system networking switch-port configuration link view") } - CliCommand::NetworkingSwitchPortSettingsView => { - Some("system networking switch-port-settings view") + CliCommand::NetworkingSwitchPortConfigurationLinkDelete => { + Some("system networking switch-port configuration link delete") } CliCommand::NetworkingBfdStatus => Some("system networking bfd status"), diff --git a/cli/src/cmd_net.rs b/cli/src/cmd_net.rs index 2a0510e1..f95e2df6 100644 --- a/cli/src/cmd_net.rs +++ b/cli/src/cmd_net.rs @@ -135,7 +135,7 @@ impl AuthenticatedCmd for CmdLinkAdd { } } client - .networking_switch_port_settings_create() + .networking_switch_port_configuration_create() .body(settings) .send() .await?; @@ -172,7 +172,7 @@ impl AuthenticatedCmd for CmdLinkDel { current_port_settings(client, &self.rack, &self.switch, &self.port).await?; settings.links.clear(); client - .networking_switch_port_settings_create() + .networking_switch_port_configuration_create() .body(settings) .send() .await?; @@ -430,7 +430,7 @@ impl AuthenticatedCmd for CmdBgpFilter { } } client - .networking_switch_port_settings_create() + .networking_switch_port_configuration_create() .body(settings) .send() .await?; @@ -487,7 +487,7 @@ impl AuthenticatedCmd for CmdBgpAuth { } } client - .networking_switch_port_settings_create() + .networking_switch_port_configuration_create() .body(settings) .send() .await?; @@ -545,7 +545,7 @@ impl AuthenticatedCmd for CmdBgpLocalPref { } } client - .networking_switch_port_settings_create() + .networking_switch_port_configuration_create() .body(settings) .send() .await?; @@ -668,7 +668,7 @@ impl AuthenticatedCmd for CmdStaticRouteSet { } client - .networking_switch_port_settings_create() + .networking_switch_port_configuration_create() .body(settings) .send() .await?; @@ -734,7 +734,7 @@ impl AuthenticatedCmd for CmdStaticRouteDelete { } client - .networking_switch_port_settings_create() + .networking_switch_port_configuration_create() .body(settings) .send() .await?; @@ -828,7 +828,7 @@ impl AuthenticatedCmd for CmdAddrAdd { } } client - .networking_switch_port_settings_create() + .networking_switch_port_configuration_create() .body(settings) .send() .await?; @@ -879,7 +879,7 @@ impl AuthenticatedCmd for CmdAddrDel { } } client - .networking_switch_port_settings_create() + .networking_switch_port_configuration_create() .body(settings) .send() .await?; @@ -1099,7 +1099,7 @@ impl AuthenticatedCmd for CmdBgpPeerSet { } } client - .networking_switch_port_settings_create() + .networking_switch_port_configuration_create() .body(settings) .send() .await?; @@ -1147,7 +1147,7 @@ impl AuthenticatedCmd for CmdBgpPeerDel { } } client - .networking_switch_port_settings_create() + .networking_switch_port_configuration_create() .body(settings) .send() .await?; @@ -1197,8 +1197,8 @@ impl AuthenticatedCmd for CmdPortConfig { for p in &ports { if let Some(id) = p.port_settings_id { let config = client - .networking_switch_port_settings_view() - .port(id) + .networking_switch_port_configuration_view() + .configuration(id) .send() .await? .into_inner(); @@ -1601,7 +1601,7 @@ impl CmdPortStatus { // modify-write operation. async fn create_current(settings_id: Uuid, client: &Client) -> Result { let list = client - .networking_switch_port_settings_list() + .networking_switch_port_configuration_list() .stream() .try_collect::>() .await?; @@ -1614,8 +1614,8 @@ async fn create_current(settings_id: Uuid, client: &Client) -> Result Cli { CliCommand::NetworkingAddressLotBlockList => { Self::cli_networking_address_lot_block_list() } + CliCommand::NetworkingAddressLotBlockAdd => { + Self::cli_networking_address_lot_block_add() + } + CliCommand::NetworkingAddressLotBlockRemove => { + Self::cli_networking_address_lot_block_remove() + } CliCommand::NetworkingAllowListView => Self::cli_networking_allow_list_view(), CliCommand::NetworkingAllowListUpdate => Self::cli_networking_allow_list_update(), CliCommand::NetworkingBfdDisable => Self::cli_networking_bfd_disable(), @@ -187,17 +193,62 @@ impl Cli { CliCommand::NetworkingLoopbackAddressDelete => { Self::cli_networking_loopback_address_delete() } - CliCommand::NetworkingSwitchPortSettingsList => { - Self::cli_networking_switch_port_settings_list() + CliCommand::NetworkingSwitchPortConfigurationList => { + Self::cli_networking_switch_port_configuration_list() + } + CliCommand::NetworkingSwitchPortConfigurationCreate => { + Self::cli_networking_switch_port_configuration_create() + } + CliCommand::NetworkingSwitchPortConfigurationDelete => { + Self::cli_networking_switch_port_configuration_delete() + } + CliCommand::NetworkingSwitchPortConfigurationView => { + Self::cli_networking_switch_port_configuration_view() + } + CliCommand::NetworkingSwitchPortConfigurationGeometryView => { + Self::cli_networking_switch_port_configuration_geometry_view() + } + CliCommand::NetworkingSwitchPortConfigurationGeometrySet => { + Self::cli_networking_switch_port_configuration_geometry_set() + } + CliCommand::NetworkingSwitchPortConfigurationInterfaceAddressList => { + Self::cli_networking_switch_port_configuration_interface_address_list() + } + CliCommand::NetworkingSwitchPortConfigurationInterfaceAddressAdd => { + Self::cli_networking_switch_port_configuration_interface_address_add() + } + CliCommand::NetworkingSwitchPortConfigurationInterfaceAddressRemove => { + Self::cli_networking_switch_port_configuration_interface_address_remove() + } + CliCommand::NetworkingSwitchPortConfigurationInterfaceBgpPeerList => { + Self::cli_networking_switch_port_configuration_interface_bgp_peer_list() + } + CliCommand::NetworkingSwitchPortConfigurationInterfaceBgpPeerAdd => { + Self::cli_networking_switch_port_configuration_interface_bgp_peer_add() + } + CliCommand::NetworkingSwitchPortConfigurationInterfaceBgpPeerRemove => { + Self::cli_networking_switch_port_configuration_interface_bgp_peer_remove() + } + CliCommand::NetworkingSwitchPortConfigurationInterfaceRouteList => { + Self::cli_networking_switch_port_configuration_interface_route_list() + } + CliCommand::NetworkingSwitchPortConfigurationInterfaceRouteAdd => { + Self::cli_networking_switch_port_configuration_interface_route_add() + } + CliCommand::NetworkingSwitchPortConfigurationInterfaceRouteRemove => { + Self::cli_networking_switch_port_configuration_interface_route_remove() } - CliCommand::NetworkingSwitchPortSettingsCreate => { - Self::cli_networking_switch_port_settings_create() + CliCommand::NetworkingSwitchPortConfigurationLinkList => { + Self::cli_networking_switch_port_configuration_link_list() } - CliCommand::NetworkingSwitchPortSettingsDelete => { - Self::cli_networking_switch_port_settings_delete() + CliCommand::NetworkingSwitchPortConfigurationLinkCreate => { + Self::cli_networking_switch_port_configuration_link_create() } - CliCommand::NetworkingSwitchPortSettingsView => { - Self::cli_networking_switch_port_settings_view() + CliCommand::NetworkingSwitchPortConfigurationLinkView => { + Self::cli_networking_switch_port_configuration_link_view() + } + CliCommand::NetworkingSwitchPortConfigurationLinkDelete => { + Self::cli_networking_switch_port_configuration_link_delete() } CliCommand::SystemPolicyView => Self::cli_system_policy_view(), CliCommand::SystemPolicyUpdate => Self::cli_system_policy_update(), @@ -586,8 +637,7 @@ impl Cli { clap::Arg::new("certificate") .long("certificate") .value_parser(clap::value_parser!(types::NameOrId)) - .required(true) - .help("Name or ID of the certificate"), + .required(true), ) .about("Fetch certificate") .long_about("Returns the details of a specific certificate") @@ -599,8 +649,7 @@ impl Cli { clap::Arg::new("certificate") .long("certificate") .value_parser(clap::value_parser!(types::NameOrId)) - .required(true) - .help("Name or ID of the certificate"), + .required(true), ) .about("Delete certificate") .long_about("Permanently delete a certificate. This operation cannot be undone.") @@ -2779,7 +2828,7 @@ impl Cli { .long("rack-id") .value_parser(clap::value_parser!(uuid::Uuid)) .required(true) - .help("ID of the rack"), + .help("The rack's unique ID."), ) .about("Fetch rack") } @@ -3209,7 +3258,7 @@ impl Cli { .long("user-id") .value_parser(clap::value_parser!(uuid::Uuid)) .required(true) - .help("The user's internal ID"), + .help("The user's internal id"), ) .about("Delete user") } @@ -3228,7 +3277,7 @@ impl Cli { .long("user-id") .value_parser(clap::value_parser!(uuid::Uuid)) .required(true) - .help("The user's internal ID"), + .help("The user's internal id"), ) .arg( clap::Arg::new("json-body") @@ -3876,7 +3925,7 @@ impl Cli { clap::Arg::new("json-body") .long("json-body") .value_name("JSON-FILE") - .required(true) + .required(false) .value_parser(clap::value_parser!(std::path::PathBuf)) .help("Path to a file that contains the full json body."), ) @@ -3931,6 +3980,86 @@ impl Cli { .about("List blocks in address lot") } + pub fn cli_networking_address_lot_block_add() -> clap::Command { + clap::Command::new("") + .arg( + clap::Arg::new("address-lot") + .long("address-lot") + .value_parser(clap::value_parser!(types::NameOrId)) + .required(true) + .help("Name or ID of the address lot"), + ) + .arg( + clap::Arg::new("first-address") + .long("first-address") + .value_parser(clap::value_parser!(std::net::IpAddr)) + .required_unless_present("json-body") + .help("The first address in the lot (inclusive)."), + ) + .arg( + clap::Arg::new("last-address") + .long("last-address") + .value_parser(clap::value_parser!(std::net::IpAddr)) + .required_unless_present("json-body") + .help("The last address in the lot (inclusive)."), + ) + .arg( + clap::Arg::new("json-body") + .long("json-body") + .value_name("JSON-FILE") + .required(false) + .value_parser(clap::value_parser!(std::path::PathBuf)) + .help("Path to a file that contains the full json body."), + ) + .arg( + clap::Arg::new("json-body-template") + .long("json-body-template") + .action(clap::ArgAction::SetTrue) + .help("XXX"), + ) + .about("Add block to address lot") + } + + pub fn cli_networking_address_lot_block_remove() -> clap::Command { + clap::Command::new("") + .arg( + clap::Arg::new("address-lot") + .long("address-lot") + .value_parser(clap::value_parser!(types::NameOrId)) + .required(true) + .help("Name or ID of the address lot"), + ) + .arg( + clap::Arg::new("first-address") + .long("first-address") + .value_parser(clap::value_parser!(std::net::IpAddr)) + .required_unless_present("json-body") + .help("The first address in the lot (inclusive)."), + ) + .arg( + clap::Arg::new("last-address") + .long("last-address") + .value_parser(clap::value_parser!(std::net::IpAddr)) + .required_unless_present("json-body") + .help("The last address in the lot (inclusive)."), + ) + .arg( + clap::Arg::new("json-body") + .long("json-body") + .value_name("JSON-FILE") + .required(false) + .value_parser(clap::value_parser!(std::path::PathBuf)) + .help("Path to a file that contains the full json body."), + ) + .arg( + clap::Arg::new("json-body-template") + .long("json-body-template") + .action(clap::ArgAction::SetTrue) + .help("XXX"), + ) + .about("Remove block from address lot") + } + pub fn cli_networking_allow_list_view() -> clap::Command { clap::Command::new("").about("Get user-facing services IP allowlist") } @@ -4428,8 +4557,17 @@ impl Cli { .about("Delete loopback address") } - pub fn cli_networking_switch_port_settings_list() -> clap::Command { + pub fn cli_networking_switch_port_configuration_list() -> clap::Command { clap::Command::new("") + .arg( + clap::Arg::new("configuration") + .long("configuration") + .value_parser(clap::value_parser!(types::NameOrId)) + .required(false) + .help( + "An optional name or id to use when selecting a switch port configuration.", + ), + ) .arg( clap::Arg::new("limit") .long("limit") @@ -4437,13 +4575,6 @@ impl Cli { .required(false) .help("Maximum number of items returned by a single call"), ) - .arg( - clap::Arg::new("port-settings") - .long("port-settings") - .value_parser(clap::value_parser!(types::NameOrId)) - .required(false) - .help("An optional name or id to use when selecting port settings."), - ) .arg( clap::Arg::new("sort-by") .long("sort-by") @@ -4460,7 +4591,7 @@ impl Cli { .about("List switch port settings") } - pub fn cli_networking_switch_port_settings_create() -> clap::Command { + pub fn cli_networking_switch_port_configuration_create() -> clap::Command { clap::Command::new("") .arg( clap::Arg::new("description") @@ -4491,41 +4622,72 @@ impl Cli { .about("Create switch port settings") } - pub fn cli_networking_switch_port_settings_delete() -> clap::Command { + pub fn cli_networking_switch_port_configuration_delete() -> clap::Command { clap::Command::new("") .arg( - clap::Arg::new("port-settings") - .long("port-settings") + clap::Arg::new("configuration") + .long("configuration") .value_parser(clap::value_parser!(types::NameOrId)) .required(false) - .help("An optional name or id to use when selecting port settings."), + .help( + "An optional name or id to use when selecting a switch port configuration.", + ), ) .about("Delete switch port settings") } - pub fn cli_networking_switch_port_settings_view() -> clap::Command { + pub fn cli_networking_switch_port_configuration_view() -> clap::Command { clap::Command::new("") .arg( - clap::Arg::new("port") - .long("port") + clap::Arg::new("configuration") + .long("configuration") .value_parser(clap::value_parser!(types::NameOrId)) .required(true) - .help("A name or id to use when selecting switch port settings info objects."), + .help("A name or id to use when selecting a switch port configuration."), ) - .about("Get information about switch port") + .about("Get information about a named set of switch-port-settings") } - pub fn cli_system_policy_view() -> clap::Command { - clap::Command::new("").about("Fetch top-level IAM policy") + pub fn cli_networking_switch_port_configuration_geometry_view() -> clap::Command { + clap::Command::new("") + .arg( + clap::Arg::new("configuration") + .long("configuration") + .value_parser(clap::value_parser!(types::NameOrId)) + .required(true) + .help("A name or id to use when selecting a switch port configuration."), + ) + .about("Get switch port geometry for a provided switch port configuration") } - pub fn cli_system_policy_update() -> clap::Command { + pub fn cli_networking_switch_port_configuration_geometry_set() -> clap::Command { clap::Command::new("") + .arg( + clap::Arg::new("configuration") + .long("configuration") + .value_parser(clap::value_parser!(types::NameOrId)) + .required(true) + .help("A name or id to use when selecting a switch port configuration."), + ) + .arg( + clap::Arg::new("geometry") + .long("geometry") + .value_parser(clap::builder::TypedValueParser::map( + clap::builder::PossibleValuesParser::new([ + types::SwitchPortGeometry::Qsfp28x1.to_string(), + types::SwitchPortGeometry::Qsfp28x2.to_string(), + types::SwitchPortGeometry::Sfp28x4.to_string(), + ]), + |s| types::SwitchPortGeometry::try_from(s).unwrap(), + )) + .required_unless_present("json-body") + .help("Link geometry for the switch port."), + ) .arg( clap::Arg::new("json-body") .long("json-body") .value_name("JSON-FILE") - .required(true) + .required(false) .value_parser(clap::value_parser!(std::path::PathBuf)) .help("Path to a file that contains the full json body."), ) @@ -4535,133 +4697,70 @@ impl Cli { .action(clap::ArgAction::SetTrue) .help("XXX"), ) - .about("Update top-level IAM policy") + .about("Set switch port geometry for a provided switch port configuration") } - pub fn cli_role_list() -> clap::Command { + pub fn cli_networking_switch_port_configuration_interface_address_list() -> clap::Command { clap::Command::new("") .arg( - clap::Arg::new("limit") - .long("limit") - .value_parser(clap::value_parser!(std::num::NonZeroU32)) - .required(false) - .help("Maximum number of items returned by a single call"), + clap::Arg::new("configuration") + .long("configuration") + .value_parser(clap::value_parser!(types::NameOrId)) + .required(true) + .help("A name or id to use when selecting a switch port configuration."), ) - .about("List built-in roles") - } - - pub fn cli_role_view() -> clap::Command { - clap::Command::new("") .arg( - clap::Arg::new("role-name") - .long("role-name") - .value_parser(clap::value_parser!(String)) + clap::Arg::new("interface") + .long("interface") + .value_parser(clap::value_parser!(types::Name)) .required(true) - .help("The built-in role's unique name."), + .help("Interface name"), ) - .about("Fetch built-in role") + .about("List addresses assigned to a provided interface configuration") } - pub fn cli_system_quotas_list() -> clap::Command { + pub fn cli_networking_switch_port_configuration_interface_address_add() -> clap::Command { clap::Command::new("") .arg( - clap::Arg::new("limit") - .long("limit") - .value_parser(clap::value_parser!(std::num::NonZeroU32)) - .required(false) - .help("Maximum number of items returned by a single call"), + clap::Arg::new("address") + .long("address") + .value_parser(clap::value_parser!(types::IpNet)) + .required_unless_present("json-body") + .help("The address and prefix length of this address."), ) .arg( - clap::Arg::new("sort-by") - .long("sort-by") - .value_parser(clap::builder::TypedValueParser::map( - clap::builder::PossibleValuesParser::new([ - types::IdSortMode::IdAscending.to_string() - ]), - |s| types::IdSortMode::try_from(s).unwrap(), - )) - .required(false), + clap::Arg::new("address-lot") + .long("address-lot") + .value_parser(clap::value_parser!(types::NameOrId)) + .required_unless_present("json-body") + .help("The address lot this address is drawn from."), ) - .about("Lists resource quotas for all silos") - } - - pub fn cli_silo_list() -> clap::Command { - clap::Command::new("") .arg( - clap::Arg::new("limit") - .long("limit") - .value_parser(clap::value_parser!(std::num::NonZeroU32)) - .required(false) - .help("Maximum number of items returned by a single call"), + clap::Arg::new("configuration") + .long("configuration") + .value_parser(clap::value_parser!(types::NameOrId)) + .required(true) + .help("A name or id to use when selecting a switch port configuration."), ) .arg( - clap::Arg::new("sort-by") - .long("sort-by") - .value_parser(clap::builder::TypedValueParser::map( - clap::builder::PossibleValuesParser::new([ - types::NameOrIdSortMode::NameAscending.to_string(), - types::NameOrIdSortMode::NameDescending.to_string(), - types::NameOrIdSortMode::IdAscending.to_string(), - ]), - |s| types::NameOrIdSortMode::try_from(s).unwrap(), - )) - .required(false), + clap::Arg::new("interface") + .long("interface") + .value_parser(clap::value_parser!(types::Name)) + .required(true) + .help("Interface name"), ) - .about("List silos") - .long_about("Lists silos that are discoverable based on the current permissions.") - } - - pub fn cli_silo_create() -> clap::Command { - clap::Command::new("") .arg( - clap::Arg::new("admin-group-name") - .long("admin-group-name") - .value_parser(clap::value_parser!(String)) + clap::Arg::new("vlan-id") + .long("vlan-id") + .value_parser(clap::value_parser!(u16)) .required(false) - .help( - "If set, this group will be created during Silo creation and granted the \ - \"Silo Admin\" role. Identity providers can assert that users belong to \ - this group and those users can log in and further initialize the \ - Silo.\n\nNote that if configuring a SAML based identity provider, \ - group_attribute_name must be set for users to be considered part of a \ - group. See `SamlIdentityProviderCreate` for more information.", - ), - ) - .arg( - clap::Arg::new("description") - .long("description") - .value_parser(clap::value_parser!(String)) - .required_unless_present("json-body"), - ) - .arg( - clap::Arg::new("discoverable") - .long("discoverable") - .value_parser(clap::value_parser!(bool)) - .required_unless_present("json-body"), - ) - .arg( - clap::Arg::new("identity-mode") - .long("identity-mode") - .value_parser(clap::builder::TypedValueParser::map( - clap::builder::PossibleValuesParser::new([ - types::SiloIdentityMode::SamlJit.to_string(), - types::SiloIdentityMode::LocalOnly.to_string(), - ]), - |s| types::SiloIdentityMode::try_from(s).unwrap(), - )) - .required_unless_present("json-body"), - ) - .arg( - clap::Arg::new("name") - .long("name") - .value_parser(clap::value_parser!(types::Name)) - .required_unless_present("json-body"), + .help("Optional VLAN ID for this address"), ) .arg( clap::Arg::new("json-body") .long("json-body") .value_name("JSON-FILE") - .required(true) + .required(false) .value_parser(clap::value_parser!(std::path::PathBuf)) .help("Path to a file that contains the full json body."), ) @@ -4671,17 +4770,853 @@ impl Cli { .action(clap::ArgAction::SetTrue) .help("XXX"), ) - .about("Create a silo") + .about("Add address to an interface configuration") } - pub fn cli_silo_view() -> clap::Command { + pub fn cli_networking_switch_port_configuration_interface_address_remove() -> clap::Command { clap::Command::new("") .arg( - clap::Arg::new("silo") - .long("silo") - .value_parser(clap::value_parser!(types::NameOrId)) - .required(true) - .help("Name or ID of the silo"), + clap::Arg::new("address") + .long("address") + .value_parser(clap::value_parser!(types::IpNet)) + .required_unless_present("json-body") + .help("The address and prefix length of this address."), + ) + .arg( + clap::Arg::new("address-lot") + .long("address-lot") + .value_parser(clap::value_parser!(types::NameOrId)) + .required_unless_present("json-body") + .help("The address lot this address is drawn from."), + ) + .arg( + clap::Arg::new("configuration") + .long("configuration") + .value_parser(clap::value_parser!(types::NameOrId)) + .required(true) + .help("A name or id to use when selecting a switch port configuration."), + ) + .arg( + clap::Arg::new("interface") + .long("interface") + .value_parser(clap::value_parser!(types::Name)) + .required(true) + .help("Interface name"), + ) + .arg( + clap::Arg::new("vlan-id") + .long("vlan-id") + .value_parser(clap::value_parser!(u16)) + .required(false) + .help("Optional VLAN ID for this address"), + ) + .arg( + clap::Arg::new("json-body") + .long("json-body") + .value_name("JSON-FILE") + .required(false) + .value_parser(clap::value_parser!(std::path::PathBuf)) + .help("Path to a file that contains the full json body."), + ) + .arg( + clap::Arg::new("json-body-template") + .long("json-body-template") + .action(clap::ArgAction::SetTrue) + .help("XXX"), + ) + .about("Remove address from an interface configuration") + } + + pub fn cli_networking_switch_port_configuration_interface_bgp_peer_list() -> clap::Command { + clap::Command::new("") + .arg( + clap::Arg::new("configuration") + .long("configuration") + .value_parser(clap::value_parser!(types::NameOrId)) + .required(true) + .help("A name or id to use when selecting a switch port configuration."), + ) + .arg( + clap::Arg::new("interface") + .long("interface") + .value_parser(clap::value_parser!(types::Name)) + .required(true) + .help("Interface name"), + ) + .about("List bgp peers assigned to a provided interface configuration") + } + + pub fn cli_networking_switch_port_configuration_interface_bgp_peer_add() -> clap::Command { + clap::Command::new("") + .arg( + clap::Arg::new("addr") + .long("addr") + .value_parser(clap::value_parser!(std::net::IpAddr)) + .required_unless_present("json-body") + .help("The address of the host to peer with."), + ) + .arg( + clap::Arg::new("bgp-config") + .long("bgp-config") + .value_parser(clap::value_parser!(types::NameOrId)) + .required_unless_present("json-body") + .help( + "The global BGP configuration used for establishing a session with this \ + peer.", + ), + ) + .arg( + clap::Arg::new("configuration") + .long("configuration") + .value_parser(clap::value_parser!(types::NameOrId)) + .required(true) + .help("A name or id to use when selecting a switch port configuration."), + ) + .arg( + clap::Arg::new("connect-retry") + .long("connect-retry") + .value_parser(clap::value_parser!(u32)) + .required_unless_present("json-body") + .help("How long to to wait between TCP connection retries (seconds)."), + ) + .arg( + clap::Arg::new("delay-open") + .long("delay-open") + .value_parser(clap::value_parser!(u32)) + .required_unless_present("json-body") + .help( + "How long to delay sending an open request after establishing a TCP \ + session (seconds).", + ), + ) + .arg( + clap::Arg::new("enforce-first-as") + .long("enforce-first-as") + .value_parser(clap::value_parser!(bool)) + .required_unless_present("json-body") + .help( + "Enforce that the first AS in paths received from this peer is the peer's \ + AS.", + ), + ) + .arg( + clap::Arg::new("hold-time") + .long("hold-time") + .value_parser(clap::value_parser!(u32)) + .required_unless_present("json-body") + .help("How long to hold peer connections between keepalives (seconds)."), + ) + .arg( + clap::Arg::new("idle-hold-time") + .long("idle-hold-time") + .value_parser(clap::value_parser!(u32)) + .required_unless_present("json-body") + .help( + "How long to hold a peer in idle before attempting a new session \ + (seconds).", + ), + ) + .arg( + clap::Arg::new("interface") + .long("interface") + .value_parser(clap::value_parser!(types::Name)) + .required(true) + .help("Interface name"), + ) + .arg( + clap::Arg::new("interface-name") + .long("interface-name") + .value_parser(clap::value_parser!(String)) + .required_unless_present("json-body") + .help( + "The name of interface to peer on. This is relative to the port \ + configuration this BGP peer configuration is a part of. For example this \ + value could be phy0 to refer to a primary physical interface. Or it \ + could be vlan47 to refer to a VLAN interface.", + ), + ) + .arg( + clap::Arg::new("keepalive") + .long("keepalive") + .value_parser(clap::value_parser!(u32)) + .required_unless_present("json-body") + .help("How often to send keepalive requests (seconds)."), + ) + .arg( + clap::Arg::new("local-pref") + .long("local-pref") + .value_parser(clap::value_parser!(u32)) + .required(false) + .help("Apply a local preference to routes received from this peer."), + ) + .arg( + clap::Arg::new("md5-auth-key") + .long("md5-auth-key") + .value_parser(clap::value_parser!(String)) + .required(false) + .help("Use the given key for TCP-MD5 authentication with the peer."), + ) + .arg( + clap::Arg::new("min-ttl") + .long("min-ttl") + .value_parser(clap::value_parser!(u8)) + .required(false) + .help("Require messages from a peer have a minimum IP time to live field."), + ) + .arg( + clap::Arg::new("multi-exit-discriminator") + .long("multi-exit-discriminator") + .value_parser(clap::value_parser!(u32)) + .required(false) + .help( + "Apply the provided multi-exit discriminator (MED) updates sent to the \ + peer.", + ), + ) + .arg( + clap::Arg::new("remote-asn") + .long("remote-asn") + .value_parser(clap::value_parser!(u32)) + .required(false) + .help("Require that a peer has a specified ASN."), + ) + .arg( + clap::Arg::new("vlan-id") + .long("vlan-id") + .value_parser(clap::value_parser!(u16)) + .required(false) + .help("Associate a VLAN ID with a peer."), + ) + .arg( + clap::Arg::new("json-body") + .long("json-body") + .value_name("JSON-FILE") + .required(true) + .value_parser(clap::value_parser!(std::path::PathBuf)) + .help("Path to a file that contains the full json body."), + ) + .arg( + clap::Arg::new("json-body-template") + .long("json-body-template") + .action(clap::ArgAction::SetTrue) + .help("XXX"), + ) + .about("Add bgp peer to an interface configuration") + } + + pub fn cli_networking_switch_port_configuration_interface_bgp_peer_remove() -> clap::Command { + clap::Command::new("") + .arg( + clap::Arg::new("addr") + .long("addr") + .value_parser(clap::value_parser!(std::net::IpAddr)) + .required_unless_present("json-body") + .help("The address of the host to peer with."), + ) + .arg( + clap::Arg::new("bgp-config") + .long("bgp-config") + .value_parser(clap::value_parser!(types::NameOrId)) + .required_unless_present("json-body") + .help( + "The global BGP configuration used for establishing a session with this \ + peer.", + ), + ) + .arg( + clap::Arg::new("configuration") + .long("configuration") + .value_parser(clap::value_parser!(types::NameOrId)) + .required(true) + .help("A name or id to use when selecting a switch port configuration."), + ) + .arg( + clap::Arg::new("connect-retry") + .long("connect-retry") + .value_parser(clap::value_parser!(u32)) + .required_unless_present("json-body") + .help("How long to to wait between TCP connection retries (seconds)."), + ) + .arg( + clap::Arg::new("delay-open") + .long("delay-open") + .value_parser(clap::value_parser!(u32)) + .required_unless_present("json-body") + .help( + "How long to delay sending an open request after establishing a TCP \ + session (seconds).", + ), + ) + .arg( + clap::Arg::new("enforce-first-as") + .long("enforce-first-as") + .value_parser(clap::value_parser!(bool)) + .required_unless_present("json-body") + .help( + "Enforce that the first AS in paths received from this peer is the peer's \ + AS.", + ), + ) + .arg( + clap::Arg::new("hold-time") + .long("hold-time") + .value_parser(clap::value_parser!(u32)) + .required_unless_present("json-body") + .help("How long to hold peer connections between keepalives (seconds)."), + ) + .arg( + clap::Arg::new("idle-hold-time") + .long("idle-hold-time") + .value_parser(clap::value_parser!(u32)) + .required_unless_present("json-body") + .help( + "How long to hold a peer in idle before attempting a new session \ + (seconds).", + ), + ) + .arg( + clap::Arg::new("interface") + .long("interface") + .value_parser(clap::value_parser!(types::Name)) + .required(true) + .help("Interface name"), + ) + .arg( + clap::Arg::new("interface-name") + .long("interface-name") + .value_parser(clap::value_parser!(String)) + .required_unless_present("json-body") + .help( + "The name of interface to peer on. This is relative to the port \ + configuration this BGP peer configuration is a part of. For example this \ + value could be phy0 to refer to a primary physical interface. Or it \ + could be vlan47 to refer to a VLAN interface.", + ), + ) + .arg( + clap::Arg::new("keepalive") + .long("keepalive") + .value_parser(clap::value_parser!(u32)) + .required_unless_present("json-body") + .help("How often to send keepalive requests (seconds)."), + ) + .arg( + clap::Arg::new("local-pref") + .long("local-pref") + .value_parser(clap::value_parser!(u32)) + .required(false) + .help("Apply a local preference to routes received from this peer."), + ) + .arg( + clap::Arg::new("md5-auth-key") + .long("md5-auth-key") + .value_parser(clap::value_parser!(String)) + .required(false) + .help("Use the given key for TCP-MD5 authentication with the peer."), + ) + .arg( + clap::Arg::new("min-ttl") + .long("min-ttl") + .value_parser(clap::value_parser!(u8)) + .required(false) + .help("Require messages from a peer have a minimum IP time to live field."), + ) + .arg( + clap::Arg::new("multi-exit-discriminator") + .long("multi-exit-discriminator") + .value_parser(clap::value_parser!(u32)) + .required(false) + .help( + "Apply the provided multi-exit discriminator (MED) updates sent to the \ + peer.", + ), + ) + .arg( + clap::Arg::new("remote-asn") + .long("remote-asn") + .value_parser(clap::value_parser!(u32)) + .required(false) + .help("Require that a peer has a specified ASN."), + ) + .arg( + clap::Arg::new("vlan-id") + .long("vlan-id") + .value_parser(clap::value_parser!(u16)) + .required(false) + .help("Associate a VLAN ID with a peer."), + ) + .arg( + clap::Arg::new("json-body") + .long("json-body") + .value_name("JSON-FILE") + .required(true) + .value_parser(clap::value_parser!(std::path::PathBuf)) + .help("Path to a file that contains the full json body."), + ) + .arg( + clap::Arg::new("json-body-template") + .long("json-body-template") + .action(clap::ArgAction::SetTrue) + .help("XXX"), + ) + .about("Remove bgp peer from an interface configuration") + } + + pub fn cli_networking_switch_port_configuration_interface_route_list() -> clap::Command { + clap::Command::new("") + .arg( + clap::Arg::new("configuration") + .long("configuration") + .value_parser(clap::value_parser!(types::NameOrId)) + .required(true) + .help("A name or id to use when selecting a switch port configuration."), + ) + .arg( + clap::Arg::new("interface") + .long("interface") + .value_parser(clap::value_parser!(types::Name)) + .required(true) + .help("Interface name"), + ) + .about("List routes assigned to a provided interface configuration") + } + + pub fn cli_networking_switch_port_configuration_interface_route_add() -> clap::Command { + clap::Command::new("") + .arg( + clap::Arg::new("configuration") + .long("configuration") + .value_parser(clap::value_parser!(types::NameOrId)) + .required(true) + .help("A name or id to use when selecting a switch port configuration."), + ) + .arg( + clap::Arg::new("dst") + .long("dst") + .value_parser(clap::value_parser!(types::IpNet)) + .required_unless_present("json-body") + .help("The route destination."), + ) + .arg( + clap::Arg::new("gw") + .long("gw") + .value_parser(clap::value_parser!(std::net::IpAddr)) + .required_unless_present("json-body") + .help("The route gateway."), + ) + .arg( + clap::Arg::new("interface") + .long("interface") + .value_parser(clap::value_parser!(types::Name)) + .required(true) + .help("Interface name"), + ) + .arg( + clap::Arg::new("local-pref") + .long("local-pref") + .value_parser(clap::value_parser!(u32)) + .required(false) + .help( + "Local preference for route. Higher preference indictes precedence within \ + and across protocols.", + ), + ) + .arg( + clap::Arg::new("vid") + .long("vid") + .value_parser(clap::value_parser!(u16)) + .required(false) + .help("VLAN id the gateway is reachable over."), + ) + .arg( + clap::Arg::new("json-body") + .long("json-body") + .value_name("JSON-FILE") + .required(false) + .value_parser(clap::value_parser!(std::path::PathBuf)) + .help("Path to a file that contains the full json body."), + ) + .arg( + clap::Arg::new("json-body-template") + .long("json-body-template") + .action(clap::ArgAction::SetTrue) + .help("XXX"), + ) + .about("Add route to an interface configuration") + } + + pub fn cli_networking_switch_port_configuration_interface_route_remove() -> clap::Command { + clap::Command::new("") + .arg( + clap::Arg::new("configuration") + .long("configuration") + .value_parser(clap::value_parser!(types::NameOrId)) + .required(true) + .help("A name or id to use when selecting a switch port configuration."), + ) + .arg( + clap::Arg::new("dst") + .long("dst") + .value_parser(clap::value_parser!(types::IpNet)) + .required_unless_present("json-body") + .help("The route destination."), + ) + .arg( + clap::Arg::new("gw") + .long("gw") + .value_parser(clap::value_parser!(std::net::IpAddr)) + .required_unless_present("json-body") + .help("The route gateway."), + ) + .arg( + clap::Arg::new("interface") + .long("interface") + .value_parser(clap::value_parser!(types::Name)) + .required(true) + .help("Interface name"), + ) + .arg( + clap::Arg::new("local-pref") + .long("local-pref") + .value_parser(clap::value_parser!(u32)) + .required(false) + .help( + "Local preference for route. Higher preference indictes precedence within \ + and across protocols.", + ), + ) + .arg( + clap::Arg::new("vid") + .long("vid") + .value_parser(clap::value_parser!(u16)) + .required(false) + .help("VLAN id the gateway is reachable over."), + ) + .arg( + clap::Arg::new("json-body") + .long("json-body") + .value_name("JSON-FILE") + .required(false) + .value_parser(clap::value_parser!(std::path::PathBuf)) + .help("Path to a file that contains the full json body."), + ) + .arg( + clap::Arg::new("json-body-template") + .long("json-body-template") + .action(clap::ArgAction::SetTrue) + .help("XXX"), + ) + .about("Remove address from an interface configuration") + } + + pub fn cli_networking_switch_port_configuration_link_list() -> clap::Command { + clap::Command::new("") + .arg( + clap::Arg::new("configuration") + .long("configuration") + .value_parser(clap::value_parser!(types::NameOrId)) + .required(true) + .help("A name or id to use when selecting a switch port configuration."), + ) + .about("List links for a provided switch port configuration") + } + + pub fn cli_networking_switch_port_configuration_link_create() -> clap::Command { + clap::Command::new("") + .arg( + clap::Arg::new("autoneg") + .long("autoneg") + .value_parser(clap::value_parser!(bool)) + .required_unless_present("json-body") + .help("Whether or not to set autonegotiation"), + ) + .arg( + clap::Arg::new("configuration") + .long("configuration") + .value_parser(clap::value_parser!(types::NameOrId)) + .required(true) + .help("A name or id to use when selecting a switch port configuration."), + ) + .arg( + clap::Arg::new("fec") + .long("fec") + .value_parser(clap::builder::TypedValueParser::map( + clap::builder::PossibleValuesParser::new([ + types::LinkFec::Firecode.to_string(), + types::LinkFec::None.to_string(), + types::LinkFec::Rs.to_string(), + ]), + |s| types::LinkFec::try_from(s).unwrap(), + )) + .required_unless_present("json-body") + .help("The forward error correction mode of the link."), + ) + .arg( + clap::Arg::new("lldp-config") + .long("lldp-config") + .value_parser(clap::value_parser!(types::NameOrId)) + .required(false) + .help( + "The optional link-layer discovery protocol (LLDP) configuration for the \ + link.", + ), + ) + .arg( + clap::Arg::new("mtu") + .long("mtu") + .value_parser(clap::value_parser!(u16)) + .required_unless_present("json-body") + .help("Maximum transmission unit for the link."), + ) + .arg( + clap::Arg::new("name") + .long("name") + .value_parser(clap::value_parser!(types::Name)) + .required_unless_present("json-body") + .help("Name of link"), + ) + .arg( + clap::Arg::new("speed") + .long("speed") + .value_parser(clap::builder::TypedValueParser::map( + clap::builder::PossibleValuesParser::new([ + types::LinkSpeed::Speed0G.to_string(), + types::LinkSpeed::Speed1G.to_string(), + types::LinkSpeed::Speed10G.to_string(), + types::LinkSpeed::Speed25G.to_string(), + types::LinkSpeed::Speed40G.to_string(), + types::LinkSpeed::Speed50G.to_string(), + types::LinkSpeed::Speed100G.to_string(), + types::LinkSpeed::Speed200G.to_string(), + types::LinkSpeed::Speed400G.to_string(), + ]), + |s| types::LinkSpeed::try_from(s).unwrap(), + )) + .required_unless_present("json-body") + .help("The speed of the link."), + ) + .arg( + clap::Arg::new("json-body") + .long("json-body") + .value_name("JSON-FILE") + .required(false) + .value_parser(clap::value_parser!(std::path::PathBuf)) + .help("Path to a file that contains the full json body."), + ) + .arg( + clap::Arg::new("json-body-template") + .long("json-body-template") + .action(clap::ArgAction::SetTrue) + .help("XXX"), + ) + .about("Create a link for a provided switch port configuration") + } + + pub fn cli_networking_switch_port_configuration_link_view() -> clap::Command { + clap::Command::new("") + .arg( + clap::Arg::new("configuration") + .long("configuration") + .value_parser(clap::value_parser!(types::NameOrId)) + .required(true) + .help("A name or id to use when selecting a switch port configuration."), + ) + .arg( + clap::Arg::new("link") + .long("link") + .value_parser(clap::value_parser!(types::Name)) + .required(true) + .help("Link name"), + ) + .about("View a link for a provided switch port configuration") + } + + pub fn cli_networking_switch_port_configuration_link_delete() -> clap::Command { + clap::Command::new("") + .arg( + clap::Arg::new("configuration") + .long("configuration") + .value_parser(clap::value_parser!(types::NameOrId)) + .required(true) + .help("A name or id to use when selecting a switch port configuration."), + ) + .arg( + clap::Arg::new("link") + .long("link") + .value_parser(clap::value_parser!(types::Name)) + .required(true) + .help("Link name"), + ) + .about("Delete a link for a provided switch port configuration") + } + + pub fn cli_system_policy_view() -> clap::Command { + clap::Command::new("").about("Fetch top-level IAM policy") + } + + pub fn cli_system_policy_update() -> clap::Command { + clap::Command::new("") + .arg( + clap::Arg::new("json-body") + .long("json-body") + .value_name("JSON-FILE") + .required(true) + .value_parser(clap::value_parser!(std::path::PathBuf)) + .help("Path to a file that contains the full json body."), + ) + .arg( + clap::Arg::new("json-body-template") + .long("json-body-template") + .action(clap::ArgAction::SetTrue) + .help("XXX"), + ) + .about("Update top-level IAM policy") + } + + pub fn cli_role_list() -> clap::Command { + clap::Command::new("") + .arg( + clap::Arg::new("limit") + .long("limit") + .value_parser(clap::value_parser!(std::num::NonZeroU32)) + .required(false) + .help("Maximum number of items returned by a single call"), + ) + .about("List built-in roles") + } + + pub fn cli_role_view() -> clap::Command { + clap::Command::new("") + .arg( + clap::Arg::new("role-name") + .long("role-name") + .value_parser(clap::value_parser!(String)) + .required(true) + .help("The built-in role's unique name."), + ) + .about("Fetch built-in role") + } + + pub fn cli_system_quotas_list() -> clap::Command { + clap::Command::new("") + .arg( + clap::Arg::new("limit") + .long("limit") + .value_parser(clap::value_parser!(std::num::NonZeroU32)) + .required(false) + .help("Maximum number of items returned by a single call"), + ) + .arg( + clap::Arg::new("sort-by") + .long("sort-by") + .value_parser(clap::builder::TypedValueParser::map( + clap::builder::PossibleValuesParser::new([ + types::IdSortMode::IdAscending.to_string() + ]), + |s| types::IdSortMode::try_from(s).unwrap(), + )) + .required(false), + ) + .about("Lists resource quotas for all silos") + } + + pub fn cli_silo_list() -> clap::Command { + clap::Command::new("") + .arg( + clap::Arg::new("limit") + .long("limit") + .value_parser(clap::value_parser!(std::num::NonZeroU32)) + .required(false) + .help("Maximum number of items returned by a single call"), + ) + .arg( + clap::Arg::new("sort-by") + .long("sort-by") + .value_parser(clap::builder::TypedValueParser::map( + clap::builder::PossibleValuesParser::new([ + types::NameOrIdSortMode::NameAscending.to_string(), + types::NameOrIdSortMode::NameDescending.to_string(), + types::NameOrIdSortMode::IdAscending.to_string(), + ]), + |s| types::NameOrIdSortMode::try_from(s).unwrap(), + )) + .required(false), + ) + .about("List silos") + .long_about("Lists silos that are discoverable based on the current permissions.") + } + + pub fn cli_silo_create() -> clap::Command { + clap::Command::new("") + .arg( + clap::Arg::new("admin-group-name") + .long("admin-group-name") + .value_parser(clap::value_parser!(String)) + .required(false) + .help( + "If set, this group will be created during Silo creation and granted the \ + \"Silo Admin\" role. Identity providers can assert that users belong to \ + this group and those users can log in and further initialize the \ + Silo.\n\nNote that if configuring a SAML based identity provider, \ + group_attribute_name must be set for users to be considered part of a \ + group. See `SamlIdentityProviderCreate` for more information.", + ), + ) + .arg( + clap::Arg::new("description") + .long("description") + .value_parser(clap::value_parser!(String)) + .required_unless_present("json-body"), + ) + .arg( + clap::Arg::new("discoverable") + .long("discoverable") + .value_parser(clap::value_parser!(bool)) + .required_unless_present("json-body"), + ) + .arg( + clap::Arg::new("identity-mode") + .long("identity-mode") + .value_parser(clap::builder::TypedValueParser::map( + clap::builder::PossibleValuesParser::new([ + types::SiloIdentityMode::SamlJit.to_string(), + types::SiloIdentityMode::LocalOnly.to_string(), + ]), + |s| types::SiloIdentityMode::try_from(s).unwrap(), + )) + .required_unless_present("json-body"), + ) + .arg( + clap::Arg::new("name") + .long("name") + .value_parser(clap::value_parser!(types::Name)) + .required_unless_present("json-body"), + ) + .arg( + clap::Arg::new("json-body") + .long("json-body") + .value_name("JSON-FILE") + .required(true) + .value_parser(clap::value_parser!(std::path::PathBuf)) + .help("Path to a file that contains the full json body."), + ) + .arg( + clap::Arg::new("json-body-template") + .long("json-body-template") + .action(clap::ArgAction::SetTrue) + .help("XXX"), + ) + .about("Create a silo") + } + + pub fn cli_silo_view() -> clap::Command { + clap::Command::new("") + .arg( + clap::Arg::new("silo") + .long("silo") + .value_parser(clap::value_parser!(types::NameOrId)) + .required(true) + .help("Name or ID of the silo"), ) .about("Fetch silo") .long_about("Fetch silo by name or ID.") @@ -4881,7 +5816,7 @@ impl Cli { .long("user-id") .value_parser(clap::value_parser!(uuid::Uuid)) .required(true) - .help("The user's internal ID"), + .help("The user's internal id"), ) .about("Fetch built-in (system) user") } @@ -6211,6 +7146,13 @@ impl Cli { self.execute_networking_address_lot_block_list(matches) .await } + CliCommand::NetworkingAddressLotBlockAdd => { + self.execute_networking_address_lot_block_add(matches).await + } + CliCommand::NetworkingAddressLotBlockRemove => { + self.execute_networking_address_lot_block_remove(matches) + .await + } CliCommand::NetworkingAllowListView => { self.execute_networking_allow_list_view(matches).await } @@ -6249,36 +7191,96 @@ impl Cli { CliCommand::NetworkingBgpMessageHistory => { self.execute_networking_bgp_message_history(matches).await } - CliCommand::NetworkingBgpImportedRoutesIpv4 => { - self.execute_networking_bgp_imported_routes_ipv4(matches) + CliCommand::NetworkingBgpImportedRoutesIpv4 => { + self.execute_networking_bgp_imported_routes_ipv4(matches) + .await + } + CliCommand::NetworkingBgpStatus => self.execute_networking_bgp_status(matches).await, + CliCommand::NetworkingLoopbackAddressList => { + self.execute_networking_loopback_address_list(matches).await + } + CliCommand::NetworkingLoopbackAddressCreate => { + self.execute_networking_loopback_address_create(matches) + .await + } + CliCommand::NetworkingLoopbackAddressDelete => { + self.execute_networking_loopback_address_delete(matches) + .await + } + CliCommand::NetworkingSwitchPortConfigurationList => { + self.execute_networking_switch_port_configuration_list(matches) + .await + } + CliCommand::NetworkingSwitchPortConfigurationCreate => { + self.execute_networking_switch_port_configuration_create(matches) + .await + } + CliCommand::NetworkingSwitchPortConfigurationDelete => { + self.execute_networking_switch_port_configuration_delete(matches) + .await + } + CliCommand::NetworkingSwitchPortConfigurationView => { + self.execute_networking_switch_port_configuration_view(matches) + .await + } + CliCommand::NetworkingSwitchPortConfigurationGeometryView => { + self.execute_networking_switch_port_configuration_geometry_view(matches) + .await + } + CliCommand::NetworkingSwitchPortConfigurationGeometrySet => { + self.execute_networking_switch_port_configuration_geometry_set(matches) + .await + } + CliCommand::NetworkingSwitchPortConfigurationInterfaceAddressList => { + self.execute_networking_switch_port_configuration_interface_address_list(matches) + .await + } + CliCommand::NetworkingSwitchPortConfigurationInterfaceAddressAdd => { + self.execute_networking_switch_port_configuration_interface_address_add(matches) + .await + } + CliCommand::NetworkingSwitchPortConfigurationInterfaceAddressRemove => { + self.execute_networking_switch_port_configuration_interface_address_remove(matches) + .await + } + CliCommand::NetworkingSwitchPortConfigurationInterfaceBgpPeerList => { + self.execute_networking_switch_port_configuration_interface_bgp_peer_list(matches) + .await + } + CliCommand::NetworkingSwitchPortConfigurationInterfaceBgpPeerAdd => { + self.execute_networking_switch_port_configuration_interface_bgp_peer_add(matches) + .await + } + CliCommand::NetworkingSwitchPortConfigurationInterfaceBgpPeerRemove => { + self.execute_networking_switch_port_configuration_interface_bgp_peer_remove(matches) .await } - CliCommand::NetworkingBgpStatus => self.execute_networking_bgp_status(matches).await, - CliCommand::NetworkingLoopbackAddressList => { - self.execute_networking_loopback_address_list(matches).await + CliCommand::NetworkingSwitchPortConfigurationInterfaceRouteList => { + self.execute_networking_switch_port_configuration_interface_route_list(matches) + .await } - CliCommand::NetworkingLoopbackAddressCreate => { - self.execute_networking_loopback_address_create(matches) + CliCommand::NetworkingSwitchPortConfigurationInterfaceRouteAdd => { + self.execute_networking_switch_port_configuration_interface_route_add(matches) .await } - CliCommand::NetworkingLoopbackAddressDelete => { - self.execute_networking_loopback_address_delete(matches) + CliCommand::NetworkingSwitchPortConfigurationInterfaceRouteRemove => { + self.execute_networking_switch_port_configuration_interface_route_remove(matches) .await } - CliCommand::NetworkingSwitchPortSettingsList => { - self.execute_networking_switch_port_settings_list(matches) + CliCommand::NetworkingSwitchPortConfigurationLinkList => { + self.execute_networking_switch_port_configuration_link_list(matches) .await } - CliCommand::NetworkingSwitchPortSettingsCreate => { - self.execute_networking_switch_port_settings_create(matches) + CliCommand::NetworkingSwitchPortConfigurationLinkCreate => { + self.execute_networking_switch_port_configuration_link_create(matches) .await } - CliCommand::NetworkingSwitchPortSettingsDelete => { - self.execute_networking_switch_port_settings_delete(matches) + CliCommand::NetworkingSwitchPortConfigurationLinkView => { + self.execute_networking_switch_port_configuration_link_view(matches) .await } - CliCommand::NetworkingSwitchPortSettingsView => { - self.execute_networking_switch_port_settings_view(matches) + CliCommand::NetworkingSwitchPortConfigurationLinkDelete => { + self.execute_networking_switch_port_configuration_link_delete(matches) .await } CliCommand::SystemPolicyView => self.execute_system_policy_view(matches).await, @@ -8418,31 +9420,291 @@ impl Cli { } } - pub async fn execute_instance_network_interface_list( - &self, - matches: &clap::ArgMatches, - ) -> anyhow::Result<()> { - let mut request = self.client.instance_network_interface_list(); - if let Some(value) = matches.get_one::("instance") { - request = request.instance(value.clone()); + pub async fn execute_instance_network_interface_list( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.instance_network_interface_list(); + if let Some(value) = matches.get_one::("instance") { + request = request.instance(value.clone()); + } + + if let Some(value) = matches.get_one::("limit") { + request = request.limit(value.clone()); + } + + if let Some(value) = matches.get_one::("project") { + request = request.project(value.clone()); + } + + if let Some(value) = matches.get_one::("sort-by") { + request = request.sort_by(value.clone()); + } + + self.config + .execute_instance_network_interface_list(matches, &mut request)?; + self.config + .list_start::(); + let mut stream = futures::StreamExt::take( + request.stream(), + matches + .get_one::("limit") + .map_or(usize::MAX, |x| x.get() as usize), + ); + loop { + match futures::TryStreamExt::try_next(&mut stream).await { + Err(r) => { + self.config.list_end_error(&r); + return Err(anyhow::Error::new(r)); + } + Ok(None) => { + self.config + .list_end_success::(); + return Ok(()); + } + Ok(Some(value)) => { + self.config.list_item(&value); + } + } + } + } + + pub async fn execute_instance_network_interface_create( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.instance_network_interface_create(); + if let Some(value) = matches.get_one::("description") { + request = request.body_map(|body| body.description(value.clone())) + } + + if let Some(value) = matches.get_one::("instance") { + request = request.instance(value.clone()); + } + + if let Some(value) = matches.get_one::("ip") { + request = request.body_map(|body| body.ip(value.clone())) + } + + if let Some(value) = matches.get_one::("name") { + request = request.body_map(|body| body.name(value.clone())) + } + + if let Some(value) = matches.get_one::("project") { + request = request.project(value.clone()); + } + + if let Some(value) = matches.get_one::("subnet-name") { + request = request.body_map(|body| body.subnet_name(value.clone())) + } + + if let Some(value) = matches.get_one::("vpc-name") { + request = request.body_map(|body| body.vpc_name(value.clone())) + } + + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = + serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); + } + + self.config + .execute_instance_network_interface_create(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) + } + } + } + + pub async fn execute_instance_network_interface_view( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.instance_network_interface_view(); + if let Some(value) = matches.get_one::("instance") { + request = request.instance(value.clone()); + } + + if let Some(value) = matches.get_one::("interface") { + request = request.interface(value.clone()); + } + + if let Some(value) = matches.get_one::("project") { + request = request.project(value.clone()); + } + + self.config + .execute_instance_network_interface_view(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) + } + } + } + + pub async fn execute_instance_network_interface_update( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.instance_network_interface_update(); + if let Some(value) = matches.get_one::("description") { + request = request.body_map(|body| body.description(value.clone())) + } + + if let Some(value) = matches.get_one::("instance") { + request = request.instance(value.clone()); + } + + if let Some(value) = matches.get_one::("interface") { + request = request.interface(value.clone()); + } + + if let Some(value) = matches.get_one::("name") { + request = request.body_map(|body| body.name(value.clone())) + } + + if let Some(value) = matches.get_one::("primary") { + request = request.body_map(|body| body.primary(value.clone())) + } + + if let Some(value) = matches.get_one::("project") { + request = request.project(value.clone()); + } + + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = + serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); + } + + self.config + .execute_instance_network_interface_update(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) + } + } + } + + pub async fn execute_instance_network_interface_delete( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.instance_network_interface_delete(); + if let Some(value) = matches.get_one::("instance") { + request = request.instance(value.clone()); + } + + if let Some(value) = matches.get_one::("interface") { + request = request.interface(value.clone()); + } + + if let Some(value) = matches.get_one::("project") { + request = request.project(value.clone()); + } + + self.config + .execute_instance_network_interface_delete(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_no_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) + } + } + } + + pub async fn execute_ping(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.ping(); + self.config.execute_ping(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) + } + } + } + + pub async fn execute_policy_view(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.policy_view(); + self.config.execute_policy_view(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) + } + } + } + + pub async fn execute_policy_update(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.policy_update(); + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); } - if let Some(value) = matches.get_one::("limit") { - request = request.limit(value.clone()); + self.config.execute_policy_update(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) + } } + } - if let Some(value) = matches.get_one::("project") { - request = request.project(value.clone()); + pub async fn execute_project_list(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.project_list(); + if let Some(value) = matches.get_one::("limit") { + request = request.limit(value.clone()); } if let Some(value) = matches.get_one::("sort-by") { request = request.sort_by(value.clone()); } - self.config - .execute_instance_network_interface_list(matches, &mut request)?; - self.config - .list_start::(); + self.config.execute_project_list(matches, &mut request)?; + self.config.list_start::(); let mut stream = futures::StreamExt::take( request.stream(), matches @@ -8456,8 +9718,7 @@ impl Cli { return Err(anyhow::Error::new(r)); } Ok(None) => { - self.config - .list_end_success::(); + self.config.list_end_success::(); return Ok(()); } Ok(Some(value)) => { @@ -8467,48 +9728,23 @@ impl Cli { } } - pub async fn execute_instance_network_interface_create( - &self, - matches: &clap::ArgMatches, - ) -> anyhow::Result<()> { - let mut request = self.client.instance_network_interface_create(); + pub async fn execute_project_create(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.project_create(); if let Some(value) = matches.get_one::("description") { request = request.body_map(|body| body.description(value.clone())) } - if let Some(value) = matches.get_one::("instance") { - request = request.instance(value.clone()); - } - - if let Some(value) = matches.get_one::("ip") { - request = request.body_map(|body| body.ip(value.clone())) - } - if let Some(value) = matches.get_one::("name") { request = request.body_map(|body| body.name(value.clone())) } - if let Some(value) = matches.get_one::("project") { - request = request.project(value.clone()); - } - - if let Some(value) = matches.get_one::("subnet-name") { - request = request.body_map(|body| body.subnet_name(value.clone())) - } - - if let Some(value) = matches.get_one::("vpc-name") { - request = request.body_map(|body| body.vpc_name(value.clone())) - } - if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = - serde_json::from_str::(&body_txt).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } - self.config - .execute_instance_network_interface_create(matches, &mut request)?; + self.config.execute_project_create(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -8522,25 +9758,13 @@ impl Cli { } } - pub async fn execute_instance_network_interface_view( - &self, - matches: &clap::ArgMatches, - ) -> anyhow::Result<()> { - let mut request = self.client.instance_network_interface_view(); - if let Some(value) = matches.get_one::("instance") { - request = request.instance(value.clone()); - } - - if let Some(value) = matches.get_one::("interface") { - request = request.interface(value.clone()); - } - + pub async fn execute_project_view(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.project_view(); if let Some(value) = matches.get_one::("project") { request = request.project(value.clone()); } - self.config - .execute_instance_network_interface_view(matches, &mut request)?; + self.config.execute_project_view(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -8554,44 +9778,27 @@ impl Cli { } } - pub async fn execute_instance_network_interface_update( - &self, - matches: &clap::ArgMatches, - ) -> anyhow::Result<()> { - let mut request = self.client.instance_network_interface_update(); + pub async fn execute_project_update(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.project_update(); if let Some(value) = matches.get_one::("description") { request = request.body_map(|body| body.description(value.clone())) } - if let Some(value) = matches.get_one::("instance") { - request = request.instance(value.clone()); - } - - if let Some(value) = matches.get_one::("interface") { - request = request.interface(value.clone()); - } - if let Some(value) = matches.get_one::("name") { request = request.body_map(|body| body.name(value.clone())) } - if let Some(value) = matches.get_one::("primary") { - request = request.body_map(|body| body.primary(value.clone())) - } - if let Some(value) = matches.get_one::("project") { request = request.project(value.clone()); } if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = - serde_json::from_str::(&body_txt).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } - self.config - .execute_instance_network_interface_update(matches, &mut request)?; + self.config.execute_project_update(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -8605,29 +9812,71 @@ impl Cli { } } - pub async fn execute_instance_network_interface_delete( + pub async fn execute_project_delete(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.project_delete(); + if let Some(value) = matches.get_one::("project") { + request = request.project(value.clone()); + } + + self.config.execute_project_delete(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_no_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) + } + } + } + + pub async fn execute_project_policy_view( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.instance_network_interface_delete(); - if let Some(value) = matches.get_one::("instance") { - request = request.instance(value.clone()); + let mut request = self.client.project_policy_view(); + if let Some(value) = matches.get_one::("project") { + request = request.project(value.clone()); } - if let Some(value) = matches.get_one::("interface") { - request = request.interface(value.clone()); + self.config + .execute_project_policy_view(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) + } } + } + pub async fn execute_project_policy_update( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.project_policy_update(); if let Some(value) = matches.get_one::("project") { request = request.project(value.clone()); } + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); + } + self.config - .execute_instance_network_interface_delete(matches, &mut request)?; + .execute_project_policy_update(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_no_item(&r); + self.config.success_item(&r); Ok(()) } Err(r) => { @@ -8637,9 +9886,70 @@ impl Cli { } } - pub async fn execute_ping(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.ping(); - self.config.execute_ping(matches, &mut request)?; + pub async fn execute_snapshot_list(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.snapshot_list(); + if let Some(value) = matches.get_one::("limit") { + request = request.limit(value.clone()); + } + + if let Some(value) = matches.get_one::("project") { + request = request.project(value.clone()); + } + + if let Some(value) = matches.get_one::("sort-by") { + request = request.sort_by(value.clone()); + } + + self.config.execute_snapshot_list(matches, &mut request)?; + self.config.list_start::(); + let mut stream = futures::StreamExt::take( + request.stream(), + matches + .get_one::("limit") + .map_or(usize::MAX, |x| x.get() as usize), + ); + loop { + match futures::TryStreamExt::try_next(&mut stream).await { + Err(r) => { + self.config.list_end_error(&r); + return Err(anyhow::Error::new(r)); + } + Ok(None) => { + self.config.list_end_success::(); + return Ok(()); + } + Ok(Some(value)) => { + self.config.list_item(&value); + } + } + } + } + + pub async fn execute_snapshot_create(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.snapshot_create(); + if let Some(value) = matches.get_one::("description") { + request = request.body_map(|body| body.description(value.clone())) + } + + if let Some(value) = matches.get_one::("disk") { + request = request.body_map(|body| body.disk(value.clone())) + } + + if let Some(value) = matches.get_one::("name") { + request = request.body_map(|body| body.name(value.clone())) + } + + if let Some(value) = matches.get_one::("project") { + request = request.project(value.clone()); + } + + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); + } + + self.config.execute_snapshot_create(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -8651,11 +9961,19 @@ impl Cli { Err(anyhow::Error::new(r)) } } - } + } + + pub async fn execute_snapshot_view(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.snapshot_view(); + if let Some(value) = matches.get_one::("project") { + request = request.project(value.clone()); + } - pub async fn execute_policy_view(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.policy_view(); - self.config.execute_policy_view(matches, &mut request)?; + if let Some(value) = matches.get_one::("snapshot") { + request = request.snapshot(value.clone()); + } + + self.config.execute_snapshot_view(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -8669,19 +9987,21 @@ impl Cli { } } - pub async fn execute_policy_update(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.policy_update(); - if let Some(value) = matches.get_one::("json-body") { - let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); - request = request.body(body_value); + pub async fn execute_snapshot_delete(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.snapshot_delete(); + if let Some(value) = matches.get_one::("project") { + request = request.project(value.clone()); } - self.config.execute_policy_update(matches, &mut request)?; + if let Some(value) = matches.get_one::("snapshot") { + request = request.snapshot(value.clone()); + } + + self.config.execute_snapshot_delete(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_item(&r); + self.config.success_no_item(&r); Ok(()) } Err(r) => { @@ -8691,18 +10011,22 @@ impl Cli { } } - pub async fn execute_project_list(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.project_list(); + pub async fn execute_physical_disk_list( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.physical_disk_list(); if let Some(value) = matches.get_one::("limit") { request = request.limit(value.clone()); } - if let Some(value) = matches.get_one::("sort-by") { + if let Some(value) = matches.get_one::("sort-by") { request = request.sort_by(value.clone()); } - self.config.execute_project_list(matches, &mut request)?; - self.config.list_start::(); + self.config + .execute_physical_disk_list(matches, &mut request)?; + self.config.list_start::(); let mut stream = futures::StreamExt::take( request.stream(), matches @@ -8716,7 +10040,8 @@ impl Cli { return Err(anyhow::Error::new(r)); } Ok(None) => { - self.config.list_end_success::(); + self.config + .list_end_success::(); return Ok(()); } Ok(Some(value)) => { @@ -8726,23 +10051,17 @@ impl Cli { } } - pub async fn execute_project_create(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.project_create(); - if let Some(value) = matches.get_one::("description") { - request = request.body_map(|body| body.description(value.clone())) - } - - if let Some(value) = matches.get_one::("name") { - request = request.body_map(|body| body.name(value.clone())) - } - - if let Some(value) = matches.get_one::("json-body") { - let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); - request = request.body(body_value); + pub async fn execute_physical_disk_view( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.physical_disk_view(); + if let Some(value) = matches.get_one::("disk-id") { + request = request.disk_id(value.clone()); } - self.config.execute_project_create(matches, &mut request)?; + self.config + .execute_physical_disk_view(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -8756,13 +10075,48 @@ impl Cli { } } - pub async fn execute_project_view(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.project_view(); - if let Some(value) = matches.get_one::("project") { - request = request.project(value.clone()); + pub async fn execute_rack_list(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.rack_list(); + if let Some(value) = matches.get_one::("limit") { + request = request.limit(value.clone()); } - self.config.execute_project_view(matches, &mut request)?; + if let Some(value) = matches.get_one::("sort-by") { + request = request.sort_by(value.clone()); + } + + self.config.execute_rack_list(matches, &mut request)?; + self.config.list_start::(); + let mut stream = futures::StreamExt::take( + request.stream(), + matches + .get_one::("limit") + .map_or(usize::MAX, |x| x.get() as usize), + ); + loop { + match futures::TryStreamExt::try_next(&mut stream).await { + Err(r) => { + self.config.list_end_error(&r); + return Err(anyhow::Error::new(r)); + } + Ok(None) => { + self.config.list_end_success::(); + return Ok(()); + } + Ok(Some(value)) => { + self.config.list_item(&value); + } + } + } + } + + pub async fn execute_rack_view(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.rack_view(); + if let Some(value) = matches.get_one::("rack-id") { + request = request.rack_id(value.clone()); + } + + self.config.execute_rack_view(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -8776,27 +10130,58 @@ impl Cli { } } - pub async fn execute_project_update(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.project_update(); - if let Some(value) = matches.get_one::("description") { - request = request.body_map(|body| body.description(value.clone())) + pub async fn execute_sled_list(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.sled_list(); + if let Some(value) = matches.get_one::("limit") { + request = request.limit(value.clone()); } - if let Some(value) = matches.get_one::("name") { - request = request.body_map(|body| body.name(value.clone())) + if let Some(value) = matches.get_one::("sort-by") { + request = request.sort_by(value.clone()); } - if let Some(value) = matches.get_one::("project") { - request = request.project(value.clone()); + self.config.execute_sled_list(matches, &mut request)?; + self.config.list_start::(); + let mut stream = futures::StreamExt::take( + request.stream(), + matches + .get_one::("limit") + .map_or(usize::MAX, |x| x.get() as usize), + ); + loop { + match futures::TryStreamExt::try_next(&mut stream).await { + Err(r) => { + self.config.list_end_error(&r); + return Err(anyhow::Error::new(r)); + } + Ok(None) => { + self.config.list_end_success::(); + return Ok(()); + } + Ok(Some(value)) => { + self.config.list_item(&value); + } + } + } + } + + pub async fn execute_sled_add(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.sled_add(); + if let Some(value) = matches.get_one::("part") { + request = request.body_map(|body| body.part(value.clone())) + } + + if let Some(value) = matches.get_one::("serial") { + request = request.body_map(|body| body.serial(value.clone())) } if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } - self.config.execute_project_update(matches, &mut request)?; + self.config.execute_sled_add(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -8810,17 +10195,17 @@ impl Cli { } } - pub async fn execute_project_delete(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.project_delete(); - if let Some(value) = matches.get_one::("project") { - request = request.project(value.clone()); + pub async fn execute_sled_view(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.sled_view(); + if let Some(value) = matches.get_one::("sled-id") { + request = request.sled_id(value.clone()); } - self.config.execute_project_delete(matches, &mut request)?; + self.config.execute_sled_view(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_no_item(&r); + self.config.success_item(&r); Ok(()) } Err(r) => { @@ -8830,47 +10215,116 @@ impl Cli { } } - pub async fn execute_project_policy_view( + pub async fn execute_sled_physical_disk_list( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.project_policy_view(); - if let Some(value) = matches.get_one::("project") { - request = request.project(value.clone()); + let mut request = self.client.sled_physical_disk_list(); + if let Some(value) = matches.get_one::("limit") { + request = request.limit(value.clone()); + } + + if let Some(value) = matches.get_one::("sled-id") { + request = request.sled_id(value.clone()); + } + + if let Some(value) = matches.get_one::("sort-by") { + request = request.sort_by(value.clone()); } self.config - .execute_project_policy_view(matches, &mut request)?; - let result = request.send().await; - match result { - Ok(r) => { - self.config.success_item(&r); - Ok(()) + .execute_sled_physical_disk_list(matches, &mut request)?; + self.config.list_start::(); + let mut stream = futures::StreamExt::take( + request.stream(), + matches + .get_one::("limit") + .map_or(usize::MAX, |x| x.get() as usize), + ); + loop { + match futures::TryStreamExt::try_next(&mut stream).await { + Err(r) => { + self.config.list_end_error(&r); + return Err(anyhow::Error::new(r)); + } + Ok(None) => { + self.config + .list_end_success::(); + return Ok(()); + } + Ok(Some(value)) => { + self.config.list_item(&value); + } } - Err(r) => { - self.config.error(&r); - Err(anyhow::Error::new(r)) + } + } + + pub async fn execute_sled_instance_list( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.sled_instance_list(); + if let Some(value) = matches.get_one::("limit") { + request = request.limit(value.clone()); + } + + if let Some(value) = matches.get_one::("sled-id") { + request = request.sled_id(value.clone()); + } + + if let Some(value) = matches.get_one::("sort-by") { + request = request.sort_by(value.clone()); + } + + self.config + .execute_sled_instance_list(matches, &mut request)?; + self.config.list_start::(); + let mut stream = futures::StreamExt::take( + request.stream(), + matches + .get_one::("limit") + .map_or(usize::MAX, |x| x.get() as usize), + ); + loop { + match futures::TryStreamExt::try_next(&mut stream).await { + Err(r) => { + self.config.list_end_error(&r); + return Err(anyhow::Error::new(r)); + } + Ok(None) => { + self.config + .list_end_success::(); + return Ok(()); + } + Ok(Some(value)) => { + self.config.list_item(&value); + } } } } - pub async fn execute_project_policy_update( + pub async fn execute_sled_set_provision_policy( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.project_policy_update(); - if let Some(value) = matches.get_one::("project") { - request = request.project(value.clone()); + let mut request = self.client.sled_set_provision_policy(); + if let Some(value) = matches.get_one::("sled-id") { + request = request.sled_id(value.clone()); + } + + if let Some(value) = matches.get_one::("state") { + request = request.body_map(|body| body.state(value.clone())) } if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); + let body_value = + serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } self.config - .execute_project_policy_update(matches, &mut request)?; + .execute_sled_set_provision_policy(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -8884,22 +10338,63 @@ impl Cli { } } - pub async fn execute_snapshot_list(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.snapshot_list(); + pub async fn execute_sled_list_uninitialized( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.sled_list_uninitialized(); if let Some(value) = matches.get_one::("limit") { request = request.limit(value.clone()); } - if let Some(value) = matches.get_one::("project") { - request = request.project(value.clone()); + self.config + .execute_sled_list_uninitialized(matches, &mut request)?; + self.config + .list_start::(); + let mut stream = futures::StreamExt::take( + request.stream(), + matches + .get_one::("limit") + .map_or(usize::MAX, |x| x.get() as usize), + ); + loop { + match futures::TryStreamExt::try_next(&mut stream).await { + Err(r) => { + self.config.list_end_error(&r); + return Err(anyhow::Error::new(r)); + } + Ok(None) => { + self.config + .list_end_success::(); + return Ok(()); + } + Ok(Some(value)) => { + self.config.list_item(&value); + } + } } + } - if let Some(value) = matches.get_one::("sort-by") { + pub async fn execute_networking_switch_port_list( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.networking_switch_port_list(); + if let Some(value) = matches.get_one::("limit") { + request = request.limit(value.clone()); + } + + if let Some(value) = matches.get_one::("sort-by") { request = request.sort_by(value.clone()); } - self.config.execute_snapshot_list(matches, &mut request)?; - self.config.list_start::(); + if let Some(value) = matches.get_one::("switch-port-id") { + request = request.switch_port_id(value.clone()); + } + + self.config + .execute_networking_switch_port_list(matches, &mut request)?; + self.config.list_start::(); let mut stream = futures::StreamExt::take( request.stream(), matches @@ -8913,7 +10408,8 @@ impl Cli { return Err(anyhow::Error::new(r)); } Ok(None) => { - self.config.list_end_success::(); + self.config + .list_end_success::(); return Ok(()); } Ok(Some(value)) => { @@ -8923,35 +10419,40 @@ impl Cli { } } - pub async fn execute_snapshot_create(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.snapshot_create(); - if let Some(value) = matches.get_one::("description") { - request = request.body_map(|body| body.description(value.clone())) + pub async fn execute_networking_switch_port_apply_settings( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.networking_switch_port_apply_settings(); + if let Some(value) = matches.get_one::("port") { + request = request.port(value.clone()); } - if let Some(value) = matches.get_one::("disk") { - request = request.body_map(|body| body.disk(value.clone())) + if let Some(value) = matches.get_one::("port-settings") { + request = request.body_map(|body| body.port_settings(value.clone())) } - if let Some(value) = matches.get_one::("name") { - request = request.body_map(|body| body.name(value.clone())) + if let Some(value) = matches.get_one::("rack-id") { + request = request.rack_id(value.clone()); } - if let Some(value) = matches.get_one::("project") { - request = request.project(value.clone()); + if let Some(value) = matches.get_one::("switch-location") { + request = request.switch_location(value.clone()); } if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); + let body_value = + serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } - self.config.execute_snapshot_create(matches, &mut request)?; + self.config + .execute_networking_switch_port_apply_settings(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_item(&r); + self.config.success_no_item(&r); Ok(()) } Err(r) => { @@ -8961,41 +10462,25 @@ impl Cli { } } - pub async fn execute_snapshot_view(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.snapshot_view(); - if let Some(value) = matches.get_one::("project") { - request = request.project(value.clone()); - } - - if let Some(value) = matches.get_one::("snapshot") { - request = request.snapshot(value.clone()); - } - - self.config.execute_snapshot_view(matches, &mut request)?; - let result = request.send().await; - match result { - Ok(r) => { - self.config.success_item(&r); - Ok(()) - } - Err(r) => { - self.config.error(&r); - Err(anyhow::Error::new(r)) - } + pub async fn execute_networking_switch_port_clear_settings( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.networking_switch_port_clear_settings(); + if let Some(value) = matches.get_one::("port") { + request = request.port(value.clone()); } - } - pub async fn execute_snapshot_delete(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.snapshot_delete(); - if let Some(value) = matches.get_one::("project") { - request = request.project(value.clone()); + if let Some(value) = matches.get_one::("rack-id") { + request = request.rack_id(value.clone()); } - if let Some(value) = matches.get_one::("snapshot") { - request = request.snapshot(value.clone()); + if let Some(value) = matches.get_one::("switch-location") { + request = request.switch_location(value.clone()); } - self.config.execute_snapshot_delete(matches, &mut request)?; + self.config + .execute_networking_switch_port_clear_settings(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -9009,57 +10494,25 @@ impl Cli { } } - pub async fn execute_physical_disk_list( + pub async fn execute_networking_switch_port_status( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.physical_disk_list(); - if let Some(value) = matches.get_one::("limit") { - request = request.limit(value.clone()); - } - - if let Some(value) = matches.get_one::("sort-by") { - request = request.sort_by(value.clone()); + let mut request = self.client.networking_switch_port_status(); + if let Some(value) = matches.get_one::("port") { + request = request.port(value.clone()); } - self.config - .execute_physical_disk_list(matches, &mut request)?; - self.config.list_start::(); - let mut stream = futures::StreamExt::take( - request.stream(), - matches - .get_one::("limit") - .map_or(usize::MAX, |x| x.get() as usize), - ); - loop { - match futures::TryStreamExt::try_next(&mut stream).await { - Err(r) => { - self.config.list_end_error(&r); - return Err(anyhow::Error::new(r)); - } - Ok(None) => { - self.config - .list_end_success::(); - return Ok(()); - } - Ok(Some(value)) => { - self.config.list_item(&value); - } - } + if let Some(value) = matches.get_one::("rack-id") { + request = request.rack_id(value.clone()); } - } - pub async fn execute_physical_disk_view( - &self, - matches: &clap::ArgMatches, - ) -> anyhow::Result<()> { - let mut request = self.client.physical_disk_view(); - if let Some(value) = matches.get_one::("disk-id") { - request = request.disk_id(value.clone()); + if let Some(value) = matches.get_one::("switch-location") { + request = request.switch_location(value.clone()); } self.config - .execute_physical_disk_view(matches, &mut request)?; + .execute_networking_switch_port_status(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -9073,8 +10526,8 @@ impl Cli { } } - pub async fn execute_rack_list(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.rack_list(); + pub async fn execute_switch_list(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.switch_list(); if let Some(value) = matches.get_one::("limit") { request = request.limit(value.clone()); } @@ -9083,8 +10536,8 @@ impl Cli { request = request.sort_by(value.clone()); } - self.config.execute_rack_list(matches, &mut request)?; - self.config.list_start::(); + self.config.execute_switch_list(matches, &mut request)?; + self.config.list_start::(); let mut stream = futures::StreamExt::take( request.stream(), matches @@ -9098,7 +10551,7 @@ impl Cli { return Err(anyhow::Error::new(r)); } Ok(None) => { - self.config.list_end_success::(); + self.config.list_end_success::(); return Ok(()); } Ok(Some(value)) => { @@ -9108,13 +10561,13 @@ impl Cli { } } - pub async fn execute_rack_view(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.rack_view(); - if let Some(value) = matches.get_one::("rack-id") { - request = request.rack_id(value.clone()); + pub async fn execute_switch_view(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.switch_view(); + if let Some(value) = matches.get_one::("switch-id") { + request = request.switch_id(value.clone()); } - self.config.execute_rack_view(matches, &mut request)?; + self.config.execute_switch_view(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -9128,18 +10581,27 @@ impl Cli { } } - pub async fn execute_sled_list(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.sled_list(); + pub async fn execute_silo_identity_provider_list( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.silo_identity_provider_list(); if let Some(value) = matches.get_one::("limit") { request = request.limit(value.clone()); } - if let Some(value) = matches.get_one::("sort-by") { + if let Some(value) = matches.get_one::("silo") { + request = request.silo(value.clone()); + } + + if let Some(value) = matches.get_one::("sort-by") { request = request.sort_by(value.clone()); } - self.config.execute_sled_list(matches, &mut request)?; - self.config.list_start::(); + self.config + .execute_silo_identity_provider_list(matches, &mut request)?; + self.config + .list_start::(); let mut stream = futures::StreamExt::take( request.stream(), matches @@ -9153,7 +10615,8 @@ impl Cli { return Err(anyhow::Error::new(r)); } Ok(None) => { - self.config.list_end_success::(); + self.config + .list_end_success::(); return Ok(()); } Ok(Some(value)) => { @@ -9161,25 +10624,29 @@ impl Cli { } } } - } - - pub async fn execute_sled_add(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.sled_add(); - if let Some(value) = matches.get_one::("part") { - request = request.body_map(|body| body.part(value.clone())) + } + + pub async fn execute_local_idp_user_create( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.local_idp_user_create(); + if let Some(value) = matches.get_one::("external-id") { + request = request.body_map(|body| body.external_id(value.clone())) } - if let Some(value) = matches.get_one::("serial") { - request = request.body_map(|body| body.serial(value.clone())) + if let Some(value) = matches.get_one::("silo") { + request = request.silo(value.clone()); } if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } - self.config.execute_sled_add(matches, &mut request)?; + self.config + .execute_local_idp_user_create(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -9193,17 +10660,25 @@ impl Cli { } } - pub async fn execute_sled_view(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.sled_view(); - if let Some(value) = matches.get_one::("sled-id") { - request = request.sled_id(value.clone()); + pub async fn execute_local_idp_user_delete( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.local_idp_user_delete(); + if let Some(value) = matches.get_one::("silo") { + request = request.silo(value.clone()); } - self.config.execute_sled_view(matches, &mut request)?; + if let Some(value) = matches.get_one::("user-id") { + request = request.user_id(value.clone()); + } + + self.config + .execute_local_idp_user_delete(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_item(&r); + self.config.success_no_item(&r); Ok(()) } Err(r) => { @@ -9213,116 +10688,90 @@ impl Cli { } } - pub async fn execute_sled_physical_disk_list( + pub async fn execute_local_idp_user_set_password( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.sled_physical_disk_list(); - if let Some(value) = matches.get_one::("limit") { - request = request.limit(value.clone()); + let mut request = self.client.local_idp_user_set_password(); + if let Some(value) = matches.get_one::("silo") { + request = request.silo(value.clone()); } - if let Some(value) = matches.get_one::("sled-id") { - request = request.sled_id(value.clone()); + if let Some(value) = matches.get_one::("user-id") { + request = request.user_id(value.clone()); } - if let Some(value) = matches.get_one::("sort-by") { - request = request.sort_by(value.clone()); + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); } self.config - .execute_sled_physical_disk_list(matches, &mut request)?; - self.config.list_start::(); - let mut stream = futures::StreamExt::take( - request.stream(), - matches - .get_one::("limit") - .map_or(usize::MAX, |x| x.get() as usize), - ); - loop { - match futures::TryStreamExt::try_next(&mut stream).await { - Err(r) => { - self.config.list_end_error(&r); - return Err(anyhow::Error::new(r)); - } - Ok(None) => { - self.config - .list_end_success::(); - return Ok(()); - } - Ok(Some(value)) => { - self.config.list_item(&value); - } + .execute_local_idp_user_set_password(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_no_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) } } } - pub async fn execute_sled_instance_list( + pub async fn execute_saml_identity_provider_create( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.sled_instance_list(); - if let Some(value) = matches.get_one::("limit") { - request = request.limit(value.clone()); + let mut request = self.client.saml_identity_provider_create(); + if let Some(value) = matches.get_one::("acs-url") { + request = request.body_map(|body| body.acs_url(value.clone())) } - if let Some(value) = matches.get_one::("sled-id") { - request = request.sled_id(value.clone()); + if let Some(value) = matches.get_one::("description") { + request = request.body_map(|body| body.description(value.clone())) } - if let Some(value) = matches.get_one::("sort-by") { - request = request.sort_by(value.clone()); + if let Some(value) = matches.get_one::("group-attribute-name") { + request = request.body_map(|body| body.group_attribute_name(value.clone())) } - self.config - .execute_sled_instance_list(matches, &mut request)?; - self.config.list_start::(); - let mut stream = futures::StreamExt::take( - request.stream(), - matches - .get_one::("limit") - .map_or(usize::MAX, |x| x.get() as usize), - ); - loop { - match futures::TryStreamExt::try_next(&mut stream).await { - Err(r) => { - self.config.list_end_error(&r); - return Err(anyhow::Error::new(r)); - } - Ok(None) => { - self.config - .list_end_success::(); - return Ok(()); - } - Ok(Some(value)) => { - self.config.list_item(&value); - } - } + if let Some(value) = matches.get_one::("idp-entity-id") { + request = request.body_map(|body| body.idp_entity_id(value.clone())) } - } - pub async fn execute_sled_set_provision_policy( - &self, - matches: &clap::ArgMatches, - ) -> anyhow::Result<()> { - let mut request = self.client.sled_set_provision_policy(); - if let Some(value) = matches.get_one::("sled-id") { - request = request.sled_id(value.clone()); + if let Some(value) = matches.get_one::("name") { + request = request.body_map(|body| body.name(value.clone())) } - if let Some(value) = matches.get_one::("state") { - request = request.body_map(|body| body.state(value.clone())) + if let Some(value) = matches.get_one::("silo") { + request = request.silo(value.clone()); + } + + if let Some(value) = matches.get_one::("slo-url") { + request = request.body_map(|body| body.slo_url(value.clone())) + } + + if let Some(value) = matches.get_one::("sp-client-id") { + request = request.body_map(|body| body.sp_client_id(value.clone())) + } + + if let Some(value) = matches.get_one::("technical-contact-email") { + request = request.body_map(|body| body.technical_contact_email(value.clone())) } if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); let body_value = - serde_json::from_str::(&body_txt).unwrap(); + serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } self.config - .execute_sled_set_provision_policy(matches, &mut request)?; + .execute_saml_identity_provider_create(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -9336,63 +10785,46 @@ impl Cli { } } - pub async fn execute_sled_list_uninitialized( + pub async fn execute_saml_identity_provider_view( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.sled_list_uninitialized(); - if let Some(value) = matches.get_one::("limit") { - request = request.limit(value.clone()); + let mut request = self.client.saml_identity_provider_view(); + if let Some(value) = matches.get_one::("provider") { + request = request.provider(value.clone()); + } + + if let Some(value) = matches.get_one::("silo") { + request = request.silo(value.clone()); } self.config - .execute_sled_list_uninitialized(matches, &mut request)?; - self.config - .list_start::(); - let mut stream = futures::StreamExt::take( - request.stream(), - matches - .get_one::("limit") - .map_or(usize::MAX, |x| x.get() as usize), - ); - loop { - match futures::TryStreamExt::try_next(&mut stream).await { - Err(r) => { - self.config.list_end_error(&r); - return Err(anyhow::Error::new(r)); - } - Ok(None) => { - self.config - .list_end_success::(); - return Ok(()); - } - Ok(Some(value)) => { - self.config.list_item(&value); - } + .execute_saml_identity_provider_view(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) } } } - pub async fn execute_networking_switch_port_list( - &self, - matches: &clap::ArgMatches, - ) -> anyhow::Result<()> { - let mut request = self.client.networking_switch_port_list(); + pub async fn execute_ip_pool_list(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.ip_pool_list(); if let Some(value) = matches.get_one::("limit") { request = request.limit(value.clone()); } - if let Some(value) = matches.get_one::("sort-by") { + if let Some(value) = matches.get_one::("sort-by") { request = request.sort_by(value.clone()); } - if let Some(value) = matches.get_one::("switch-port-id") { - request = request.switch_port_id(value.clone()); - } - - self.config - .execute_networking_switch_port_list(matches, &mut request)?; - self.config.list_start::(); + self.config.execute_ip_pool_list(matches, &mut request)?; + self.config.list_start::(); let mut stream = futures::StreamExt::take( request.stream(), matches @@ -9406,8 +10838,7 @@ impl Cli { return Err(anyhow::Error::new(r)); } Ok(None) => { - self.config - .list_end_success::(); + self.config.list_end_success::(); return Ok(()); } Ok(Some(value)) => { @@ -9417,40 +10848,27 @@ impl Cli { } } - pub async fn execute_networking_switch_port_apply_settings( - &self, - matches: &clap::ArgMatches, - ) -> anyhow::Result<()> { - let mut request = self.client.networking_switch_port_apply_settings(); - if let Some(value) = matches.get_one::("port") { - request = request.port(value.clone()); - } - - if let Some(value) = matches.get_one::("port-settings") { - request = request.body_map(|body| body.port_settings(value.clone())) - } - - if let Some(value) = matches.get_one::("rack-id") { - request = request.rack_id(value.clone()); + pub async fn execute_ip_pool_create(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.ip_pool_create(); + if let Some(value) = matches.get_one::("description") { + request = request.body_map(|body| body.description(value.clone())) } - if let Some(value) = matches.get_one::("switch-location") { - request = request.switch_location(value.clone()); + if let Some(value) = matches.get_one::("name") { + request = request.body_map(|body| body.name(value.clone())) } if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = - serde_json::from_str::(&body_txt).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } - self.config - .execute_networking_switch_port_apply_settings(matches, &mut request)?; + self.config.execute_ip_pool_create(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_no_item(&r); + self.config.success_item(&r); Ok(()) } Err(r) => { @@ -9460,29 +10878,17 @@ impl Cli { } } - pub async fn execute_networking_switch_port_clear_settings( - &self, - matches: &clap::ArgMatches, - ) -> anyhow::Result<()> { - let mut request = self.client.networking_switch_port_clear_settings(); - if let Some(value) = matches.get_one::("port") { - request = request.port(value.clone()); - } - - if let Some(value) = matches.get_one::("rack-id") { - request = request.rack_id(value.clone()); - } - - if let Some(value) = matches.get_one::("switch-location") { - request = request.switch_location(value.clone()); + pub async fn execute_ip_pool_view(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.ip_pool_view(); + if let Some(value) = matches.get_one::("pool") { + request = request.pool(value.clone()); } - self.config - .execute_networking_switch_port_clear_settings(matches, &mut request)?; + self.config.execute_ip_pool_view(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_no_item(&r); + self.config.success_item(&r); Ok(()) } Err(r) => { @@ -9492,25 +10898,27 @@ impl Cli { } } - pub async fn execute_networking_switch_port_status( - &self, - matches: &clap::ArgMatches, - ) -> anyhow::Result<()> { - let mut request = self.client.networking_switch_port_status(); - if let Some(value) = matches.get_one::("port") { - request = request.port(value.clone()); + pub async fn execute_ip_pool_update(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.ip_pool_update(); + if let Some(value) = matches.get_one::("description") { + request = request.body_map(|body| body.description(value.clone())) } - if let Some(value) = matches.get_one::("rack-id") { - request = request.rack_id(value.clone()); + if let Some(value) = matches.get_one::("name") { + request = request.body_map(|body| body.name(value.clone())) } - if let Some(value) = matches.get_one::("switch-location") { - request = request.switch_location(value.clone()); + if let Some(value) = matches.get_one::("pool") { + request = request.pool(value.clone()); } - self.config - .execute_networking_switch_port_status(matches, &mut request)?; + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); + } + + self.config.execute_ip_pool_update(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -9524,52 +10932,17 @@ impl Cli { } } - pub async fn execute_switch_list(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.switch_list(); - if let Some(value) = matches.get_one::("limit") { - request = request.limit(value.clone()); - } - - if let Some(value) = matches.get_one::("sort-by") { - request = request.sort_by(value.clone()); - } - - self.config.execute_switch_list(matches, &mut request)?; - self.config.list_start::(); - let mut stream = futures::StreamExt::take( - request.stream(), - matches - .get_one::("limit") - .map_or(usize::MAX, |x| x.get() as usize), - ); - loop { - match futures::TryStreamExt::try_next(&mut stream).await { - Err(r) => { - self.config.list_end_error(&r); - return Err(anyhow::Error::new(r)); - } - Ok(None) => { - self.config.list_end_success::(); - return Ok(()); - } - Ok(Some(value)) => { - self.config.list_item(&value); - } - } - } - } - - pub async fn execute_switch_view(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.switch_view(); - if let Some(value) = matches.get_one::("switch-id") { - request = request.switch_id(value.clone()); + pub async fn execute_ip_pool_delete(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.ip_pool_delete(); + if let Some(value) = matches.get_one::("pool") { + request = request.pool(value.clone()); } - self.config.execute_switch_view(matches, &mut request)?; + self.config.execute_ip_pool_delete(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_item(&r); + self.config.success_no_item(&r); Ok(()) } Err(r) => { @@ -9579,27 +10952,22 @@ impl Cli { } } - pub async fn execute_silo_identity_provider_list( + pub async fn execute_ip_pool_range_list( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.silo_identity_provider_list(); + let mut request = self.client.ip_pool_range_list(); if let Some(value) = matches.get_one::("limit") { request = request.limit(value.clone()); } - if let Some(value) = matches.get_one::("silo") { - request = request.silo(value.clone()); - } - - if let Some(value) = matches.get_one::("sort-by") { - request = request.sort_by(value.clone()); + if let Some(value) = matches.get_one::("pool") { + request = request.pool(value.clone()); } self.config - .execute_silo_identity_provider_list(matches, &mut request)?; - self.config - .list_start::(); + .execute_ip_pool_range_list(matches, &mut request)?; + self.config.list_start::(); let mut stream = futures::StreamExt::take( request.stream(), matches @@ -9614,7 +10982,7 @@ impl Cli { } Ok(None) => { self.config - .list_end_success::(); + .list_end_success::(); return Ok(()); } Ok(Some(value)) => { @@ -9624,27 +10992,23 @@ impl Cli { } } - pub async fn execute_local_idp_user_create( + pub async fn execute_ip_pool_range_add( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.local_idp_user_create(); - if let Some(value) = matches.get_one::("external-id") { - request = request.body_map(|body| body.external_id(value.clone())) - } - - if let Some(value) = matches.get_one::("silo") { - request = request.silo(value.clone()); + let mut request = self.client.ip_pool_range_add(); + if let Some(value) = matches.get_one::("pool") { + request = request.pool(value.clone()); } if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } self.config - .execute_local_idp_user_create(matches, &mut request)?; + .execute_ip_pool_range_add(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -9658,21 +11022,23 @@ impl Cli { } } - pub async fn execute_local_idp_user_delete( + pub async fn execute_ip_pool_range_remove( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.local_idp_user_delete(); - if let Some(value) = matches.get_one::("silo") { - request = request.silo(value.clone()); + let mut request = self.client.ip_pool_range_remove(); + if let Some(value) = matches.get_one::("pool") { + request = request.pool(value.clone()); } - if let Some(value) = matches.get_one::("user-id") { - request = request.user_id(value.clone()); + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); } self.config - .execute_local_idp_user_delete(matches, &mut request)?; + .execute_ip_pool_range_remove(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -9686,31 +11052,79 @@ impl Cli { } } - pub async fn execute_local_idp_user_set_password( + pub async fn execute_ip_pool_silo_list( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.local_idp_user_set_password(); - if let Some(value) = matches.get_one::("silo") { - request = request.silo(value.clone()); + let mut request = self.client.ip_pool_silo_list(); + if let Some(value) = matches.get_one::("limit") { + request = request.limit(value.clone()); } - if let Some(value) = matches.get_one::("user-id") { - request = request.user_id(value.clone()); + if let Some(value) = matches.get_one::("pool") { + request = request.pool(value.clone()); + } + + if let Some(value) = matches.get_one::("sort-by") { + request = request.sort_by(value.clone()); + } + + self.config + .execute_ip_pool_silo_list(matches, &mut request)?; + self.config.list_start::(); + let mut stream = futures::StreamExt::take( + request.stream(), + matches + .get_one::("limit") + .map_or(usize::MAX, |x| x.get() as usize), + ); + loop { + match futures::TryStreamExt::try_next(&mut stream).await { + Err(r) => { + self.config.list_end_error(&r); + return Err(anyhow::Error::new(r)); + } + Ok(None) => { + self.config + .list_end_success::(); + return Ok(()); + } + Ok(Some(value)) => { + self.config.list_item(&value); + } + } + } + } + + pub async fn execute_ip_pool_silo_link( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.ip_pool_silo_link(); + if let Some(value) = matches.get_one::("is-default") { + request = request.body_map(|body| body.is_default(value.clone())) + } + + if let Some(value) = matches.get_one::("pool") { + request = request.pool(value.clone()); + } + + if let Some(value) = matches.get_one::("silo") { + request = request.body_map(|body| body.silo(value.clone())) } if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } self.config - .execute_local_idp_user_set_password(matches, &mut request)?; + .execute_ip_pool_silo_link(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_no_item(&r); + self.config.success_item(&r); Ok(()) } Err(r) => { @@ -9720,56 +11134,31 @@ impl Cli { } } - pub async fn execute_saml_identity_provider_create( + pub async fn execute_ip_pool_silo_update( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.saml_identity_provider_create(); - if let Some(value) = matches.get_one::("acs-url") { - request = request.body_map(|body| body.acs_url(value.clone())) - } - - if let Some(value) = matches.get_one::("description") { - request = request.body_map(|body| body.description(value.clone())) - } - - if let Some(value) = matches.get_one::("group-attribute-name") { - request = request.body_map(|body| body.group_attribute_name(value.clone())) - } - - if let Some(value) = matches.get_one::("idp-entity-id") { - request = request.body_map(|body| body.idp_entity_id(value.clone())) - } - - if let Some(value) = matches.get_one::("name") { - request = request.body_map(|body| body.name(value.clone())) - } - - if let Some(value) = matches.get_one::("silo") { - request = request.silo(value.clone()); - } - - if let Some(value) = matches.get_one::("slo-url") { - request = request.body_map(|body| body.slo_url(value.clone())) + let mut request = self.client.ip_pool_silo_update(); + if let Some(value) = matches.get_one::("is-default") { + request = request.body_map(|body| body.is_default(value.clone())) } - if let Some(value) = matches.get_one::("sp-client-id") { - request = request.body_map(|body| body.sp_client_id(value.clone())) + if let Some(value) = matches.get_one::("pool") { + request = request.pool(value.clone()); } - - if let Some(value) = matches.get_one::("technical-contact-email") { - request = request.body_map(|body| body.technical_contact_email(value.clone())) + + if let Some(value) = matches.get_one::("silo") { + request = request.silo(value.clone()); } if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = - serde_json::from_str::(&body_txt).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } self.config - .execute_saml_identity_provider_create(matches, &mut request)?; + .execute_ip_pool_silo_update(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -9783,13 +11172,13 @@ impl Cli { } } - pub async fn execute_saml_identity_provider_view( + pub async fn execute_ip_pool_silo_unlink( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.saml_identity_provider_view(); - if let Some(value) = matches.get_one::("provider") { - request = request.provider(value.clone()); + let mut request = self.client.ip_pool_silo_unlink(); + if let Some(value) = matches.get_one::("pool") { + request = request.pool(value.clone()); } if let Some(value) = matches.get_one::("silo") { @@ -9797,7 +11186,31 @@ impl Cli { } self.config - .execute_saml_identity_provider_view(matches, &mut request)?; + .execute_ip_pool_silo_unlink(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_no_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) + } + } + } + + pub async fn execute_ip_pool_utilization_view( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.ip_pool_utilization_view(); + if let Some(value) = matches.get_one::("pool") { + request = request.pool(value.clone()); + } + + self.config + .execute_ip_pool_utilization_view(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -9811,18 +11224,38 @@ impl Cli { } } - pub async fn execute_ip_pool_list(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.ip_pool_list(); - if let Some(value) = matches.get_one::("limit") { - request = request.limit(value.clone()); + pub async fn execute_ip_pool_service_view( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.ip_pool_service_view(); + self.config + .execute_ip_pool_service_view(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) + } } + } - if let Some(value) = matches.get_one::("sort-by") { - request = request.sort_by(value.clone()); + pub async fn execute_ip_pool_service_range_list( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.ip_pool_service_range_list(); + if let Some(value) = matches.get_one::("limit") { + request = request.limit(value.clone()); } - self.config.execute_ip_pool_list(matches, &mut request)?; - self.config.list_start::(); + self.config + .execute_ip_pool_service_range_list(matches, &mut request)?; + self.config.list_start::(); let mut stream = futures::StreamExt::take( request.stream(), matches @@ -9836,7 +11269,8 @@ impl Cli { return Err(anyhow::Error::new(r)); } Ok(None) => { - self.config.list_end_success::(); + self.config + .list_end_success::(); return Ok(()); } Ok(Some(value)) => { @@ -9846,23 +11280,19 @@ impl Cli { } } - pub async fn execute_ip_pool_create(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.ip_pool_create(); - if let Some(value) = matches.get_one::("description") { - request = request.body_map(|body| body.description(value.clone())) - } - - if let Some(value) = matches.get_one::("name") { - request = request.body_map(|body| body.name(value.clone())) - } - + pub async fn execute_ip_pool_service_range_add( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.ip_pool_service_range_add(); if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } - self.config.execute_ip_pool_create(matches, &mut request)?; + self.config + .execute_ip_pool_service_range_add(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -9876,17 +11306,23 @@ impl Cli { } } - pub async fn execute_ip_pool_view(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.ip_pool_view(); - if let Some(value) = matches.get_one::("pool") { - request = request.pool(value.clone()); + pub async fn execute_ip_pool_service_range_remove( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.ip_pool_service_range_remove(); + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); } - self.config.execute_ip_pool_view(matches, &mut request)?; + self.config + .execute_ip_pool_service_range_remove(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_item(&r); + self.config.success_no_item(&r); Ok(()) } Err(r) => { @@ -9896,76 +11332,75 @@ impl Cli { } } - pub async fn execute_ip_pool_update(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.ip_pool_update(); - if let Some(value) = matches.get_one::("description") { - request = request.body_map(|body| body.description(value.clone())) + pub async fn execute_system_metric(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.system_metric(); + if let Some(value) = matches.get_one::>("end-time") { + request = request.end_time(value.clone()); } - if let Some(value) = matches.get_one::("name") { - request = request.body_map(|body| body.name(value.clone())) + if let Some(value) = matches.get_one::("limit") { + request = request.limit(value.clone()); } - if let Some(value) = matches.get_one::("pool") { - request = request.pool(value.clone()); + if let Some(value) = matches.get_one::("metric-name") { + request = request.metric_name(value.clone()); } - if let Some(value) = matches.get_one::("json-body") { - let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); - request = request.body(body_value); + if let Some(value) = matches.get_one::("order") { + request = request.order(value.clone()); } - self.config.execute_ip_pool_update(matches, &mut request)?; - let result = request.send().await; - match result { - Ok(r) => { - self.config.success_item(&r); - Ok(()) - } - Err(r) => { - self.config.error(&r); - Err(anyhow::Error::new(r)) - } + if let Some(value) = matches.get_one::("silo") { + request = request.silo(value.clone()); } - } - pub async fn execute_ip_pool_delete(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.ip_pool_delete(); - if let Some(value) = matches.get_one::("pool") { - request = request.pool(value.clone()); + if let Some(value) = matches.get_one::>("start-time") + { + request = request.start_time(value.clone()); } - self.config.execute_ip_pool_delete(matches, &mut request)?; - let result = request.send().await; - match result { - Ok(r) => { - self.config.success_no_item(&r); - Ok(()) - } - Err(r) => { - self.config.error(&r); - Err(anyhow::Error::new(r)) + self.config.execute_system_metric(matches, &mut request)?; + self.config.list_start::(); + let mut stream = futures::StreamExt::take( + request.stream(), + matches + .get_one::("limit") + .map_or(usize::MAX, |x| x.get() as usize), + ); + loop { + match futures::TryStreamExt::try_next(&mut stream).await { + Err(r) => { + self.config.list_end_error(&r); + return Err(anyhow::Error::new(r)); + } + Ok(None) => { + self.config + .list_end_success::(); + return Ok(()); + } + Ok(Some(value)) => { + self.config.list_item(&value); + } } } } - pub async fn execute_ip_pool_range_list( + pub async fn execute_networking_address_lot_list( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.ip_pool_range_list(); + let mut request = self.client.networking_address_lot_list(); if let Some(value) = matches.get_one::("limit") { request = request.limit(value.clone()); } - if let Some(value) = matches.get_one::("pool") { - request = request.pool(value.clone()); + if let Some(value) = matches.get_one::("sort-by") { + request = request.sort_by(value.clone()); } self.config - .execute_ip_pool_range_list(matches, &mut request)?; - self.config.list_start::(); + .execute_networking_address_lot_list(matches, &mut request)?; + self.config.list_start::(); let mut stream = futures::StreamExt::take( request.stream(), matches @@ -9980,7 +11415,7 @@ impl Cli { } Ok(None) => { self.config - .list_end_success::(); + .list_end_success::(); return Ok(()); } Ok(Some(value)) => { @@ -9990,23 +11425,31 @@ impl Cli { } } - pub async fn execute_ip_pool_range_add( + pub async fn execute_networking_address_lot_create( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.ip_pool_range_add(); - if let Some(value) = matches.get_one::("pool") { - request = request.pool(value.clone()); + let mut request = self.client.networking_address_lot_create(); + if let Some(value) = matches.get_one::("description") { + request = request.body_map(|body| body.description(value.clone())) + } + + if let Some(value) = matches.get_one::("kind") { + request = request.body_map(|body| body.kind(value.clone())) + } + + if let Some(value) = matches.get_one::("name") { + request = request.body_map(|body| body.name(value.clone())) } if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } self.config - .execute_ip_pool_range_add(matches, &mut request)?; + .execute_networking_address_lot_create(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -10020,23 +11463,17 @@ impl Cli { } } - pub async fn execute_ip_pool_range_remove( + pub async fn execute_networking_address_lot_delete( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.ip_pool_range_remove(); - if let Some(value) = matches.get_one::("pool") { - request = request.pool(value.clone()); - } - - if let Some(value) = matches.get_one::("json-body") { - let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); - request = request.body(body_value); + let mut request = self.client.networking_address_lot_delete(); + if let Some(value) = matches.get_one::("address-lot") { + request = request.address_lot(value.clone()); } self.config - .execute_ip_pool_range_remove(matches, &mut request)?; + .execute_networking_address_lot_delete(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -10050,17 +11487,17 @@ impl Cli { } } - pub async fn execute_ip_pool_silo_list( + pub async fn execute_networking_address_lot_block_list( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.ip_pool_silo_list(); - if let Some(value) = matches.get_one::("limit") { - request = request.limit(value.clone()); + let mut request = self.client.networking_address_lot_block_list(); + if let Some(value) = matches.get_one::("address-lot") { + request = request.address_lot(value.clone()); } - if let Some(value) = matches.get_one::("pool") { - request = request.pool(value.clone()); + if let Some(value) = matches.get_one::("limit") { + request = request.limit(value.clone()); } if let Some(value) = matches.get_one::("sort-by") { @@ -10068,8 +11505,9 @@ impl Cli { } self.config - .execute_ip_pool_silo_list(matches, &mut request)?; - self.config.list_start::(); + .execute_networking_address_lot_block_list(matches, &mut request)?; + self.config + .list_start::(); let mut stream = futures::StreamExt::take( request.stream(), matches @@ -10084,7 +11522,7 @@ impl Cli { } Ok(None) => { self.config - .list_end_success::(); + .list_end_success::(); return Ok(()); } Ok(Some(value)) => { @@ -10094,31 +11532,32 @@ impl Cli { } } - pub async fn execute_ip_pool_silo_link( + pub async fn execute_networking_address_lot_block_add( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.ip_pool_silo_link(); - if let Some(value) = matches.get_one::("is-default") { - request = request.body_map(|body| body.is_default(value.clone())) + let mut request = self.client.networking_address_lot_block_add(); + if let Some(value) = matches.get_one::("address-lot") { + request = request.address_lot(value.clone()); } - if let Some(value) = matches.get_one::("pool") { - request = request.pool(value.clone()); + if let Some(value) = matches.get_one::("first-address") { + request = request.body_map(|body| body.first_address(value.clone())) } - if let Some(value) = matches.get_one::("silo") { - request = request.body_map(|body| body.silo(value.clone())) + if let Some(value) = matches.get_one::("last-address") { + request = request.body_map(|body| body.last_address(value.clone())) } if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); + let body_value = + serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } self.config - .execute_ip_pool_silo_link(matches, &mut request)?; + .execute_networking_address_lot_block_add(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -10132,35 +11571,36 @@ impl Cli { } } - pub async fn execute_ip_pool_silo_update( + pub async fn execute_networking_address_lot_block_remove( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.ip_pool_silo_update(); - if let Some(value) = matches.get_one::("is-default") { - request = request.body_map(|body| body.is_default(value.clone())) + let mut request = self.client.networking_address_lot_block_remove(); + if let Some(value) = matches.get_one::("address-lot") { + request = request.address_lot(value.clone()); } - if let Some(value) = matches.get_one::("pool") { - request = request.pool(value.clone()); + if let Some(value) = matches.get_one::("first-address") { + request = request.body_map(|body| body.first_address(value.clone())) } - if let Some(value) = matches.get_one::("silo") { - request = request.silo(value.clone()); + if let Some(value) = matches.get_one::("last-address") { + request = request.body_map(|body| body.last_address(value.clone())) } if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); + let body_value = + serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } self.config - .execute_ip_pool_silo_update(matches, &mut request)?; + .execute_networking_address_lot_block_remove(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_item(&r); + self.config.success_no_item(&r); Ok(()) } Err(r) => { @@ -10170,25 +11610,17 @@ impl Cli { } } - pub async fn execute_ip_pool_silo_unlink( + pub async fn execute_networking_allow_list_view( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.ip_pool_silo_unlink(); - if let Some(value) = matches.get_one::("pool") { - request = request.pool(value.clone()); - } - - if let Some(value) = matches.get_one::("silo") { - request = request.silo(value.clone()); - } - + let mut request = self.client.networking_allow_list_view(); self.config - .execute_ip_pool_silo_unlink(matches, &mut request)?; + .execute_networking_allow_list_view(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_no_item(&r); + self.config.success_item(&r); Ok(()) } Err(r) => { @@ -10198,17 +11630,19 @@ impl Cli { } } - pub async fn execute_ip_pool_utilization_view( + pub async fn execute_networking_allow_list_update( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.ip_pool_utilization_view(); - if let Some(value) = matches.get_one::("pool") { - request = request.pool(value.clone()); + let mut request = self.client.networking_allow_list_update(); + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); } self.config - .execute_ip_pool_utilization_view(matches, &mut request)?; + .execute_networking_allow_list_update(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -10222,17 +11656,31 @@ impl Cli { } } - pub async fn execute_ip_pool_service_view( + pub async fn execute_networking_bfd_disable( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.ip_pool_service_view(); + let mut request = self.client.networking_bfd_disable(); + if let Some(value) = matches.get_one::("remote") { + request = request.body_map(|body| body.remote(value.clone())) + } + + if let Some(value) = matches.get_one::("switch") { + request = request.body_map(|body| body.switch(value.clone())) + } + + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); + } + self.config - .execute_ip_pool_service_view(matches, &mut request)?; + .execute_networking_bfd_disable(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_item(&r); + self.config.success_no_item(&r); Ok(()) } Err(r) => { @@ -10242,59 +11690,47 @@ impl Cli { } } - pub async fn execute_ip_pool_service_range_list( + pub async fn execute_networking_bfd_enable( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.ip_pool_service_range_list(); - if let Some(value) = matches.get_one::("limit") { - request = request.limit(value.clone()); + let mut request = self.client.networking_bfd_enable(); + if let Some(value) = matches.get_one::("detection-threshold") { + request = request.body_map(|body| body.detection_threshold(value.clone())) } - self.config - .execute_ip_pool_service_range_list(matches, &mut request)?; - self.config.list_start::(); - let mut stream = futures::StreamExt::take( - request.stream(), - matches - .get_one::("limit") - .map_or(usize::MAX, |x| x.get() as usize), - ); - loop { - match futures::TryStreamExt::try_next(&mut stream).await { - Err(r) => { - self.config.list_end_error(&r); - return Err(anyhow::Error::new(r)); - } - Ok(None) => { - self.config - .list_end_success::(); - return Ok(()); - } - Ok(Some(value)) => { - self.config.list_item(&value); - } - } + if let Some(value) = matches.get_one::("local") { + request = request.body_map(|body| body.local(value.clone())) + } + + if let Some(value) = matches.get_one::("mode") { + request = request.body_map(|body| body.mode(value.clone())) + } + + if let Some(value) = matches.get_one::("remote") { + request = request.body_map(|body| body.remote(value.clone())) + } + + if let Some(value) = matches.get_one::("required-rx") { + request = request.body_map(|body| body.required_rx(value.clone())) + } + + if let Some(value) = matches.get_one::("switch") { + request = request.body_map(|body| body.switch(value.clone())) } - } - pub async fn execute_ip_pool_service_range_add( - &self, - matches: &clap::ArgMatches, - ) -> anyhow::Result<()> { - let mut request = self.client.ip_pool_service_range_add(); if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } self.config - .execute_ip_pool_service_range_add(matches, &mut request)?; + .execute_networking_bfd_enable(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_item(&r); + self.config.success_no_item(&r); Ok(()) } Err(r) => { @@ -10304,23 +11740,17 @@ impl Cli { } } - pub async fn execute_ip_pool_service_range_remove( + pub async fn execute_networking_bfd_status( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.ip_pool_service_range_remove(); - if let Some(value) = matches.get_one::("json-body") { - let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); - request = request.body(body_value); - } - + let mut request = self.client.networking_bfd_status(); self.config - .execute_ip_pool_service_range_remove(matches, &mut request)?; + .execute_networking_bfd_status(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_no_item(&r); + self.config.success_item(&r); Ok(()) } Err(r) => { @@ -10330,35 +11760,26 @@ impl Cli { } } - pub async fn execute_system_metric(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.system_metric(); - if let Some(value) = matches.get_one::>("end-time") { - request = request.end_time(value.clone()); - } - + pub async fn execute_networking_bgp_config_list( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.networking_bgp_config_list(); if let Some(value) = matches.get_one::("limit") { request = request.limit(value.clone()); } - if let Some(value) = matches.get_one::("metric-name") { - request = request.metric_name(value.clone()); - } - - if let Some(value) = matches.get_one::("order") { - request = request.order(value.clone()); - } - - if let Some(value) = matches.get_one::("silo") { - request = request.silo(value.clone()); + if let Some(value) = matches.get_one::("name-or-id") { + request = request.name_or_id(value.clone()); } - if let Some(value) = matches.get_one::>("start-time") - { - request = request.start_time(value.clone()); + if let Some(value) = matches.get_one::("sort-by") { + request = request.sort_by(value.clone()); } - self.config.execute_system_metric(matches, &mut request)?; - self.config.list_start::(); + self.config + .execute_networking_bgp_config_list(matches, &mut request)?; + self.config.list_start::(); let mut stream = futures::StreamExt::take( request.stream(), matches @@ -10373,7 +11794,7 @@ impl Cli { } Ok(None) => { self.config - .list_end_success::(); + .list_end_success::(); return Ok(()); } Ok(Some(value)) => { @@ -10383,71 +11804,134 @@ impl Cli { } } - pub async fn execute_networking_address_lot_list( + pub async fn execute_networking_bgp_config_create( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.networking_bgp_config_create(); + if let Some(value) = matches.get_one::("asn") { + request = request.body_map(|body| body.asn(value.clone())) + } + + if let Some(value) = matches.get_one::("bgp-announce-set-id") { + request = request.body_map(|body| body.bgp_announce_set_id(value.clone())) + } + + if let Some(value) = matches.get_one::("description") { + request = request.body_map(|body| body.description(value.clone())) + } + + if let Some(value) = matches.get_one::("name") { + request = request.body_map(|body| body.name(value.clone())) + } + + if let Some(value) = matches.get_one::("vrf") { + request = request.body_map(|body| body.vrf(value.clone())) + } + + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); + } + + self.config + .execute_networking_bgp_config_create(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) + } + } + } + + pub async fn execute_networking_bgp_config_delete( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.networking_bgp_config_delete(); + if let Some(value) = matches.get_one::("name-or-id") { + request = request.name_or_id(value.clone()); + } + + self.config + .execute_networking_bgp_config_delete(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_no_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) + } + } + } + + pub async fn execute_networking_bgp_announce_set_list( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_address_lot_list(); + let mut request = self.client.networking_bgp_announce_set_list(); if let Some(value) = matches.get_one::("limit") { request = request.limit(value.clone()); } + if let Some(value) = matches.get_one::("name-or-id") { + request = request.name_or_id(value.clone()); + } + + if let Some(value) = matches.get_one::("page-token") { + request = request.page_token(value.clone()); + } + if let Some(value) = matches.get_one::("sort-by") { request = request.sort_by(value.clone()); } self.config - .execute_networking_address_lot_list(matches, &mut request)?; - self.config.list_start::(); - let mut stream = futures::StreamExt::take( - request.stream(), - matches - .get_one::("limit") - .map_or(usize::MAX, |x| x.get() as usize), - ); - loop { - match futures::TryStreamExt::try_next(&mut stream).await { - Err(r) => { - self.config.list_end_error(&r); - return Err(anyhow::Error::new(r)); - } - Ok(None) => { - self.config - .list_end_success::(); - return Ok(()); - } - Ok(Some(value)) => { - self.config.list_item(&value); - } + .execute_networking_bgp_announce_set_list(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) } } } - pub async fn execute_networking_address_lot_create( + pub async fn execute_networking_bgp_announce_set_update( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_address_lot_create(); + let mut request = self.client.networking_bgp_announce_set_update(); if let Some(value) = matches.get_one::("description") { request = request.body_map(|body| body.description(value.clone())) } - if let Some(value) = matches.get_one::("kind") { - request = request.body_map(|body| body.kind(value.clone())) - } - if let Some(value) = matches.get_one::("name") { request = request.body_map(|body| body.name(value.clone())) } if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); + let body_value = + serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } self.config - .execute_networking_address_lot_create(matches, &mut request)?; + .execute_networking_bgp_announce_set_update(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -10461,17 +11945,17 @@ impl Cli { } } - pub async fn execute_networking_address_lot_delete( + pub async fn execute_networking_bgp_announce_set_delete( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_address_lot_delete(); - if let Some(value) = matches.get_one::("address-lot") { - request = request.address_lot(value.clone()); + let mut request = self.client.networking_bgp_announce_set_delete(); + if let Some(value) = matches.get_one::("name-or-id") { + request = request.name_or_id(value.clone()); } self.config - .execute_networking_address_lot_delete(matches, &mut request)?; + .execute_networking_bgp_announce_set_delete(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -10485,58 +11969,37 @@ impl Cli { } } - pub async fn execute_networking_address_lot_block_list( + pub async fn execute_networking_bgp_announcement_list( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_address_lot_block_list(); - if let Some(value) = matches.get_one::("address-lot") { - request = request.address_lot(value.clone()); - } - - if let Some(value) = matches.get_one::("limit") { - request = request.limit(value.clone()); - } - - if let Some(value) = matches.get_one::("sort-by") { - request = request.sort_by(value.clone()); + let mut request = self.client.networking_bgp_announcement_list(); + if let Some(value) = matches.get_one::("name-or-id") { + request = request.name_or_id(value.clone()); } self.config - .execute_networking_address_lot_block_list(matches, &mut request)?; - self.config - .list_start::(); - let mut stream = futures::StreamExt::take( - request.stream(), - matches - .get_one::("limit") - .map_or(usize::MAX, |x| x.get() as usize), - ); - loop { - match futures::TryStreamExt::try_next(&mut stream).await { - Err(r) => { - self.config.list_end_error(&r); - return Err(anyhow::Error::new(r)); - } - Ok(None) => { - self.config - .list_end_success::(); - return Ok(()); - } - Ok(Some(value)) => { - self.config.list_item(&value); - } + .execute_networking_bgp_announcement_list(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) } } } - pub async fn execute_networking_allow_list_view( + pub async fn execute_networking_bgp_exported( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_allow_list_view(); + let mut request = self.client.networking_bgp_exported(); self.config - .execute_networking_allow_list_view(matches, &mut request)?; + .execute_networking_bgp_exported(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -10550,19 +12013,17 @@ impl Cli { } } - pub async fn execute_networking_allow_list_update( + pub async fn execute_networking_bgp_message_history( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_allow_list_update(); - if let Some(value) = matches.get_one::("json-body") { - let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); - request = request.body(body_value); + let mut request = self.client.networking_bgp_message_history(); + if let Some(value) = matches.get_one::("asn") { + request = request.asn(value.clone()); } self.config - .execute_networking_allow_list_update(matches, &mut request)?; + .execute_networking_bgp_message_history(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -10576,31 +12037,41 @@ impl Cli { } } - pub async fn execute_networking_bfd_disable( + pub async fn execute_networking_bgp_imported_routes_ipv4( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_bfd_disable(); - if let Some(value) = matches.get_one::("remote") { - request = request.body_map(|body| body.remote(value.clone())) - } - - if let Some(value) = matches.get_one::("switch") { - request = request.body_map(|body| body.switch(value.clone())) + let mut request = self.client.networking_bgp_imported_routes_ipv4(); + if let Some(value) = matches.get_one::("asn") { + request = request.asn(value.clone()); } - if let Some(value) = matches.get_one::("json-body") { - let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); - request = request.body(body_value); + self.config + .execute_networking_bgp_imported_routes_ipv4(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) + } } + } + pub async fn execute_networking_bgp_status( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.networking_bgp_status(); self.config - .execute_networking_bfd_disable(matches, &mut request)?; + .execute_networking_bgp_status(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_no_item(&r); + self.config.success_item(&r); Ok(()) } Err(r) => { @@ -10610,47 +12081,89 @@ impl Cli { } } - pub async fn execute_networking_bfd_enable( + pub async fn execute_networking_loopback_address_list( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_bfd_enable(); - if let Some(value) = matches.get_one::("detection-threshold") { - request = request.body_map(|body| body.detection_threshold(value.clone())) + let mut request = self.client.networking_loopback_address_list(); + if let Some(value) = matches.get_one::("limit") { + request = request.limit(value.clone()); } - if let Some(value) = matches.get_one::("local") { - request = request.body_map(|body| body.local(value.clone())) + if let Some(value) = matches.get_one::("sort-by") { + request = request.sort_by(value.clone()); } - if let Some(value) = matches.get_one::("mode") { - request = request.body_map(|body| body.mode(value.clone())) + self.config + .execute_networking_loopback_address_list(matches, &mut request)?; + self.config + .list_start::(); + let mut stream = futures::StreamExt::take( + request.stream(), + matches + .get_one::("limit") + .map_or(usize::MAX, |x| x.get() as usize), + ); + loop { + match futures::TryStreamExt::try_next(&mut stream).await { + Err(r) => { + self.config.list_end_error(&r); + return Err(anyhow::Error::new(r)); + } + Ok(None) => { + self.config + .list_end_success::(); + return Ok(()); + } + Ok(Some(value)) => { + self.config.list_item(&value); + } + } } + } - if let Some(value) = matches.get_one::("remote") { - request = request.body_map(|body| body.remote(value.clone())) + pub async fn execute_networking_loopback_address_create( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.networking_loopback_address_create(); + if let Some(value) = matches.get_one::("address") { + request = request.body_map(|body| body.address(value.clone())) } - if let Some(value) = matches.get_one::("required-rx") { - request = request.body_map(|body| body.required_rx(value.clone())) + if let Some(value) = matches.get_one::("address-lot") { + request = request.body_map(|body| body.address_lot(value.clone())) } - if let Some(value) = matches.get_one::("switch") { - request = request.body_map(|body| body.switch(value.clone())) + if let Some(value) = matches.get_one::("anycast") { + request = request.body_map(|body| body.anycast(value.clone())) + } + + if let Some(value) = matches.get_one::("mask") { + request = request.body_map(|body| body.mask(value.clone())) + } + + if let Some(value) = matches.get_one::("rack-id") { + request = request.body_map(|body| body.rack_id(value.clone())) + } + + if let Some(value) = matches.get_one::("switch-location") { + request = request.body_map(|body| body.switch_location(value.clone())) } if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); + let body_value = + serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } self.config - .execute_networking_bfd_enable(matches, &mut request)?; + .execute_networking_loopback_address_create(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_no_item(&r); + self.config.success_item(&r); Ok(()) } Err(r) => { @@ -10660,17 +12173,33 @@ impl Cli { } } - pub async fn execute_networking_bfd_status( + pub async fn execute_networking_loopback_address_delete( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_bfd_status(); + let mut request = self.client.networking_loopback_address_delete(); + if let Some(value) = matches.get_one::("address") { + request = request.address(value.clone()); + } + + if let Some(value) = matches.get_one::("rack-id") { + request = request.rack_id(value.clone()); + } + + if let Some(value) = matches.get_one::("subnet-mask") { + request = request.subnet_mask(value.clone()); + } + + if let Some(value) = matches.get_one::("switch-location") { + request = request.switch_location(value.clone()); + } + self.config - .execute_networking_bfd_status(matches, &mut request)?; + .execute_networking_loopback_address_delete(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_item(&r); + self.config.success_no_item(&r); Ok(()) } Err(r) => { @@ -10680,17 +12209,17 @@ impl Cli { } } - pub async fn execute_networking_bgp_config_list( + pub async fn execute_networking_switch_port_configuration_list( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_bgp_config_list(); - if let Some(value) = matches.get_one::("limit") { - request = request.limit(value.clone()); + let mut request = self.client.networking_switch_port_configuration_list(); + if let Some(value) = matches.get_one::("configuration") { + request = request.configuration(value.clone()); } - if let Some(value) = matches.get_one::("name-or-id") { - request = request.name_or_id(value.clone()); + if let Some(value) = matches.get_one::("limit") { + request = request.limit(value.clone()); } if let Some(value) = matches.get_one::("sort-by") { @@ -10698,8 +12227,9 @@ impl Cli { } self.config - .execute_networking_bgp_config_list(matches, &mut request)?; - self.config.list_start::(); + .execute_networking_switch_port_configuration_list(matches, &mut request)?; + self.config + .list_start::(); let mut stream = futures::StreamExt::take( request.stream(), matches @@ -10714,7 +12244,7 @@ impl Cli { } Ok(None) => { self.config - .list_end_success::(); + .list_end_success::(); return Ok(()); } Ok(Some(value)) => { @@ -10724,19 +12254,11 @@ impl Cli { } } - pub async fn execute_networking_bgp_config_create( + pub async fn execute_networking_switch_port_configuration_create( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_bgp_config_create(); - if let Some(value) = matches.get_one::("asn") { - request = request.body_map(|body| body.asn(value.clone())) - } - - if let Some(value) = matches.get_one::("bgp-announce-set-id") { - request = request.body_map(|body| body.bgp_announce_set_id(value.clone())) - } - + let mut request = self.client.networking_switch_port_configuration_create(); if let Some(value) = matches.get_one::("description") { request = request.body_map(|body| body.description(value.clone())) } @@ -10745,18 +12267,15 @@ impl Cli { request = request.body_map(|body| body.name(value.clone())) } - if let Some(value) = matches.get_one::("vrf") { - request = request.body_map(|body| body.vrf(value.clone())) - } - if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); + let body_value = + serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } self.config - .execute_networking_bgp_config_create(matches, &mut request)?; + .execute_networking_switch_port_configuration_create(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -10770,17 +12289,17 @@ impl Cli { } } - pub async fn execute_networking_bgp_config_delete( + pub async fn execute_networking_switch_port_configuration_delete( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_bgp_config_delete(); - if let Some(value) = matches.get_one::("name-or-id") { - request = request.name_or_id(value.clone()); + let mut request = self.client.networking_switch_port_configuration_delete(); + if let Some(value) = matches.get_one::("configuration") { + request = request.configuration(value.clone()); } self.config - .execute_networking_bgp_config_delete(matches, &mut request)?; + .execute_networking_switch_port_configuration_delete(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -10794,29 +12313,43 @@ impl Cli { } } - pub async fn execute_networking_bgp_announce_set_list( + pub async fn execute_networking_switch_port_configuration_view( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_bgp_announce_set_list(); - if let Some(value) = matches.get_one::("limit") { - request = request.limit(value.clone()); - } - - if let Some(value) = matches.get_one::("name-or-id") { - request = request.name_or_id(value.clone()); + let mut request = self.client.networking_switch_port_configuration_view(); + if let Some(value) = matches.get_one::("configuration") { + request = request.configuration(value.clone()); } - if let Some(value) = matches.get_one::("page-token") { - request = request.page_token(value.clone()); + self.config + .execute_networking_switch_port_configuration_view(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) + } } + } - if let Some(value) = matches.get_one::("sort-by") { - request = request.sort_by(value.clone()); + pub async fn execute_networking_switch_port_configuration_geometry_view( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self + .client + .networking_switch_port_configuration_geometry_view(); + if let Some(value) = matches.get_one::("configuration") { + request = request.configuration(value.clone()); } self.config - .execute_networking_bgp_announce_set_list(matches, &mut request)?; + .execute_networking_switch_port_configuration_geometry_view(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -10830,28 +12363,30 @@ impl Cli { } } - pub async fn execute_networking_bgp_announce_set_update( + pub async fn execute_networking_switch_port_configuration_geometry_set( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_bgp_announce_set_update(); - if let Some(value) = matches.get_one::("description") { - request = request.body_map(|body| body.description(value.clone())) + let mut request = self + .client + .networking_switch_port_configuration_geometry_set(); + if let Some(value) = matches.get_one::("configuration") { + request = request.configuration(value.clone()); } - if let Some(value) = matches.get_one::("name") { - request = request.body_map(|body| body.name(value.clone())) + if let Some(value) = matches.get_one::("geometry") { + request = request.body_map(|body| body.geometry(value.clone())) } if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); let body_value = - serde_json::from_str::(&body_txt).unwrap(); + serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } self.config - .execute_networking_bgp_announce_set_update(matches, &mut request)?; + .execute_networking_switch_port_configuration_geometry_set(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -10865,21 +12400,30 @@ impl Cli { } } - pub async fn execute_networking_bgp_announce_set_delete( + pub async fn execute_networking_switch_port_configuration_interface_address_list( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_bgp_announce_set_delete(); - if let Some(value) = matches.get_one::("name-or-id") { - request = request.name_or_id(value.clone()); + let mut request = self + .client + .networking_switch_port_configuration_interface_address_list(); + if let Some(value) = matches.get_one::("configuration") { + request = request.configuration(value.clone()); + } + + if let Some(value) = matches.get_one::("interface") { + request = request.interface(value.clone()); } self.config - .execute_networking_bgp_announce_set_delete(matches, &mut request)?; + .execute_networking_switch_port_configuration_interface_address_list( + matches, + &mut request, + )?; let result = request.send().await; match result { Ok(r) => { - self.config.success_no_item(&r); + self.config.success_item(&r); Ok(()) } Err(r) => { @@ -10889,17 +12433,44 @@ impl Cli { } } - pub async fn execute_networking_bgp_announcement_list( + pub async fn execute_networking_switch_port_configuration_interface_address_add( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_bgp_announcement_list(); - if let Some(value) = matches.get_one::("name-or-id") { - request = request.name_or_id(value.clone()); + let mut request = self + .client + .networking_switch_port_configuration_interface_address_add(); + if let Some(value) = matches.get_one::("address") { + request = request.body_map(|body| body.address(value.clone())) + } + + if let Some(value) = matches.get_one::("address-lot") { + request = request.body_map(|body| body.address_lot(value.clone())) + } + + if let Some(value) = matches.get_one::("configuration") { + request = request.configuration(value.clone()); + } + + if let Some(value) = matches.get_one::("interface") { + request = request.interface(value.clone()); + } + + if let Some(value) = matches.get_one::("vlan-id") { + request = request.body_map(|body| body.vlan_id(value.clone())) + } + + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); } self.config - .execute_networking_bgp_announcement_list(matches, &mut request)?; + .execute_networking_switch_port_configuration_interface_address_add( + matches, + &mut request, + )?; let result = request.send().await; match result { Ok(r) => { @@ -10913,13 +12484,77 @@ impl Cli { } } - pub async fn execute_networking_bgp_exported( + pub async fn execute_networking_switch_port_configuration_interface_address_remove( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_bgp_exported(); + let mut request = self + .client + .networking_switch_port_configuration_interface_address_remove(); + if let Some(value) = matches.get_one::("address") { + request = request.body_map(|body| body.address(value.clone())) + } + + if let Some(value) = matches.get_one::("address-lot") { + request = request.body_map(|body| body.address_lot(value.clone())) + } + + if let Some(value) = matches.get_one::("configuration") { + request = request.configuration(value.clone()); + } + + if let Some(value) = matches.get_one::("interface") { + request = request.interface(value.clone()); + } + + if let Some(value) = matches.get_one::("vlan-id") { + request = request.body_map(|body| body.vlan_id(value.clone())) + } + + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); + } + self.config - .execute_networking_bgp_exported(matches, &mut request)?; + .execute_networking_switch_port_configuration_interface_address_remove( + matches, + &mut request, + )?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_no_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) + } + } + } + + pub async fn execute_networking_switch_port_configuration_interface_bgp_peer_list( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self + .client + .networking_switch_port_configuration_interface_bgp_peer_list(); + if let Some(value) = matches.get_one::("configuration") { + request = request.configuration(value.clone()); + } + + if let Some(value) = matches.get_one::("interface") { + request = request.interface(value.clone()); + } + + self.config + .execute_networking_switch_port_configuration_interface_bgp_peer_list( + matches, + &mut request, + )?; let result = request.send().await; match result { Ok(r) => { @@ -10933,17 +12568,92 @@ impl Cli { } } - pub async fn execute_networking_bgp_message_history( + pub async fn execute_networking_switch_port_configuration_interface_bgp_peer_add( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_bgp_message_history(); - if let Some(value) = matches.get_one::("asn") { - request = request.asn(value.clone()); + let mut request = self + .client + .networking_switch_port_configuration_interface_bgp_peer_add(); + if let Some(value) = matches.get_one::("addr") { + request = request.body_map(|body| body.addr(value.clone())) + } + + if let Some(value) = matches.get_one::("bgp-config") { + request = request.body_map(|body| body.bgp_config(value.clone())) + } + + if let Some(value) = matches.get_one::("configuration") { + request = request.configuration(value.clone()); + } + + if let Some(value) = matches.get_one::("connect-retry") { + request = request.body_map(|body| body.connect_retry(value.clone())) + } + + if let Some(value) = matches.get_one::("delay-open") { + request = request.body_map(|body| body.delay_open(value.clone())) + } + + if let Some(value) = matches.get_one::("enforce-first-as") { + request = request.body_map(|body| body.enforce_first_as(value.clone())) + } + + if let Some(value) = matches.get_one::("hold-time") { + request = request.body_map(|body| body.hold_time(value.clone())) + } + + if let Some(value) = matches.get_one::("idle-hold-time") { + request = request.body_map(|body| body.idle_hold_time(value.clone())) + } + + if let Some(value) = matches.get_one::("interface") { + request = request.interface(value.clone()); + } + + if let Some(value) = matches.get_one::("interface-name") { + request = request.body_map(|body| body.interface_name(value.clone())) + } + + if let Some(value) = matches.get_one::("keepalive") { + request = request.body_map(|body| body.keepalive(value.clone())) + } + + if let Some(value) = matches.get_one::("local-pref") { + request = request.body_map(|body| body.local_pref(value.clone())) + } + + if let Some(value) = matches.get_one::("md5-auth-key") { + request = request.body_map(|body| body.md5_auth_key(value.clone())) + } + + if let Some(value) = matches.get_one::("min-ttl") { + request = request.body_map(|body| body.min_ttl(value.clone())) + } + + if let Some(value) = matches.get_one::("multi-exit-discriminator") { + request = request.body_map(|body| body.multi_exit_discriminator(value.clone())) + } + + if let Some(value) = matches.get_one::("remote-asn") { + request = request.body_map(|body| body.remote_asn(value.clone())) + } + + if let Some(value) = matches.get_one::("vlan-id") { + request = request.body_map(|body| body.vlan_id(value.clone())) + } + + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); } self.config - .execute_networking_bgp_message_history(matches, &mut request)?; + .execute_networking_switch_port_configuration_interface_bgp_peer_add( + matches, + &mut request, + )?; let result = request.send().await; match result { Ok(r) => { @@ -10957,21 +12667,96 @@ impl Cli { } } - pub async fn execute_networking_bgp_imported_routes_ipv4( + pub async fn execute_networking_switch_port_configuration_interface_bgp_peer_remove( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_bgp_imported_routes_ipv4(); - if let Some(value) = matches.get_one::("asn") { - request = request.asn(value.clone()); + let mut request = self + .client + .networking_switch_port_configuration_interface_bgp_peer_remove(); + if let Some(value) = matches.get_one::("addr") { + request = request.body_map(|body| body.addr(value.clone())) + } + + if let Some(value) = matches.get_one::("bgp-config") { + request = request.body_map(|body| body.bgp_config(value.clone())) + } + + if let Some(value) = matches.get_one::("configuration") { + request = request.configuration(value.clone()); + } + + if let Some(value) = matches.get_one::("connect-retry") { + request = request.body_map(|body| body.connect_retry(value.clone())) + } + + if let Some(value) = matches.get_one::("delay-open") { + request = request.body_map(|body| body.delay_open(value.clone())) + } + + if let Some(value) = matches.get_one::("enforce-first-as") { + request = request.body_map(|body| body.enforce_first_as(value.clone())) + } + + if let Some(value) = matches.get_one::("hold-time") { + request = request.body_map(|body| body.hold_time(value.clone())) + } + + if let Some(value) = matches.get_one::("idle-hold-time") { + request = request.body_map(|body| body.idle_hold_time(value.clone())) + } + + if let Some(value) = matches.get_one::("interface") { + request = request.interface(value.clone()); + } + + if let Some(value) = matches.get_one::("interface-name") { + request = request.body_map(|body| body.interface_name(value.clone())) + } + + if let Some(value) = matches.get_one::("keepalive") { + request = request.body_map(|body| body.keepalive(value.clone())) + } + + if let Some(value) = matches.get_one::("local-pref") { + request = request.body_map(|body| body.local_pref(value.clone())) + } + + if let Some(value) = matches.get_one::("md5-auth-key") { + request = request.body_map(|body| body.md5_auth_key(value.clone())) + } + + if let Some(value) = matches.get_one::("min-ttl") { + request = request.body_map(|body| body.min_ttl(value.clone())) + } + + if let Some(value) = matches.get_one::("multi-exit-discriminator") { + request = request.body_map(|body| body.multi_exit_discriminator(value.clone())) + } + + if let Some(value) = matches.get_one::("remote-asn") { + request = request.body_map(|body| body.remote_asn(value.clone())) + } + + if let Some(value) = matches.get_one::("vlan-id") { + request = request.body_map(|body| body.vlan_id(value.clone())) + } + + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); } self.config - .execute_networking_bgp_imported_routes_ipv4(matches, &mut request)?; + .execute_networking_switch_port_configuration_interface_bgp_peer_remove( + matches, + &mut request, + )?; let result = request.send().await; match result { Ok(r) => { - self.config.success_item(&r); + self.config.success_no_item(&r); Ok(()) } Err(r) => { @@ -10981,13 +12766,26 @@ impl Cli { } } - pub async fn execute_networking_bgp_status( + pub async fn execute_networking_switch_port_configuration_interface_route_list( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_bgp_status(); + let mut request = self + .client + .networking_switch_port_configuration_interface_route_list(); + if let Some(value) = matches.get_one::("configuration") { + request = request.configuration(value.clone()); + } + + if let Some(value) = matches.get_one::("interface") { + request = request.interface(value.clone()); + } + self.config - .execute_networking_bgp_status(matches, &mut request)?; + .execute_networking_switch_port_configuration_interface_route_list( + matches, + &mut request, + )?; let result = request.send().await; match result { Ok(r) => { @@ -11001,89 +12799,107 @@ impl Cli { } } - pub async fn execute_networking_loopback_address_list( + pub async fn execute_networking_switch_port_configuration_interface_route_add( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_loopback_address_list(); - if let Some(value) = matches.get_one::("limit") { - request = request.limit(value.clone()); + let mut request = self + .client + .networking_switch_port_configuration_interface_route_add(); + if let Some(value) = matches.get_one::("configuration") { + request = request.configuration(value.clone()); } - if let Some(value) = matches.get_one::("sort-by") { - request = request.sort_by(value.clone()); + if let Some(value) = matches.get_one::("dst") { + request = request.body_map(|body| body.dst(value.clone())) + } + + if let Some(value) = matches.get_one::("gw") { + request = request.body_map(|body| body.gw(value.clone())) + } + + if let Some(value) = matches.get_one::("interface") { + request = request.interface(value.clone()); + } + + if let Some(value) = matches.get_one::("local-pref") { + request = request.body_map(|body| body.local_pref(value.clone())) + } + + if let Some(value) = matches.get_one::("vid") { + request = request.body_map(|body| body.vid(value.clone())) + } + + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); } self.config - .execute_networking_loopback_address_list(matches, &mut request)?; - self.config - .list_start::(); - let mut stream = futures::StreamExt::take( - request.stream(), - matches - .get_one::("limit") - .map_or(usize::MAX, |x| x.get() as usize), - ); - loop { - match futures::TryStreamExt::try_next(&mut stream).await { - Err(r) => { - self.config.list_end_error(&r); - return Err(anyhow::Error::new(r)); - } - Ok(None) => { - self.config - .list_end_success::(); - return Ok(()); - } - Ok(Some(value)) => { - self.config.list_item(&value); - } + .execute_networking_switch_port_configuration_interface_route_add( + matches, + &mut request, + )?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) } } } - pub async fn execute_networking_loopback_address_create( + pub async fn execute_networking_switch_port_configuration_interface_route_remove( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_loopback_address_create(); - if let Some(value) = matches.get_one::("address") { - request = request.body_map(|body| body.address(value.clone())) + let mut request = self + .client + .networking_switch_port_configuration_interface_route_remove(); + if let Some(value) = matches.get_one::("configuration") { + request = request.configuration(value.clone()); } - if let Some(value) = matches.get_one::("address-lot") { - request = request.body_map(|body| body.address_lot(value.clone())) + if let Some(value) = matches.get_one::("dst") { + request = request.body_map(|body| body.dst(value.clone())) } - if let Some(value) = matches.get_one::("anycast") { - request = request.body_map(|body| body.anycast(value.clone())) + if let Some(value) = matches.get_one::("gw") { + request = request.body_map(|body| body.gw(value.clone())) } - if let Some(value) = matches.get_one::("mask") { - request = request.body_map(|body| body.mask(value.clone())) + if let Some(value) = matches.get_one::("interface") { + request = request.interface(value.clone()); } - if let Some(value) = matches.get_one::("rack-id") { - request = request.body_map(|body| body.rack_id(value.clone())) + if let Some(value) = matches.get_one::("local-pref") { + request = request.body_map(|body| body.local_pref(value.clone())) } - if let Some(value) = matches.get_one::("switch-location") { - request = request.body_map(|body| body.switch_location(value.clone())) + if let Some(value) = matches.get_one::("vid") { + request = request.body_map(|body| body.vid(value.clone())) } if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = - serde_json::from_str::(&body_txt).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } self.config - .execute_networking_loopback_address_create(matches, &mut request)?; + .execute_networking_switch_port_configuration_interface_route_remove( + matches, + &mut request, + )?; let result = request.send().await; match result { Ok(r) => { - self.config.success_item(&r); + self.config.success_no_item(&r); Ok(()) } Err(r) => { @@ -11093,33 +12909,21 @@ impl Cli { } } - pub async fn execute_networking_loopback_address_delete( + pub async fn execute_networking_switch_port_configuration_link_list( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_loopback_address_delete(); - if let Some(value) = matches.get_one::("address") { - request = request.address(value.clone()); - } - - if let Some(value) = matches.get_one::("rack-id") { - request = request.rack_id(value.clone()); - } - - if let Some(value) = matches.get_one::("subnet-mask") { - request = request.subnet_mask(value.clone()); - } - - if let Some(value) = matches.get_one::("switch-location") { - request = request.switch_location(value.clone()); + let mut request = self.client.networking_switch_port_configuration_link_list(); + if let Some(value) = matches.get_one::("configuration") { + request = request.configuration(value.clone()); } self.config - .execute_networking_loopback_address_delete(matches, &mut request)?; + .execute_networking_switch_port_configuration_link_list(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_no_item(&r); + self.config.success_item(&r); Ok(()) } Err(r) => { @@ -11129,73 +12933,50 @@ impl Cli { } } - pub async fn execute_networking_switch_port_settings_list( + pub async fn execute_networking_switch_port_configuration_link_create( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_switch_port_settings_list(); - if let Some(value) = matches.get_one::("limit") { - request = request.limit(value.clone()); + let mut request = self + .client + .networking_switch_port_configuration_link_create(); + if let Some(value) = matches.get_one::("autoneg") { + request = request.body_map(|body| body.autoneg(value.clone())) } - if let Some(value) = matches.get_one::("port-settings") { - request = request.port_settings(value.clone()); + if let Some(value) = matches.get_one::("configuration") { + request = request.configuration(value.clone()); } - if let Some(value) = matches.get_one::("sort-by") { - request = request.sort_by(value.clone()); + if let Some(value) = matches.get_one::("fec") { + request = request.body_map(|body| body.fec(value.clone())) } - self.config - .execute_networking_switch_port_settings_list(matches, &mut request)?; - self.config - .list_start::(); - let mut stream = futures::StreamExt::take( - request.stream(), - matches - .get_one::("limit") - .map_or(usize::MAX, |x| x.get() as usize), - ); - loop { - match futures::TryStreamExt::try_next(&mut stream).await { - Err(r) => { - self.config.list_end_error(&r); - return Err(anyhow::Error::new(r)); - } - Ok(None) => { - self.config - .list_end_success::(); - return Ok(()); - } - Ok(Some(value)) => { - self.config.list_item(&value); - } - } + if let Some(value) = matches.get_one::("lldp-config") { + request = request.body_map(|body| body.lldp_config(value.clone())) } - } - pub async fn execute_networking_switch_port_settings_create( - &self, - matches: &clap::ArgMatches, - ) -> anyhow::Result<()> { - let mut request = self.client.networking_switch_port_settings_create(); - if let Some(value) = matches.get_one::("description") { - request = request.body_map(|body| body.description(value.clone())) + if let Some(value) = matches.get_one::("mtu") { + request = request.body_map(|body| body.mtu(value.clone())) } if let Some(value) = matches.get_one::("name") { request = request.body_map(|body| body.name(value.clone())) } + if let Some(value) = matches.get_one::("speed") { + request = request.body_map(|body| body.speed(value.clone())) + } + if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); let body_value = - serde_json::from_str::(&body_txt).unwrap(); + serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } self.config - .execute_networking_switch_port_settings_create(matches, &mut request)?; + .execute_networking_switch_port_configuration_link_create(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -11209,21 +12990,25 @@ impl Cli { } } - pub async fn execute_networking_switch_port_settings_delete( + pub async fn execute_networking_switch_port_configuration_link_view( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_switch_port_settings_delete(); - if let Some(value) = matches.get_one::("port-settings") { - request = request.port_settings(value.clone()); + let mut request = self.client.networking_switch_port_configuration_link_view(); + if let Some(value) = matches.get_one::("configuration") { + request = request.configuration(value.clone()); + } + + if let Some(value) = matches.get_one::("link") { + request = request.link(value.clone()); } self.config - .execute_networking_switch_port_settings_delete(matches, &mut request)?; + .execute_networking_switch_port_configuration_link_view(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_no_item(&r); + self.config.success_item(&r); Ok(()) } Err(r) => { @@ -11233,21 +13018,27 @@ impl Cli { } } - pub async fn execute_networking_switch_port_settings_view( + pub async fn execute_networking_switch_port_configuration_link_delete( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_switch_port_settings_view(); - if let Some(value) = matches.get_one::("port") { - request = request.port(value.clone()); + let mut request = self + .client + .networking_switch_port_configuration_link_delete(); + if let Some(value) = matches.get_one::("configuration") { + request = request.configuration(value.clone()); + } + + if let Some(value) = matches.get_one::("link") { + request = request.link(value.clone()); } self.config - .execute_networking_switch_port_settings_view(matches, &mut request)?; + .execute_networking_switch_port_configuration_link_delete(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_item(&r); + self.config.success_no_item(&r); Ok(()) } Err(r) => { @@ -13925,6 +15716,22 @@ pub trait CliConfig { Ok(()) } + fn execute_networking_address_lot_block_add( + &self, + matches: &clap::ArgMatches, + request: &mut builder::NetworkingAddressLotBlockAdd, + ) -> anyhow::Result<()> { + Ok(()) + } + + fn execute_networking_address_lot_block_remove( + &self, + matches: &clap::ArgMatches, + request: &mut builder::NetworkingAddressLotBlockRemove, + ) -> anyhow::Result<()> { + Ok(()) + } + fn execute_networking_allow_list_view( &self, matches: &clap::ArgMatches, @@ -14077,34 +15884,154 @@ pub trait CliConfig { Ok(()) } - fn execute_networking_switch_port_settings_list( + fn execute_networking_switch_port_configuration_list( + &self, + matches: &clap::ArgMatches, + request: &mut builder::NetworkingSwitchPortConfigurationList, + ) -> anyhow::Result<()> { + Ok(()) + } + + fn execute_networking_switch_port_configuration_create( + &self, + matches: &clap::ArgMatches, + request: &mut builder::NetworkingSwitchPortConfigurationCreate, + ) -> anyhow::Result<()> { + Ok(()) + } + + fn execute_networking_switch_port_configuration_delete( + &self, + matches: &clap::ArgMatches, + request: &mut builder::NetworkingSwitchPortConfigurationDelete, + ) -> anyhow::Result<()> { + Ok(()) + } + + fn execute_networking_switch_port_configuration_view( + &self, + matches: &clap::ArgMatches, + request: &mut builder::NetworkingSwitchPortConfigurationView, + ) -> anyhow::Result<()> { + Ok(()) + } + + fn execute_networking_switch_port_configuration_geometry_view( + &self, + matches: &clap::ArgMatches, + request: &mut builder::NetworkingSwitchPortConfigurationGeometryView, + ) -> anyhow::Result<()> { + Ok(()) + } + + fn execute_networking_switch_port_configuration_geometry_set( + &self, + matches: &clap::ArgMatches, + request: &mut builder::NetworkingSwitchPortConfigurationGeometrySet, + ) -> anyhow::Result<()> { + Ok(()) + } + + fn execute_networking_switch_port_configuration_interface_address_list( + &self, + matches: &clap::ArgMatches, + request: &mut builder::NetworkingSwitchPortConfigurationInterfaceAddressList, + ) -> anyhow::Result<()> { + Ok(()) + } + + fn execute_networking_switch_port_configuration_interface_address_add( + &self, + matches: &clap::ArgMatches, + request: &mut builder::NetworkingSwitchPortConfigurationInterfaceAddressAdd, + ) -> anyhow::Result<()> { + Ok(()) + } + + fn execute_networking_switch_port_configuration_interface_address_remove( + &self, + matches: &clap::ArgMatches, + request: &mut builder::NetworkingSwitchPortConfigurationInterfaceAddressRemove, + ) -> anyhow::Result<()> { + Ok(()) + } + + fn execute_networking_switch_port_configuration_interface_bgp_peer_list( + &self, + matches: &clap::ArgMatches, + request: &mut builder::NetworkingSwitchPortConfigurationInterfaceBgpPeerList, + ) -> anyhow::Result<()> { + Ok(()) + } + + fn execute_networking_switch_port_configuration_interface_bgp_peer_add( + &self, + matches: &clap::ArgMatches, + request: &mut builder::NetworkingSwitchPortConfigurationInterfaceBgpPeerAdd, + ) -> anyhow::Result<()> { + Ok(()) + } + + fn execute_networking_switch_port_configuration_interface_bgp_peer_remove( + &self, + matches: &clap::ArgMatches, + request: &mut builder::NetworkingSwitchPortConfigurationInterfaceBgpPeerRemove, + ) -> anyhow::Result<()> { + Ok(()) + } + + fn execute_networking_switch_port_configuration_interface_route_list( + &self, + matches: &clap::ArgMatches, + request: &mut builder::NetworkingSwitchPortConfigurationInterfaceRouteList, + ) -> anyhow::Result<()> { + Ok(()) + } + + fn execute_networking_switch_port_configuration_interface_route_add( + &self, + matches: &clap::ArgMatches, + request: &mut builder::NetworkingSwitchPortConfigurationInterfaceRouteAdd, + ) -> anyhow::Result<()> { + Ok(()) + } + + fn execute_networking_switch_port_configuration_interface_route_remove( + &self, + matches: &clap::ArgMatches, + request: &mut builder::NetworkingSwitchPortConfigurationInterfaceRouteRemove, + ) -> anyhow::Result<()> { + Ok(()) + } + + fn execute_networking_switch_port_configuration_link_list( &self, matches: &clap::ArgMatches, - request: &mut builder::NetworkingSwitchPortSettingsList, + request: &mut builder::NetworkingSwitchPortConfigurationLinkList, ) -> anyhow::Result<()> { Ok(()) } - fn execute_networking_switch_port_settings_create( + fn execute_networking_switch_port_configuration_link_create( &self, matches: &clap::ArgMatches, - request: &mut builder::NetworkingSwitchPortSettingsCreate, + request: &mut builder::NetworkingSwitchPortConfigurationLinkCreate, ) -> anyhow::Result<()> { Ok(()) } - fn execute_networking_switch_port_settings_delete( + fn execute_networking_switch_port_configuration_link_view( &self, matches: &clap::ArgMatches, - request: &mut builder::NetworkingSwitchPortSettingsDelete, + request: &mut builder::NetworkingSwitchPortConfigurationLinkView, ) -> anyhow::Result<()> { Ok(()) } - fn execute_networking_switch_port_settings_view( + fn execute_networking_switch_port_configuration_link_delete( &self, matches: &clap::ArgMatches, - request: &mut builder::NetworkingSwitchPortSettingsView, + request: &mut builder::NetworkingSwitchPortConfigurationLinkDelete, ) -> anyhow::Result<()> { Ok(()) } @@ -14615,6 +16542,8 @@ pub enum CliCommand { NetworkingAddressLotCreate, NetworkingAddressLotDelete, NetworkingAddressLotBlockList, + NetworkingAddressLotBlockAdd, + NetworkingAddressLotBlockRemove, NetworkingAllowListView, NetworkingAllowListUpdate, NetworkingBfdDisable, @@ -14634,10 +16563,25 @@ pub enum CliCommand { NetworkingLoopbackAddressList, NetworkingLoopbackAddressCreate, NetworkingLoopbackAddressDelete, - NetworkingSwitchPortSettingsList, - NetworkingSwitchPortSettingsCreate, - NetworkingSwitchPortSettingsDelete, - NetworkingSwitchPortSettingsView, + NetworkingSwitchPortConfigurationList, + NetworkingSwitchPortConfigurationCreate, + NetworkingSwitchPortConfigurationDelete, + NetworkingSwitchPortConfigurationView, + NetworkingSwitchPortConfigurationGeometryView, + NetworkingSwitchPortConfigurationGeometrySet, + NetworkingSwitchPortConfigurationInterfaceAddressList, + NetworkingSwitchPortConfigurationInterfaceAddressAdd, + NetworkingSwitchPortConfigurationInterfaceAddressRemove, + NetworkingSwitchPortConfigurationInterfaceBgpPeerList, + NetworkingSwitchPortConfigurationInterfaceBgpPeerAdd, + NetworkingSwitchPortConfigurationInterfaceBgpPeerRemove, + NetworkingSwitchPortConfigurationInterfaceRouteList, + NetworkingSwitchPortConfigurationInterfaceRouteAdd, + NetworkingSwitchPortConfigurationInterfaceRouteRemove, + NetworkingSwitchPortConfigurationLinkList, + NetworkingSwitchPortConfigurationLinkCreate, + NetworkingSwitchPortConfigurationLinkView, + NetworkingSwitchPortConfigurationLinkDelete, SystemPolicyView, SystemPolicyUpdate, RoleList, @@ -14817,6 +16761,8 @@ impl CliCommand { CliCommand::NetworkingAddressLotCreate, CliCommand::NetworkingAddressLotDelete, CliCommand::NetworkingAddressLotBlockList, + CliCommand::NetworkingAddressLotBlockAdd, + CliCommand::NetworkingAddressLotBlockRemove, CliCommand::NetworkingAllowListView, CliCommand::NetworkingAllowListUpdate, CliCommand::NetworkingBfdDisable, @@ -14836,10 +16782,25 @@ impl CliCommand { CliCommand::NetworkingLoopbackAddressList, CliCommand::NetworkingLoopbackAddressCreate, CliCommand::NetworkingLoopbackAddressDelete, - CliCommand::NetworkingSwitchPortSettingsList, - CliCommand::NetworkingSwitchPortSettingsCreate, - CliCommand::NetworkingSwitchPortSettingsDelete, - CliCommand::NetworkingSwitchPortSettingsView, + CliCommand::NetworkingSwitchPortConfigurationList, + CliCommand::NetworkingSwitchPortConfigurationCreate, + CliCommand::NetworkingSwitchPortConfigurationDelete, + CliCommand::NetworkingSwitchPortConfigurationView, + CliCommand::NetworkingSwitchPortConfigurationGeometryView, + CliCommand::NetworkingSwitchPortConfigurationGeometrySet, + CliCommand::NetworkingSwitchPortConfigurationInterfaceAddressList, + CliCommand::NetworkingSwitchPortConfigurationInterfaceAddressAdd, + CliCommand::NetworkingSwitchPortConfigurationInterfaceAddressRemove, + CliCommand::NetworkingSwitchPortConfigurationInterfaceBgpPeerList, + CliCommand::NetworkingSwitchPortConfigurationInterfaceBgpPeerAdd, + CliCommand::NetworkingSwitchPortConfigurationInterfaceBgpPeerRemove, + CliCommand::NetworkingSwitchPortConfigurationInterfaceRouteList, + CliCommand::NetworkingSwitchPortConfigurationInterfaceRouteAdd, + CliCommand::NetworkingSwitchPortConfigurationInterfaceRouteRemove, + CliCommand::NetworkingSwitchPortConfigurationLinkList, + CliCommand::NetworkingSwitchPortConfigurationLinkCreate, + CliCommand::NetworkingSwitchPortConfigurationLinkView, + CliCommand::NetworkingSwitchPortConfigurationLinkDelete, CliCommand::SystemPolicyView, CliCommand::SystemPolicyUpdate, CliCommand::RoleList, diff --git a/oxide.json b/oxide.json index a855378c..55cfc4bc 100644 --- a/oxide.json +++ b/oxide.json @@ -468,7 +468,6 @@ { "in": "path", "name": "certificate", - "description": "Name or ID of the certificate", "required": true, "schema": { "$ref": "#/components/schemas/NameOrId" @@ -505,7 +504,6 @@ { "in": "path", "name": "certificate", - "description": "Name or ID of the certificate", "required": true, "schema": { "$ref": "#/components/schemas/NameOrId" @@ -4169,7 +4167,7 @@ { "in": "path", "name": "rack_id", - "description": "ID of the rack", + "description": "The rack's unique ID.", "required": true, "schema": { "type": "string", @@ -5030,7 +5028,7 @@ { "in": "path", "name": "user_id", - "description": "The user's internal ID", + "description": "The user's internal id", "required": true, "schema": { "type": "string", @@ -5072,7 +5070,7 @@ { "in": "path", "name": "user_id", - "description": "The user's internal ID", + "description": "The user's internal id", "required": true, "schema": { "type": "string", @@ -6251,6 +6249,95 @@ } } }, + "/v1/system/networking/address-lot/{address_lot}/blocks/add": { + "post": { + "tags": [ + "system/networking" + ], + "summary": "Add block to address lot", + "operationId": "networking_address_lot_block_add", + "parameters": [ + { + "in": "path", + "name": "address_lot", + "description": "Name or ID of the address lot", + "required": true, + "schema": { + "$ref": "#/components/schemas/NameOrId" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddressLotBlockAddRemove" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "successful creation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddressLotBlock" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/v1/system/networking/address-lot/{address_lot}/blocks/remove": { + "post": { + "tags": [ + "system/networking" + ], + "summary": "Remove block from address lot", + "operationId": "networking_address_lot_block_remove", + "parameters": [ + { + "in": "path", + "name": "address_lot", + "description": "Name or ID of the address lot", + "required": true, + "schema": { + "$ref": "#/components/schemas/NameOrId" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddressLotBlockAddRemove" + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "resource updated" + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, "/v1/system/networking/allow-list": { "get": { "tags": [ @@ -6877,19 +6964,730 @@ } }, { - "in": "query", - "name": "page_token", - "description": "Token returned by previous call to retrieve the subsequent page", + "in": "query", + "name": "page_token", + "description": "Token returned by previous call to retrieve the subsequent page", + "schema": { + "nullable": true, + "type": "string" + } + }, + { + "in": "query", + "name": "sort_by", + "schema": { + "$ref": "#/components/schemas/IdSortMode" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LoopbackAddressResultsPage" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + }, + "x-dropshot-pagination": { + "required": [] + } + }, + "post": { + "tags": [ + "system/networking" + ], + "summary": "Create loopback address", + "operationId": "networking_loopback_address_create", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LoopbackAddressCreate" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "successful creation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LoopbackAddress" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/v1/system/networking/loopback-address/{rack_id}/{switch_location}/{address}/{subnet_mask}": { + "delete": { + "tags": [ + "system/networking" + ], + "summary": "Delete loopback address", + "operationId": "networking_loopback_address_delete", + "parameters": [ + { + "in": "path", + "name": "address", + "description": "The IP address and subnet mask to use when selecting the loopback address.", + "required": true, + "schema": { + "type": "string", + "format": "ip" + } + }, + { + "in": "path", + "name": "rack_id", + "description": "The rack to use when selecting the loopback address.", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + }, + { + "in": "path", + "name": "subnet_mask", + "description": "The IP address and subnet mask to use when selecting the loopback address.", + "required": true, + "schema": { + "type": "integer", + "format": "uint8", + "minimum": 0 + } + }, + { + "in": "path", + "name": "switch_location", + "description": "The switch location to use when selecting the loopback address.", + "required": true, + "schema": { + "$ref": "#/components/schemas/Name" + } + } + ], + "responses": { + "204": { + "description": "successful deletion" + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/v1/system/networking/switch-port-configuration": { + "get": { + "tags": [ + "system/networking" + ], + "summary": "List switch port settings", + "operationId": "networking_switch_port_configuration_list", + "parameters": [ + { + "in": "query", + "name": "configuration", + "description": "An optional name or id to use when selecting a switch port configuration.", + "schema": { + "$ref": "#/components/schemas/NameOrId" + } + }, + { + "in": "query", + "name": "limit", + "description": "Maximum number of items returned by a single call", + "schema": { + "nullable": true, + "type": "integer", + "format": "uint32", + "minimum": 1 + } + }, + { + "in": "query", + "name": "page_token", + "description": "Token returned by previous call to retrieve the subsequent page", + "schema": { + "nullable": true, + "type": "string" + } + }, + { + "in": "query", + "name": "sort_by", + "schema": { + "$ref": "#/components/schemas/NameOrIdSortMode" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SwitchPortSettingsResultsPage" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + }, + "x-dropshot-pagination": { + "required": [] + } + }, + "post": { + "tags": [ + "system/networking" + ], + "summary": "Create switch port settings", + "operationId": "networking_switch_port_configuration_create", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SwitchPortSettingsCreate" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "successful creation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SwitchPortSettingsView" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + }, + "delete": { + "tags": [ + "system/networking" + ], + "summary": "Delete switch port settings", + "operationId": "networking_switch_port_configuration_delete", + "parameters": [ + { + "in": "query", + "name": "configuration", + "description": "An optional name or id to use when selecting a switch port configuration.", + "schema": { + "$ref": "#/components/schemas/NameOrId" + } + } + ], + "responses": { + "204": { + "description": "successful deletion" + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/v1/system/networking/switch-port-configuration/{configuration}": { + "get": { + "tags": [ + "system/networking" + ], + "summary": "Get information about a named set of switch-port-settings", + "operationId": "networking_switch_port_configuration_view", + "parameters": [ + { + "in": "path", + "name": "configuration", + "description": "A name or id to use when selecting a switch port configuration.", + "required": true, + "schema": { + "$ref": "#/components/schemas/NameOrId" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SwitchPortSettingsView" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/v1/system/networking/switch-port-configuration/{configuration}/geometry": { + "get": { + "tags": [ + "system/networking" + ], + "summary": "Get switch port geometry for a provided switch port configuration", + "operationId": "networking_switch_port_configuration_geometry_view", + "parameters": [ + { + "in": "path", + "name": "configuration", + "description": "A name or id to use when selecting a switch port configuration.", + "required": true, + "schema": { + "$ref": "#/components/schemas/NameOrId" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SwitchPortConfig" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + }, + "post": { + "tags": [ + "system/networking" + ], + "summary": "Set switch port geometry for a provided switch port configuration", + "operationId": "networking_switch_port_configuration_geometry_set", + "parameters": [ + { + "in": "path", + "name": "configuration", + "description": "A name or id to use when selecting a switch port configuration.", + "required": true, + "schema": { + "$ref": "#/components/schemas/NameOrId" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SwitchPortConfigCreate" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "successful creation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SwitchPortConfig" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/v1/system/networking/switch-port-configuration/{configuration}/interface/{interface}/address": { + "get": { + "tags": [ + "system/networking" + ], + "summary": "List addresses assigned to a provided interface configuration", + "operationId": "networking_switch_port_configuration_interface_address_list", + "parameters": [ + { + "in": "path", + "name": "configuration", + "description": "A name or id to use when selecting a switch port configuration.", + "required": true, + "schema": { + "$ref": "#/components/schemas/NameOrId" + } + }, + { + "in": "path", + "name": "interface", + "description": "Interface name", + "required": true, + "schema": { + "$ref": "#/components/schemas/Name" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "title": "Array_of_SwitchPortAddressConfig", + "type": "array", + "items": { + "$ref": "#/components/schemas/SwitchPortAddressConfig" + } + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/v1/system/networking/switch-port-configuration/{configuration}/interface/{interface}/address/add": { + "post": { + "tags": [ + "system/networking" + ], + "summary": "Add address to an interface configuration", + "operationId": "networking_switch_port_configuration_interface_address_add", + "parameters": [ + { + "in": "path", + "name": "configuration", + "description": "A name or id to use when selecting a switch port configuration.", + "required": true, + "schema": { + "$ref": "#/components/schemas/NameOrId" + } + }, + { + "in": "path", + "name": "interface", + "description": "Interface name", + "required": true, + "schema": { + "$ref": "#/components/schemas/Name" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Address" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "successful creation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SwitchPortAddressConfig" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/v1/system/networking/switch-port-configuration/{configuration}/interface/{interface}/address/remove": { + "post": { + "tags": [ + "system/networking" + ], + "summary": "Remove address from an interface configuration", + "operationId": "networking_switch_port_configuration_interface_address_remove", + "parameters": [ + { + "in": "path", + "name": "configuration", + "description": "A name or id to use when selecting a switch port configuration.", + "required": true, + "schema": { + "$ref": "#/components/schemas/NameOrId" + } + }, + { + "in": "path", + "name": "interface", + "description": "Interface name", + "required": true, + "schema": { + "$ref": "#/components/schemas/Name" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Address" + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "successful deletion" + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/v1/system/networking/switch-port-configuration/{configuration}/interface/{interface}/bgp-peer": { + "get": { + "tags": [ + "system/networking" + ], + "summary": "List bgp peers assigned to a provided interface configuration", + "operationId": "networking_switch_port_configuration_interface_bgp_peer_list", + "parameters": [ + { + "in": "path", + "name": "configuration", + "description": "A name or id to use when selecting a switch port configuration.", + "required": true, + "schema": { + "$ref": "#/components/schemas/NameOrId" + } + }, + { + "in": "path", + "name": "interface", + "description": "Interface name", + "required": true, + "schema": { + "$ref": "#/components/schemas/Name" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BgpPeerConfig" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/v1/system/networking/switch-port-configuration/{configuration}/interface/{interface}/bgp-peer/add": { + "post": { + "tags": [ + "system/networking" + ], + "summary": "Add bgp peer to an interface configuration", + "operationId": "networking_switch_port_configuration_interface_bgp_peer_add", + "parameters": [ + { + "in": "path", + "name": "configuration", + "description": "A name or id to use when selecting a switch port configuration.", + "required": true, + "schema": { + "$ref": "#/components/schemas/NameOrId" + } + }, + { + "in": "path", + "name": "interface", + "description": "Interface name", + "required": true, + "schema": { + "$ref": "#/components/schemas/Name" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BgpPeer" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "successful creation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BgpPeer" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/v1/system/networking/switch-port-configuration/{configuration}/interface/{interface}/bgp-peer/remove": { + "post": { + "tags": [ + "system/networking" + ], + "summary": "Remove bgp peer from an interface configuration", + "operationId": "networking_switch_port_configuration_interface_bgp_peer_remove", + "parameters": [ + { + "in": "path", + "name": "configuration", + "description": "A name or id to use when selecting a switch port configuration.", + "required": true, + "schema": { + "$ref": "#/components/schemas/NameOrId" + } + }, + { + "in": "path", + "name": "interface", + "description": "Interface name", + "required": true, + "schema": { + "$ref": "#/components/schemas/Name" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BgpPeer" + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "successful deletion" + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/v1/system/networking/switch-port-configuration/{configuration}/interface/{interface}/route": { + "get": { + "tags": [ + "system/networking" + ], + "summary": "List routes assigned to a provided interface configuration", + "operationId": "networking_switch_port_configuration_interface_route_list", + "parameters": [ + { + "in": "path", + "name": "configuration", + "description": "A name or id to use when selecting a switch port configuration.", + "required": true, "schema": { - "nullable": true, - "type": "string" + "$ref": "#/components/schemas/NameOrId" } }, { - "in": "query", - "name": "sort_by", + "in": "path", + "name": "interface", + "description": "Interface name", + "required": true, "schema": { - "$ref": "#/components/schemas/IdSortMode" + "$ref": "#/components/schemas/Name" } } ], @@ -6899,7 +7697,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LoopbackAddressResultsPage" + "$ref": "#/components/schemas/RouteConfig" } } } @@ -6910,22 +7708,41 @@ "5XX": { "$ref": "#/components/responses/Error" } - }, - "x-dropshot-pagination": { - "required": [] } - }, + } + }, + "/v1/system/networking/switch-port-configuration/{configuration}/interface/{interface}/route/add": { "post": { "tags": [ "system/networking" ], - "summary": "Create loopback address", - "operationId": "networking_loopback_address_create", + "summary": "Add route to an interface configuration", + "operationId": "networking_switch_port_configuration_interface_route_add", + "parameters": [ + { + "in": "path", + "name": "configuration", + "description": "A name or id to use when selecting a switch port configuration.", + "required": true, + "schema": { + "$ref": "#/components/schemas/NameOrId" + } + }, + { + "in": "path", + "name": "interface", + "description": "Interface name", + "required": true, + "schema": { + "$ref": "#/components/schemas/Name" + } + } + ], "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LoopbackAddressCreate" + "$ref": "#/components/schemas/Route" } } }, @@ -6937,7 +7754,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LoopbackAddress" + "$ref": "#/components/schemas/Route" } } } @@ -6951,55 +7768,43 @@ } } }, - "/v1/system/networking/loopback-address/{rack_id}/{switch_location}/{address}/{subnet_mask}": { - "delete": { + "/v1/system/networking/switch-port-configuration/{configuration}/interface/{interface}/route/remove": { + "post": { "tags": [ "system/networking" ], - "summary": "Delete loopback address", - "operationId": "networking_loopback_address_delete", + "summary": "Remove address from an interface configuration", + "operationId": "networking_switch_port_configuration_interface_route_remove", "parameters": [ { "in": "path", - "name": "address", - "description": "The IP address and subnet mask to use when selecting the loopback address.", - "required": true, - "schema": { - "type": "string", - "format": "ip" - } - }, - { - "in": "path", - "name": "rack_id", - "description": "The rack to use when selecting the loopback address.", - "required": true, - "schema": { - "type": "string", - "format": "uuid" - } - }, - { - "in": "path", - "name": "subnet_mask", - "description": "The IP address and subnet mask to use when selecting the loopback address.", + "name": "configuration", + "description": "A name or id to use when selecting a switch port configuration.", "required": true, "schema": { - "type": "integer", - "format": "uint8", - "minimum": 0 + "$ref": "#/components/schemas/NameOrId" } }, { "in": "path", - "name": "switch_location", - "description": "The switch location to use when selecting the loopback address.", + "name": "interface", + "description": "Interface name", "required": true, "schema": { "$ref": "#/components/schemas/Name" } } ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Route" + } + } + }, + "required": true + }, "responses": { "204": { "description": "successful deletion" @@ -7013,48 +7818,22 @@ } } }, - "/v1/system/networking/switch-port-settings": { + "/v1/system/networking/switch-port-configuration/{configuration}/link": { "get": { "tags": [ "system/networking" ], - "summary": "List switch port settings", - "operationId": "networking_switch_port_settings_list", + "summary": "List links for a provided switch port configuration", + "operationId": "networking_switch_port_configuration_link_list", "parameters": [ { - "in": "query", - "name": "limit", - "description": "Maximum number of items returned by a single call", - "schema": { - "nullable": true, - "type": "integer", - "format": "uint32", - "minimum": 1 - } - }, - { - "in": "query", - "name": "page_token", - "description": "Token returned by previous call to retrieve the subsequent page", - "schema": { - "nullable": true, - "type": "string" - } - }, - { - "in": "query", - "name": "port_settings", - "description": "An optional name or id to use when selecting port settings.", + "in": "path", + "name": "configuration", + "description": "A name or id to use when selecting a switch port configuration.", + "required": true, "schema": { "$ref": "#/components/schemas/NameOrId" } - }, - { - "in": "query", - "name": "sort_by", - "schema": { - "$ref": "#/components/schemas/NameOrIdSortMode" - } } ], "responses": { @@ -7063,7 +7842,11 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SwitchPortSettingsResultsPage" + "title": "Array_of_SwitchPortLinkConfig", + "type": "array", + "items": { + "$ref": "#/components/schemas/SwitchPortLinkConfig" + } } } } @@ -7074,22 +7857,30 @@ "5XX": { "$ref": "#/components/responses/Error" } - }, - "x-dropshot-pagination": { - "required": [] } }, "post": { "tags": [ "system/networking" ], - "summary": "Create switch port settings", - "operationId": "networking_switch_port_settings_create", + "summary": "Create a link for a provided switch port configuration", + "operationId": "networking_switch_port_configuration_link_create", + "parameters": [ + { + "in": "path", + "name": "configuration", + "description": "A name or id to use when selecting a switch port configuration.", + "required": true, + "schema": { + "$ref": "#/components/schemas/NameOrId" + } + } + ], "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SwitchPortSettingsCreate" + "$ref": "#/components/schemas/NamedLinkConfigCreate" } } }, @@ -7101,7 +7892,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SwitchPortSettingsView" + "$ref": "#/components/schemas/SwitchPortLinkConfig" } } } @@ -7113,26 +7904,45 @@ "$ref": "#/components/responses/Error" } } - }, - "delete": { + } + }, + "/v1/system/networking/switch-port-configuration/{configuration}/link/{link}": { + "get": { "tags": [ "system/networking" ], - "summary": "Delete switch port settings", - "operationId": "networking_switch_port_settings_delete", + "summary": "View a link for a provided switch port configuration", + "operationId": "networking_switch_port_configuration_link_view", "parameters": [ { - "in": "query", - "name": "port_settings", - "description": "An optional name or id to use when selecting port settings.", + "in": "path", + "name": "configuration", + "description": "A name or id to use when selecting a switch port configuration.", + "required": true, "schema": { "$ref": "#/components/schemas/NameOrId" } + }, + { + "in": "path", + "name": "link", + "description": "Link name", + "required": true, + "schema": { + "$ref": "#/components/schemas/Name" + } } ], "responses": { - "204": { - "description": "successful deletion" + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SwitchPortLinkConfig" + } + } + } }, "4XX": { "$ref": "#/components/responses/Error" @@ -7141,36 +7951,36 @@ "$ref": "#/components/responses/Error" } } - } - }, - "/v1/system/networking/switch-port-settings/{port}": { - "get": { + }, + "delete": { "tags": [ "system/networking" ], - "summary": "Get information about switch port", - "operationId": "networking_switch_port_settings_view", + "summary": "Delete a link for a provided switch port configuration", + "operationId": "networking_switch_port_configuration_link_delete", "parameters": [ { "in": "path", - "name": "port", - "description": "A name or id to use when selecting switch port settings info objects.", + "name": "configuration", + "description": "A name or id to use when selecting a switch port configuration.", "required": true, "schema": { "$ref": "#/components/schemas/NameOrId" } + }, + { + "in": "path", + "name": "link", + "description": "Link name", + "required": true, + "schema": { + "$ref": "#/components/schemas/Name" + } } ], "responses": { - "200": { - "description": "successful operation", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SwitchPortSettingsView" - } - } - } + "204": { + "description": "successful deletion" }, "4XX": { "$ref": "#/components/responses/Error" @@ -7874,7 +8684,7 @@ { "in": "path", "name": "user_id", - "description": "The user's internal ID", + "description": "The user's internal id", "required": true, "schema": { "type": "string", @@ -9771,8 +10581,8 @@ "last_address" ] }, - "AddressLotBlockCreate": { - "description": "Parameters for creating an address lot block. Fist and last addresses are inclusive.", + "AddressLotBlockAddRemove": { + "description": "Parameters for adding or removing an address lot block. First and last addresses are inclusive.", "type": "object", "properties": { "first_address": { @@ -9816,13 +10626,6 @@ "description": "Parameters for creating an address lot.", "type": "object", "properties": { - "blocks": { - "description": "The blocks to add along with the new address lot.", - "type": "array", - "items": { - "$ref": "#/components/schemas/AddressLotBlockCreate" - } - }, "description": { "type": "string" }, @@ -9839,7 +10642,6 @@ } }, "required": [ - "blocks", "description", "kind", "name" @@ -9849,13 +10651,6 @@ "description": "An address lot and associated blocks resulting from creating an address lot.", "type": "object", "properties": { - "blocks": { - "description": "The address lot blocks that were created.", - "type": "array", - "items": { - "$ref": "#/components/schemas/AddressLotBlock" - } - }, "lot": { "description": "The address lot that was created.", "allOf": [ @@ -9866,7 +10661,6 @@ } }, "required": [ - "blocks", "lot" ] }, @@ -16548,6 +17342,62 @@ } ] }, + "NamedLinkConfigCreate": { + "description": "Named switch link configuration.", + "type": "object", + "properties": { + "autoneg": { + "description": "Whether or not to set autonegotiation", + "type": "boolean" + }, + "fec": { + "description": "The forward error correction mode of the link.", + "allOf": [ + { + "$ref": "#/components/schemas/LinkFec" + } + ] + }, + "lldp_config": { + "nullable": true, + "description": "The optional link-layer discovery protocol (LLDP) configuration for the link.", + "allOf": [ + { + "$ref": "#/components/schemas/NameOrId" + } + ] + }, + "mtu": { + "description": "Maximum transmission unit for the link.", + "type": "integer", + "format": "uint16", + "minimum": 0 + }, + "name": { + "description": "Name of link", + "allOf": [ + { + "$ref": "#/components/schemas/Name" + } + ] + }, + "speed": { + "description": "The speed of the link.", + "allOf": [ + { + "$ref": "#/components/schemas/LinkSpeed" + } + ] + } + }, + "required": [ + "autoneg", + "fec", + "mtu", + "name", + "speed" + ] + }, "NetworkInterface": { "description": "Information required to construct a virtual network interface", "type": "object", @@ -19337,7 +20187,6 @@ "type": "string" }, "lldp_link_config_id": { - "nullable": true, "description": "The link-layer discovery protocol service configuration id for this link.", "type": "string", "format": "uuid" @@ -19366,6 +20215,7 @@ "autoneg", "fec", "link_name", + "lldp_link_config_id", "mtu", "port_settings_id", "speed" @@ -19936,8 +20786,7 @@ "nanoseconds", "volts", "amps", - "watts", - "degrees_celsius" + "degrees_celcius" ] }, { diff --git a/sdk-httpmock/src/generated_httpmock.rs b/sdk-httpmock/src/generated_httpmock.rs index c545d2d8..e12f8744 100644 --- a/sdk-httpmock/src/generated_httpmock.rs +++ b/sdk-httpmock/src/generated_httpmock.rs @@ -10098,6 +10098,136 @@ pub mod operations { } } + pub struct NetworkingAddressLotBlockAddWhen(httpmock::When); + impl NetworkingAddressLotBlockAddWhen { + pub fn new(inner: httpmock::When) -> Self { + Self(inner.method(httpmock::Method::POST).path_matches( + regex::Regex::new("^/v1/system/networking/address-lot/[^/]*/blocks/add$").unwrap(), + )) + } + + pub fn into_inner(self) -> httpmock::When { + self.0 + } + + pub fn address_lot(self, value: &types::NameOrId) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/address-lot/{}/blocks/add$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + + pub fn body(self, value: &types::AddressLotBlockAddRemove) -> Self { + Self(self.0.json_body_obj(value)) + } + } + + pub struct NetworkingAddressLotBlockAddThen(httpmock::Then); + impl NetworkingAddressLotBlockAddThen { + pub fn new(inner: httpmock::Then) -> Self { + Self(inner) + } + + pub fn into_inner(self) -> httpmock::Then { + self.0 + } + + pub fn created(self, value: &types::AddressLotBlock) -> Self { + Self( + self.0 + .status(201u16) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn client_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 4u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn server_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 5u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + } + + pub struct NetworkingAddressLotBlockRemoveWhen(httpmock::When); + impl NetworkingAddressLotBlockRemoveWhen { + pub fn new(inner: httpmock::When) -> Self { + Self( + inner.method(httpmock::Method::POST).path_matches( + regex::Regex::new("^/v1/system/networking/address-lot/[^/]*/blocks/remove$") + .unwrap(), + ), + ) + } + + pub fn into_inner(self) -> httpmock::When { + self.0 + } + + pub fn address_lot(self, value: &types::NameOrId) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/address-lot/{}/blocks/remove$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + + pub fn body(self, value: &types::AddressLotBlockAddRemove) -> Self { + Self(self.0.json_body_obj(value)) + } + } + + pub struct NetworkingAddressLotBlockRemoveThen(httpmock::Then); + impl NetworkingAddressLotBlockRemoveThen { + pub fn new(inner: httpmock::Then) -> Self { + Self(inner) + } + + pub fn into_inner(self) -> httpmock::Then { + self.0 + } + + pub fn no_content(self) -> Self { + Self(self.0.status(204u16)) + } + + pub fn client_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 4u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn server_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 5u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + } + pub struct NetworkingAllowListViewWhen(httpmock::When); impl NetworkingAllowListViewWhen { pub fn new(inner: httpmock::When) -> Self { @@ -11376,11 +11506,11 @@ pub mod operations { } } - pub struct NetworkingSwitchPortSettingsListWhen(httpmock::When); - impl NetworkingSwitchPortSettingsListWhen { + pub struct NetworkingSwitchPortConfigurationListWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationListWhen { pub fn new(inner: httpmock::When) -> Self { Self(inner.method(httpmock::Method::GET).path_matches( - regex::Regex::new("^/v1/system/networking/switch-port-settings$").unwrap(), + regex::Regex::new("^/v1/system/networking/switch-port-configuration$").unwrap(), )) } @@ -11388,49 +11518,49 @@ pub mod operations { self.0 } - pub fn limit(self, value: T) -> Self + pub fn configuration<'a, T>(self, value: T) -> Self where - T: Into>, + T: Into>, { if let Some(value) = value.into() { - Self(self.0.query_param("limit", value.to_string())) + Self(self.0.query_param("configuration", value.to_string())) } else { Self(self.0.matches(|req| { req.query_params .as_ref() - .and_then(|qs| qs.iter().find(|(key, _)| key == "limit")) + .and_then(|qs| qs.iter().find(|(key, _)| key == "configuration")) .is_none() })) } } - pub fn page_token<'a, T>(self, value: T) -> Self + pub fn limit(self, value: T) -> Self where - T: Into>, + T: Into>, { if let Some(value) = value.into() { - Self(self.0.query_param("page_token", value.to_string())) + Self(self.0.query_param("limit", value.to_string())) } else { Self(self.0.matches(|req| { req.query_params .as_ref() - .and_then(|qs| qs.iter().find(|(key, _)| key == "page_token")) + .and_then(|qs| qs.iter().find(|(key, _)| key == "limit")) .is_none() })) } } - pub fn port_settings<'a, T>(self, value: T) -> Self + pub fn page_token<'a, T>(self, value: T) -> Self where - T: Into>, + T: Into>, { if let Some(value) = value.into() { - Self(self.0.query_param("port_settings", value.to_string())) + Self(self.0.query_param("page_token", value.to_string())) } else { Self(self.0.matches(|req| { req.query_params .as_ref() - .and_then(|qs| qs.iter().find(|(key, _)| key == "port_settings")) + .and_then(|qs| qs.iter().find(|(key, _)| key == "page_token")) .is_none() })) } @@ -11453,8 +11583,8 @@ pub mod operations { } } - pub struct NetworkingSwitchPortSettingsListThen(httpmock::Then); - impl NetworkingSwitchPortSettingsListThen { + pub struct NetworkingSwitchPortConfigurationListThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationListThen { pub fn new(inner: httpmock::Then) -> Self { Self(inner) } @@ -11493,11 +11623,11 @@ pub mod operations { } } - pub struct NetworkingSwitchPortSettingsCreateWhen(httpmock::When); - impl NetworkingSwitchPortSettingsCreateWhen { + pub struct NetworkingSwitchPortConfigurationCreateWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationCreateWhen { pub fn new(inner: httpmock::When) -> Self { Self(inner.method(httpmock::Method::POST).path_matches( - regex::Regex::new("^/v1/system/networking/switch-port-settings$").unwrap(), + regex::Regex::new("^/v1/system/networking/switch-port-configuration$").unwrap(), )) } @@ -11510,8 +11640,8 @@ pub mod operations { } } - pub struct NetworkingSwitchPortSettingsCreateThen(httpmock::Then); - impl NetworkingSwitchPortSettingsCreateThen { + pub struct NetworkingSwitchPortConfigurationCreateThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationCreateThen { pub fn new(inner: httpmock::Then) -> Self { Self(inner) } @@ -11550,11 +11680,11 @@ pub mod operations { } } - pub struct NetworkingSwitchPortSettingsDeleteWhen(httpmock::When); - impl NetworkingSwitchPortSettingsDeleteWhen { + pub struct NetworkingSwitchPortConfigurationDeleteWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationDeleteWhen { pub fn new(inner: httpmock::When) -> Self { Self(inner.method(httpmock::Method::DELETE).path_matches( - regex::Regex::new("^/v1/system/networking/switch-port-settings$").unwrap(), + regex::Regex::new("^/v1/system/networking/switch-port-configuration$").unwrap(), )) } @@ -11562,25 +11692,1139 @@ pub mod operations { self.0 } - pub fn port_settings<'a, T>(self, value: T) -> Self + pub fn configuration<'a, T>(self, value: T) -> Self where T: Into>, { if let Some(value) = value.into() { - Self(self.0.query_param("port_settings", value.to_string())) + Self(self.0.query_param("configuration", value.to_string())) } else { Self(self.0.matches(|req| { req.query_params .as_ref() - .and_then(|qs| qs.iter().find(|(key, _)| key == "port_settings")) + .and_then(|qs| qs.iter().find(|(key, _)| key == "configuration")) .is_none() })) } } } - pub struct NetworkingSwitchPortSettingsDeleteThen(httpmock::Then); - impl NetworkingSwitchPortSettingsDeleteThen { + pub struct NetworkingSwitchPortConfigurationDeleteThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationDeleteThen { + pub fn new(inner: httpmock::Then) -> Self { + Self(inner) + } + + pub fn into_inner(self) -> httpmock::Then { + self.0 + } + + pub fn no_content(self) -> Self { + Self(self.0.status(204u16)) + } + + pub fn client_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 4u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn server_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 5u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + } + + pub struct NetworkingSwitchPortConfigurationViewWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationViewWhen { + pub fn new(inner: httpmock::When) -> Self { + Self( + inner.method(httpmock::Method::GET).path_matches( + regex::Regex::new("^/v1/system/networking/switch-port-configuration/[^/]*$") + .unwrap(), + ), + ) + } + + pub fn into_inner(self) -> httpmock::When { + self.0 + } + + pub fn configuration(self, value: &types::NameOrId) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/switch-port-configuration/{}$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + } + + pub struct NetworkingSwitchPortConfigurationViewThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationViewThen { + pub fn new(inner: httpmock::Then) -> Self { + Self(inner) + } + + pub fn into_inner(self) -> httpmock::Then { + self.0 + } + + pub fn ok(self, value: &types::SwitchPortSettingsView) -> Self { + Self( + self.0 + .status(200u16) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn client_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 4u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn server_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 5u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + } + + pub struct NetworkingSwitchPortConfigurationGeometryViewWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationGeometryViewWhen { + pub fn new(inner: httpmock::When) -> Self { + Self( + inner.method(httpmock::Method::GET).path_matches( + regex::Regex::new( + "^/v1/system/networking/switch-port-configuration/[^/]*/geometry$", + ) + .unwrap(), + ), + ) + } + + pub fn into_inner(self) -> httpmock::When { + self.0 + } + + pub fn configuration(self, value: &types::NameOrId) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/switch-port-configuration/{}/geometry$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + } + + pub struct NetworkingSwitchPortConfigurationGeometryViewThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationGeometryViewThen { + pub fn new(inner: httpmock::Then) -> Self { + Self(inner) + } + + pub fn into_inner(self) -> httpmock::Then { + self.0 + } + + pub fn ok(self, value: &types::SwitchPortConfig) -> Self { + Self( + self.0 + .status(200u16) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn client_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 4u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn server_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 5u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + } + + pub struct NetworkingSwitchPortConfigurationGeometrySetWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationGeometrySetWhen { + pub fn new(inner: httpmock::When) -> Self { + Self( + inner.method(httpmock::Method::POST).path_matches( + regex::Regex::new( + "^/v1/system/networking/switch-port-configuration/[^/]*/geometry$", + ) + .unwrap(), + ), + ) + } + + pub fn into_inner(self) -> httpmock::When { + self.0 + } + + pub fn configuration(self, value: &types::NameOrId) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/switch-port-configuration/{}/geometry$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + + pub fn body(self, value: &types::SwitchPortConfigCreate) -> Self { + Self(self.0.json_body_obj(value)) + } + } + + pub struct NetworkingSwitchPortConfigurationGeometrySetThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationGeometrySetThen { + pub fn new(inner: httpmock::Then) -> Self { + Self(inner) + } + + pub fn into_inner(self) -> httpmock::Then { + self.0 + } + + pub fn created(self, value: &types::SwitchPortConfig) -> Self { + Self( + self.0 + .status(201u16) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn client_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 4u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn server_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 5u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + } + + pub struct NetworkingSwitchPortConfigurationInterfaceAddressListWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationInterfaceAddressListWhen { + pub fn new(inner: httpmock::When) -> Self { + Self( + inner.method(httpmock::Method::GET).path_matches( + regex::Regex::new( + "^/v1/system/networking/switch-port-configuration/[^/]*/interface/[^/]*/\ + address$", + ) + .unwrap(), + ), + ) + } + + pub fn into_inner(self) -> httpmock::When { + self.0 + } + + pub fn configuration(self, value: &types::NameOrId) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/switch-port-configuration/{}/interface/.*/address$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + + pub fn interface(self, value: &types::Name) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/switch-port-configuration/.*/interface/{}/address$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + } + + pub struct NetworkingSwitchPortConfigurationInterfaceAddressListThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationInterfaceAddressListThen { + pub fn new(inner: httpmock::Then) -> Self { + Self(inner) + } + + pub fn into_inner(self) -> httpmock::Then { + self.0 + } + + pub fn ok(self, value: &Vec) -> Self { + Self( + self.0 + .status(200u16) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn client_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 4u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn server_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 5u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + } + + pub struct NetworkingSwitchPortConfigurationInterfaceAddressAddWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationInterfaceAddressAddWhen { + pub fn new(inner: httpmock::When) -> Self { + Self( + inner.method(httpmock::Method::POST).path_matches( + regex::Regex::new( + "^/v1/system/networking/switch-port-configuration/[^/]*/interface/[^/]*/\ + address/add$", + ) + .unwrap(), + ), + ) + } + + pub fn into_inner(self) -> httpmock::When { + self.0 + } + + pub fn configuration(self, value: &types::NameOrId) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/switch-port-configuration/{}/interface/.*/address/add$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + + pub fn interface(self, value: &types::Name) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/switch-port-configuration/.*/interface/{}/address/add$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + + pub fn body(self, value: &types::Address) -> Self { + Self(self.0.json_body_obj(value)) + } + } + + pub struct NetworkingSwitchPortConfigurationInterfaceAddressAddThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationInterfaceAddressAddThen { + pub fn new(inner: httpmock::Then) -> Self { + Self(inner) + } + + pub fn into_inner(self) -> httpmock::Then { + self.0 + } + + pub fn created(self, value: &types::SwitchPortAddressConfig) -> Self { + Self( + self.0 + .status(201u16) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn client_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 4u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn server_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 5u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + } + + pub struct NetworkingSwitchPortConfigurationInterfaceAddressRemoveWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationInterfaceAddressRemoveWhen { + pub fn new(inner: httpmock::When) -> Self { + Self( + inner.method(httpmock::Method::POST).path_matches( + regex::Regex::new( + "^/v1/system/networking/switch-port-configuration/[^/]*/interface/[^/]*/\ + address/remove$", + ) + .unwrap(), + ), + ) + } + + pub fn into_inner(self) -> httpmock::When { + self.0 + } + + pub fn configuration(self, value: &types::NameOrId) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/switch-port-configuration/{}/interface/.*/address/remove$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + + pub fn interface(self, value: &types::Name) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/switch-port-configuration/.*/interface/{}/address/remove$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + + pub fn body(self, value: &types::Address) -> Self { + Self(self.0.json_body_obj(value)) + } + } + + pub struct NetworkingSwitchPortConfigurationInterfaceAddressRemoveThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationInterfaceAddressRemoveThen { + pub fn new(inner: httpmock::Then) -> Self { + Self(inner) + } + + pub fn into_inner(self) -> httpmock::Then { + self.0 + } + + pub fn no_content(self) -> Self { + Self(self.0.status(204u16)) + } + + pub fn client_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 4u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn server_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 5u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + } + + pub struct NetworkingSwitchPortConfigurationInterfaceBgpPeerListWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationInterfaceBgpPeerListWhen { + pub fn new(inner: httpmock::When) -> Self { + Self( + inner.method(httpmock::Method::GET).path_matches( + regex::Regex::new( + "^/v1/system/networking/switch-port-configuration/[^/]*/interface/[^/]*/\ + bgp-peer$", + ) + .unwrap(), + ), + ) + } + + pub fn into_inner(self) -> httpmock::When { + self.0 + } + + pub fn configuration(self, value: &types::NameOrId) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/switch-port-configuration/{}/interface/.*/bgp-peer$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + + pub fn interface(self, value: &types::Name) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/switch-port-configuration/.*/interface/{}/bgp-peer$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + } + + pub struct NetworkingSwitchPortConfigurationInterfaceBgpPeerListThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationInterfaceBgpPeerListThen { + pub fn new(inner: httpmock::Then) -> Self { + Self(inner) + } + + pub fn into_inner(self) -> httpmock::Then { + self.0 + } + + pub fn ok(self, value: &types::BgpPeerConfig) -> Self { + Self( + self.0 + .status(200u16) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn client_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 4u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn server_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 5u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + } + + pub struct NetworkingSwitchPortConfigurationInterfaceBgpPeerAddWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationInterfaceBgpPeerAddWhen { + pub fn new(inner: httpmock::When) -> Self { + Self( + inner.method(httpmock::Method::POST).path_matches( + regex::Regex::new( + "^/v1/system/networking/switch-port-configuration/[^/]*/interface/[^/]*/\ + bgp-peer/add$", + ) + .unwrap(), + ), + ) + } + + pub fn into_inner(self) -> httpmock::When { + self.0 + } + + pub fn configuration(self, value: &types::NameOrId) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/switch-port-configuration/{}/interface/.*/bgp-peer/add$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + + pub fn interface(self, value: &types::Name) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/switch-port-configuration/.*/interface/{}/bgp-peer/add$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + + pub fn body(self, value: &types::BgpPeer) -> Self { + Self(self.0.json_body_obj(value)) + } + } + + pub struct NetworkingSwitchPortConfigurationInterfaceBgpPeerAddThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationInterfaceBgpPeerAddThen { + pub fn new(inner: httpmock::Then) -> Self { + Self(inner) + } + + pub fn into_inner(self) -> httpmock::Then { + self.0 + } + + pub fn created(self, value: &types::BgpPeer) -> Self { + Self( + self.0 + .status(201u16) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn client_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 4u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn server_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 5u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + } + + pub struct NetworkingSwitchPortConfigurationInterfaceBgpPeerRemoveWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationInterfaceBgpPeerRemoveWhen { + pub fn new(inner: httpmock::When) -> Self { + Self( + inner.method(httpmock::Method::POST).path_matches( + regex::Regex::new( + "^/v1/system/networking/switch-port-configuration/[^/]*/interface/[^/]*/\ + bgp-peer/remove$", + ) + .unwrap(), + ), + ) + } + + pub fn into_inner(self) -> httpmock::When { + self.0 + } + + pub fn configuration(self, value: &types::NameOrId) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/switch-port-configuration/{}/interface/.*/bgp-peer/remove$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + + pub fn interface(self, value: &types::Name) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/switch-port-configuration/.*/interface/{}/bgp-peer/remove$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + + pub fn body(self, value: &types::BgpPeer) -> Self { + Self(self.0.json_body_obj(value)) + } + } + + pub struct NetworkingSwitchPortConfigurationInterfaceBgpPeerRemoveThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationInterfaceBgpPeerRemoveThen { + pub fn new(inner: httpmock::Then) -> Self { + Self(inner) + } + + pub fn into_inner(self) -> httpmock::Then { + self.0 + } + + pub fn no_content(self) -> Self { + Self(self.0.status(204u16)) + } + + pub fn client_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 4u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn server_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 5u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + } + + pub struct NetworkingSwitchPortConfigurationInterfaceRouteListWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationInterfaceRouteListWhen { + pub fn new(inner: httpmock::When) -> Self { + Self( + inner.method(httpmock::Method::GET).path_matches( + regex::Regex::new( + "^/v1/system/networking/switch-port-configuration/[^/]*/interface/[^/]*/\ + route$", + ) + .unwrap(), + ), + ) + } + + pub fn into_inner(self) -> httpmock::When { + self.0 + } + + pub fn configuration(self, value: &types::NameOrId) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/switch-port-configuration/{}/interface/.*/route$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + + pub fn interface(self, value: &types::Name) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/switch-port-configuration/.*/interface/{}/route$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + } + + pub struct NetworkingSwitchPortConfigurationInterfaceRouteListThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationInterfaceRouteListThen { + pub fn new(inner: httpmock::Then) -> Self { + Self(inner) + } + + pub fn into_inner(self) -> httpmock::Then { + self.0 + } + + pub fn ok(self, value: &types::RouteConfig) -> Self { + Self( + self.0 + .status(200u16) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn client_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 4u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn server_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 5u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + } + + pub struct NetworkingSwitchPortConfigurationInterfaceRouteAddWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationInterfaceRouteAddWhen { + pub fn new(inner: httpmock::When) -> Self { + Self( + inner.method(httpmock::Method::POST).path_matches( + regex::Regex::new( + "^/v1/system/networking/switch-port-configuration/[^/]*/interface/[^/]*/\ + route/add$", + ) + .unwrap(), + ), + ) + } + + pub fn into_inner(self) -> httpmock::When { + self.0 + } + + pub fn configuration(self, value: &types::NameOrId) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/switch-port-configuration/{}/interface/.*/route/add$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + + pub fn interface(self, value: &types::Name) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/switch-port-configuration/.*/interface/{}/route/add$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + + pub fn body(self, value: &types::Route) -> Self { + Self(self.0.json_body_obj(value)) + } + } + + pub struct NetworkingSwitchPortConfigurationInterfaceRouteAddThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationInterfaceRouteAddThen { + pub fn new(inner: httpmock::Then) -> Self { + Self(inner) + } + + pub fn into_inner(self) -> httpmock::Then { + self.0 + } + + pub fn created(self, value: &types::Route) -> Self { + Self( + self.0 + .status(201u16) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn client_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 4u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn server_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 5u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + } + + pub struct NetworkingSwitchPortConfigurationInterfaceRouteRemoveWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationInterfaceRouteRemoveWhen { + pub fn new(inner: httpmock::When) -> Self { + Self( + inner.method(httpmock::Method::POST).path_matches( + regex::Regex::new( + "^/v1/system/networking/switch-port-configuration/[^/]*/interface/[^/]*/\ + route/remove$", + ) + .unwrap(), + ), + ) + } + + pub fn into_inner(self) -> httpmock::When { + self.0 + } + + pub fn configuration(self, value: &types::NameOrId) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/switch-port-configuration/{}/interface/.*/route/remove$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + + pub fn interface(self, value: &types::Name) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/switch-port-configuration/.*/interface/{}/route/remove$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + + pub fn body(self, value: &types::Route) -> Self { + Self(self.0.json_body_obj(value)) + } + } + + pub struct NetworkingSwitchPortConfigurationInterfaceRouteRemoveThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationInterfaceRouteRemoveThen { + pub fn new(inner: httpmock::Then) -> Self { + Self(inner) + } + + pub fn into_inner(self) -> httpmock::Then { + self.0 + } + + pub fn no_content(self) -> Self { + Self(self.0.status(204u16)) + } + + pub fn client_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 4u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn server_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 5u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + } + + pub struct NetworkingSwitchPortConfigurationLinkListWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationLinkListWhen { + pub fn new(inner: httpmock::When) -> Self { + Self( + inner.method(httpmock::Method::GET).path_matches( + regex::Regex::new( + "^/v1/system/networking/switch-port-configuration/[^/]*/link$", + ) + .unwrap(), + ), + ) + } + + pub fn into_inner(self) -> httpmock::When { + self.0 + } + + pub fn configuration(self, value: &types::NameOrId) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/switch-port-configuration/{}/link$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + } + + pub struct NetworkingSwitchPortConfigurationLinkListThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationLinkListThen { + pub fn new(inner: httpmock::Then) -> Self { + Self(inner) + } + + pub fn into_inner(self) -> httpmock::Then { + self.0 + } + + pub fn ok(self, value: &Vec) -> Self { + Self( + self.0 + .status(200u16) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn client_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 4u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn server_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 5u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + } + + pub struct NetworkingSwitchPortConfigurationLinkCreateWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationLinkCreateWhen { + pub fn new(inner: httpmock::When) -> Self { + Self( + inner.method(httpmock::Method::POST).path_matches( + regex::Regex::new( + "^/v1/system/networking/switch-port-configuration/[^/]*/link$", + ) + .unwrap(), + ), + ) + } + + pub fn into_inner(self) -> httpmock::When { + self.0 + } + + pub fn configuration(self, value: &types::NameOrId) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/switch-port-configuration/{}/link$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + + pub fn body(self, value: &types::NamedLinkConfigCreate) -> Self { + Self(self.0.json_body_obj(value)) + } + } + + pub struct NetworkingSwitchPortConfigurationLinkCreateThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationLinkCreateThen { + pub fn new(inner: httpmock::Then) -> Self { + Self(inner) + } + + pub fn into_inner(self) -> httpmock::Then { + self.0 + } + + pub fn created(self, value: &types::SwitchPortLinkConfig) -> Self { + Self( + self.0 + .status(201u16) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn client_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 4u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn server_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 5u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + } + + pub struct NetworkingSwitchPortConfigurationLinkViewWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationLinkViewWhen { + pub fn new(inner: httpmock::When) -> Self { + Self( + inner.method(httpmock::Method::GET).path_matches( + regex::Regex::new( + "^/v1/system/networking/switch-port-configuration/[^/]*/link/[^/]*$", + ) + .unwrap(), + ), + ) + } + + pub fn into_inner(self) -> httpmock::When { + self.0 + } + + pub fn configuration(self, value: &types::NameOrId) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/switch-port-configuration/{}/link/.*$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + + pub fn link(self, value: &types::Name) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/switch-port-configuration/.*/link/{}$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + } + + pub struct NetworkingSwitchPortConfigurationLinkViewThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationLinkViewThen { pub fn new(inner: httpmock::Then) -> Self { Self(inner) } @@ -11589,8 +12833,13 @@ pub mod operations { self.0 } - pub fn no_content(self) -> Self { - Self(self.0.status(204u16)) + pub fn ok(self, value: &types::SwitchPortLinkConfig) -> Self { + Self( + self.0 + .status(200u16) + .header("content-type", "application/json") + .json_body_obj(value), + ) } pub fn client_error(self, status: u16, value: &types::Error) -> Self { @@ -11614,21 +12863,35 @@ pub mod operations { } } - pub struct NetworkingSwitchPortSettingsViewWhen(httpmock::When); - impl NetworkingSwitchPortSettingsViewWhen { + pub struct NetworkingSwitchPortConfigurationLinkDeleteWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationLinkDeleteWhen { pub fn new(inner: httpmock::When) -> Self { - Self(inner.method(httpmock::Method::GET).path_matches( - regex::Regex::new("^/v1/system/networking/switch-port-settings/[^/]*$").unwrap(), - )) + Self( + inner.method(httpmock::Method::DELETE).path_matches( + regex::Regex::new( + "^/v1/system/networking/switch-port-configuration/[^/]*/link/[^/]*$", + ) + .unwrap(), + ), + ) } pub fn into_inner(self) -> httpmock::When { self.0 } - pub fn port(self, value: &types::NameOrId) -> Self { + pub fn configuration(self, value: &types::NameOrId) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/switch-port-configuration/{}/link/.*$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + + pub fn link(self, value: &types::Name) -> Self { let re = regex::Regex::new(&format!( - "^/v1/system/networking/switch-port-settings/{}$", + "^/v1/system/networking/switch-port-configuration/.*/link/{}$", value.to_string() )) .unwrap(); @@ -11636,8 +12899,8 @@ pub mod operations { } } - pub struct NetworkingSwitchPortSettingsViewThen(httpmock::Then); - impl NetworkingSwitchPortSettingsViewThen { + pub struct NetworkingSwitchPortConfigurationLinkDeleteThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationLinkDeleteThen { pub fn new(inner: httpmock::Then) -> Self { Self(inner) } @@ -11646,13 +12909,8 @@ pub mod operations { self.0 } - pub fn ok(self, value: &types::SwitchPortSettingsView) -> Self { - Self( - self.0 - .status(200u16) - .header("content-type", "application/json") - .json_body_obj(value), - ) + pub fn no_content(self) -> Self { + Self(self.0.status(204u16)) } pub fn client_error(self, status: u16, value: &types::Error) -> Self { @@ -16221,6 +17479,18 @@ pub trait MockServerExt { operations::NetworkingAddressLotBlockListWhen, operations::NetworkingAddressLotBlockListThen, ); + fn networking_address_lot_block_add(&self, config_fn: F) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingAddressLotBlockAddWhen, + operations::NetworkingAddressLotBlockAddThen, + ); + fn networking_address_lot_block_remove(&self, config_fn: F) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingAddressLotBlockRemoveWhen, + operations::NetworkingAddressLotBlockRemoveThen, + ); fn networking_allow_list_view(&self, config_fn: F) -> httpmock::Mock where F: FnOnce(operations::NetworkingAllowListViewWhen, operations::NetworkingAllowListViewThen); @@ -16314,29 +17584,146 @@ pub trait MockServerExt { operations::NetworkingLoopbackAddressDeleteWhen, operations::NetworkingLoopbackAddressDeleteThen, ); - fn networking_switch_port_settings_list(&self, config_fn: F) -> httpmock::Mock + fn networking_switch_port_configuration_list(&self, config_fn: F) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationListWhen, + operations::NetworkingSwitchPortConfigurationListThen, + ); + fn networking_switch_port_configuration_create(&self, config_fn: F) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationCreateWhen, + operations::NetworkingSwitchPortConfigurationCreateThen, + ); + fn networking_switch_port_configuration_delete(&self, config_fn: F) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationDeleteWhen, + operations::NetworkingSwitchPortConfigurationDeleteThen, + ); + fn networking_switch_port_configuration_view(&self, config_fn: F) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationViewWhen, + operations::NetworkingSwitchPortConfigurationViewThen, + ); + fn networking_switch_port_configuration_geometry_view(&self, config_fn: F) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationGeometryViewWhen, + operations::NetworkingSwitchPortConfigurationGeometryViewThen, + ); + fn networking_switch_port_configuration_geometry_set(&self, config_fn: F) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationGeometrySetWhen, + operations::NetworkingSwitchPortConfigurationGeometrySetThen, + ); + fn networking_switch_port_configuration_interface_address_list( + &self, + config_fn: F, + ) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationInterfaceAddressListWhen, + operations::NetworkingSwitchPortConfigurationInterfaceAddressListThen, + ); + fn networking_switch_port_configuration_interface_address_add( + &self, + config_fn: F, + ) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationInterfaceAddressAddWhen, + operations::NetworkingSwitchPortConfigurationInterfaceAddressAddThen, + ); + fn networking_switch_port_configuration_interface_address_remove( + &self, + config_fn: F, + ) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationInterfaceAddressRemoveWhen, + operations::NetworkingSwitchPortConfigurationInterfaceAddressRemoveThen, + ); + fn networking_switch_port_configuration_interface_bgp_peer_list( + &self, + config_fn: F, + ) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationInterfaceBgpPeerListWhen, + operations::NetworkingSwitchPortConfigurationInterfaceBgpPeerListThen, + ); + fn networking_switch_port_configuration_interface_bgp_peer_add( + &self, + config_fn: F, + ) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationInterfaceBgpPeerAddWhen, + operations::NetworkingSwitchPortConfigurationInterfaceBgpPeerAddThen, + ); + fn networking_switch_port_configuration_interface_bgp_peer_remove( + &self, + config_fn: F, + ) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationInterfaceBgpPeerRemoveWhen, + operations::NetworkingSwitchPortConfigurationInterfaceBgpPeerRemoveThen, + ); + fn networking_switch_port_configuration_interface_route_list( + &self, + config_fn: F, + ) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationInterfaceRouteListWhen, + operations::NetworkingSwitchPortConfigurationInterfaceRouteListThen, + ); + fn networking_switch_port_configuration_interface_route_add( + &self, + config_fn: F, + ) -> httpmock::Mock where F: FnOnce( - operations::NetworkingSwitchPortSettingsListWhen, - operations::NetworkingSwitchPortSettingsListThen, + operations::NetworkingSwitchPortConfigurationInterfaceRouteAddWhen, + operations::NetworkingSwitchPortConfigurationInterfaceRouteAddThen, ); - fn networking_switch_port_settings_create(&self, config_fn: F) -> httpmock::Mock + fn networking_switch_port_configuration_interface_route_remove( + &self, + config_fn: F, + ) -> httpmock::Mock where F: FnOnce( - operations::NetworkingSwitchPortSettingsCreateWhen, - operations::NetworkingSwitchPortSettingsCreateThen, + operations::NetworkingSwitchPortConfigurationInterfaceRouteRemoveWhen, + operations::NetworkingSwitchPortConfigurationInterfaceRouteRemoveThen, ); - fn networking_switch_port_settings_delete(&self, config_fn: F) -> httpmock::Mock + fn networking_switch_port_configuration_link_list(&self, config_fn: F) -> httpmock::Mock where F: FnOnce( - operations::NetworkingSwitchPortSettingsDeleteWhen, - operations::NetworkingSwitchPortSettingsDeleteThen, + operations::NetworkingSwitchPortConfigurationLinkListWhen, + operations::NetworkingSwitchPortConfigurationLinkListThen, ); - fn networking_switch_port_settings_view(&self, config_fn: F) -> httpmock::Mock + fn networking_switch_port_configuration_link_create(&self, config_fn: F) -> httpmock::Mock where F: FnOnce( - operations::NetworkingSwitchPortSettingsViewWhen, - operations::NetworkingSwitchPortSettingsViewThen, + operations::NetworkingSwitchPortConfigurationLinkCreateWhen, + operations::NetworkingSwitchPortConfigurationLinkCreateThen, + ); + fn networking_switch_port_configuration_link_view(&self, config_fn: F) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationLinkViewWhen, + operations::NetworkingSwitchPortConfigurationLinkViewThen, + ); + fn networking_switch_port_configuration_link_delete(&self, config_fn: F) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationLinkDeleteWhen, + operations::NetworkingSwitchPortConfigurationLinkDeleteThen, ); fn system_policy_view(&self, config_fn: F) -> httpmock::Mock where @@ -18075,6 +19462,36 @@ impl MockServerExt for httpmock::MockServer { }) } + fn networking_address_lot_block_add(&self, config_fn: F) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingAddressLotBlockAddWhen, + operations::NetworkingAddressLotBlockAddThen, + ), + { + self.mock(|when, then| { + config_fn( + operations::NetworkingAddressLotBlockAddWhen::new(when), + operations::NetworkingAddressLotBlockAddThen::new(then), + ) + }) + } + + fn networking_address_lot_block_remove(&self, config_fn: F) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingAddressLotBlockRemoveWhen, + operations::NetworkingAddressLotBlockRemoveThen, + ), + { + self.mock(|when, then| { + config_fn( + operations::NetworkingAddressLotBlockRemoveWhen::new(when), + operations::NetworkingAddressLotBlockRemoveThen::new(then), + ) + }) + } + fn networking_allow_list_view(&self, config_fn: F) -> httpmock::Mock where F: FnOnce(operations::NetworkingAllowListViewWhen, operations::NetworkingAllowListViewThen), @@ -18339,62 +19756,314 @@ impl MockServerExt for httpmock::MockServer { }) } - fn networking_switch_port_settings_list(&self, config_fn: F) -> httpmock::Mock + fn networking_switch_port_configuration_list(&self, config_fn: F) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationListWhen, + operations::NetworkingSwitchPortConfigurationListThen, + ), + { + self.mock(|when, then| { + config_fn( + operations::NetworkingSwitchPortConfigurationListWhen::new(when), + operations::NetworkingSwitchPortConfigurationListThen::new(then), + ) + }) + } + + fn networking_switch_port_configuration_create(&self, config_fn: F) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationCreateWhen, + operations::NetworkingSwitchPortConfigurationCreateThen, + ), + { + self.mock(|when, then| { + config_fn( + operations::NetworkingSwitchPortConfigurationCreateWhen::new(when), + operations::NetworkingSwitchPortConfigurationCreateThen::new(then), + ) + }) + } + + fn networking_switch_port_configuration_delete(&self, config_fn: F) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationDeleteWhen, + operations::NetworkingSwitchPortConfigurationDeleteThen, + ), + { + self.mock(|when, then| { + config_fn( + operations::NetworkingSwitchPortConfigurationDeleteWhen::new(when), + operations::NetworkingSwitchPortConfigurationDeleteThen::new(then), + ) + }) + } + + fn networking_switch_port_configuration_view(&self, config_fn: F) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationViewWhen, + operations::NetworkingSwitchPortConfigurationViewThen, + ), + { + self.mock(|when, then| { + config_fn( + operations::NetworkingSwitchPortConfigurationViewWhen::new(when), + operations::NetworkingSwitchPortConfigurationViewThen::new(then), + ) + }) + } + + fn networking_switch_port_configuration_geometry_view(&self, config_fn: F) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationGeometryViewWhen, + operations::NetworkingSwitchPortConfigurationGeometryViewThen, + ), + { + self.mock(|when, then| { + config_fn( + operations::NetworkingSwitchPortConfigurationGeometryViewWhen::new(when), + operations::NetworkingSwitchPortConfigurationGeometryViewThen::new(then), + ) + }) + } + + fn networking_switch_port_configuration_geometry_set(&self, config_fn: F) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationGeometrySetWhen, + operations::NetworkingSwitchPortConfigurationGeometrySetThen, + ), + { + self.mock(|when, then| { + config_fn( + operations::NetworkingSwitchPortConfigurationGeometrySetWhen::new(when), + operations::NetworkingSwitchPortConfigurationGeometrySetThen::new(then), + ) + }) + } + + fn networking_switch_port_configuration_interface_address_list( + &self, + config_fn: F, + ) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationInterfaceAddressListWhen, + operations::NetworkingSwitchPortConfigurationInterfaceAddressListThen, + ), + { + self.mock(|when, then| { + config_fn( + operations::NetworkingSwitchPortConfigurationInterfaceAddressListWhen::new(when), + operations::NetworkingSwitchPortConfigurationInterfaceAddressListThen::new(then), + ) + }) + } + + fn networking_switch_port_configuration_interface_address_add( + &self, + config_fn: F, + ) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationInterfaceAddressAddWhen, + operations::NetworkingSwitchPortConfigurationInterfaceAddressAddThen, + ), + { + self.mock(|when, then| { + config_fn( + operations::NetworkingSwitchPortConfigurationInterfaceAddressAddWhen::new(when), + operations::NetworkingSwitchPortConfigurationInterfaceAddressAddThen::new(then), + ) + }) + } + + fn networking_switch_port_configuration_interface_address_remove( + &self, + config_fn: F, + ) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationInterfaceAddressRemoveWhen, + operations::NetworkingSwitchPortConfigurationInterfaceAddressRemoveThen, + ), + { + self.mock(|when, then| { + config_fn( + operations::NetworkingSwitchPortConfigurationInterfaceAddressRemoveWhen::new(when), + operations::NetworkingSwitchPortConfigurationInterfaceAddressRemoveThen::new(then), + ) + }) + } + + fn networking_switch_port_configuration_interface_bgp_peer_list( + &self, + config_fn: F, + ) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationInterfaceBgpPeerListWhen, + operations::NetworkingSwitchPortConfigurationInterfaceBgpPeerListThen, + ), + { + self.mock(|when, then| { + config_fn( + operations::NetworkingSwitchPortConfigurationInterfaceBgpPeerListWhen::new(when), + operations::NetworkingSwitchPortConfigurationInterfaceBgpPeerListThen::new(then), + ) + }) + } + + fn networking_switch_port_configuration_interface_bgp_peer_add( + &self, + config_fn: F, + ) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationInterfaceBgpPeerAddWhen, + operations::NetworkingSwitchPortConfigurationInterfaceBgpPeerAddThen, + ), + { + self.mock(|when, then| { + config_fn( + operations::NetworkingSwitchPortConfigurationInterfaceBgpPeerAddWhen::new(when), + operations::NetworkingSwitchPortConfigurationInterfaceBgpPeerAddThen::new(then), + ) + }) + } + + fn networking_switch_port_configuration_interface_bgp_peer_remove( + &self, + config_fn: F, + ) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationInterfaceBgpPeerRemoveWhen, + operations::NetworkingSwitchPortConfigurationInterfaceBgpPeerRemoveThen, + ), + { + self.mock(|when, then| { + config_fn( + operations::NetworkingSwitchPortConfigurationInterfaceBgpPeerRemoveWhen::new(when), + operations::NetworkingSwitchPortConfigurationInterfaceBgpPeerRemoveThen::new(then), + ) + }) + } + + fn networking_switch_port_configuration_interface_route_list( + &self, + config_fn: F, + ) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationInterfaceRouteListWhen, + operations::NetworkingSwitchPortConfigurationInterfaceRouteListThen, + ), + { + self.mock(|when, then| { + config_fn( + operations::NetworkingSwitchPortConfigurationInterfaceRouteListWhen::new(when), + operations::NetworkingSwitchPortConfigurationInterfaceRouteListThen::new(then), + ) + }) + } + + fn networking_switch_port_configuration_interface_route_add( + &self, + config_fn: F, + ) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationInterfaceRouteAddWhen, + operations::NetworkingSwitchPortConfigurationInterfaceRouteAddThen, + ), + { + self.mock(|when, then| { + config_fn( + operations::NetworkingSwitchPortConfigurationInterfaceRouteAddWhen::new(when), + operations::NetworkingSwitchPortConfigurationInterfaceRouteAddThen::new(then), + ) + }) + } + + fn networking_switch_port_configuration_interface_route_remove( + &self, + config_fn: F, + ) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationInterfaceRouteRemoveWhen, + operations::NetworkingSwitchPortConfigurationInterfaceRouteRemoveThen, + ), + { + self.mock(|when, then| { + config_fn( + operations::NetworkingSwitchPortConfigurationInterfaceRouteRemoveWhen::new(when), + operations::NetworkingSwitchPortConfigurationInterfaceRouteRemoveThen::new(then), + ) + }) + } + + fn networking_switch_port_configuration_link_list(&self, config_fn: F) -> httpmock::Mock where F: FnOnce( - operations::NetworkingSwitchPortSettingsListWhen, - operations::NetworkingSwitchPortSettingsListThen, + operations::NetworkingSwitchPortConfigurationLinkListWhen, + operations::NetworkingSwitchPortConfigurationLinkListThen, ), { self.mock(|when, then| { config_fn( - operations::NetworkingSwitchPortSettingsListWhen::new(when), - operations::NetworkingSwitchPortSettingsListThen::new(then), + operations::NetworkingSwitchPortConfigurationLinkListWhen::new(when), + operations::NetworkingSwitchPortConfigurationLinkListThen::new(then), ) }) } - fn networking_switch_port_settings_create(&self, config_fn: F) -> httpmock::Mock + fn networking_switch_port_configuration_link_create(&self, config_fn: F) -> httpmock::Mock where F: FnOnce( - operations::NetworkingSwitchPortSettingsCreateWhen, - operations::NetworkingSwitchPortSettingsCreateThen, + operations::NetworkingSwitchPortConfigurationLinkCreateWhen, + operations::NetworkingSwitchPortConfigurationLinkCreateThen, ), { self.mock(|when, then| { config_fn( - operations::NetworkingSwitchPortSettingsCreateWhen::new(when), - operations::NetworkingSwitchPortSettingsCreateThen::new(then), + operations::NetworkingSwitchPortConfigurationLinkCreateWhen::new(when), + operations::NetworkingSwitchPortConfigurationLinkCreateThen::new(then), ) }) } - fn networking_switch_port_settings_delete(&self, config_fn: F) -> httpmock::Mock + fn networking_switch_port_configuration_link_view(&self, config_fn: F) -> httpmock::Mock where F: FnOnce( - operations::NetworkingSwitchPortSettingsDeleteWhen, - operations::NetworkingSwitchPortSettingsDeleteThen, + operations::NetworkingSwitchPortConfigurationLinkViewWhen, + operations::NetworkingSwitchPortConfigurationLinkViewThen, ), { self.mock(|when, then| { config_fn( - operations::NetworkingSwitchPortSettingsDeleteWhen::new(when), - operations::NetworkingSwitchPortSettingsDeleteThen::new(then), + operations::NetworkingSwitchPortConfigurationLinkViewWhen::new(when), + operations::NetworkingSwitchPortConfigurationLinkViewThen::new(then), ) }) } - fn networking_switch_port_settings_view(&self, config_fn: F) -> httpmock::Mock + fn networking_switch_port_configuration_link_delete(&self, config_fn: F) -> httpmock::Mock where F: FnOnce( - operations::NetworkingSwitchPortSettingsViewWhen, - operations::NetworkingSwitchPortSettingsViewThen, + operations::NetworkingSwitchPortConfigurationLinkDeleteWhen, + operations::NetworkingSwitchPortConfigurationLinkDeleteThen, ), { self.mock(|when, then| { config_fn( - operations::NetworkingSwitchPortSettingsViewWhen::new(when), - operations::NetworkingSwitchPortSettingsViewThen::new(then), + operations::NetworkingSwitchPortConfigurationLinkDeleteWhen::new(when), + operations::NetworkingSwitchPortConfigurationLinkDeleteThen::new(then), ) }) } diff --git a/sdk/src/generated_sdk.rs b/sdk/src/generated_sdk.rs index 0e0fe3d0..a4505235 100644 --- a/sdk/src/generated_sdk.rs +++ b/sdk/src/generated_sdk.rs @@ -300,15 +300,15 @@ pub mod types { } } - /// Parameters for creating an address lot block. Fist and last addresses - /// are inclusive. + /// Parameters for adding or removing an address lot block. First and last + /// addresses are inclusive. /// ///
JSON schema /// /// ```json /// { - /// "description": "Parameters for creating an address lot block. Fist and - /// last addresses are inclusive.", + /// "description": "Parameters for adding or removing an address lot block. + /// First and last addresses are inclusive.", /// "type": "object", /// "required": [ /// "first_address", @@ -332,21 +332,21 @@ pub mod types { #[derive( :: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, schemars :: JsonSchema, )] - pub struct AddressLotBlockCreate { + pub struct AddressLotBlockAddRemove { /// The first address in the lot (inclusive). pub first_address: std::net::IpAddr, /// The last address in the lot (inclusive). pub last_address: std::net::IpAddr, } - impl From<&AddressLotBlockCreate> for AddressLotBlockCreate { - fn from(value: &AddressLotBlockCreate) -> Self { + impl From<&AddressLotBlockAddRemove> for AddressLotBlockAddRemove { + fn from(value: &AddressLotBlockAddRemove) -> Self { value.clone() } } - impl AddressLotBlockCreate { - pub fn builder() -> builder::AddressLotBlockCreate { + impl AddressLotBlockAddRemove { + pub fn builder() -> builder::AddressLotBlockAddRemove { Default::default() } } @@ -414,19 +414,11 @@ pub mod types { /// "description": "Parameters for creating an address lot.", /// "type": "object", /// "required": [ - /// "blocks", /// "description", /// "kind", /// "name" /// ], /// "properties": { - /// "blocks": { - /// "description": "The blocks to add along with the new address lot.", - /// "type": "array", - /// "items": { - /// "$ref": "#/components/schemas/AddressLotBlockCreate" - /// } - /// }, /// "description": { /// "type": "string" /// }, @@ -449,8 +441,6 @@ pub mod types { :: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, schemars :: JsonSchema, )] pub struct AddressLotCreate { - /// The blocks to add along with the new address lot. - pub blocks: Vec, pub description: String, /// The kind of address lot to create. pub kind: AddressLotKind, @@ -480,17 +470,9 @@ pub mod types { /// creating an address lot.", /// "type": "object", /// "required": [ - /// "blocks", /// "lot" /// ], /// "properties": { - /// "blocks": { - /// "description": "The address lot blocks that were created.", - /// "type": "array", - /// "items": { - /// "$ref": "#/components/schemas/AddressLotBlock" - /// } - /// }, /// "lot": { /// "description": "The address lot that was created.", /// "allOf": [ @@ -507,8 +489,6 @@ pub mod types { :: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, schemars :: JsonSchema, )] pub struct AddressLotCreateResponse { - /// The address lot blocks that were created. - pub blocks: Vec, /// The address lot that was created. pub lot: AddressLot, } @@ -15477,6 +15457,101 @@ pub mod types { } } + /// Named switch link configuration. + /// + ///
JSON schema + /// + /// ```json + /// { + /// "description": "Named switch link configuration.", + /// "type": "object", + /// "required": [ + /// "autoneg", + /// "fec", + /// "mtu", + /// "name", + /// "speed" + /// ], + /// "properties": { + /// "autoneg": { + /// "description": "Whether or not to set autonegotiation", + /// "type": "boolean" + /// }, + /// "fec": { + /// "description": "The forward error correction mode of the link.", + /// "allOf": [ + /// { + /// "$ref": "#/components/schemas/LinkFec" + /// } + /// ] + /// }, + /// "lldp_config": { + /// "description": "The optional link-layer discovery protocol (LLDP) + /// configuration for the link.", + /// "allOf": [ + /// { + /// "$ref": "#/components/schemas/NameOrId" + /// } + /// ] + /// }, + /// "mtu": { + /// "description": "Maximum transmission unit for the link.", + /// "type": "integer", + /// "format": "uint16", + /// "minimum": 0.0 + /// }, + /// "name": { + /// "description": "Name of link", + /// "allOf": [ + /// { + /// "$ref": "#/components/schemas/Name" + /// } + /// ] + /// }, + /// "speed": { + /// "description": "The speed of the link.", + /// "allOf": [ + /// { + /// "$ref": "#/components/schemas/LinkSpeed" + /// } + /// ] + /// } + /// } + /// } + /// ``` + ///
+ #[derive( + :: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, schemars :: JsonSchema, + )] + pub struct NamedLinkConfigCreate { + /// Whether or not to set autonegotiation + pub autoneg: bool, + /// The forward error correction mode of the link. + pub fec: LinkFec, + /// The optional link-layer discovery protocol (LLDP) configuration for + /// the link. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub lldp_config: Option, + /// Maximum transmission unit for the link. + pub mtu: u16, + /// Name of link + pub name: Name, + /// The speed of the link. + pub speed: LinkSpeed, + } + + impl From<&NamedLinkConfigCreate> for NamedLinkConfigCreate { + fn from(value: &NamedLinkConfigCreate) -> Self { + value.clone() + } + } + + impl NamedLinkConfigCreate { + pub fn builder() -> builder::NamedLinkConfigCreate { + Default::default() + } + } + /// Information required to construct a virtual network interface /// ///
JSON schema @@ -22501,6 +22576,7 @@ pub mod types { /// "autoneg", /// "fec", /// "link_name", + /// "lldp_link_config_id", /// "mtu", /// "port_settings_id", /// "speed" @@ -22526,10 +22602,7 @@ pub mod types { /// "lldp_link_config_id": { /// "description": "The link-layer discovery protocol service /// configuration id for this link.", - /// "type": [ - /// "string", - /// "null" - /// ], + /// "type": "string", /// "format": "uuid" /// }, /// "mtu": { @@ -22568,8 +22641,7 @@ pub mod types { pub link_name: String, /// The link-layer discovery protocol service configuration id for this /// link. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub lldp_link_config_id: Option, + pub lldp_link_config_id: uuid::Uuid, /// The maximum transmission unit for this link. pub mtu: u16, /// The port settings this link configuration belongs to. @@ -23983,8 +24055,7 @@ pub mod types { /// "nanoseconds", /// "volts", /// "amps", - /// "watts", - /// "degrees_celsius" + /// "degrees_celcius" /// ] /// }, /// { @@ -24032,10 +24103,8 @@ pub mod types { Volts, #[serde(rename = "amps")] Amps, - #[serde(rename = "watts")] - Watts, - #[serde(rename = "degrees_celsius")] - DegreesCelsius, + #[serde(rename = "degrees_celcius")] + DegreesCelcius, /// No meaningful units, e.g. a dimensionless quanity. #[serde(rename = "none")] None, @@ -24059,8 +24128,7 @@ pub mod types { Self::Nanoseconds => "nanoseconds".to_string(), Self::Volts => "volts".to_string(), Self::Amps => "amps".to_string(), - Self::Watts => "watts".to_string(), - Self::DegreesCelsius => "degrees_celsius".to_string(), + Self::DegreesCelcius => "degrees_celcius".to_string(), Self::None => "none".to_string(), Self::Rpm => "rpm".to_string(), } @@ -24077,8 +24145,7 @@ pub mod types { "nanoseconds" => Ok(Self::Nanoseconds), "volts" => Ok(Self::Volts), "amps" => Ok(Self::Amps), - "watts" => Ok(Self::Watts), - "degrees_celsius" => Ok(Self::DegreesCelsius), + "degrees_celcius" => Ok(Self::DegreesCelcius), "none" => Ok(Self::None), "rpm" => Ok(Self::Rpm), _ => Err("invalid value".into()), @@ -27442,12 +27509,12 @@ pub mod types { } #[derive(Clone, Debug)] - pub struct AddressLotBlockCreate { + pub struct AddressLotBlockAddRemove { first_address: Result, last_address: Result, } - impl Default for AddressLotBlockCreate { + impl Default for AddressLotBlockAddRemove { fn default() -> Self { Self { first_address: Err("no value supplied for first_address".to_string()), @@ -27456,7 +27523,7 @@ pub mod types { } } - impl AddressLotBlockCreate { + impl AddressLotBlockAddRemove { pub fn first_address(mut self, value: T) -> Self where T: std::convert::TryInto, @@ -27479,10 +27546,10 @@ pub mod types { } } - impl std::convert::TryFrom for super::AddressLotBlockCreate { + impl std::convert::TryFrom for super::AddressLotBlockAddRemove { type Error = super::error::ConversionError; fn try_from( - value: AddressLotBlockCreate, + value: AddressLotBlockAddRemove, ) -> Result { Ok(Self { first_address: value.first_address?, @@ -27491,8 +27558,8 @@ pub mod types { } } - impl From for AddressLotBlockCreate { - fn from(value: super::AddressLotBlockCreate) -> Self { + impl From for AddressLotBlockAddRemove { + fn from(value: super::AddressLotBlockAddRemove) -> Self { Self { first_address: Ok(value.first_address), last_address: Ok(value.last_address), @@ -27561,7 +27628,6 @@ pub mod types { #[derive(Clone, Debug)] pub struct AddressLotCreate { - blocks: Result, String>, description: Result, kind: Result, name: Result, @@ -27570,7 +27636,6 @@ pub mod types { impl Default for AddressLotCreate { fn default() -> Self { Self { - blocks: Err("no value supplied for blocks".to_string()), description: Err("no value supplied for description".to_string()), kind: Err("no value supplied for kind".to_string()), name: Err("no value supplied for name".to_string()), @@ -27579,16 +27644,6 @@ pub mod types { } impl AddressLotCreate { - pub fn blocks(mut self, value: T) -> Self - where - T: std::convert::TryInto>, - T::Error: std::fmt::Display, - { - self.blocks = value - .try_into() - .map_err(|e| format!("error converting supplied value for blocks: {}", e)); - self - } pub fn description(mut self, value: T) -> Self where T: std::convert::TryInto, @@ -27625,7 +27680,6 @@ pub mod types { type Error = super::error::ConversionError; fn try_from(value: AddressLotCreate) -> Result { Ok(Self { - blocks: value.blocks?, description: value.description?, kind: value.kind?, name: value.name?, @@ -27636,7 +27690,6 @@ pub mod types { impl From for AddressLotCreate { fn from(value: super::AddressLotCreate) -> Self { Self { - blocks: Ok(value.blocks), description: Ok(value.description), kind: Ok(value.kind), name: Ok(value.name), @@ -27646,30 +27699,18 @@ pub mod types { #[derive(Clone, Debug)] pub struct AddressLotCreateResponse { - blocks: Result, String>, lot: Result, } impl Default for AddressLotCreateResponse { fn default() -> Self { Self { - blocks: Err("no value supplied for blocks".to_string()), lot: Err("no value supplied for lot".to_string()), } } } impl AddressLotCreateResponse { - pub fn blocks(mut self, value: T) -> Self - where - T: std::convert::TryInto>, - T::Error: std::fmt::Display, - { - self.blocks = value - .try_into() - .map_err(|e| format!("error converting supplied value for blocks: {}", e)); - self - } pub fn lot(mut self, value: T) -> Self where T: std::convert::TryInto, @@ -27687,19 +27728,13 @@ pub mod types { fn try_from( value: AddressLotCreateResponse, ) -> Result { - Ok(Self { - blocks: value.blocks?, - lot: value.lot?, - }) + Ok(Self { lot: value.lot? }) } } impl From for AddressLotCreateResponse { fn from(value: super::AddressLotCreateResponse) -> Self { - Self { - blocks: Ok(value.blocks), - lot: Ok(value.lot), - } + Self { lot: Ok(value.lot) } } } @@ -37484,6 +37519,121 @@ pub mod types { } } + #[derive(Clone, Debug)] + pub struct NamedLinkConfigCreate { + autoneg: Result, + fec: Result, + lldp_config: Result, String>, + mtu: Result, + name: Result, + speed: Result, + } + + impl Default for NamedLinkConfigCreate { + fn default() -> Self { + Self { + autoneg: Err("no value supplied for autoneg".to_string()), + fec: Err("no value supplied for fec".to_string()), + lldp_config: Ok(Default::default()), + mtu: Err("no value supplied for mtu".to_string()), + name: Err("no value supplied for name".to_string()), + speed: Err("no value supplied for speed".to_string()), + } + } + } + + impl NamedLinkConfigCreate { + pub fn autoneg(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.autoneg = value + .try_into() + .map_err(|e| format!("error converting supplied value for autoneg: {}", e)); + self + } + pub fn fec(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.fec = value + .try_into() + .map_err(|e| format!("error converting supplied value for fec: {}", e)); + self + } + pub fn lldp_config(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.lldp_config = value + .try_into() + .map_err(|e| format!("error converting supplied value for lldp_config: {}", e)); + self + } + pub fn mtu(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.mtu = value + .try_into() + .map_err(|e| format!("error converting supplied value for mtu: {}", e)); + self + } + pub fn name(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.name = value + .try_into() + .map_err(|e| format!("error converting supplied value for name: {}", e)); + self + } + pub fn speed(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.speed = value + .try_into() + .map_err(|e| format!("error converting supplied value for speed: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::NamedLinkConfigCreate { + type Error = super::error::ConversionError; + fn try_from( + value: NamedLinkConfigCreate, + ) -> Result { + Ok(Self { + autoneg: value.autoneg?, + fec: value.fec?, + lldp_config: value.lldp_config?, + mtu: value.mtu?, + name: value.name?, + speed: value.speed?, + }) + } + } + + impl From for NamedLinkConfigCreate { + fn from(value: super::NamedLinkConfigCreate) -> Self { + Self { + autoneg: Ok(value.autoneg), + fec: Ok(value.fec), + lldp_config: Ok(value.lldp_config), + mtu: Ok(value.mtu), + name: Ok(value.name), + speed: Ok(value.speed), + } + } + } + #[derive(Clone, Debug)] pub struct NetworkInterface { id: Result, @@ -43016,7 +43166,7 @@ pub mod types { autoneg: Result, fec: Result, link_name: Result, - lldp_link_config_id: Result, String>, + lldp_link_config_id: Result, mtu: Result, port_settings_id: Result, speed: Result, @@ -43028,7 +43178,9 @@ pub mod types { autoneg: Err("no value supplied for autoneg".to_string()), fec: Err("no value supplied for fec".to_string()), link_name: Err("no value supplied for link_name".to_string()), - lldp_link_config_id: Ok(Default::default()), + lldp_link_config_id: Err( + "no value supplied for lldp_link_config_id".to_string() + ), mtu: Err("no value supplied for mtu".to_string()), port_settings_id: Err("no value supplied for port_settings_id".to_string()), speed: Err("no value supplied for speed".to_string()), @@ -43069,7 +43221,7 @@ pub mod types { } pub fn lldp_link_config_id(mut self, value: T) -> Self where - T: std::convert::TryInto>, + T: std::convert::TryInto, T::Error: std::fmt::Display, { self.lldp_link_config_id = value.try_into().map_err(|e| { @@ -48502,8 +48654,6 @@ pub trait ClientSilosExt { /// /// Sends a `GET` request to `/v1/certificates/{certificate}` /// - /// Arguments: - /// - `certificate`: Name or ID of the certificate /// ```ignore /// let response = client.certificate_view() /// .certificate(certificate) @@ -48517,8 +48667,6 @@ pub trait ClientSilosExt { /// /// Sends a `DELETE` request to `/v1/certificates/{certificate}` /// - /// Arguments: - /// - `certificate`: Name or ID of the certificate /// ```ignore /// let response = client.certificate_delete() /// .certificate(certificate) @@ -48799,7 +48947,7 @@ pub trait ClientSystemHardwareExt { /// Sends a `GET` request to `/v1/system/hardware/racks/{rack_id}` /// /// Arguments: - /// - `rack_id`: ID of the rack + /// - `rack_id`: The rack's unique ID. /// ```ignore /// let response = client.rack_view() /// .rack_id(rack_id) @@ -49469,6 +49617,38 @@ pub trait ClientSystemNetworkingExt { /// .await; /// ``` fn networking_address_lot_block_list(&self) -> builder::NetworkingAddressLotBlockList; + /// Add block to address lot + /// + /// Sends a `POST` request to + /// `/v1/system/networking/address-lot/{address_lot}/blocks/add` + /// + /// Arguments: + /// - `address_lot`: Name or ID of the address lot + /// - `body` + /// ```ignore + /// let response = client.networking_address_lot_block_add() + /// .address_lot(address_lot) + /// .body(body) + /// .send() + /// .await; + /// ``` + fn networking_address_lot_block_add(&self) -> builder::NetworkingAddressLotBlockAdd; + /// Remove block from address lot + /// + /// Sends a `POST` request to + /// `/v1/system/networking/address-lot/{address_lot}/blocks/remove` + /// + /// Arguments: + /// - `address_lot`: Name or ID of the address lot + /// - `body` + /// ```ignore + /// let response = client.networking_address_lot_block_remove() + /// .address_lot(address_lot) + /// .body(body) + /// .send() + /// .await; + /// ``` + fn networking_address_lot_block_remove(&self) -> builder::NetworkingAddressLotBlockRemove; /// Get user-facing services IP allowlist /// /// Sends a `GET` request to `/v1/system/networking/allow-list` @@ -49729,67 +49909,382 @@ pub trait ClientSystemNetworkingExt { fn networking_loopback_address_delete(&self) -> builder::NetworkingLoopbackAddressDelete; /// List switch port settings /// - /// Sends a `GET` request to `/v1/system/networking/switch-port-settings` + /// Sends a `GET` request to + /// `/v1/system/networking/switch-port-configuration` /// /// Arguments: + /// - `configuration`: An optional name or id to use when selecting a switch + /// port configuration. /// - `limit`: Maximum number of items returned by a single call /// - `page_token`: Token returned by previous call to retrieve the /// subsequent page - /// - `port_settings`: An optional name or id to use when selecting port - /// settings. /// - `sort_by` /// ```ignore - /// let response = client.networking_switch_port_settings_list() + /// let response = client.networking_switch_port_configuration_list() + /// .configuration(configuration) /// .limit(limit) /// .page_token(page_token) - /// .port_settings(port_settings) /// .sort_by(sort_by) /// .send() /// .await; /// ``` - fn networking_switch_port_settings_list(&self) -> builder::NetworkingSwitchPortSettingsList; + fn networking_switch_port_configuration_list( + &self, + ) -> builder::NetworkingSwitchPortConfigurationList; /// Create switch port settings /// - /// Sends a `POST` request to `/v1/system/networking/switch-port-settings` + /// Sends a `POST` request to + /// `/v1/system/networking/switch-port-configuration` /// /// ```ignore - /// let response = client.networking_switch_port_settings_create() + /// let response = client.networking_switch_port_configuration_create() /// .body(body) /// .send() /// .await; /// ``` - fn networking_switch_port_settings_create(&self) - -> builder::NetworkingSwitchPortSettingsCreate; + fn networking_switch_port_configuration_create( + &self, + ) -> builder::NetworkingSwitchPortConfigurationCreate; /// Delete switch port settings /// - /// Sends a `DELETE` request to `/v1/system/networking/switch-port-settings` + /// Sends a `DELETE` request to + /// `/v1/system/networking/switch-port-configuration` /// /// Arguments: - /// - `port_settings`: An optional name or id to use when selecting port - /// settings. + /// - `configuration`: An optional name or id to use when selecting a switch + /// port configuration. /// ```ignore - /// let response = client.networking_switch_port_settings_delete() - /// .port_settings(port_settings) + /// let response = client.networking_switch_port_configuration_delete() + /// .configuration(configuration) /// .send() /// .await; /// ``` - fn networking_switch_port_settings_delete(&self) - -> builder::NetworkingSwitchPortSettingsDelete; - /// Get information about switch port + fn networking_switch_port_configuration_delete( + &self, + ) -> builder::NetworkingSwitchPortConfigurationDelete; + /// Get information about a named set of switch-port-settings /// /// Sends a `GET` request to - /// `/v1/system/networking/switch-port-settings/{port}` + /// `/v1/system/networking/switch-port-configuration/{configuration}` /// /// Arguments: - /// - `port`: A name or id to use when selecting switch port settings info - /// objects. + /// - `configuration`: A name or id to use when selecting a switch port + /// configuration. /// ```ignore - /// let response = client.networking_switch_port_settings_view() - /// .port(port) + /// let response = client.networking_switch_port_configuration_view() + /// .configuration(configuration) /// .send() /// .await; /// ``` - fn networking_switch_port_settings_view(&self) -> builder::NetworkingSwitchPortSettingsView; + fn networking_switch_port_configuration_view( + &self, + ) -> builder::NetworkingSwitchPortConfigurationView; + /// Get switch port geometry for a provided switch port configuration + /// + /// Sends a `GET` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// geometry` + /// + /// Arguments: + /// - `configuration`: A name or id to use when selecting a switch port + /// configuration. + /// ```ignore + /// let response = client.networking_switch_port_configuration_geometry_view() + /// .configuration(configuration) + /// .send() + /// .await; + /// ``` + fn networking_switch_port_configuration_geometry_view( + &self, + ) -> builder::NetworkingSwitchPortConfigurationGeometryView; + /// Set switch port geometry for a provided switch port configuration + /// + /// Sends a `POST` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// geometry` + /// + /// Arguments: + /// - `configuration`: A name or id to use when selecting a switch port + /// configuration. + /// - `body` + /// ```ignore + /// let response = client.networking_switch_port_configuration_geometry_set() + /// .configuration(configuration) + /// .body(body) + /// .send() + /// .await; + /// ``` + fn networking_switch_port_configuration_geometry_set( + &self, + ) -> builder::NetworkingSwitchPortConfigurationGeometrySet; + /// List addresses assigned to a provided interface configuration + /// + /// Sends a `GET` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// interface/{interface}/address` + /// + /// Arguments: + /// - `configuration`: A name or id to use when selecting a switch port + /// configuration. + /// - `interface`: Interface name + /// ```ignore + /// let response = client.networking_switch_port_configuration_interface_address_list() + /// .configuration(configuration) + /// .interface(interface) + /// .send() + /// .await; + /// ``` + fn networking_switch_port_configuration_interface_address_list( + &self, + ) -> builder::NetworkingSwitchPortConfigurationInterfaceAddressList; + /// Add address to an interface configuration + /// + /// Sends a `POST` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// interface/{interface}/address/add` + /// + /// Arguments: + /// - `configuration`: A name or id to use when selecting a switch port + /// configuration. + /// - `interface`: Interface name + /// - `body` + /// ```ignore + /// let response = client.networking_switch_port_configuration_interface_address_add() + /// .configuration(configuration) + /// .interface(interface) + /// .body(body) + /// .send() + /// .await; + /// ``` + fn networking_switch_port_configuration_interface_address_add( + &self, + ) -> builder::NetworkingSwitchPortConfigurationInterfaceAddressAdd; + /// Remove address from an interface configuration + /// + /// Sends a `POST` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// interface/{interface}/address/remove` + /// + /// Arguments: + /// - `configuration`: A name or id to use when selecting a switch port + /// configuration. + /// - `interface`: Interface name + /// - `body` + /// ```ignore + /// let response = client.networking_switch_port_configuration_interface_address_remove() + /// .configuration(configuration) + /// .interface(interface) + /// .body(body) + /// .send() + /// .await; + /// ``` + fn networking_switch_port_configuration_interface_address_remove( + &self, + ) -> builder::NetworkingSwitchPortConfigurationInterfaceAddressRemove; + /// List bgp peers assigned to a provided interface configuration + /// + /// Sends a `GET` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// interface/{interface}/bgp-peer` + /// + /// Arguments: + /// - `configuration`: A name or id to use when selecting a switch port + /// configuration. + /// - `interface`: Interface name + /// ```ignore + /// let response = client.networking_switch_port_configuration_interface_bgp_peer_list() + /// .configuration(configuration) + /// .interface(interface) + /// .send() + /// .await; + /// ``` + fn networking_switch_port_configuration_interface_bgp_peer_list( + &self, + ) -> builder::NetworkingSwitchPortConfigurationInterfaceBgpPeerList; + /// Add bgp peer to an interface configuration + /// + /// Sends a `POST` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// interface/{interface}/bgp-peer/add` + /// + /// Arguments: + /// - `configuration`: A name or id to use when selecting a switch port + /// configuration. + /// - `interface`: Interface name + /// - `body` + /// ```ignore + /// let response = client.networking_switch_port_configuration_interface_bgp_peer_add() + /// .configuration(configuration) + /// .interface(interface) + /// .body(body) + /// .send() + /// .await; + /// ``` + fn networking_switch_port_configuration_interface_bgp_peer_add( + &self, + ) -> builder::NetworkingSwitchPortConfigurationInterfaceBgpPeerAdd; + /// Remove bgp peer from an interface configuration + /// + /// Sends a `POST` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// interface/{interface}/bgp-peer/remove` + /// + /// Arguments: + /// - `configuration`: A name or id to use when selecting a switch port + /// configuration. + /// - `interface`: Interface name + /// - `body` + /// ```ignore + /// let response = client.networking_switch_port_configuration_interface_bgp_peer_remove() + /// .configuration(configuration) + /// .interface(interface) + /// .body(body) + /// .send() + /// .await; + /// ``` + fn networking_switch_port_configuration_interface_bgp_peer_remove( + &self, + ) -> builder::NetworkingSwitchPortConfigurationInterfaceBgpPeerRemove; + /// List routes assigned to a provided interface configuration + /// + /// Sends a `GET` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// interface/{interface}/route` + /// + /// Arguments: + /// - `configuration`: A name or id to use when selecting a switch port + /// configuration. + /// - `interface`: Interface name + /// ```ignore + /// let response = client.networking_switch_port_configuration_interface_route_list() + /// .configuration(configuration) + /// .interface(interface) + /// .send() + /// .await; + /// ``` + fn networking_switch_port_configuration_interface_route_list( + &self, + ) -> builder::NetworkingSwitchPortConfigurationInterfaceRouteList; + /// Add route to an interface configuration + /// + /// Sends a `POST` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// interface/{interface}/route/add` + /// + /// Arguments: + /// - `configuration`: A name or id to use when selecting a switch port + /// configuration. + /// - `interface`: Interface name + /// - `body` + /// ```ignore + /// let response = client.networking_switch_port_configuration_interface_route_add() + /// .configuration(configuration) + /// .interface(interface) + /// .body(body) + /// .send() + /// .await; + /// ``` + fn networking_switch_port_configuration_interface_route_add( + &self, + ) -> builder::NetworkingSwitchPortConfigurationInterfaceRouteAdd; + /// Remove address from an interface configuration + /// + /// Sends a `POST` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// interface/{interface}/route/remove` + /// + /// Arguments: + /// - `configuration`: A name or id to use when selecting a switch port + /// configuration. + /// - `interface`: Interface name + /// - `body` + /// ```ignore + /// let response = client.networking_switch_port_configuration_interface_route_remove() + /// .configuration(configuration) + /// .interface(interface) + /// .body(body) + /// .send() + /// .await; + /// ``` + fn networking_switch_port_configuration_interface_route_remove( + &self, + ) -> builder::NetworkingSwitchPortConfigurationInterfaceRouteRemove; + /// List links for a provided switch port configuration + /// + /// Sends a `GET` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/link` + /// + /// Arguments: + /// - `configuration`: A name or id to use when selecting a switch port + /// configuration. + /// ```ignore + /// let response = client.networking_switch_port_configuration_link_list() + /// .configuration(configuration) + /// .send() + /// .await; + /// ``` + fn networking_switch_port_configuration_link_list( + &self, + ) -> builder::NetworkingSwitchPortConfigurationLinkList; + /// Create a link for a provided switch port configuration + /// + /// Sends a `POST` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/link` + /// + /// Arguments: + /// - `configuration`: A name or id to use when selecting a switch port + /// configuration. + /// - `body` + /// ```ignore + /// let response = client.networking_switch_port_configuration_link_create() + /// .configuration(configuration) + /// .body(body) + /// .send() + /// .await; + /// ``` + fn networking_switch_port_configuration_link_create( + &self, + ) -> builder::NetworkingSwitchPortConfigurationLinkCreate; + /// View a link for a provided switch port configuration + /// + /// Sends a `GET` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/link/ + /// {link}` + /// + /// Arguments: + /// - `configuration`: A name or id to use when selecting a switch port + /// configuration. + /// - `link`: Link name + /// ```ignore + /// let response = client.networking_switch_port_configuration_link_view() + /// .configuration(configuration) + /// .link(link) + /// .send() + /// .await; + /// ``` + fn networking_switch_port_configuration_link_view( + &self, + ) -> builder::NetworkingSwitchPortConfigurationLinkView; + /// Delete a link for a provided switch port configuration + /// + /// Sends a `DELETE` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/link/ + /// {link}` + /// + /// Arguments: + /// - `configuration`: A name or id to use when selecting a switch port + /// configuration. + /// - `link`: Link name + /// ```ignore + /// let response = client.networking_switch_port_configuration_link_delete() + /// .configuration(configuration) + /// .link(link) + /// .send() + /// .await; + /// ``` + fn networking_switch_port_configuration_link_delete( + &self, + ) -> builder::NetworkingSwitchPortConfigurationLinkDelete; } impl ClientSystemNetworkingExt for Client { @@ -49877,6 +50372,14 @@ impl ClientSystemNetworkingExt for Client { builder::NetworkingAddressLotBlockList::new(self) } + fn networking_address_lot_block_add(&self) -> builder::NetworkingAddressLotBlockAdd { + builder::NetworkingAddressLotBlockAdd::new(self) + } + + fn networking_address_lot_block_remove(&self) -> builder::NetworkingAddressLotBlockRemove { + builder::NetworkingAddressLotBlockRemove::new(self) + } + fn networking_allow_list_view(&self) -> builder::NetworkingAllowListView { builder::NetworkingAllowListView::new(self) } @@ -49953,24 +50456,118 @@ impl ClientSystemNetworkingExt for Client { builder::NetworkingLoopbackAddressDelete::new(self) } - fn networking_switch_port_settings_list(&self) -> builder::NetworkingSwitchPortSettingsList { - builder::NetworkingSwitchPortSettingsList::new(self) + fn networking_switch_port_configuration_list( + &self, + ) -> builder::NetworkingSwitchPortConfigurationList { + builder::NetworkingSwitchPortConfigurationList::new(self) + } + + fn networking_switch_port_configuration_create( + &self, + ) -> builder::NetworkingSwitchPortConfigurationCreate { + builder::NetworkingSwitchPortConfigurationCreate::new(self) + } + + fn networking_switch_port_configuration_delete( + &self, + ) -> builder::NetworkingSwitchPortConfigurationDelete { + builder::NetworkingSwitchPortConfigurationDelete::new(self) + } + + fn networking_switch_port_configuration_view( + &self, + ) -> builder::NetworkingSwitchPortConfigurationView { + builder::NetworkingSwitchPortConfigurationView::new(self) + } + + fn networking_switch_port_configuration_geometry_view( + &self, + ) -> builder::NetworkingSwitchPortConfigurationGeometryView { + builder::NetworkingSwitchPortConfigurationGeometryView::new(self) + } + + fn networking_switch_port_configuration_geometry_set( + &self, + ) -> builder::NetworkingSwitchPortConfigurationGeometrySet { + builder::NetworkingSwitchPortConfigurationGeometrySet::new(self) } - fn networking_switch_port_settings_create( + fn networking_switch_port_configuration_interface_address_list( &self, - ) -> builder::NetworkingSwitchPortSettingsCreate { - builder::NetworkingSwitchPortSettingsCreate::new(self) + ) -> builder::NetworkingSwitchPortConfigurationInterfaceAddressList { + builder::NetworkingSwitchPortConfigurationInterfaceAddressList::new(self) } - fn networking_switch_port_settings_delete( + fn networking_switch_port_configuration_interface_address_add( &self, - ) -> builder::NetworkingSwitchPortSettingsDelete { - builder::NetworkingSwitchPortSettingsDelete::new(self) + ) -> builder::NetworkingSwitchPortConfigurationInterfaceAddressAdd { + builder::NetworkingSwitchPortConfigurationInterfaceAddressAdd::new(self) } - fn networking_switch_port_settings_view(&self) -> builder::NetworkingSwitchPortSettingsView { - builder::NetworkingSwitchPortSettingsView::new(self) + fn networking_switch_port_configuration_interface_address_remove( + &self, + ) -> builder::NetworkingSwitchPortConfigurationInterfaceAddressRemove { + builder::NetworkingSwitchPortConfigurationInterfaceAddressRemove::new(self) + } + + fn networking_switch_port_configuration_interface_bgp_peer_list( + &self, + ) -> builder::NetworkingSwitchPortConfigurationInterfaceBgpPeerList { + builder::NetworkingSwitchPortConfigurationInterfaceBgpPeerList::new(self) + } + + fn networking_switch_port_configuration_interface_bgp_peer_add( + &self, + ) -> builder::NetworkingSwitchPortConfigurationInterfaceBgpPeerAdd { + builder::NetworkingSwitchPortConfigurationInterfaceBgpPeerAdd::new(self) + } + + fn networking_switch_port_configuration_interface_bgp_peer_remove( + &self, + ) -> builder::NetworkingSwitchPortConfigurationInterfaceBgpPeerRemove { + builder::NetworkingSwitchPortConfigurationInterfaceBgpPeerRemove::new(self) + } + + fn networking_switch_port_configuration_interface_route_list( + &self, + ) -> builder::NetworkingSwitchPortConfigurationInterfaceRouteList { + builder::NetworkingSwitchPortConfigurationInterfaceRouteList::new(self) + } + + fn networking_switch_port_configuration_interface_route_add( + &self, + ) -> builder::NetworkingSwitchPortConfigurationInterfaceRouteAdd { + builder::NetworkingSwitchPortConfigurationInterfaceRouteAdd::new(self) + } + + fn networking_switch_port_configuration_interface_route_remove( + &self, + ) -> builder::NetworkingSwitchPortConfigurationInterfaceRouteRemove { + builder::NetworkingSwitchPortConfigurationInterfaceRouteRemove::new(self) + } + + fn networking_switch_port_configuration_link_list( + &self, + ) -> builder::NetworkingSwitchPortConfigurationLinkList { + builder::NetworkingSwitchPortConfigurationLinkList::new(self) + } + + fn networking_switch_port_configuration_link_create( + &self, + ) -> builder::NetworkingSwitchPortConfigurationLinkCreate { + builder::NetworkingSwitchPortConfigurationLinkCreate::new(self) + } + + fn networking_switch_port_configuration_link_view( + &self, + ) -> builder::NetworkingSwitchPortConfigurationLinkView { + builder::NetworkingSwitchPortConfigurationLinkView::new(self) + } + + fn networking_switch_port_configuration_link_delete( + &self, + ) -> builder::NetworkingSwitchPortConfigurationLinkDelete { + builder::NetworkingSwitchPortConfigurationLinkDelete::new(self) } } @@ -50021,7 +50618,7 @@ pub trait ClientSystemSilosExt { /// `/v1/system/identity-providers/local/users/{user_id}` /// /// Arguments: - /// - `user_id`: The user's internal ID + /// - `user_id`: The user's internal id /// - `silo`: Name or ID of the silo /// ```ignore /// let response = client.local_idp_user_delete() @@ -50040,7 +50637,7 @@ pub trait ClientSystemSilosExt { /// `/v1/system/identity-providers/local/users/{user_id}/set-password` /// /// Arguments: - /// - `user_id`: The user's internal ID + /// - `user_id`: The user's internal id /// - `silo`: Name or ID of the silo /// - `body` /// ```ignore @@ -50268,7 +50865,7 @@ pub trait ClientSystemSilosExt { /// Sends a `GET` request to `/v1/system/users/{user_id}` /// /// Arguments: - /// - `user_id`: The user's internal ID + /// - `user_id`: The user's internal id /// - `silo`: Name or ID of the silo /// ```ignore /// let response = client.silo_user_view() @@ -64087,162 +64684,81 @@ pub mod builder { } } - /// Builder for [`ClientSystemNetworkingExt::networking_allow_list_view`] - /// - /// [`ClientSystemNetworkingExt::networking_allow_list_view`]: super::ClientSystemNetworkingExt::networking_allow_list_view - #[derive(Debug, Clone)] - pub struct NetworkingAllowListView<'a> { - client: &'a super::Client, - } - - impl<'a> NetworkingAllowListView<'a> { - pub fn new(client: &'a super::Client) -> Self { - Self { client: client } - } - - /// Sends a `GET` request to `/v1/system/networking/allow-list` - pub async fn send(self) -> Result, Error> { - let Self { client } = self; - let url = format!("{}/v1/system/networking/allow-list", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } - } - } - - /// Builder for [`ClientSystemNetworkingExt::networking_allow_list_update`] + /// Builder for + /// [`ClientSystemNetworkingExt::networking_address_lot_block_add`] /// - /// [`ClientSystemNetworkingExt::networking_allow_list_update`]: super::ClientSystemNetworkingExt::networking_allow_list_update + /// [`ClientSystemNetworkingExt::networking_address_lot_block_add`]: super::ClientSystemNetworkingExt::networking_address_lot_block_add #[derive(Debug, Clone)] - pub struct NetworkingAllowListUpdate<'a> { + pub struct NetworkingAddressLotBlockAdd<'a> { client: &'a super::Client, - body: Result, + address_lot: Result, + body: Result, } - impl<'a> NetworkingAllowListUpdate<'a> { + impl<'a> NetworkingAddressLotBlockAdd<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, - body: Ok(types::builder::AllowListUpdate::default()), + address_lot: Err("address_lot was not initialized".to_string()), + body: Ok(types::builder::AddressLotBlockAddRemove::default()), } } - pub fn body(mut self, value: V) -> Self + pub fn address_lot(mut self, value: V) -> Self where - V: std::convert::TryInto, - >::Error: std::fmt::Display, + V: std::convert::TryInto, { - self.body = value + self.address_lot = value .try_into() - .map(From::from) - .map_err(|s| format!("conversion to `AllowListUpdate` for body failed: {}", s)); - self - } - - pub fn body_map(mut self, f: F) -> Self - where - F: std::ops::FnOnce(types::builder::AllowListUpdate) -> types::builder::AllowListUpdate, - { - self.body = self.body.map(f); + .map_err(|_| "conversion to `NameOrId` for address_lot failed".to_string()); self } - /// Sends a `PUT` request to `/v1/system/networking/allow-list` - pub async fn send(self) -> Result, Error> { - let Self { client, body } = self; - let body = body - .and_then(|v| types::AllowListUpdate::try_from(v).map_err(|e| e.to_string())) - .map_err(Error::InvalidRequest)?; - let url = format!("{}/v1/system/networking/allow-list", client.baseurl,); - #[allow(unused_mut)] - let mut request = client - .client - .put(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } - } - } - - /// Builder for [`ClientSystemNetworkingExt::networking_bfd_disable`] - /// - /// [`ClientSystemNetworkingExt::networking_bfd_disable`]: super::ClientSystemNetworkingExt::networking_bfd_disable - #[derive(Debug, Clone)] - pub struct NetworkingBfdDisable<'a> { - client: &'a super::Client, - body: Result, - } - - impl<'a> NetworkingBfdDisable<'a> { - pub fn new(client: &'a super::Client) -> Self { - Self { - client: client, - body: Ok(types::builder::BfdSessionDisable::default()), - } - } - pub fn body(mut self, value: V) -> Self where - V: std::convert::TryInto, - >::Error: std::fmt::Display, + V: std::convert::TryInto, + >::Error: std::fmt::Display, { - self.body = value - .try_into() - .map(From::from) - .map_err(|s| format!("conversion to `BfdSessionDisable` for body failed: {}", s)); + self.body = value.try_into().map(From::from).map_err(|s| { + format!( + "conversion to `AddressLotBlockAddRemove` for body failed: {}", + s + ) + }); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce( - types::builder::BfdSessionDisable, - ) -> types::builder::BfdSessionDisable, + types::builder::AddressLotBlockAddRemove, + ) -> types::builder::AddressLotBlockAddRemove, { self.body = self.body.map(f); self } - /// Sends a `POST` request to `/v1/system/networking/bfd-disable` - pub async fn send(self) -> Result, Error> { - let Self { client, body } = self; + /// Sends a `POST` request to + /// `/v1/system/networking/address-lot/{address_lot}/blocks/add` + pub async fn send( + self, + ) -> Result, Error> { + let Self { + client, + address_lot, + body, + } = self; + let address_lot = address_lot.map_err(Error::InvalidRequest)?; let body = body - .and_then(|v| types::BfdSessionDisable::try_from(v).map_err(|e| e.to_string())) + .and_then(|v| { + types::AddressLotBlockAddRemove::try_from(v).map_err(|e| e.to_string()) + }) .map_err(Error::InvalidRequest)?; - let url = format!("{}/v1/system/networking/bfd-disable", client.baseurl,); + let url = format!( + "{}/v1/system/networking/address-lot/{}/blocks/add", + client.baseurl, + encode_path(&address_lot.to_string()), + ); #[allow(unused_mut)] let mut request = client .client @@ -64256,7 +64772,7 @@ pub mod builder { let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), + 201u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), @@ -64268,52 +64784,79 @@ pub mod builder { } } - /// Builder for [`ClientSystemNetworkingExt::networking_bfd_enable`] + /// Builder for + /// [`ClientSystemNetworkingExt::networking_address_lot_block_remove`] /// - /// [`ClientSystemNetworkingExt::networking_bfd_enable`]: super::ClientSystemNetworkingExt::networking_bfd_enable + /// [`ClientSystemNetworkingExt::networking_address_lot_block_remove`]: super::ClientSystemNetworkingExt::networking_address_lot_block_remove #[derive(Debug, Clone)] - pub struct NetworkingBfdEnable<'a> { + pub struct NetworkingAddressLotBlockRemove<'a> { client: &'a super::Client, - body: Result, + address_lot: Result, + body: Result, } - impl<'a> NetworkingBfdEnable<'a> { + impl<'a> NetworkingAddressLotBlockRemove<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, - body: Ok(types::builder::BfdSessionEnable::default()), + address_lot: Err("address_lot was not initialized".to_string()), + body: Ok(types::builder::AddressLotBlockAddRemove::default()), } } - pub fn body(mut self, value: V) -> Self + pub fn address_lot(mut self, value: V) -> Self where - V: std::convert::TryInto, - >::Error: std::fmt::Display, + V: std::convert::TryInto, { - self.body = value + self.address_lot = value .try_into() - .map(From::from) - .map_err(|s| format!("conversion to `BfdSessionEnable` for body failed: {}", s)); + .map_err(|_| "conversion to `NameOrId` for address_lot failed".to_string()); + self + } + + pub fn body(mut self, value: V) -> Self + where + V: std::convert::TryInto, + >::Error: std::fmt::Display, + { + self.body = value.try_into().map(From::from).map_err(|s| { + format!( + "conversion to `AddressLotBlockAddRemove` for body failed: {}", + s + ) + }); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce( - types::builder::BfdSessionEnable, - ) -> types::builder::BfdSessionEnable, + types::builder::AddressLotBlockAddRemove, + ) -> types::builder::AddressLotBlockAddRemove, { self.body = self.body.map(f); self } - /// Sends a `POST` request to `/v1/system/networking/bfd-enable` + /// Sends a `POST` request to + /// `/v1/system/networking/address-lot/{address_lot}/blocks/remove` pub async fn send(self) -> Result, Error> { - let Self { client, body } = self; + let Self { + client, + address_lot, + body, + } = self; + let address_lot = address_lot.map_err(Error::InvalidRequest)?; let body = body - .and_then(|v| types::BfdSessionEnable::try_from(v).map_err(|e| e.to_string())) + .and_then(|v| { + types::AddressLotBlockAddRemove::try_from(v).map_err(|e| e.to_string()) + }) .map_err(Error::InvalidRequest)?; - let url = format!("{}/v1/system/networking/bfd-enable", client.baseurl,); + let url = format!( + "{}/v1/system/networking/address-lot/{}/blocks/remove", + client.baseurl, + encode_path(&address_lot.to_string()), + ); #[allow(unused_mut)] let mut request = client .client @@ -64339,25 +64882,277 @@ pub mod builder { } } - /// Builder for [`ClientSystemNetworkingExt::networking_bfd_status`] + /// Builder for [`ClientSystemNetworkingExt::networking_allow_list_view`] /// - /// [`ClientSystemNetworkingExt::networking_bfd_status`]: super::ClientSystemNetworkingExt::networking_bfd_status + /// [`ClientSystemNetworkingExt::networking_allow_list_view`]: super::ClientSystemNetworkingExt::networking_allow_list_view #[derive(Debug, Clone)] - pub struct NetworkingBfdStatus<'a> { + pub struct NetworkingAllowListView<'a> { client: &'a super::Client, } - impl<'a> NetworkingBfdStatus<'a> { + impl<'a> NetworkingAllowListView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client } } - /// Sends a `GET` request to `/v1/system/networking/bfd-status` - pub async fn send( - self, - ) -> Result>, Error> { + /// Sends a `GET` request to `/v1/system/networking/allow-list` + pub async fn send(self) -> Result, Error> { let Self { client } = self; - let url = format!("{}/v1/system/networking/bfd-status", client.baseurl,); + let url = format!("{}/v1/system/networking/allow-list", client.baseurl,); + #[allow(unused_mut)] + let mut request = client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + } + + /// Builder for [`ClientSystemNetworkingExt::networking_allow_list_update`] + /// + /// [`ClientSystemNetworkingExt::networking_allow_list_update`]: super::ClientSystemNetworkingExt::networking_allow_list_update + #[derive(Debug, Clone)] + pub struct NetworkingAllowListUpdate<'a> { + client: &'a super::Client, + body: Result, + } + + impl<'a> NetworkingAllowListUpdate<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client: client, + body: Ok(types::builder::AllowListUpdate::default()), + } + } + + pub fn body(mut self, value: V) -> Self + where + V: std::convert::TryInto, + >::Error: std::fmt::Display, + { + self.body = value + .try_into() + .map(From::from) + .map_err(|s| format!("conversion to `AllowListUpdate` for body failed: {}", s)); + self + } + + pub fn body_map(mut self, f: F) -> Self + where + F: std::ops::FnOnce(types::builder::AllowListUpdate) -> types::builder::AllowListUpdate, + { + self.body = self.body.map(f); + self + } + + /// Sends a `PUT` request to `/v1/system/networking/allow-list` + pub async fn send(self) -> Result, Error> { + let Self { client, body } = self; + let body = body + .and_then(|v| types::AllowListUpdate::try_from(v).map_err(|e| e.to_string())) + .map_err(Error::InvalidRequest)?; + let url = format!("{}/v1/system/networking/allow-list", client.baseurl,); + #[allow(unused_mut)] + let mut request = client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + } + + /// Builder for [`ClientSystemNetworkingExt::networking_bfd_disable`] + /// + /// [`ClientSystemNetworkingExt::networking_bfd_disable`]: super::ClientSystemNetworkingExt::networking_bfd_disable + #[derive(Debug, Clone)] + pub struct NetworkingBfdDisable<'a> { + client: &'a super::Client, + body: Result, + } + + impl<'a> NetworkingBfdDisable<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client: client, + body: Ok(types::builder::BfdSessionDisable::default()), + } + } + + pub fn body(mut self, value: V) -> Self + where + V: std::convert::TryInto, + >::Error: std::fmt::Display, + { + self.body = value + .try_into() + .map(From::from) + .map_err(|s| format!("conversion to `BfdSessionDisable` for body failed: {}", s)); + self + } + + pub fn body_map(mut self, f: F) -> Self + where + F: std::ops::FnOnce( + types::builder::BfdSessionDisable, + ) -> types::builder::BfdSessionDisable, + { + self.body = self.body.map(f); + self + } + + /// Sends a `POST` request to `/v1/system/networking/bfd-disable` + pub async fn send(self) -> Result, Error> { + let Self { client, body } = self; + let body = body + .and_then(|v| types::BfdSessionDisable::try_from(v).map_err(|e| e.to_string())) + .map_err(Error::InvalidRequest)?; + let url = format!("{}/v1/system/networking/bfd-disable", client.baseurl,); + #[allow(unused_mut)] + let mut request = client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + } + + /// Builder for [`ClientSystemNetworkingExt::networking_bfd_enable`] + /// + /// [`ClientSystemNetworkingExt::networking_bfd_enable`]: super::ClientSystemNetworkingExt::networking_bfd_enable + #[derive(Debug, Clone)] + pub struct NetworkingBfdEnable<'a> { + client: &'a super::Client, + body: Result, + } + + impl<'a> NetworkingBfdEnable<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client: client, + body: Ok(types::builder::BfdSessionEnable::default()), + } + } + + pub fn body(mut self, value: V) -> Self + where + V: std::convert::TryInto, + >::Error: std::fmt::Display, + { + self.body = value + .try_into() + .map(From::from) + .map_err(|s| format!("conversion to `BfdSessionEnable` for body failed: {}", s)); + self + } + + pub fn body_map(mut self, f: F) -> Self + where + F: std::ops::FnOnce( + types::builder::BfdSessionEnable, + ) -> types::builder::BfdSessionEnable, + { + self.body = self.body.map(f); + self + } + + /// Sends a `POST` request to `/v1/system/networking/bfd-enable` + pub async fn send(self) -> Result, Error> { + let Self { client, body } = self; + let body = body + .and_then(|v| types::BfdSessionEnable::try_from(v).map_err(|e| e.to_string())) + .map_err(Error::InvalidRequest)?; + let url = format!("{}/v1/system/networking/bfd-enable", client.baseurl,); + #[allow(unused_mut)] + let mut request = client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + } + + /// Builder for [`ClientSystemNetworkingExt::networking_bfd_status`] + /// + /// [`ClientSystemNetworkingExt::networking_bfd_status`]: super::ClientSystemNetworkingExt::networking_bfd_status + #[derive(Debug, Clone)] + pub struct NetworkingBfdStatus<'a> { + client: &'a super::Client, + } + + impl<'a> NetworkingBfdStatus<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { client: client } + } + + /// Sends a `GET` request to `/v1/system/networking/bfd-status` + pub async fn send( + self, + ) -> Result>, Error> { + let Self { client } = self; + let url = format!("{}/v1/system/networking/bfd-status", client.baseurl,); #[allow(unused_mut)] let mut request = client .client @@ -65548,29 +66343,40 @@ pub mod builder { } /// Builder for - /// [`ClientSystemNetworkingExt::networking_switch_port_settings_list`] + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_list`] /// - /// [`ClientSystemNetworkingExt::networking_switch_port_settings_list`]: super::ClientSystemNetworkingExt::networking_switch_port_settings_list + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_list`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_list #[derive(Debug, Clone)] - pub struct NetworkingSwitchPortSettingsList<'a> { + pub struct NetworkingSwitchPortConfigurationList<'a> { client: &'a super::Client, + configuration: Result, String>, limit: Result, String>, page_token: Result, String>, - port_settings: Result, String>, sort_by: Result, String>, } - impl<'a> NetworkingSwitchPortSettingsList<'a> { + impl<'a> NetworkingSwitchPortConfigurationList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, + configuration: Ok(None), limit: Ok(None), page_token: Ok(None), - port_settings: Ok(None), sort_by: Ok(None), } } + pub fn configuration(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.configuration = value + .try_into() + .map(Some) + .map_err(|_| "conversion to `NameOrId` for configuration failed".to_string()); + self + } + pub fn limit(mut self, value: V) -> Self where V: std::convert::TryInto, @@ -65592,17 +66398,6 @@ pub mod builder { self } - pub fn port_settings(mut self, value: V) -> Self - where - V: std::convert::TryInto, - { - self.port_settings = value - .try_into() - .map(Some) - .map_err(|_| "conversion to `NameOrId` for port_settings failed".to_string()); - self - } - pub fn sort_by(mut self, value: V) -> Self where V: std::convert::TryInto, @@ -65615,36 +66410,36 @@ pub mod builder { } /// Sends a `GET` request to - /// `/v1/system/networking/switch-port-settings` + /// `/v1/system/networking/switch-port-configuration` pub async fn send( self, ) -> Result, Error> { let Self { client, + configuration, limit, page_token, - port_settings, sort_by, } = self; + let configuration = configuration.map_err(Error::InvalidRequest)?; let limit = limit.map_err(Error::InvalidRequest)?; let page_token = page_token.map_err(Error::InvalidRequest)?; - let port_settings = port_settings.map_err(Error::InvalidRequest)?; let sort_by = sort_by.map_err(Error::InvalidRequest)?; let url = format!( - "{}/v1/system/networking/switch-port-settings", + "{}/v1/system/networking/switch-port-configuration", client.baseurl, ); let mut query = Vec::with_capacity(4usize); + if let Some(v) = &configuration { + query.push(("configuration", v.to_string())); + } if let Some(v) = &limit { query.push(("limit", v.to_string())); } if let Some(v) = &page_token { query.push(("page_token", v.to_string())); } - if let Some(v) = &port_settings { - query.push(("port_settings", v.to_string())); - } if let Some(v) = &sort_by { query.push(("sort_by", v.to_string())); } @@ -65673,7 +66468,7 @@ pub mod builder { } /// Streams `GET` requests to - /// `/v1/system/networking/switch-port-settings` + /// `/v1/system/networking/switch-port-configuration` pub fn stream( self, ) -> impl futures::Stream>> @@ -65683,8 +66478,8 @@ pub mod builder { use futures::TryFutureExt; use futures::TryStreamExt; let next = Self { + configuration: Ok(None), page_token: Ok(None), - port_settings: Ok(None), sort_by: Ok(None), ..self.clone() }; @@ -65723,16 +66518,16 @@ pub mod builder { } /// Builder for - /// [`ClientSystemNetworkingExt::networking_switch_port_settings_create`] + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_create`] /// - /// [`ClientSystemNetworkingExt::networking_switch_port_settings_create`]: super::ClientSystemNetworkingExt::networking_switch_port_settings_create + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_create`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_create #[derive(Debug, Clone)] - pub struct NetworkingSwitchPortSettingsCreate<'a> { + pub struct NetworkingSwitchPortConfigurationCreate<'a> { client: &'a super::Client, body: Result, } - impl<'a> NetworkingSwitchPortSettingsCreate<'a> { + impl<'a> NetworkingSwitchPortConfigurationCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, @@ -65765,7 +66560,7 @@ pub mod builder { } /// Sends a `POST` request to - /// `/v1/system/networking/switch-port-settings` + /// `/v1/system/networking/switch-port-configuration` pub async fn send( self, ) -> Result, Error> { @@ -65776,7 +66571,7 @@ pub mod builder { }) .map_err(Error::InvalidRequest)?; let url = format!( - "{}/v1/system/networking/switch-port-settings", + "{}/v1/system/networking/switch-port-configuration", client.baseurl, ); #[allow(unused_mut)] @@ -65805,49 +66600,49 @@ pub mod builder { } /// Builder for - /// [`ClientSystemNetworkingExt::networking_switch_port_settings_delete`] + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_delete`] /// - /// [`ClientSystemNetworkingExt::networking_switch_port_settings_delete`]: super::ClientSystemNetworkingExt::networking_switch_port_settings_delete + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_delete`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_delete #[derive(Debug, Clone)] - pub struct NetworkingSwitchPortSettingsDelete<'a> { + pub struct NetworkingSwitchPortConfigurationDelete<'a> { client: &'a super::Client, - port_settings: Result, String>, + configuration: Result, String>, } - impl<'a> NetworkingSwitchPortSettingsDelete<'a> { + impl<'a> NetworkingSwitchPortConfigurationDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, - port_settings: Ok(None), + configuration: Ok(None), } } - pub fn port_settings(mut self, value: V) -> Self + pub fn configuration(mut self, value: V) -> Self where V: std::convert::TryInto, { - self.port_settings = value + self.configuration = value .try_into() .map(Some) - .map_err(|_| "conversion to `NameOrId` for port_settings failed".to_string()); + .map_err(|_| "conversion to `NameOrId` for configuration failed".to_string()); self } /// Sends a `DELETE` request to - /// `/v1/system/networking/switch-port-settings` + /// `/v1/system/networking/switch-port-configuration` pub async fn send(self) -> Result, Error> { let Self { client, - port_settings, + configuration, } = self; - let port_settings = port_settings.map_err(Error::InvalidRequest)?; + let configuration = configuration.map_err(Error::InvalidRequest)?; let url = format!( - "{}/v1/system/networking/switch-port-settings", + "{}/v1/system/networking/switch-port-configuration", client.baseurl, ); let mut query = Vec::with_capacity(1usize); - if let Some(v) = &port_settings { - query.push(("port_settings", v.to_string())); + if let Some(v) = &configuration { + query.push(("configuration", v.to_string())); } #[allow(unused_mut)] let mut request = client @@ -65875,44 +66670,599 @@ pub mod builder { } /// Builder for - /// [`ClientSystemNetworkingExt::networking_switch_port_settings_view`] + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_view`] /// - /// [`ClientSystemNetworkingExt::networking_switch_port_settings_view`]: super::ClientSystemNetworkingExt::networking_switch_port_settings_view + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_view`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_view #[derive(Debug, Clone)] - pub struct NetworkingSwitchPortSettingsView<'a> { + pub struct NetworkingSwitchPortConfigurationView<'a> { client: &'a super::Client, - port: Result, + configuration: Result, } - impl<'a> NetworkingSwitchPortSettingsView<'a> { + impl<'a> NetworkingSwitchPortConfigurationView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, - port: Err("port was not initialized".to_string()), + configuration: Err("configuration was not initialized".to_string()), } } - pub fn port(mut self, value: V) -> Self + pub fn configuration(mut self, value: V) -> Self where V: std::convert::TryInto, { - self.port = value + self.configuration = value .try_into() - .map_err(|_| "conversion to `NameOrId` for port failed".to_string()); + .map_err(|_| "conversion to `NameOrId` for configuration failed".to_string()); self } /// Sends a `GET` request to - /// `/v1/system/networking/switch-port-settings/{port}` + /// `/v1/system/networking/switch-port-configuration/{configuration}` pub async fn send( self, ) -> Result, Error> { - let Self { client, port } = self; - let port = port.map_err(Error::InvalidRequest)?; + let Self { + client, + configuration, + } = self; + let configuration = configuration.map_err(Error::InvalidRequest)?; let url = format!( - "{}/v1/system/networking/switch-port-settings/{}", + "{}/v1/system/networking/switch-port-configuration/{}", client.baseurl, - encode_path(&port.to_string()), + encode_path(&configuration.to_string()), + ); + #[allow(unused_mut)] + let mut request = client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + } + + /// Builder for + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_geometry_view`] + /// + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_geometry_view`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_geometry_view + #[derive(Debug, Clone)] + pub struct NetworkingSwitchPortConfigurationGeometryView<'a> { + client: &'a super::Client, + configuration: Result, + } + + impl<'a> NetworkingSwitchPortConfigurationGeometryView<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client: client, + configuration: Err("configuration was not initialized".to_string()), + } + } + + pub fn configuration(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.configuration = value + .try_into() + .map_err(|_| "conversion to `NameOrId` for configuration failed".to_string()); + self + } + + /// Sends a `GET` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// geometry` + pub async fn send( + self, + ) -> Result, Error> { + let Self { + client, + configuration, + } = self; + let configuration = configuration.map_err(Error::InvalidRequest)?; + let url = format!( + "{}/v1/system/networking/switch-port-configuration/{}/geometry", + client.baseurl, + encode_path(&configuration.to_string()), + ); + #[allow(unused_mut)] + let mut request = client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + } + + /// Builder for + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_geometry_set`] + /// + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_geometry_set`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_geometry_set + #[derive(Debug, Clone)] + pub struct NetworkingSwitchPortConfigurationGeometrySet<'a> { + client: &'a super::Client, + configuration: Result, + body: Result, + } + + impl<'a> NetworkingSwitchPortConfigurationGeometrySet<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client: client, + configuration: Err("configuration was not initialized".to_string()), + body: Ok(types::builder::SwitchPortConfigCreate::default()), + } + } + + pub fn configuration(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.configuration = value + .try_into() + .map_err(|_| "conversion to `NameOrId` for configuration failed".to_string()); + self + } + + pub fn body(mut self, value: V) -> Self + where + V: std::convert::TryInto, + >::Error: std::fmt::Display, + { + self.body = value.try_into().map(From::from).map_err(|s| { + format!( + "conversion to `SwitchPortConfigCreate` for body failed: {}", + s + ) + }); + self + } + + pub fn body_map(mut self, f: F) -> Self + where + F: std::ops::FnOnce( + types::builder::SwitchPortConfigCreate, + ) -> types::builder::SwitchPortConfigCreate, + { + self.body = self.body.map(f); + self + } + + /// Sends a `POST` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// geometry` + pub async fn send( + self, + ) -> Result, Error> { + let Self { + client, + configuration, + body, + } = self; + let configuration = configuration.map_err(Error::InvalidRequest)?; + let body = body + .and_then(|v| types::SwitchPortConfigCreate::try_from(v).map_err(|e| e.to_string())) + .map_err(Error::InvalidRequest)?; + let url = format!( + "{}/v1/system/networking/switch-port-configuration/{}/geometry", + client.baseurl, + encode_path(&configuration.to_string()), + ); + #[allow(unused_mut)] + let mut request = client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + } + + /// Builder for + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_interface_address_list`] + /// + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_interface_address_list`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_interface_address_list + #[derive(Debug, Clone)] + pub struct NetworkingSwitchPortConfigurationInterfaceAddressList<'a> { + client: &'a super::Client, + configuration: Result, + interface: Result, + } + + impl<'a> NetworkingSwitchPortConfigurationInterfaceAddressList<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client: client, + configuration: Err("configuration was not initialized".to_string()), + interface: Err("interface was not initialized".to_string()), + } + } + + pub fn configuration(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.configuration = value + .try_into() + .map_err(|_| "conversion to `NameOrId` for configuration failed".to_string()); + self + } + + pub fn interface(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.interface = value + .try_into() + .map_err(|_| "conversion to `Name` for interface failed".to_string()); + self + } + + /// Sends a `GET` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// interface/{interface}/address` + pub async fn send( + self, + ) -> Result>, Error> + { + let Self { + client, + configuration, + interface, + } = self; + let configuration = configuration.map_err(Error::InvalidRequest)?; + let interface = interface.map_err(Error::InvalidRequest)?; + let url = format!( + "{}/v1/system/networking/switch-port-configuration/{}/interface/{}/address", + client.baseurl, + encode_path(&configuration.to_string()), + encode_path(&interface.to_string()), + ); + #[allow(unused_mut)] + let mut request = client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + } + + /// Builder for + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_interface_address_add`] + /// + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_interface_address_add`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_interface_address_add + #[derive(Debug, Clone)] + pub struct NetworkingSwitchPortConfigurationInterfaceAddressAdd<'a> { + client: &'a super::Client, + configuration: Result, + interface: Result, + body: Result, + } + + impl<'a> NetworkingSwitchPortConfigurationInterfaceAddressAdd<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client: client, + configuration: Err("configuration was not initialized".to_string()), + interface: Err("interface was not initialized".to_string()), + body: Ok(types::builder::Address::default()), + } + } + + pub fn configuration(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.configuration = value + .try_into() + .map_err(|_| "conversion to `NameOrId` for configuration failed".to_string()); + self + } + + pub fn interface(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.interface = value + .try_into() + .map_err(|_| "conversion to `Name` for interface failed".to_string()); + self + } + + pub fn body(mut self, value: V) -> Self + where + V: std::convert::TryInto, + >::Error: std::fmt::Display, + { + self.body = value + .try_into() + .map(From::from) + .map_err(|s| format!("conversion to `Address` for body failed: {}", s)); + self + } + + pub fn body_map(mut self, f: F) -> Self + where + F: std::ops::FnOnce(types::builder::Address) -> types::builder::Address, + { + self.body = self.body.map(f); + self + } + + /// Sends a `POST` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// interface/{interface}/address/add` + pub async fn send( + self, + ) -> Result, Error> { + let Self { + client, + configuration, + interface, + body, + } = self; + let configuration = configuration.map_err(Error::InvalidRequest)?; + let interface = interface.map_err(Error::InvalidRequest)?; + let body = body + .and_then(|v| types::Address::try_from(v).map_err(|e| e.to_string())) + .map_err(Error::InvalidRequest)?; + let url = format!( + "{}/v1/system/networking/switch-port-configuration/{}/interface/{}/address/add", + client.baseurl, + encode_path(&configuration.to_string()), + encode_path(&interface.to_string()), + ); + #[allow(unused_mut)] + let mut request = client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + } + + /// Builder for + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_interface_address_remove`] + /// + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_interface_address_remove`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_interface_address_remove + #[derive(Debug, Clone)] + pub struct NetworkingSwitchPortConfigurationInterfaceAddressRemove<'a> { + client: &'a super::Client, + configuration: Result, + interface: Result, + body: Result, + } + + impl<'a> NetworkingSwitchPortConfigurationInterfaceAddressRemove<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client: client, + configuration: Err("configuration was not initialized".to_string()), + interface: Err("interface was not initialized".to_string()), + body: Ok(types::builder::Address::default()), + } + } + + pub fn configuration(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.configuration = value + .try_into() + .map_err(|_| "conversion to `NameOrId` for configuration failed".to_string()); + self + } + + pub fn interface(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.interface = value + .try_into() + .map_err(|_| "conversion to `Name` for interface failed".to_string()); + self + } + + pub fn body(mut self, value: V) -> Self + where + V: std::convert::TryInto, + >::Error: std::fmt::Display, + { + self.body = value + .try_into() + .map(From::from) + .map_err(|s| format!("conversion to `Address` for body failed: {}", s)); + self + } + + pub fn body_map(mut self, f: F) -> Self + where + F: std::ops::FnOnce(types::builder::Address) -> types::builder::Address, + { + self.body = self.body.map(f); + self + } + + /// Sends a `POST` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// interface/{interface}/address/remove` + pub async fn send(self) -> Result, Error> { + let Self { + client, + configuration, + interface, + body, + } = self; + let configuration = configuration.map_err(Error::InvalidRequest)?; + let interface = interface.map_err(Error::InvalidRequest)?; + let body = body + .and_then(|v| types::Address::try_from(v).map_err(|e| e.to_string())) + .map_err(Error::InvalidRequest)?; + let url = format!( + "{}/v1/system/networking/switch-port-configuration/{}/interface/{}/address/remove", + client.baseurl, + encode_path(&configuration.to_string()), + encode_path(&interface.to_string()), + ); + #[allow(unused_mut)] + let mut request = client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + } + + /// Builder for + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_interface_bgp_peer_list`] + /// + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_interface_bgp_peer_list`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_interface_bgp_peer_list + #[derive(Debug, Clone)] + pub struct NetworkingSwitchPortConfigurationInterfaceBgpPeerList<'a> { + client: &'a super::Client, + configuration: Result, + interface: Result, + } + + impl<'a> NetworkingSwitchPortConfigurationInterfaceBgpPeerList<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client: client, + configuration: Err("configuration was not initialized".to_string()), + interface: Err("interface was not initialized".to_string()), + } + } + + pub fn configuration(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.configuration = value + .try_into() + .map_err(|_| "conversion to `NameOrId` for configuration failed".to_string()); + self + } + + pub fn interface(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.interface = value + .try_into() + .map_err(|_| "conversion to `Name` for interface failed".to_string()); + self + } + + /// Sends a `GET` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// interface/{interface}/bgp-peer` + pub async fn send( + self, + ) -> Result, Error> { + let Self { + client, + configuration, + interface, + } = self; + let configuration = configuration.map_err(Error::InvalidRequest)?; + let interface = interface.map_err(Error::InvalidRequest)?; + let url = format!( + "{}/v1/system/networking/switch-port-configuration/{}/interface/{}/bgp-peer", + client.baseurl, + encode_path(&configuration.to_string()), + encode_path(&interface.to_string()), ); #[allow(unused_mut)] let mut request = client @@ -65938,6 +67288,850 @@ pub mod builder { } } + /// Builder for + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_interface_bgp_peer_add`] + /// + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_interface_bgp_peer_add`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_interface_bgp_peer_add + #[derive(Debug, Clone)] + pub struct NetworkingSwitchPortConfigurationInterfaceBgpPeerAdd<'a> { + client: &'a super::Client, + configuration: Result, + interface: Result, + body: Result, + } + + impl<'a> NetworkingSwitchPortConfigurationInterfaceBgpPeerAdd<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client: client, + configuration: Err("configuration was not initialized".to_string()), + interface: Err("interface was not initialized".to_string()), + body: Ok(types::builder::BgpPeer::default()), + } + } + + pub fn configuration(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.configuration = value + .try_into() + .map_err(|_| "conversion to `NameOrId` for configuration failed".to_string()); + self + } + + pub fn interface(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.interface = value + .try_into() + .map_err(|_| "conversion to `Name` for interface failed".to_string()); + self + } + + pub fn body(mut self, value: V) -> Self + where + V: std::convert::TryInto, + >::Error: std::fmt::Display, + { + self.body = value + .try_into() + .map(From::from) + .map_err(|s| format!("conversion to `BgpPeer` for body failed: {}", s)); + self + } + + pub fn body_map(mut self, f: F) -> Self + where + F: std::ops::FnOnce(types::builder::BgpPeer) -> types::builder::BgpPeer, + { + self.body = self.body.map(f); + self + } + + /// Sends a `POST` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// interface/{interface}/bgp-peer/add` + pub async fn send(self) -> Result, Error> { + let Self { + client, + configuration, + interface, + body, + } = self; + let configuration = configuration.map_err(Error::InvalidRequest)?; + let interface = interface.map_err(Error::InvalidRequest)?; + let body = body + .and_then(|v| types::BgpPeer::try_from(v).map_err(|e| e.to_string())) + .map_err(Error::InvalidRequest)?; + let url = format!( + "{}/v1/system/networking/switch-port-configuration/{}/interface/{}/bgp-peer/add", + client.baseurl, + encode_path(&configuration.to_string()), + encode_path(&interface.to_string()), + ); + #[allow(unused_mut)] + let mut request = client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + } + + /// Builder for + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_interface_bgp_peer_remove`] + /// + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_interface_bgp_peer_remove`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_interface_bgp_peer_remove + #[derive(Debug, Clone)] + pub struct NetworkingSwitchPortConfigurationInterfaceBgpPeerRemove<'a> { + client: &'a super::Client, + configuration: Result, + interface: Result, + body: Result, + } + + impl<'a> NetworkingSwitchPortConfigurationInterfaceBgpPeerRemove<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client: client, + configuration: Err("configuration was not initialized".to_string()), + interface: Err("interface was not initialized".to_string()), + body: Ok(types::builder::BgpPeer::default()), + } + } + + pub fn configuration(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.configuration = value + .try_into() + .map_err(|_| "conversion to `NameOrId` for configuration failed".to_string()); + self + } + + pub fn interface(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.interface = value + .try_into() + .map_err(|_| "conversion to `Name` for interface failed".to_string()); + self + } + + pub fn body(mut self, value: V) -> Self + where + V: std::convert::TryInto, + >::Error: std::fmt::Display, + { + self.body = value + .try_into() + .map(From::from) + .map_err(|s| format!("conversion to `BgpPeer` for body failed: {}", s)); + self + } + + pub fn body_map(mut self, f: F) -> Self + where + F: std::ops::FnOnce(types::builder::BgpPeer) -> types::builder::BgpPeer, + { + self.body = self.body.map(f); + self + } + + /// Sends a `POST` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// interface/{interface}/bgp-peer/remove` + pub async fn send(self) -> Result, Error> { + let Self { + client, + configuration, + interface, + body, + } = self; + let configuration = configuration.map_err(Error::InvalidRequest)?; + let interface = interface.map_err(Error::InvalidRequest)?; + let body = body + .and_then(|v| types::BgpPeer::try_from(v).map_err(|e| e.to_string())) + .map_err(Error::InvalidRequest)?; + let url = format!( + "{}/v1/system/networking/switch-port-configuration/{}/interface/{}/bgp-peer/remove", + client.baseurl, + encode_path(&configuration.to_string()), + encode_path(&interface.to_string()), + ); + #[allow(unused_mut)] + let mut request = client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + } + + /// Builder for + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_interface_route_list`] + /// + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_interface_route_list`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_interface_route_list + #[derive(Debug, Clone)] + pub struct NetworkingSwitchPortConfigurationInterfaceRouteList<'a> { + client: &'a super::Client, + configuration: Result, + interface: Result, + } + + impl<'a> NetworkingSwitchPortConfigurationInterfaceRouteList<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client: client, + configuration: Err("configuration was not initialized".to_string()), + interface: Err("interface was not initialized".to_string()), + } + } + + pub fn configuration(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.configuration = value + .try_into() + .map_err(|_| "conversion to `NameOrId` for configuration failed".to_string()); + self + } + + pub fn interface(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.interface = value + .try_into() + .map_err(|_| "conversion to `Name` for interface failed".to_string()); + self + } + + /// Sends a `GET` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// interface/{interface}/route` + pub async fn send(self) -> Result, Error> { + let Self { + client, + configuration, + interface, + } = self; + let configuration = configuration.map_err(Error::InvalidRequest)?; + let interface = interface.map_err(Error::InvalidRequest)?; + let url = format!( + "{}/v1/system/networking/switch-port-configuration/{}/interface/{}/route", + client.baseurl, + encode_path(&configuration.to_string()), + encode_path(&interface.to_string()), + ); + #[allow(unused_mut)] + let mut request = client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + } + + /// Builder for + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_interface_route_add`] + /// + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_interface_route_add`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_interface_route_add + #[derive(Debug, Clone)] + pub struct NetworkingSwitchPortConfigurationInterfaceRouteAdd<'a> { + client: &'a super::Client, + configuration: Result, + interface: Result, + body: Result, + } + + impl<'a> NetworkingSwitchPortConfigurationInterfaceRouteAdd<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client: client, + configuration: Err("configuration was not initialized".to_string()), + interface: Err("interface was not initialized".to_string()), + body: Ok(types::builder::Route::default()), + } + } + + pub fn configuration(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.configuration = value + .try_into() + .map_err(|_| "conversion to `NameOrId` for configuration failed".to_string()); + self + } + + pub fn interface(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.interface = value + .try_into() + .map_err(|_| "conversion to `Name` for interface failed".to_string()); + self + } + + pub fn body(mut self, value: V) -> Self + where + V: std::convert::TryInto, + >::Error: std::fmt::Display, + { + self.body = value + .try_into() + .map(From::from) + .map_err(|s| format!("conversion to `Route` for body failed: {}", s)); + self + } + + pub fn body_map(mut self, f: F) -> Self + where + F: std::ops::FnOnce(types::builder::Route) -> types::builder::Route, + { + self.body = self.body.map(f); + self + } + + /// Sends a `POST` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// interface/{interface}/route/add` + pub async fn send(self) -> Result, Error> { + let Self { + client, + configuration, + interface, + body, + } = self; + let configuration = configuration.map_err(Error::InvalidRequest)?; + let interface = interface.map_err(Error::InvalidRequest)?; + let body = body + .and_then(|v| types::Route::try_from(v).map_err(|e| e.to_string())) + .map_err(Error::InvalidRequest)?; + let url = format!( + "{}/v1/system/networking/switch-port-configuration/{}/interface/{}/route/add", + client.baseurl, + encode_path(&configuration.to_string()), + encode_path(&interface.to_string()), + ); + #[allow(unused_mut)] + let mut request = client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + } + + /// Builder for + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_interface_route_remove`] + /// + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_interface_route_remove`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_interface_route_remove + #[derive(Debug, Clone)] + pub struct NetworkingSwitchPortConfigurationInterfaceRouteRemove<'a> { + client: &'a super::Client, + configuration: Result, + interface: Result, + body: Result, + } + + impl<'a> NetworkingSwitchPortConfigurationInterfaceRouteRemove<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client: client, + configuration: Err("configuration was not initialized".to_string()), + interface: Err("interface was not initialized".to_string()), + body: Ok(types::builder::Route::default()), + } + } + + pub fn configuration(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.configuration = value + .try_into() + .map_err(|_| "conversion to `NameOrId` for configuration failed".to_string()); + self + } + + pub fn interface(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.interface = value + .try_into() + .map_err(|_| "conversion to `Name` for interface failed".to_string()); + self + } + + pub fn body(mut self, value: V) -> Self + where + V: std::convert::TryInto, + >::Error: std::fmt::Display, + { + self.body = value + .try_into() + .map(From::from) + .map_err(|s| format!("conversion to `Route` for body failed: {}", s)); + self + } + + pub fn body_map(mut self, f: F) -> Self + where + F: std::ops::FnOnce(types::builder::Route) -> types::builder::Route, + { + self.body = self.body.map(f); + self + } + + /// Sends a `POST` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// interface/{interface}/route/remove` + pub async fn send(self) -> Result, Error> { + let Self { + client, + configuration, + interface, + body, + } = self; + let configuration = configuration.map_err(Error::InvalidRequest)?; + let interface = interface.map_err(Error::InvalidRequest)?; + let body = body + .and_then(|v| types::Route::try_from(v).map_err(|e| e.to_string())) + .map_err(Error::InvalidRequest)?; + let url = format!( + "{}/v1/system/networking/switch-port-configuration/{}/interface/{}/route/remove", + client.baseurl, + encode_path(&configuration.to_string()), + encode_path(&interface.to_string()), + ); + #[allow(unused_mut)] + let mut request = client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + } + + /// Builder for + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_link_list`] + /// + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_link_list`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_link_list + #[derive(Debug, Clone)] + pub struct NetworkingSwitchPortConfigurationLinkList<'a> { + client: &'a super::Client, + configuration: Result, + } + + impl<'a> NetworkingSwitchPortConfigurationLinkList<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client: client, + configuration: Err("configuration was not initialized".to_string()), + } + } + + pub fn configuration(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.configuration = value + .try_into() + .map_err(|_| "conversion to `NameOrId` for configuration failed".to_string()); + self + } + + /// Sends a `GET` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// link` + pub async fn send( + self, + ) -> Result>, Error> { + let Self { + client, + configuration, + } = self; + let configuration = configuration.map_err(Error::InvalidRequest)?; + let url = format!( + "{}/v1/system/networking/switch-port-configuration/{}/link", + client.baseurl, + encode_path(&configuration.to_string()), + ); + #[allow(unused_mut)] + let mut request = client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + } + + /// Builder for + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_link_create`] + /// + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_link_create`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_link_create + #[derive(Debug, Clone)] + pub struct NetworkingSwitchPortConfigurationLinkCreate<'a> { + client: &'a super::Client, + configuration: Result, + body: Result, + } + + impl<'a> NetworkingSwitchPortConfigurationLinkCreate<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client: client, + configuration: Err("configuration was not initialized".to_string()), + body: Ok(types::builder::NamedLinkConfigCreate::default()), + } + } + + pub fn configuration(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.configuration = value + .try_into() + .map_err(|_| "conversion to `NameOrId` for configuration failed".to_string()); + self + } + + pub fn body(mut self, value: V) -> Self + where + V: std::convert::TryInto, + >::Error: std::fmt::Display, + { + self.body = value.try_into().map(From::from).map_err(|s| { + format!( + "conversion to `NamedLinkConfigCreate` for body failed: {}", + s + ) + }); + self + } + + pub fn body_map(mut self, f: F) -> Self + where + F: std::ops::FnOnce( + types::builder::NamedLinkConfigCreate, + ) -> types::builder::NamedLinkConfigCreate, + { + self.body = self.body.map(f); + self + } + + /// Sends a `POST` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// link` + pub async fn send( + self, + ) -> Result, Error> { + let Self { + client, + configuration, + body, + } = self; + let configuration = configuration.map_err(Error::InvalidRequest)?; + let body = body + .and_then(|v| types::NamedLinkConfigCreate::try_from(v).map_err(|e| e.to_string())) + .map_err(Error::InvalidRequest)?; + let url = format!( + "{}/v1/system/networking/switch-port-configuration/{}/link", + client.baseurl, + encode_path(&configuration.to_string()), + ); + #[allow(unused_mut)] + let mut request = client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + } + + /// Builder for + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_link_view`] + /// + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_link_view`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_link_view + #[derive(Debug, Clone)] + pub struct NetworkingSwitchPortConfigurationLinkView<'a> { + client: &'a super::Client, + configuration: Result, + link: Result, + } + + impl<'a> NetworkingSwitchPortConfigurationLinkView<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client: client, + configuration: Err("configuration was not initialized".to_string()), + link: Err("link was not initialized".to_string()), + } + } + + pub fn configuration(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.configuration = value + .try_into() + .map_err(|_| "conversion to `NameOrId` for configuration failed".to_string()); + self + } + + pub fn link(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.link = value + .try_into() + .map_err(|_| "conversion to `Name` for link failed".to_string()); + self + } + + /// Sends a `GET` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// link/{link}` + pub async fn send( + self, + ) -> Result, Error> { + let Self { + client, + configuration, + link, + } = self; + let configuration = configuration.map_err(Error::InvalidRequest)?; + let link = link.map_err(Error::InvalidRequest)?; + let url = format!( + "{}/v1/system/networking/switch-port-configuration/{}/link/{}", + client.baseurl, + encode_path(&configuration.to_string()), + encode_path(&link.to_string()), + ); + #[allow(unused_mut)] + let mut request = client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + } + + /// Builder for + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_link_delete`] + /// + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_link_delete`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_link_delete + #[derive(Debug, Clone)] + pub struct NetworkingSwitchPortConfigurationLinkDelete<'a> { + client: &'a super::Client, + configuration: Result, + link: Result, + } + + impl<'a> NetworkingSwitchPortConfigurationLinkDelete<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client: client, + configuration: Err("configuration was not initialized".to_string()), + link: Err("link was not initialized".to_string()), + } + } + + pub fn configuration(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.configuration = value + .try_into() + .map_err(|_| "conversion to `NameOrId` for configuration failed".to_string()); + self + } + + pub fn link(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.link = value + .try_into() + .map_err(|_| "conversion to `Name` for link failed".to_string()); + self + } + + /// Sends a `DELETE` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// link/{link}` + pub async fn send(self) -> Result, Error> { + let Self { + client, + configuration, + link, + } = self; + let configuration = configuration.map_err(Error::InvalidRequest)?; + let link = link.map_err(Error::InvalidRequest)?; + let url = format!( + "{}/v1/system/networking/switch-port-configuration/{}/link/{}", + client.baseurl, + encode_path(&configuration.to_string()), + encode_path(&link.to_string()), + ); + #[allow(unused_mut)] + let mut request = client + .client + .delete(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + } + /// Builder for [`ClientPolicyExt::system_policy_view`] /// /// [`ClientPolicyExt::system_policy_view`]: super::ClientPolicyExt::system_policy_view From f424598f23c79cebedaa3ba796f1f4ac03bc07ee Mon Sep 17 00:00:00 2001 From: Levon Tarver Date: Fri, 30 Aug 2024 00:52:06 +0000 Subject: [PATCH 2/8] address add / remove --- cli/src/cli_builder.rs | 36 +- cli/src/generated_cli.rs | 982 +++++++++---------- oxide.json | 409 ++++---- sdk-httpmock/src/generated_httpmock.rs | 691 ++++++-------- sdk/src/generated_sdk.rs | 1203 ++++++++++++------------ 5 files changed, 1527 insertions(+), 1794 deletions(-) diff --git a/cli/src/cli_builder.rs b/cli/src/cli_builder.rs index d4adf74f..c60d56f6 100644 --- a/cli/src/cli_builder.rs +++ b/cli/src/cli_builder.rs @@ -477,34 +477,34 @@ fn xxx<'a>(command: CliCommand) -> Option<&'a str> { Some("system networking switch-port configuration geometry set") } - CliCommand::NetworkingSwitchPortConfigurationInterfaceAddressList => { - Some("system networking switch-port configuration interface address list") + CliCommand::NetworkingSwitchPortConfigurationAddressList => { + Some("system networking switch-port configuration address list") } - CliCommand::NetworkingSwitchPortConfigurationInterfaceAddressAdd => { - Some("system networking switch-port configuration interface address add") + CliCommand::NetworkingSwitchPortConfigurationAddressAdd => { + Some("system networking switch-port configuration address add") } - CliCommand::NetworkingSwitchPortConfigurationInterfaceAddressRemove => { - Some("system networking switch-port configuration interface address remove") + CliCommand::NetworkingSwitchPortConfigurationAddressRemove => { + Some("system networking switch-port configuration address remove") } - CliCommand::NetworkingSwitchPortConfigurationInterfaceBgpPeerList => { - Some("system networking switch-port configuration interface bgp peer list") + CliCommand::NetworkingSwitchPortConfigurationBgpPeerList => { + Some("system networking switch-port configuration bgp peer list") } - CliCommand::NetworkingSwitchPortConfigurationInterfaceBgpPeerAdd => { - Some("system networking switch-port configuration interface bgp peer add") + CliCommand::NetworkingSwitchPortConfigurationBgpPeerAdd => { + Some("system networking switch-port configuration bgp peer add") } - CliCommand::NetworkingSwitchPortConfigurationInterfaceBgpPeerRemove => { - Some("system networking switch-port configuration interface bgp peer remove") + CliCommand::NetworkingSwitchPortConfigurationBgpPeerRemove => { + Some("system networking switch-port configuration bgp peer remove") } - CliCommand::NetworkingSwitchPortConfigurationInterfaceRouteList => { - Some("system networking switch-port configuration interface route list") + CliCommand::NetworkingSwitchPortConfigurationRouteList => { + Some("system networking switch-port configuration route list") } - CliCommand::NetworkingSwitchPortConfigurationInterfaceRouteAdd => { - Some("system networking switch-port configuration interface route add") + CliCommand::NetworkingSwitchPortConfigurationRouteAdd => { + Some("system networking switch-port configuration route add") } - CliCommand::NetworkingSwitchPortConfigurationInterfaceRouteRemove => { - Some("system networking switch-port configuration interface route remove") + CliCommand::NetworkingSwitchPortConfigurationRouteRemove => { + Some("system networking switch-port configuration route remove") } CliCommand::NetworkingSwitchPortConfigurationLinkList => { diff --git a/cli/src/generated_cli.rs b/cli/src/generated_cli.rs index 3643777d..f6e7e5a8 100644 --- a/cli/src/generated_cli.rs +++ b/cli/src/generated_cli.rs @@ -205,38 +205,29 @@ impl Cli { CliCommand::NetworkingSwitchPortConfigurationView => { Self::cli_networking_switch_port_configuration_view() } - CliCommand::NetworkingSwitchPortConfigurationGeometryView => { - Self::cli_networking_switch_port_configuration_geometry_view() - } - CliCommand::NetworkingSwitchPortConfigurationGeometrySet => { - Self::cli_networking_switch_port_configuration_geometry_set() - } - CliCommand::NetworkingSwitchPortConfigurationInterfaceAddressList => { - Self::cli_networking_switch_port_configuration_interface_address_list() + CliCommand::NetworkingSwitchPortConfigurationAddressList => { + Self::cli_networking_switch_port_configuration_address_list() } - CliCommand::NetworkingSwitchPortConfigurationInterfaceAddressAdd => { - Self::cli_networking_switch_port_configuration_interface_address_add() + CliCommand::NetworkingSwitchPortConfigurationAddressAdd => { + Self::cli_networking_switch_port_configuration_address_add() } - CliCommand::NetworkingSwitchPortConfigurationInterfaceAddressRemove => { - Self::cli_networking_switch_port_configuration_interface_address_remove() + CliCommand::NetworkingSwitchPortConfigurationAddressRemove => { + Self::cli_networking_switch_port_configuration_address_remove() } - CliCommand::NetworkingSwitchPortConfigurationInterfaceBgpPeerList => { - Self::cli_networking_switch_port_configuration_interface_bgp_peer_list() + CliCommand::NetworkingSwitchPortConfigurationBgpPeerList => { + Self::cli_networking_switch_port_configuration_bgp_peer_list() } - CliCommand::NetworkingSwitchPortConfigurationInterfaceBgpPeerAdd => { - Self::cli_networking_switch_port_configuration_interface_bgp_peer_add() + CliCommand::NetworkingSwitchPortConfigurationBgpPeerAdd => { + Self::cli_networking_switch_port_configuration_bgp_peer_add() } - CliCommand::NetworkingSwitchPortConfigurationInterfaceBgpPeerRemove => { - Self::cli_networking_switch_port_configuration_interface_bgp_peer_remove() + CliCommand::NetworkingSwitchPortConfigurationBgpPeerRemove => { + Self::cli_networking_switch_port_configuration_bgp_peer_remove() } - CliCommand::NetworkingSwitchPortConfigurationInterfaceRouteList => { - Self::cli_networking_switch_port_configuration_interface_route_list() - } - CliCommand::NetworkingSwitchPortConfigurationInterfaceRouteAdd => { - Self::cli_networking_switch_port_configuration_interface_route_add() + CliCommand::NetworkingSwitchPortConfigurationGeometryView => { + Self::cli_networking_switch_port_configuration_geometry_view() } - CliCommand::NetworkingSwitchPortConfigurationInterfaceRouteRemove => { - Self::cli_networking_switch_port_configuration_interface_route_remove() + CliCommand::NetworkingSwitchPortConfigurationGeometrySet => { + Self::cli_networking_switch_port_configuration_geometry_set() } CliCommand::NetworkingSwitchPortConfigurationLinkList => { Self::cli_networking_switch_port_configuration_link_list() @@ -250,6 +241,15 @@ impl Cli { CliCommand::NetworkingSwitchPortConfigurationLinkDelete => { Self::cli_networking_switch_port_configuration_link_delete() } + CliCommand::NetworkingSwitchPortConfigurationRouteList => { + Self::cli_networking_switch_port_configuration_route_list() + } + CliCommand::NetworkingSwitchPortConfigurationRouteAdd => { + Self::cli_networking_switch_port_configuration_route_add() + } + CliCommand::NetworkingSwitchPortConfigurationRouteRemove => { + Self::cli_networking_switch_port_configuration_route_remove() + } CliCommand::SystemPolicyView => Self::cli_system_policy_view(), CliCommand::SystemPolicyUpdate => Self::cli_system_policy_update(), CliCommand::RoleList => Self::cli_role_list(), @@ -4648,59 +4648,7 @@ impl Cli { .about("Get information about a named set of switch-port-settings") } - pub fn cli_networking_switch_port_configuration_geometry_view() -> clap::Command { - clap::Command::new("") - .arg( - clap::Arg::new("configuration") - .long("configuration") - .value_parser(clap::value_parser!(types::NameOrId)) - .required(true) - .help("A name or id to use when selecting a switch port configuration."), - ) - .about("Get switch port geometry for a provided switch port configuration") - } - - pub fn cli_networking_switch_port_configuration_geometry_set() -> clap::Command { - clap::Command::new("") - .arg( - clap::Arg::new("configuration") - .long("configuration") - .value_parser(clap::value_parser!(types::NameOrId)) - .required(true) - .help("A name or id to use when selecting a switch port configuration."), - ) - .arg( - clap::Arg::new("geometry") - .long("geometry") - .value_parser(clap::builder::TypedValueParser::map( - clap::builder::PossibleValuesParser::new([ - types::SwitchPortGeometry::Qsfp28x1.to_string(), - types::SwitchPortGeometry::Qsfp28x2.to_string(), - types::SwitchPortGeometry::Sfp28x4.to_string(), - ]), - |s| types::SwitchPortGeometry::try_from(s).unwrap(), - )) - .required_unless_present("json-body") - .help("Link geometry for the switch port."), - ) - .arg( - clap::Arg::new("json-body") - .long("json-body") - .value_name("JSON-FILE") - .required(false) - .value_parser(clap::value_parser!(std::path::PathBuf)) - .help("Path to a file that contains the full json body."), - ) - .arg( - clap::Arg::new("json-body-template") - .long("json-body-template") - .action(clap::ArgAction::SetTrue) - .help("XXX"), - ) - .about("Set switch port geometry for a provided switch port configuration") - } - - pub fn cli_networking_switch_port_configuration_interface_address_list() -> clap::Command { + pub fn cli_networking_switch_port_configuration_address_list() -> clap::Command { clap::Command::new("") .arg( clap::Arg::new("configuration") @@ -4709,17 +4657,10 @@ impl Cli { .required(true) .help("A name or id to use when selecting a switch port configuration."), ) - .arg( - clap::Arg::new("interface") - .long("interface") - .value_parser(clap::value_parser!(types::Name)) - .required(true) - .help("Interface name"), - ) .about("List addresses assigned to a provided interface configuration") } - pub fn cli_networking_switch_port_configuration_interface_address_add() -> clap::Command { + pub fn cli_networking_switch_port_configuration_address_add() -> clap::Command { clap::Command::new("") .arg( clap::Arg::new("address") @@ -4746,8 +4687,8 @@ impl Cli { clap::Arg::new("interface") .long("interface") .value_parser(clap::value_parser!(types::Name)) - .required(true) - .help("Interface name"), + .required_unless_present("json-body") + .help("The name of the interface"), ) .arg( clap::Arg::new("vlan-id") @@ -4773,7 +4714,7 @@ impl Cli { .about("Add address to an interface configuration") } - pub fn cli_networking_switch_port_configuration_interface_address_remove() -> clap::Command { + pub fn cli_networking_switch_port_configuration_address_remove() -> clap::Command { clap::Command::new("") .arg( clap::Arg::new("address") @@ -4800,8 +4741,8 @@ impl Cli { clap::Arg::new("interface") .long("interface") .value_parser(clap::value_parser!(types::Name)) - .required(true) - .help("Interface name"), + .required_unless_present("json-body") + .help("The name of the interface"), ) .arg( clap::Arg::new("vlan-id") @@ -4827,7 +4768,7 @@ impl Cli { .about("Remove address from an interface configuration") } - pub fn cli_networking_switch_port_configuration_interface_bgp_peer_list() -> clap::Command { + pub fn cli_networking_switch_port_configuration_bgp_peer_list() -> clap::Command { clap::Command::new("") .arg( clap::Arg::new("configuration") @@ -4836,17 +4777,10 @@ impl Cli { .required(true) .help("A name or id to use when selecting a switch port configuration."), ) - .arg( - clap::Arg::new("interface") - .long("interface") - .value_parser(clap::value_parser!(types::Name)) - .required(true) - .help("Interface name"), - ) .about("List bgp peers assigned to a provided interface configuration") } - pub fn cli_networking_switch_port_configuration_interface_bgp_peer_add() -> clap::Command { + pub fn cli_networking_switch_port_configuration_bgp_peer_add() -> clap::Command { clap::Command::new("") .arg( clap::Arg::new("addr") @@ -4916,13 +4850,6 @@ impl Cli { (seconds).", ), ) - .arg( - clap::Arg::new("interface") - .long("interface") - .value_parser(clap::value_parser!(types::Name)) - .required(true) - .help("Interface name"), - ) .arg( clap::Arg::new("interface-name") .long("interface-name") @@ -5004,7 +4931,7 @@ impl Cli { .about("Add bgp peer to an interface configuration") } - pub fn cli_networking_switch_port_configuration_interface_bgp_peer_remove() -> clap::Command { + pub fn cli_networking_switch_port_configuration_bgp_peer_remove() -> clap::Command { clap::Command::new("") .arg( clap::Arg::new("addr") @@ -5074,13 +5001,6 @@ impl Cli { (seconds).", ), ) - .arg( - clap::Arg::new("interface") - .long("interface") - .value_parser(clap::value_parser!(types::Name)) - .required(true) - .help("Interface name"), - ) .arg( clap::Arg::new("interface-name") .long("interface-name") @@ -5162,26 +5082,7 @@ impl Cli { .about("Remove bgp peer from an interface configuration") } - pub fn cli_networking_switch_port_configuration_interface_route_list() -> clap::Command { - clap::Command::new("") - .arg( - clap::Arg::new("configuration") - .long("configuration") - .value_parser(clap::value_parser!(types::NameOrId)) - .required(true) - .help("A name or id to use when selecting a switch port configuration."), - ) - .arg( - clap::Arg::new("interface") - .long("interface") - .value_parser(clap::value_parser!(types::Name)) - .required(true) - .help("Interface name"), - ) - .about("List routes assigned to a provided interface configuration") - } - - pub fn cli_networking_switch_port_configuration_interface_route_add() -> clap::Command { + pub fn cli_networking_switch_port_configuration_geometry_view() -> clap::Command { clap::Command::new("") .arg( clap::Arg::new("configuration") @@ -5190,62 +5091,10 @@ impl Cli { .required(true) .help("A name or id to use when selecting a switch port configuration."), ) - .arg( - clap::Arg::new("dst") - .long("dst") - .value_parser(clap::value_parser!(types::IpNet)) - .required_unless_present("json-body") - .help("The route destination."), - ) - .arg( - clap::Arg::new("gw") - .long("gw") - .value_parser(clap::value_parser!(std::net::IpAddr)) - .required_unless_present("json-body") - .help("The route gateway."), - ) - .arg( - clap::Arg::new("interface") - .long("interface") - .value_parser(clap::value_parser!(types::Name)) - .required(true) - .help("Interface name"), - ) - .arg( - clap::Arg::new("local-pref") - .long("local-pref") - .value_parser(clap::value_parser!(u32)) - .required(false) - .help( - "Local preference for route. Higher preference indictes precedence within \ - and across protocols.", - ), - ) - .arg( - clap::Arg::new("vid") - .long("vid") - .value_parser(clap::value_parser!(u16)) - .required(false) - .help("VLAN id the gateway is reachable over."), - ) - .arg( - clap::Arg::new("json-body") - .long("json-body") - .value_name("JSON-FILE") - .required(false) - .value_parser(clap::value_parser!(std::path::PathBuf)) - .help("Path to a file that contains the full json body."), - ) - .arg( - clap::Arg::new("json-body-template") - .long("json-body-template") - .action(clap::ArgAction::SetTrue) - .help("XXX"), - ) - .about("Add route to an interface configuration") + .about("Get switch port geometry for a provided switch port configuration") } - pub fn cli_networking_switch_port_configuration_interface_route_remove() -> clap::Command { + pub fn cli_networking_switch_port_configuration_geometry_set() -> clap::Command { clap::Command::new("") .arg( clap::Arg::new("configuration") @@ -5255,42 +5104,18 @@ impl Cli { .help("A name or id to use when selecting a switch port configuration."), ) .arg( - clap::Arg::new("dst") - .long("dst") - .value_parser(clap::value_parser!(types::IpNet)) - .required_unless_present("json-body") - .help("The route destination."), - ) - .arg( - clap::Arg::new("gw") - .long("gw") - .value_parser(clap::value_parser!(std::net::IpAddr)) + clap::Arg::new("geometry") + .long("geometry") + .value_parser(clap::builder::TypedValueParser::map( + clap::builder::PossibleValuesParser::new([ + types::SwitchPortGeometry::Qsfp28x1.to_string(), + types::SwitchPortGeometry::Qsfp28x2.to_string(), + types::SwitchPortGeometry::Sfp28x4.to_string(), + ]), + |s| types::SwitchPortGeometry::try_from(s).unwrap(), + )) .required_unless_present("json-body") - .help("The route gateway."), - ) - .arg( - clap::Arg::new("interface") - .long("interface") - .value_parser(clap::value_parser!(types::Name)) - .required(true) - .help("Interface name"), - ) - .arg( - clap::Arg::new("local-pref") - .long("local-pref") - .value_parser(clap::value_parser!(u32)) - .required(false) - .help( - "Local preference for route. Higher preference indictes precedence within \ - and across protocols.", - ), - ) - .arg( - clap::Arg::new("vid") - .long("vid") - .value_parser(clap::value_parser!(u16)) - .required(false) - .help("VLAN id the gateway is reachable over."), + .help("Link geometry for the switch port."), ) .arg( clap::Arg::new("json-body") @@ -5306,7 +5131,7 @@ impl Cli { .action(clap::ArgAction::SetTrue) .help("XXX"), ) - .about("Remove address from an interface configuration") + .about("Set switch port geometry for a provided switch port configuration") } pub fn cli_networking_switch_port_configuration_link_list() -> clap::Command { @@ -5450,49 +5275,175 @@ impl Cli { .about("Delete a link for a provided switch port configuration") } - pub fn cli_system_policy_view() -> clap::Command { - clap::Command::new("").about("Fetch top-level IAM policy") - } - - pub fn cli_system_policy_update() -> clap::Command { + pub fn cli_networking_switch_port_configuration_route_list() -> clap::Command { clap::Command::new("") .arg( - clap::Arg::new("json-body") - .long("json-body") - .value_name("JSON-FILE") + clap::Arg::new("configuration") + .long("configuration") + .value_parser(clap::value_parser!(types::NameOrId)) .required(true) - .value_parser(clap::value_parser!(std::path::PathBuf)) - .help("Path to a file that contains the full json body."), - ) - .arg( - clap::Arg::new("json-body-template") - .long("json-body-template") - .action(clap::ArgAction::SetTrue) - .help("XXX"), - ) - .about("Update top-level IAM policy") - } - - pub fn cli_role_list() -> clap::Command { - clap::Command::new("") - .arg( - clap::Arg::new("limit") - .long("limit") - .value_parser(clap::value_parser!(std::num::NonZeroU32)) - .required(false) - .help("Maximum number of items returned by a single call"), + .help("A name or id to use when selecting a switch port configuration."), ) - .about("List built-in roles") + .about("List routes assigned to a provided interface configuration") } - pub fn cli_role_view() -> clap::Command { + pub fn cli_networking_switch_port_configuration_route_add() -> clap::Command { clap::Command::new("") .arg( - clap::Arg::new("role-name") - .long("role-name") - .value_parser(clap::value_parser!(String)) + clap::Arg::new("configuration") + .long("configuration") + .value_parser(clap::value_parser!(types::NameOrId)) .required(true) - .help("The built-in role's unique name."), + .help("A name or id to use when selecting a switch port configuration."), + ) + .arg( + clap::Arg::new("dst") + .long("dst") + .value_parser(clap::value_parser!(types::IpNet)) + .required_unless_present("json-body") + .help("The route destination."), + ) + .arg( + clap::Arg::new("gw") + .long("gw") + .value_parser(clap::value_parser!(std::net::IpAddr)) + .required_unless_present("json-body") + .help("The route gateway."), + ) + .arg( + clap::Arg::new("local-pref") + .long("local-pref") + .value_parser(clap::value_parser!(u32)) + .required(false) + .help( + "Local preference for route. Higher preference indictes precedence within \ + and across protocols.", + ), + ) + .arg( + clap::Arg::new("vid") + .long("vid") + .value_parser(clap::value_parser!(u16)) + .required(false) + .help("VLAN id the gateway is reachable over."), + ) + .arg( + clap::Arg::new("json-body") + .long("json-body") + .value_name("JSON-FILE") + .required(false) + .value_parser(clap::value_parser!(std::path::PathBuf)) + .help("Path to a file that contains the full json body."), + ) + .arg( + clap::Arg::new("json-body-template") + .long("json-body-template") + .action(clap::ArgAction::SetTrue) + .help("XXX"), + ) + .about("Add route to an interface configuration") + } + + pub fn cli_networking_switch_port_configuration_route_remove() -> clap::Command { + clap::Command::new("") + .arg( + clap::Arg::new("configuration") + .long("configuration") + .value_parser(clap::value_parser!(types::NameOrId)) + .required(true) + .help("A name or id to use when selecting a switch port configuration."), + ) + .arg( + clap::Arg::new("dst") + .long("dst") + .value_parser(clap::value_parser!(types::IpNet)) + .required_unless_present("json-body") + .help("The route destination."), + ) + .arg( + clap::Arg::new("gw") + .long("gw") + .value_parser(clap::value_parser!(std::net::IpAddr)) + .required_unless_present("json-body") + .help("The route gateway."), + ) + .arg( + clap::Arg::new("local-pref") + .long("local-pref") + .value_parser(clap::value_parser!(u32)) + .required(false) + .help( + "Local preference for route. Higher preference indictes precedence within \ + and across protocols.", + ), + ) + .arg( + clap::Arg::new("vid") + .long("vid") + .value_parser(clap::value_parser!(u16)) + .required(false) + .help("VLAN id the gateway is reachable over."), + ) + .arg( + clap::Arg::new("json-body") + .long("json-body") + .value_name("JSON-FILE") + .required(false) + .value_parser(clap::value_parser!(std::path::PathBuf)) + .help("Path to a file that contains the full json body."), + ) + .arg( + clap::Arg::new("json-body-template") + .long("json-body-template") + .action(clap::ArgAction::SetTrue) + .help("XXX"), + ) + .about("Remove address from an interface configuration") + } + + pub fn cli_system_policy_view() -> clap::Command { + clap::Command::new("").about("Fetch top-level IAM policy") + } + + pub fn cli_system_policy_update() -> clap::Command { + clap::Command::new("") + .arg( + clap::Arg::new("json-body") + .long("json-body") + .value_name("JSON-FILE") + .required(true) + .value_parser(clap::value_parser!(std::path::PathBuf)) + .help("Path to a file that contains the full json body."), + ) + .arg( + clap::Arg::new("json-body-template") + .long("json-body-template") + .action(clap::ArgAction::SetTrue) + .help("XXX"), + ) + .about("Update top-level IAM policy") + } + + pub fn cli_role_list() -> clap::Command { + clap::Command::new("") + .arg( + clap::Arg::new("limit") + .long("limit") + .value_parser(clap::value_parser!(std::num::NonZeroU32)) + .required(false) + .help("Maximum number of items returned by a single call"), + ) + .about("List built-in roles") + } + + pub fn cli_role_view() -> clap::Command { + clap::Command::new("") + .arg( + clap::Arg::new("role-name") + .long("role-name") + .value_parser(clap::value_parser!(String)) + .required(true) + .help("The built-in role's unique name."), ) .about("Fetch built-in role") } @@ -7223,48 +7174,36 @@ impl Cli { self.execute_networking_switch_port_configuration_view(matches) .await } - CliCommand::NetworkingSwitchPortConfigurationGeometryView => { - self.execute_networking_switch_port_configuration_geometry_view(matches) - .await - } - CliCommand::NetworkingSwitchPortConfigurationGeometrySet => { - self.execute_networking_switch_port_configuration_geometry_set(matches) + CliCommand::NetworkingSwitchPortConfigurationAddressList => { + self.execute_networking_switch_port_configuration_address_list(matches) .await } - CliCommand::NetworkingSwitchPortConfigurationInterfaceAddressList => { - self.execute_networking_switch_port_configuration_interface_address_list(matches) + CliCommand::NetworkingSwitchPortConfigurationAddressAdd => { + self.execute_networking_switch_port_configuration_address_add(matches) .await } - CliCommand::NetworkingSwitchPortConfigurationInterfaceAddressAdd => { - self.execute_networking_switch_port_configuration_interface_address_add(matches) + CliCommand::NetworkingSwitchPortConfigurationAddressRemove => { + self.execute_networking_switch_port_configuration_address_remove(matches) .await } - CliCommand::NetworkingSwitchPortConfigurationInterfaceAddressRemove => { - self.execute_networking_switch_port_configuration_interface_address_remove(matches) + CliCommand::NetworkingSwitchPortConfigurationBgpPeerList => { + self.execute_networking_switch_port_configuration_bgp_peer_list(matches) .await } - CliCommand::NetworkingSwitchPortConfigurationInterfaceBgpPeerList => { - self.execute_networking_switch_port_configuration_interface_bgp_peer_list(matches) + CliCommand::NetworkingSwitchPortConfigurationBgpPeerAdd => { + self.execute_networking_switch_port_configuration_bgp_peer_add(matches) .await } - CliCommand::NetworkingSwitchPortConfigurationInterfaceBgpPeerAdd => { - self.execute_networking_switch_port_configuration_interface_bgp_peer_add(matches) + CliCommand::NetworkingSwitchPortConfigurationBgpPeerRemove => { + self.execute_networking_switch_port_configuration_bgp_peer_remove(matches) .await } - CliCommand::NetworkingSwitchPortConfigurationInterfaceBgpPeerRemove => { - self.execute_networking_switch_port_configuration_interface_bgp_peer_remove(matches) - .await - } - CliCommand::NetworkingSwitchPortConfigurationInterfaceRouteList => { - self.execute_networking_switch_port_configuration_interface_route_list(matches) - .await - } - CliCommand::NetworkingSwitchPortConfigurationInterfaceRouteAdd => { - self.execute_networking_switch_port_configuration_interface_route_add(matches) + CliCommand::NetworkingSwitchPortConfigurationGeometryView => { + self.execute_networking_switch_port_configuration_geometry_view(matches) .await } - CliCommand::NetworkingSwitchPortConfigurationInterfaceRouteRemove => { - self.execute_networking_switch_port_configuration_interface_route_remove(matches) + CliCommand::NetworkingSwitchPortConfigurationGeometrySet => { + self.execute_networking_switch_port_configuration_geometry_set(matches) .await } CliCommand::NetworkingSwitchPortConfigurationLinkList => { @@ -7283,6 +7222,18 @@ impl Cli { self.execute_networking_switch_port_configuration_link_delete(matches) .await } + CliCommand::NetworkingSwitchPortConfigurationRouteList => { + self.execute_networking_switch_port_configuration_route_list(matches) + .await + } + CliCommand::NetworkingSwitchPortConfigurationRouteAdd => { + self.execute_networking_switch_port_configuration_route_add(matches) + .await + } + CliCommand::NetworkingSwitchPortConfigurationRouteRemove => { + self.execute_networking_switch_port_configuration_route_remove(matches) + .await + } CliCommand::SystemPolicyView => self.execute_system_policy_view(matches).await, CliCommand::SystemPolicyUpdate => self.execute_system_policy_update(matches).await, CliCommand::RoleList => self.execute_role_list(matches).await, @@ -12337,89 +12288,19 @@ impl Cli { } } - pub async fn execute_networking_switch_port_configuration_geometry_view( - &self, - matches: &clap::ArgMatches, - ) -> anyhow::Result<()> { - let mut request = self - .client - .networking_switch_port_configuration_geometry_view(); - if let Some(value) = matches.get_one::("configuration") { - request = request.configuration(value.clone()); - } - - self.config - .execute_networking_switch_port_configuration_geometry_view(matches, &mut request)?; - let result = request.send().await; - match result { - Ok(r) => { - self.config.success_item(&r); - Ok(()) - } - Err(r) => { - self.config.error(&r); - Err(anyhow::Error::new(r)) - } - } - } - - pub async fn execute_networking_switch_port_configuration_geometry_set( - &self, - matches: &clap::ArgMatches, - ) -> anyhow::Result<()> { - let mut request = self - .client - .networking_switch_port_configuration_geometry_set(); - if let Some(value) = matches.get_one::("configuration") { - request = request.configuration(value.clone()); - } - - if let Some(value) = matches.get_one::("geometry") { - request = request.body_map(|body| body.geometry(value.clone())) - } - - if let Some(value) = matches.get_one::("json-body") { - let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = - serde_json::from_str::(&body_txt).unwrap(); - request = request.body(body_value); - } - - self.config - .execute_networking_switch_port_configuration_geometry_set(matches, &mut request)?; - let result = request.send().await; - match result { - Ok(r) => { - self.config.success_item(&r); - Ok(()) - } - Err(r) => { - self.config.error(&r); - Err(anyhow::Error::new(r)) - } - } - } - - pub async fn execute_networking_switch_port_configuration_interface_address_list( + pub async fn execute_networking_switch_port_configuration_address_list( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { let mut request = self .client - .networking_switch_port_configuration_interface_address_list(); + .networking_switch_port_configuration_address_list(); if let Some(value) = matches.get_one::("configuration") { request = request.configuration(value.clone()); } - if let Some(value) = matches.get_one::("interface") { - request = request.interface(value.clone()); - } - self.config - .execute_networking_switch_port_configuration_interface_address_list( - matches, - &mut request, - )?; + .execute_networking_switch_port_configuration_address_list(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -12433,13 +12314,13 @@ impl Cli { } } - pub async fn execute_networking_switch_port_configuration_interface_address_add( + pub async fn execute_networking_switch_port_configuration_address_add( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { let mut request = self .client - .networking_switch_port_configuration_interface_address_add(); + .networking_switch_port_configuration_address_add(); if let Some(value) = matches.get_one::("address") { request = request.body_map(|body| body.address(value.clone())) } @@ -12453,7 +12334,7 @@ impl Cli { } if let Some(value) = matches.get_one::("interface") { - request = request.interface(value.clone()); + request = request.body_map(|body| body.interface(value.clone())) } if let Some(value) = matches.get_one::("vlan-id") { @@ -12462,15 +12343,12 @@ impl Cli { if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } self.config - .execute_networking_switch_port_configuration_interface_address_add( - matches, - &mut request, - )?; + .execute_networking_switch_port_configuration_address_add(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -12484,13 +12362,13 @@ impl Cli { } } - pub async fn execute_networking_switch_port_configuration_interface_address_remove( + pub async fn execute_networking_switch_port_configuration_address_remove( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { let mut request = self .client - .networking_switch_port_configuration_interface_address_remove(); + .networking_switch_port_configuration_address_remove(); if let Some(value) = matches.get_one::("address") { request = request.body_map(|body| body.address(value.clone())) } @@ -12504,7 +12382,7 @@ impl Cli { } if let Some(value) = matches.get_one::("interface") { - request = request.interface(value.clone()); + request = request.body_map(|body| body.interface(value.clone())) } if let Some(value) = matches.get_one::("vlan-id") { @@ -12513,15 +12391,12 @@ impl Cli { if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } self.config - .execute_networking_switch_port_configuration_interface_address_remove( - matches, - &mut request, - )?; + .execute_networking_switch_port_configuration_address_remove(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -12535,26 +12410,19 @@ impl Cli { } } - pub async fn execute_networking_switch_port_configuration_interface_bgp_peer_list( + pub async fn execute_networking_switch_port_configuration_bgp_peer_list( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { let mut request = self .client - .networking_switch_port_configuration_interface_bgp_peer_list(); + .networking_switch_port_configuration_bgp_peer_list(); if let Some(value) = matches.get_one::("configuration") { request = request.configuration(value.clone()); } - if let Some(value) = matches.get_one::("interface") { - request = request.interface(value.clone()); - } - self.config - .execute_networking_switch_port_configuration_interface_bgp_peer_list( - matches, - &mut request, - )?; + .execute_networking_switch_port_configuration_bgp_peer_list(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -12568,13 +12436,13 @@ impl Cli { } } - pub async fn execute_networking_switch_port_configuration_interface_bgp_peer_add( + pub async fn execute_networking_switch_port_configuration_bgp_peer_add( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { let mut request = self .client - .networking_switch_port_configuration_interface_bgp_peer_add(); + .networking_switch_port_configuration_bgp_peer_add(); if let Some(value) = matches.get_one::("addr") { request = request.body_map(|body| body.addr(value.clone())) } @@ -12607,10 +12475,6 @@ impl Cli { request = request.body_map(|body| body.idle_hold_time(value.clone())) } - if let Some(value) = matches.get_one::("interface") { - request = request.interface(value.clone()); - } - if let Some(value) = matches.get_one::("interface-name") { request = request.body_map(|body| body.interface_name(value.clone())) } @@ -12650,10 +12514,7 @@ impl Cli { } self.config - .execute_networking_switch_port_configuration_interface_bgp_peer_add( - matches, - &mut request, - )?; + .execute_networking_switch_port_configuration_bgp_peer_add(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -12667,13 +12528,13 @@ impl Cli { } } - pub async fn execute_networking_switch_port_configuration_interface_bgp_peer_remove( + pub async fn execute_networking_switch_port_configuration_bgp_peer_remove( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { let mut request = self .client - .networking_switch_port_configuration_interface_bgp_peer_remove(); + .networking_switch_port_configuration_bgp_peer_remove(); if let Some(value) = matches.get_one::("addr") { request = request.body_map(|body| body.addr(value.clone())) } @@ -12706,10 +12567,6 @@ impl Cli { request = request.body_map(|body| body.idle_hold_time(value.clone())) } - if let Some(value) = matches.get_one::("interface") { - request = request.interface(value.clone()); - } - if let Some(value) = matches.get_one::("interface-name") { request = request.body_map(|body| body.interface_name(value.clone())) } @@ -12749,10 +12606,7 @@ impl Cli { } self.config - .execute_networking_switch_port_configuration_interface_bgp_peer_remove( - matches, - &mut request, - )?; + .execute_networking_switch_port_configuration_bgp_peer_remove(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -12766,26 +12620,19 @@ impl Cli { } } - pub async fn execute_networking_switch_port_configuration_interface_route_list( + pub async fn execute_networking_switch_port_configuration_geometry_view( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { let mut request = self .client - .networking_switch_port_configuration_interface_route_list(); + .networking_switch_port_configuration_geometry_view(); if let Some(value) = matches.get_one::("configuration") { request = request.configuration(value.clone()); } - if let Some(value) = matches.get_one::("interface") { - request = request.interface(value.clone()); - } - self.config - .execute_networking_switch_port_configuration_interface_route_list( - matches, - &mut request, - )?; + .execute_networking_switch_port_configuration_geometry_view(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -12799,48 +12646,30 @@ impl Cli { } } - pub async fn execute_networking_switch_port_configuration_interface_route_add( + pub async fn execute_networking_switch_port_configuration_geometry_set( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { let mut request = self .client - .networking_switch_port_configuration_interface_route_add(); + .networking_switch_port_configuration_geometry_set(); if let Some(value) = matches.get_one::("configuration") { request = request.configuration(value.clone()); } - if let Some(value) = matches.get_one::("dst") { - request = request.body_map(|body| body.dst(value.clone())) - } - - if let Some(value) = matches.get_one::("gw") { - request = request.body_map(|body| body.gw(value.clone())) - } - - if let Some(value) = matches.get_one::("interface") { - request = request.interface(value.clone()); - } - - if let Some(value) = matches.get_one::("local-pref") { - request = request.body_map(|body| body.local_pref(value.clone())) - } - - if let Some(value) = matches.get_one::("vid") { - request = request.body_map(|body| body.vid(value.clone())) + if let Some(value) = matches.get_one::("geometry") { + request = request.body_map(|body| body.geometry(value.clone())) } if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); + let body_value = + serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } self.config - .execute_networking_switch_port_configuration_interface_route_add( - matches, - &mut request, - )?; + .execute_networking_switch_port_configuration_geometry_set(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -12854,61 +12683,6 @@ impl Cli { } } - pub async fn execute_networking_switch_port_configuration_interface_route_remove( - &self, - matches: &clap::ArgMatches, - ) -> anyhow::Result<()> { - let mut request = self - .client - .networking_switch_port_configuration_interface_route_remove(); - if let Some(value) = matches.get_one::("configuration") { - request = request.configuration(value.clone()); - } - - if let Some(value) = matches.get_one::("dst") { - request = request.body_map(|body| body.dst(value.clone())) - } - - if let Some(value) = matches.get_one::("gw") { - request = request.body_map(|body| body.gw(value.clone())) - } - - if let Some(value) = matches.get_one::("interface") { - request = request.interface(value.clone()); - } - - if let Some(value) = matches.get_one::("local-pref") { - request = request.body_map(|body| body.local_pref(value.clone())) - } - - if let Some(value) = matches.get_one::("vid") { - request = request.body_map(|body| body.vid(value.clone())) - } - - if let Some(value) = matches.get_one::("json-body") { - let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); - request = request.body(body_value); - } - - self.config - .execute_networking_switch_port_configuration_interface_route_remove( - matches, - &mut request, - )?; - let result = request.send().await; - match result { - Ok(r) => { - self.config.success_no_item(&r); - Ok(()) - } - Err(r) => { - self.config.error(&r); - Err(anyhow::Error::new(r)) - } - } - } - pub async fn execute_networking_switch_port_configuration_link_list( &self, matches: &clap::ArgMatches, @@ -13048,6 +12822,126 @@ impl Cli { } } + pub async fn execute_networking_switch_port_configuration_route_list( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self + .client + .networking_switch_port_configuration_route_list(); + if let Some(value) = matches.get_one::("configuration") { + request = request.configuration(value.clone()); + } + + self.config + .execute_networking_switch_port_configuration_route_list(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) + } + } + } + + pub async fn execute_networking_switch_port_configuration_route_add( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.networking_switch_port_configuration_route_add(); + if let Some(value) = matches.get_one::("configuration") { + request = request.configuration(value.clone()); + } + + if let Some(value) = matches.get_one::("dst") { + request = request.body_map(|body| body.dst(value.clone())) + } + + if let Some(value) = matches.get_one::("gw") { + request = request.body_map(|body| body.gw(value.clone())) + } + + if let Some(value) = matches.get_one::("local-pref") { + request = request.body_map(|body| body.local_pref(value.clone())) + } + + if let Some(value) = matches.get_one::("vid") { + request = request.body_map(|body| body.vid(value.clone())) + } + + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); + } + + self.config + .execute_networking_switch_port_configuration_route_add(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) + } + } + } + + pub async fn execute_networking_switch_port_configuration_route_remove( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self + .client + .networking_switch_port_configuration_route_remove(); + if let Some(value) = matches.get_one::("configuration") { + request = request.configuration(value.clone()); + } + + if let Some(value) = matches.get_one::("dst") { + request = request.body_map(|body| body.dst(value.clone())) + } + + if let Some(value) = matches.get_one::("gw") { + request = request.body_map(|body| body.gw(value.clone())) + } + + if let Some(value) = matches.get_one::("local-pref") { + request = request.body_map(|body| body.local_pref(value.clone())) + } + + if let Some(value) = matches.get_one::("vid") { + request = request.body_map(|body| body.vid(value.clone())) + } + + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); + } + + self.config + .execute_networking_switch_port_configuration_route_remove(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_no_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) + } + } + } + pub async fn execute_system_policy_view( &self, matches: &clap::ArgMatches, @@ -15916,122 +15810,122 @@ pub trait CliConfig { Ok(()) } - fn execute_networking_switch_port_configuration_geometry_view( + fn execute_networking_switch_port_configuration_address_list( &self, matches: &clap::ArgMatches, - request: &mut builder::NetworkingSwitchPortConfigurationGeometryView, + request: &mut builder::NetworkingSwitchPortConfigurationAddressList, ) -> anyhow::Result<()> { Ok(()) } - fn execute_networking_switch_port_configuration_geometry_set( + fn execute_networking_switch_port_configuration_address_add( &self, matches: &clap::ArgMatches, - request: &mut builder::NetworkingSwitchPortConfigurationGeometrySet, + request: &mut builder::NetworkingSwitchPortConfigurationAddressAdd, ) -> anyhow::Result<()> { Ok(()) } - fn execute_networking_switch_port_configuration_interface_address_list( + fn execute_networking_switch_port_configuration_address_remove( &self, matches: &clap::ArgMatches, - request: &mut builder::NetworkingSwitchPortConfigurationInterfaceAddressList, + request: &mut builder::NetworkingSwitchPortConfigurationAddressRemove, ) -> anyhow::Result<()> { Ok(()) } - fn execute_networking_switch_port_configuration_interface_address_add( + fn execute_networking_switch_port_configuration_bgp_peer_list( &self, matches: &clap::ArgMatches, - request: &mut builder::NetworkingSwitchPortConfigurationInterfaceAddressAdd, + request: &mut builder::NetworkingSwitchPortConfigurationBgpPeerList, ) -> anyhow::Result<()> { Ok(()) } - fn execute_networking_switch_port_configuration_interface_address_remove( + fn execute_networking_switch_port_configuration_bgp_peer_add( &self, matches: &clap::ArgMatches, - request: &mut builder::NetworkingSwitchPortConfigurationInterfaceAddressRemove, + request: &mut builder::NetworkingSwitchPortConfigurationBgpPeerAdd, ) -> anyhow::Result<()> { Ok(()) } - fn execute_networking_switch_port_configuration_interface_bgp_peer_list( + fn execute_networking_switch_port_configuration_bgp_peer_remove( &self, matches: &clap::ArgMatches, - request: &mut builder::NetworkingSwitchPortConfigurationInterfaceBgpPeerList, + request: &mut builder::NetworkingSwitchPortConfigurationBgpPeerRemove, ) -> anyhow::Result<()> { Ok(()) } - fn execute_networking_switch_port_configuration_interface_bgp_peer_add( + fn execute_networking_switch_port_configuration_geometry_view( &self, matches: &clap::ArgMatches, - request: &mut builder::NetworkingSwitchPortConfigurationInterfaceBgpPeerAdd, + request: &mut builder::NetworkingSwitchPortConfigurationGeometryView, ) -> anyhow::Result<()> { Ok(()) } - fn execute_networking_switch_port_configuration_interface_bgp_peer_remove( + fn execute_networking_switch_port_configuration_geometry_set( &self, matches: &clap::ArgMatches, - request: &mut builder::NetworkingSwitchPortConfigurationInterfaceBgpPeerRemove, + request: &mut builder::NetworkingSwitchPortConfigurationGeometrySet, ) -> anyhow::Result<()> { Ok(()) } - fn execute_networking_switch_port_configuration_interface_route_list( + fn execute_networking_switch_port_configuration_link_list( &self, matches: &clap::ArgMatches, - request: &mut builder::NetworkingSwitchPortConfigurationInterfaceRouteList, + request: &mut builder::NetworkingSwitchPortConfigurationLinkList, ) -> anyhow::Result<()> { Ok(()) } - fn execute_networking_switch_port_configuration_interface_route_add( + fn execute_networking_switch_port_configuration_link_create( &self, matches: &clap::ArgMatches, - request: &mut builder::NetworkingSwitchPortConfigurationInterfaceRouteAdd, + request: &mut builder::NetworkingSwitchPortConfigurationLinkCreate, ) -> anyhow::Result<()> { Ok(()) } - fn execute_networking_switch_port_configuration_interface_route_remove( + fn execute_networking_switch_port_configuration_link_view( &self, matches: &clap::ArgMatches, - request: &mut builder::NetworkingSwitchPortConfigurationInterfaceRouteRemove, + request: &mut builder::NetworkingSwitchPortConfigurationLinkView, ) -> anyhow::Result<()> { Ok(()) } - fn execute_networking_switch_port_configuration_link_list( + fn execute_networking_switch_port_configuration_link_delete( &self, matches: &clap::ArgMatches, - request: &mut builder::NetworkingSwitchPortConfigurationLinkList, + request: &mut builder::NetworkingSwitchPortConfigurationLinkDelete, ) -> anyhow::Result<()> { Ok(()) } - fn execute_networking_switch_port_configuration_link_create( + fn execute_networking_switch_port_configuration_route_list( &self, matches: &clap::ArgMatches, - request: &mut builder::NetworkingSwitchPortConfigurationLinkCreate, + request: &mut builder::NetworkingSwitchPortConfigurationRouteList, ) -> anyhow::Result<()> { Ok(()) } - fn execute_networking_switch_port_configuration_link_view( + fn execute_networking_switch_port_configuration_route_add( &self, matches: &clap::ArgMatches, - request: &mut builder::NetworkingSwitchPortConfigurationLinkView, + request: &mut builder::NetworkingSwitchPortConfigurationRouteAdd, ) -> anyhow::Result<()> { Ok(()) } - fn execute_networking_switch_port_configuration_link_delete( + fn execute_networking_switch_port_configuration_route_remove( &self, matches: &clap::ArgMatches, - request: &mut builder::NetworkingSwitchPortConfigurationLinkDelete, + request: &mut builder::NetworkingSwitchPortConfigurationRouteRemove, ) -> anyhow::Result<()> { Ok(()) } @@ -16567,21 +16461,21 @@ pub enum CliCommand { NetworkingSwitchPortConfigurationCreate, NetworkingSwitchPortConfigurationDelete, NetworkingSwitchPortConfigurationView, + NetworkingSwitchPortConfigurationAddressList, + NetworkingSwitchPortConfigurationAddressAdd, + NetworkingSwitchPortConfigurationAddressRemove, + NetworkingSwitchPortConfigurationBgpPeerList, + NetworkingSwitchPortConfigurationBgpPeerAdd, + NetworkingSwitchPortConfigurationBgpPeerRemove, NetworkingSwitchPortConfigurationGeometryView, NetworkingSwitchPortConfigurationGeometrySet, - NetworkingSwitchPortConfigurationInterfaceAddressList, - NetworkingSwitchPortConfigurationInterfaceAddressAdd, - NetworkingSwitchPortConfigurationInterfaceAddressRemove, - NetworkingSwitchPortConfigurationInterfaceBgpPeerList, - NetworkingSwitchPortConfigurationInterfaceBgpPeerAdd, - NetworkingSwitchPortConfigurationInterfaceBgpPeerRemove, - NetworkingSwitchPortConfigurationInterfaceRouteList, - NetworkingSwitchPortConfigurationInterfaceRouteAdd, - NetworkingSwitchPortConfigurationInterfaceRouteRemove, NetworkingSwitchPortConfigurationLinkList, NetworkingSwitchPortConfigurationLinkCreate, NetworkingSwitchPortConfigurationLinkView, NetworkingSwitchPortConfigurationLinkDelete, + NetworkingSwitchPortConfigurationRouteList, + NetworkingSwitchPortConfigurationRouteAdd, + NetworkingSwitchPortConfigurationRouteRemove, SystemPolicyView, SystemPolicyUpdate, RoleList, @@ -16786,21 +16680,21 @@ impl CliCommand { CliCommand::NetworkingSwitchPortConfigurationCreate, CliCommand::NetworkingSwitchPortConfigurationDelete, CliCommand::NetworkingSwitchPortConfigurationView, + CliCommand::NetworkingSwitchPortConfigurationAddressList, + CliCommand::NetworkingSwitchPortConfigurationAddressAdd, + CliCommand::NetworkingSwitchPortConfigurationAddressRemove, + CliCommand::NetworkingSwitchPortConfigurationBgpPeerList, + CliCommand::NetworkingSwitchPortConfigurationBgpPeerAdd, + CliCommand::NetworkingSwitchPortConfigurationBgpPeerRemove, CliCommand::NetworkingSwitchPortConfigurationGeometryView, CliCommand::NetworkingSwitchPortConfigurationGeometrySet, - CliCommand::NetworkingSwitchPortConfigurationInterfaceAddressList, - CliCommand::NetworkingSwitchPortConfigurationInterfaceAddressAdd, - CliCommand::NetworkingSwitchPortConfigurationInterfaceAddressRemove, - CliCommand::NetworkingSwitchPortConfigurationInterfaceBgpPeerList, - CliCommand::NetworkingSwitchPortConfigurationInterfaceBgpPeerAdd, - CliCommand::NetworkingSwitchPortConfigurationInterfaceBgpPeerRemove, - CliCommand::NetworkingSwitchPortConfigurationInterfaceRouteList, - CliCommand::NetworkingSwitchPortConfigurationInterfaceRouteAdd, - CliCommand::NetworkingSwitchPortConfigurationInterfaceRouteRemove, CliCommand::NetworkingSwitchPortConfigurationLinkList, CliCommand::NetworkingSwitchPortConfigurationLinkCreate, CliCommand::NetworkingSwitchPortConfigurationLinkView, CliCommand::NetworkingSwitchPortConfigurationLinkDelete, + CliCommand::NetworkingSwitchPortConfigurationRouteList, + CliCommand::NetworkingSwitchPortConfigurationRouteAdd, + CliCommand::NetworkingSwitchPortConfigurationRouteRemove, CliCommand::SystemPolicyView, CliCommand::SystemPolicyUpdate, CliCommand::RoleList, diff --git a/oxide.json b/oxide.json index 55cfc4bc..84295088 100644 --- a/oxide.json +++ b/oxide.json @@ -7268,13 +7268,13 @@ } } }, - "/v1/system/networking/switch-port-configuration/{configuration}/geometry": { + "/v1/system/networking/switch-port-configuration/{configuration}/address": { "get": { "tags": [ "system/networking" ], - "summary": "Get switch port geometry for a provided switch port configuration", - "operationId": "networking_switch_port_configuration_geometry_view", + "summary": "List addresses assigned to a provided interface configuration", + "operationId": "networking_switch_port_configuration_address_list", "parameters": [ { "in": "path", @@ -7292,7 +7292,11 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SwitchPortConfig" + "title": "Array_of_SwitchPortAddressConfig", + "type": "array", + "items": { + "$ref": "#/components/schemas/SwitchPortAddressConfig" + } } } } @@ -7304,13 +7308,15 @@ "$ref": "#/components/responses/Error" } } - }, + } + }, + "/v1/system/networking/switch-port-configuration/{configuration}/address/add": { "post": { "tags": [ "system/networking" ], - "summary": "Set switch port geometry for a provided switch port configuration", - "operationId": "networking_switch_port_configuration_geometry_set", + "summary": "Add address to an interface configuration", + "operationId": "networking_switch_port_configuration_address_add", "parameters": [ { "in": "path", @@ -7326,7 +7332,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SwitchPortConfigCreate" + "$ref": "#/components/schemas/AddressAddRemove" } } }, @@ -7338,7 +7344,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SwitchPortConfig" + "$ref": "#/components/schemas/SwitchPortAddressConfig" } } } @@ -7352,13 +7358,13 @@ } } }, - "/v1/system/networking/switch-port-configuration/{configuration}/interface/{interface}/address": { - "get": { + "/v1/system/networking/switch-port-configuration/{configuration}/address/remove": { + "post": { "tags": [ "system/networking" ], - "summary": "List addresses assigned to a provided interface configuration", - "operationId": "networking_switch_port_configuration_interface_address_list", + "summary": "Remove address from an interface configuration", + "operationId": "networking_switch_port_configuration_address_remove", "parameters": [ { "in": "path", @@ -7368,14 +7374,46 @@ "schema": { "$ref": "#/components/schemas/NameOrId" } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddressAddRemove" + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "successful deletion" + }, + "4XX": { + "$ref": "#/components/responses/Error" }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/v1/system/networking/switch-port-configuration/{configuration}/bgp-peer": { + "get": { + "tags": [ + "system/networking" + ], + "summary": "List bgp peers assigned to a provided interface configuration", + "operationId": "networking_switch_port_configuration_bgp_peer_list", + "parameters": [ { "in": "path", - "name": "interface", - "description": "Interface name", + "name": "configuration", + "description": "A name or id to use when selecting a switch port configuration.", "required": true, "schema": { - "$ref": "#/components/schemas/Name" + "$ref": "#/components/schemas/NameOrId" } } ], @@ -7385,11 +7423,7 @@ "content": { "application/json": { "schema": { - "title": "Array_of_SwitchPortAddressConfig", - "type": "array", - "items": { - "$ref": "#/components/schemas/SwitchPortAddressConfig" - } + "$ref": "#/components/schemas/BgpPeerConfig" } } } @@ -7403,13 +7437,13 @@ } } }, - "/v1/system/networking/switch-port-configuration/{configuration}/interface/{interface}/address/add": { + "/v1/system/networking/switch-port-configuration/{configuration}/bgp-peer/add": { "post": { "tags": [ "system/networking" ], - "summary": "Add address to an interface configuration", - "operationId": "networking_switch_port_configuration_interface_address_add", + "summary": "Add bgp peer to an interface configuration", + "operationId": "networking_switch_port_configuration_bgp_peer_add", "parameters": [ { "in": "path", @@ -7419,22 +7453,13 @@ "schema": { "$ref": "#/components/schemas/NameOrId" } - }, - { - "in": "path", - "name": "interface", - "description": "Interface name", - "required": true, - "schema": { - "$ref": "#/components/schemas/Name" - } } ], "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Address" + "$ref": "#/components/schemas/BgpPeer" } } }, @@ -7446,7 +7471,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SwitchPortAddressConfig" + "$ref": "#/components/schemas/BgpPeer" } } } @@ -7460,13 +7485,13 @@ } } }, - "/v1/system/networking/switch-port-configuration/{configuration}/interface/{interface}/address/remove": { + "/v1/system/networking/switch-port-configuration/{configuration}/bgp-peer/remove": { "post": { "tags": [ "system/networking" ], - "summary": "Remove address from an interface configuration", - "operationId": "networking_switch_port_configuration_interface_address_remove", + "summary": "Remove bgp peer from an interface configuration", + "operationId": "networking_switch_port_configuration_bgp_peer_remove", "parameters": [ { "in": "path", @@ -7476,22 +7501,13 @@ "schema": { "$ref": "#/components/schemas/NameOrId" } - }, - { - "in": "path", - "name": "interface", - "description": "Interface name", - "required": true, - "schema": { - "$ref": "#/components/schemas/Name" - } } ], "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Address" + "$ref": "#/components/schemas/BgpPeer" } } }, @@ -7510,13 +7526,13 @@ } } }, - "/v1/system/networking/switch-port-configuration/{configuration}/interface/{interface}/bgp-peer": { + "/v1/system/networking/switch-port-configuration/{configuration}/geometry": { "get": { "tags": [ "system/networking" ], - "summary": "List bgp peers assigned to a provided interface configuration", - "operationId": "networking_switch_port_configuration_interface_bgp_peer_list", + "summary": "Get switch port geometry for a provided switch port configuration", + "operationId": "networking_switch_port_configuration_geometry_view", "parameters": [ { "in": "path", @@ -7526,15 +7542,6 @@ "schema": { "$ref": "#/components/schemas/NameOrId" } - }, - { - "in": "path", - "name": "interface", - "description": "Interface name", - "required": true, - "schema": { - "$ref": "#/components/schemas/Name" - } } ], "responses": { @@ -7543,7 +7550,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BgpPeerConfig" + "$ref": "#/components/schemas/SwitchPortConfig" } } } @@ -7555,15 +7562,13 @@ "$ref": "#/components/responses/Error" } } - } - }, - "/v1/system/networking/switch-port-configuration/{configuration}/interface/{interface}/bgp-peer/add": { + }, "post": { "tags": [ "system/networking" ], - "summary": "Add bgp peer to an interface configuration", - "operationId": "networking_switch_port_configuration_interface_bgp_peer_add", + "summary": "Set switch port geometry for a provided switch port configuration", + "operationId": "networking_switch_port_configuration_geometry_set", "parameters": [ { "in": "path", @@ -7573,22 +7578,13 @@ "schema": { "$ref": "#/components/schemas/NameOrId" } - }, - { - "in": "path", - "name": "interface", - "description": "Interface name", - "required": true, - "schema": { - "$ref": "#/components/schemas/Name" - } } ], "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BgpPeer" + "$ref": "#/components/schemas/SwitchPortConfigCreate" } } }, @@ -7600,7 +7596,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BgpPeer" + "$ref": "#/components/schemas/SwitchPortConfig" } } } @@ -7614,13 +7610,13 @@ } } }, - "/v1/system/networking/switch-port-configuration/{configuration}/interface/{interface}/bgp-peer/remove": { - "post": { + "/v1/system/networking/switch-port-configuration/{configuration}/link": { + "get": { "tags": [ "system/networking" ], - "summary": "Remove bgp peer from an interface configuration", - "operationId": "networking_switch_port_configuration_interface_bgp_peer_remove", + "summary": "List links for a provided switch port configuration", + "operationId": "networking_switch_port_configuration_link_list", "parameters": [ { "in": "path", @@ -7630,31 +7626,23 @@ "schema": { "$ref": "#/components/schemas/NameOrId" } - }, - { - "in": "path", - "name": "interface", - "description": "Interface name", - "required": true, - "schema": { - "$ref": "#/components/schemas/Name" - } } ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/BgpPeer" + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "title": "Array_of_SwitchPortLinkConfig", + "type": "array", + "items": { + "$ref": "#/components/schemas/SwitchPortLinkConfig" + } + } } } }, - "required": true - }, - "responses": { - "204": { - "description": "successful deletion" - }, "4XX": { "$ref": "#/components/responses/Error" }, @@ -7662,15 +7650,13 @@ "$ref": "#/components/responses/Error" } } - } - }, - "/v1/system/networking/switch-port-configuration/{configuration}/interface/{interface}/route": { - "get": { + }, + "post": { "tags": [ "system/networking" ], - "summary": "List routes assigned to a provided interface configuration", - "operationId": "networking_switch_port_configuration_interface_route_list", + "summary": "Create a link for a provided switch port configuration", + "operationId": "networking_switch_port_configuration_link_create", "parameters": [ { "in": "path", @@ -7680,24 +7666,25 @@ "schema": { "$ref": "#/components/schemas/NameOrId" } - }, - { - "in": "path", - "name": "interface", - "description": "Interface name", - "required": true, - "schema": { - "$ref": "#/components/schemas/Name" - } } ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NamedLinkConfigCreate" + } + } + }, + "required": true + }, "responses": { - "200": { - "description": "successful operation", + "201": { + "description": "successful creation", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/RouteConfig" + "$ref": "#/components/schemas/SwitchPortLinkConfig" } } } @@ -7711,13 +7698,13 @@ } } }, - "/v1/system/networking/switch-port-configuration/{configuration}/interface/{interface}/route/add": { - "post": { + "/v1/system/networking/switch-port-configuration/{configuration}/link/{link}": { + "get": { "tags": [ "system/networking" ], - "summary": "Add route to an interface configuration", - "operationId": "networking_switch_port_configuration_interface_route_add", + "summary": "View a link for a provided switch port configuration", + "operationId": "networking_switch_port_configuration_link_view", "parameters": [ { "in": "path", @@ -7730,31 +7717,21 @@ }, { "in": "path", - "name": "interface", - "description": "Interface name", + "name": "link", + "description": "Link name", "required": true, "schema": { "$ref": "#/components/schemas/Name" } } ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Route" - } - } - }, - "required": true - }, "responses": { - "201": { - "description": "successful creation", + "200": { + "description": "successful operation", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Route" + "$ref": "#/components/schemas/SwitchPortLinkConfig" } } } @@ -7766,15 +7743,13 @@ "$ref": "#/components/responses/Error" } } - } - }, - "/v1/system/networking/switch-port-configuration/{configuration}/interface/{interface}/route/remove": { - "post": { + }, + "delete": { "tags": [ "system/networking" ], - "summary": "Remove address from an interface configuration", - "operationId": "networking_switch_port_configuration_interface_route_remove", + "summary": "Delete a link for a provided switch port configuration", + "operationId": "networking_switch_port_configuration_link_delete", "parameters": [ { "in": "path", @@ -7787,24 +7762,14 @@ }, { "in": "path", - "name": "interface", - "description": "Interface name", + "name": "link", + "description": "Link name", "required": true, "schema": { "$ref": "#/components/schemas/Name" } } ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Route" - } - } - }, - "required": true - }, "responses": { "204": { "description": "successful deletion" @@ -7818,13 +7783,13 @@ } } }, - "/v1/system/networking/switch-port-configuration/{configuration}/link": { + "/v1/system/networking/switch-port-configuration/{configuration}/route": { "get": { "tags": [ "system/networking" ], - "summary": "List links for a provided switch port configuration", - "operationId": "networking_switch_port_configuration_link_list", + "summary": "List routes assigned to a provided interface configuration", + "operationId": "networking_switch_port_configuration_route_list", "parameters": [ { "in": "path", @@ -7842,11 +7807,7 @@ "content": { "application/json": { "schema": { - "title": "Array_of_SwitchPortLinkConfig", - "type": "array", - "items": { - "$ref": "#/components/schemas/SwitchPortLinkConfig" - } + "$ref": "#/components/schemas/RouteConfig" } } } @@ -7858,13 +7819,15 @@ "$ref": "#/components/responses/Error" } } - }, + } + }, + "/v1/system/networking/switch-port-configuration/{configuration}/route/add": { "post": { "tags": [ "system/networking" ], - "summary": "Create a link for a provided switch port configuration", - "operationId": "networking_switch_port_configuration_link_create", + "summary": "Add route to an interface configuration", + "operationId": "networking_switch_port_configuration_route_add", "parameters": [ { "in": "path", @@ -7880,7 +7843,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/NamedLinkConfigCreate" + "$ref": "#/components/schemas/Route" } } }, @@ -7892,7 +7855,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SwitchPortLinkConfig" + "$ref": "#/components/schemas/Route" } } } @@ -7906,13 +7869,13 @@ } } }, - "/v1/system/networking/switch-port-configuration/{configuration}/link/{link}": { - "get": { + "/v1/system/networking/switch-port-configuration/{configuration}/route/remove": { + "post": { "tags": [ "system/networking" ], - "summary": "View a link for a provided switch port configuration", - "operationId": "networking_switch_port_configuration_link_view", + "summary": "Remove address from an interface configuration", + "operationId": "networking_switch_port_configuration_route_remove", "parameters": [ { "in": "path", @@ -7922,62 +7885,18 @@ "schema": { "$ref": "#/components/schemas/NameOrId" } - }, - { - "in": "path", - "name": "link", - "description": "Link name", - "required": true, - "schema": { - "$ref": "#/components/schemas/Name" - } } ], - "responses": { - "200": { - "description": "successful operation", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SwitchPortLinkConfig" - } + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Route" } } }, - "4XX": { - "$ref": "#/components/responses/Error" - }, - "5XX": { - "$ref": "#/components/responses/Error" - } - } - }, - "delete": { - "tags": [ - "system/networking" - ], - "summary": "Delete a link for a provided switch port configuration", - "operationId": "networking_switch_port_configuration_link_delete", - "parameters": [ - { - "in": "path", - "name": "configuration", - "description": "A name or id to use when selecting a switch port configuration.", - "required": true, - "schema": { - "$ref": "#/components/schemas/NameOrId" - } - }, - { - "in": "path", - "name": "link", - "description": "Link name", - "required": true, - "schema": { - "$ref": "#/components/schemas/Name" - } - } - ], + "required": true + }, "responses": { "204": { "description": "successful deletion" @@ -10490,6 +10409,48 @@ "address_lot" ] }, + "AddressAddRemove": { + "description": "An address to be added or removed from an interface", + "type": "object", + "properties": { + "address": { + "description": "The address and prefix length of this address.", + "allOf": [ + { + "$ref": "#/components/schemas/IpNet" + } + ] + }, + "address_lot": { + "description": "The address lot this address is drawn from.", + "allOf": [ + { + "$ref": "#/components/schemas/NameOrId" + } + ] + }, + "interface": { + "description": "The name of the interface", + "allOf": [ + { + "$ref": "#/components/schemas/Name" + } + ] + }, + "vlan_id": { + "nullable": true, + "description": "Optional VLAN ID for this address", + "type": "integer", + "format": "uint16", + "minimum": 0 + } + }, + "required": [ + "address", + "address_lot", + "interface" + ] + }, "AddressConfig": { "description": "A set of addresses associated with a port configuration.", "type": "object", diff --git a/sdk-httpmock/src/generated_httpmock.rs b/sdk-httpmock/src/generated_httpmock.rs index e12f8744..2cfc56ea 100644 --- a/sdk-httpmock/src/generated_httpmock.rs +++ b/sdk-httpmock/src/generated_httpmock.rs @@ -11809,13 +11809,13 @@ pub mod operations { } } - pub struct NetworkingSwitchPortConfigurationGeometryViewWhen(httpmock::When); - impl NetworkingSwitchPortConfigurationGeometryViewWhen { + pub struct NetworkingSwitchPortConfigurationAddressListWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationAddressListWhen { pub fn new(inner: httpmock::When) -> Self { Self( inner.method(httpmock::Method::GET).path_matches( regex::Regex::new( - "^/v1/system/networking/switch-port-configuration/[^/]*/geometry$", + "^/v1/system/networking/switch-port-configuration/[^/]*/address$", ) .unwrap(), ), @@ -11828,7 +11828,7 @@ pub mod operations { pub fn configuration(self, value: &types::NameOrId) -> Self { let re = regex::Regex::new(&format!( - "^/v1/system/networking/switch-port-configuration/{}/geometry$", + "^/v1/system/networking/switch-port-configuration/{}/address$", value.to_string() )) .unwrap(); @@ -11836,8 +11836,8 @@ pub mod operations { } } - pub struct NetworkingSwitchPortConfigurationGeometryViewThen(httpmock::Then); - impl NetworkingSwitchPortConfigurationGeometryViewThen { + pub struct NetworkingSwitchPortConfigurationAddressListThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationAddressListThen { pub fn new(inner: httpmock::Then) -> Self { Self(inner) } @@ -11846,7 +11846,7 @@ pub mod operations { self.0 } - pub fn ok(self, value: &types::SwitchPortConfig) -> Self { + pub fn ok(self, value: &Vec) -> Self { Self( self.0 .status(200u16) @@ -11876,13 +11876,13 @@ pub mod operations { } } - pub struct NetworkingSwitchPortConfigurationGeometrySetWhen(httpmock::When); - impl NetworkingSwitchPortConfigurationGeometrySetWhen { + pub struct NetworkingSwitchPortConfigurationAddressAddWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationAddressAddWhen { pub fn new(inner: httpmock::When) -> Self { Self( inner.method(httpmock::Method::POST).path_matches( regex::Regex::new( - "^/v1/system/networking/switch-port-configuration/[^/]*/geometry$", + "^/v1/system/networking/switch-port-configuration/[^/]*/address/add$", ) .unwrap(), ), @@ -11895,20 +11895,20 @@ pub mod operations { pub fn configuration(self, value: &types::NameOrId) -> Self { let re = regex::Regex::new(&format!( - "^/v1/system/networking/switch-port-configuration/{}/geometry$", + "^/v1/system/networking/switch-port-configuration/{}/address/add$", value.to_string() )) .unwrap(); Self(self.0.path_matches(re)) } - pub fn body(self, value: &types::SwitchPortConfigCreate) -> Self { + pub fn body(self, value: &types::AddressAddRemove) -> Self { Self(self.0.json_body_obj(value)) } } - pub struct NetworkingSwitchPortConfigurationGeometrySetThen(httpmock::Then); - impl NetworkingSwitchPortConfigurationGeometrySetThen { + pub struct NetworkingSwitchPortConfigurationAddressAddThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationAddressAddThen { pub fn new(inner: httpmock::Then) -> Self { Self(inner) } @@ -11917,7 +11917,7 @@ pub mod operations { self.0 } - pub fn created(self, value: &types::SwitchPortConfig) -> Self { + pub fn created(self, value: &types::SwitchPortAddressConfig) -> Self { Self( self.0 .status(201u16) @@ -11947,14 +11947,13 @@ pub mod operations { } } - pub struct NetworkingSwitchPortConfigurationInterfaceAddressListWhen(httpmock::When); - impl NetworkingSwitchPortConfigurationInterfaceAddressListWhen { + pub struct NetworkingSwitchPortConfigurationAddressRemoveWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationAddressRemoveWhen { pub fn new(inner: httpmock::When) -> Self { Self( - inner.method(httpmock::Method::GET).path_matches( + inner.method(httpmock::Method::POST).path_matches( regex::Regex::new( - "^/v1/system/networking/switch-port-configuration/[^/]*/interface/[^/]*/\ - address$", + "^/v1/system/networking/switch-port-configuration/[^/]*/address/remove$", ) .unwrap(), ), @@ -11967,25 +11966,20 @@ pub mod operations { pub fn configuration(self, value: &types::NameOrId) -> Self { let re = regex::Regex::new(&format!( - "^/v1/system/networking/switch-port-configuration/{}/interface/.*/address$", + "^/v1/system/networking/switch-port-configuration/{}/address/remove$", value.to_string() )) .unwrap(); Self(self.0.path_matches(re)) } - pub fn interface(self, value: &types::Name) -> Self { - let re = regex::Regex::new(&format!( - "^/v1/system/networking/switch-port-configuration/.*/interface/{}/address$", - value.to_string() - )) - .unwrap(); - Self(self.0.path_matches(re)) + pub fn body(self, value: &types::AddressAddRemove) -> Self { + Self(self.0.json_body_obj(value)) } } - pub struct NetworkingSwitchPortConfigurationInterfaceAddressListThen(httpmock::Then); - impl NetworkingSwitchPortConfigurationInterfaceAddressListThen { + pub struct NetworkingSwitchPortConfigurationAddressRemoveThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationAddressRemoveThen { pub fn new(inner: httpmock::Then) -> Self { Self(inner) } @@ -11994,13 +11988,8 @@ pub mod operations { self.0 } - pub fn ok(self, value: &Vec) -> Self { - Self( - self.0 - .status(200u16) - .header("content-type", "application/json") - .json_body_obj(value), - ) + pub fn no_content(self) -> Self { + Self(self.0.status(204u16)) } pub fn client_error(self, status: u16, value: &types::Error) -> Self { @@ -12024,14 +12013,13 @@ pub mod operations { } } - pub struct NetworkingSwitchPortConfigurationInterfaceAddressAddWhen(httpmock::When); - impl NetworkingSwitchPortConfigurationInterfaceAddressAddWhen { + pub struct NetworkingSwitchPortConfigurationBgpPeerListWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationBgpPeerListWhen { pub fn new(inner: httpmock::When) -> Self { Self( - inner.method(httpmock::Method::POST).path_matches( + inner.method(httpmock::Method::GET).path_matches( regex::Regex::new( - "^/v1/system/networking/switch-port-configuration/[^/]*/interface/[^/]*/\ - address/add$", + "^/v1/system/networking/switch-port-configuration/[^/]*/bgp-peer$", ) .unwrap(), ), @@ -12044,29 +12032,16 @@ pub mod operations { pub fn configuration(self, value: &types::NameOrId) -> Self { let re = regex::Regex::new(&format!( - "^/v1/system/networking/switch-port-configuration/{}/interface/.*/address/add$", + "^/v1/system/networking/switch-port-configuration/{}/bgp-peer$", value.to_string() )) .unwrap(); Self(self.0.path_matches(re)) } - - pub fn interface(self, value: &types::Name) -> Self { - let re = regex::Regex::new(&format!( - "^/v1/system/networking/switch-port-configuration/.*/interface/{}/address/add$", - value.to_string() - )) - .unwrap(); - Self(self.0.path_matches(re)) - } - - pub fn body(self, value: &types::Address) -> Self { - Self(self.0.json_body_obj(value)) - } } - pub struct NetworkingSwitchPortConfigurationInterfaceAddressAddThen(httpmock::Then); - impl NetworkingSwitchPortConfigurationInterfaceAddressAddThen { + pub struct NetworkingSwitchPortConfigurationBgpPeerListThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationBgpPeerListThen { pub fn new(inner: httpmock::Then) -> Self { Self(inner) } @@ -12075,10 +12050,10 @@ pub mod operations { self.0 } - pub fn created(self, value: &types::SwitchPortAddressConfig) -> Self { + pub fn ok(self, value: &types::BgpPeerConfig) -> Self { Self( self.0 - .status(201u16) + .status(200u16) .header("content-type", "application/json") .json_body_obj(value), ) @@ -12105,14 +12080,13 @@ pub mod operations { } } - pub struct NetworkingSwitchPortConfigurationInterfaceAddressRemoveWhen(httpmock::When); - impl NetworkingSwitchPortConfigurationInterfaceAddressRemoveWhen { + pub struct NetworkingSwitchPortConfigurationBgpPeerAddWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationBgpPeerAddWhen { pub fn new(inner: httpmock::When) -> Self { Self( inner.method(httpmock::Method::POST).path_matches( regex::Regex::new( - "^/v1/system/networking/switch-port-configuration/[^/]*/interface/[^/]*/\ - address/remove$", + "^/v1/system/networking/switch-port-configuration/[^/]*/bgp-peer/add$", ) .unwrap(), ), @@ -12125,29 +12099,20 @@ pub mod operations { pub fn configuration(self, value: &types::NameOrId) -> Self { let re = regex::Regex::new(&format!( - "^/v1/system/networking/switch-port-configuration/{}/interface/.*/address/remove$", - value.to_string() - )) - .unwrap(); - Self(self.0.path_matches(re)) - } - - pub fn interface(self, value: &types::Name) -> Self { - let re = regex::Regex::new(&format!( - "^/v1/system/networking/switch-port-configuration/.*/interface/{}/address/remove$", + "^/v1/system/networking/switch-port-configuration/{}/bgp-peer/add$", value.to_string() )) .unwrap(); Self(self.0.path_matches(re)) } - pub fn body(self, value: &types::Address) -> Self { + pub fn body(self, value: &types::BgpPeer) -> Self { Self(self.0.json_body_obj(value)) } } - pub struct NetworkingSwitchPortConfigurationInterfaceAddressRemoveThen(httpmock::Then); - impl NetworkingSwitchPortConfigurationInterfaceAddressRemoveThen { + pub struct NetworkingSwitchPortConfigurationBgpPeerAddThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationBgpPeerAddThen { pub fn new(inner: httpmock::Then) -> Self { Self(inner) } @@ -12156,8 +12121,13 @@ pub mod operations { self.0 } - pub fn no_content(self) -> Self { - Self(self.0.status(204u16)) + pub fn created(self, value: &types::BgpPeer) -> Self { + Self( + self.0 + .status(201u16) + .header("content-type", "application/json") + .json_body_obj(value), + ) } pub fn client_error(self, status: u16, value: &types::Error) -> Self { @@ -12181,14 +12151,13 @@ pub mod operations { } } - pub struct NetworkingSwitchPortConfigurationInterfaceBgpPeerListWhen(httpmock::When); - impl NetworkingSwitchPortConfigurationInterfaceBgpPeerListWhen { + pub struct NetworkingSwitchPortConfigurationBgpPeerRemoveWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationBgpPeerRemoveWhen { pub fn new(inner: httpmock::When) -> Self { Self( - inner.method(httpmock::Method::GET).path_matches( + inner.method(httpmock::Method::POST).path_matches( regex::Regex::new( - "^/v1/system/networking/switch-port-configuration/[^/]*/interface/[^/]*/\ - bgp-peer$", + "^/v1/system/networking/switch-port-configuration/[^/]*/bgp-peer/remove$", ) .unwrap(), ), @@ -12201,25 +12170,20 @@ pub mod operations { pub fn configuration(self, value: &types::NameOrId) -> Self { let re = regex::Regex::new(&format!( - "^/v1/system/networking/switch-port-configuration/{}/interface/.*/bgp-peer$", + "^/v1/system/networking/switch-port-configuration/{}/bgp-peer/remove$", value.to_string() )) .unwrap(); Self(self.0.path_matches(re)) } - pub fn interface(self, value: &types::Name) -> Self { - let re = regex::Regex::new(&format!( - "^/v1/system/networking/switch-port-configuration/.*/interface/{}/bgp-peer$", - value.to_string() - )) - .unwrap(); - Self(self.0.path_matches(re)) + pub fn body(self, value: &types::BgpPeer) -> Self { + Self(self.0.json_body_obj(value)) } } - pub struct NetworkingSwitchPortConfigurationInterfaceBgpPeerListThen(httpmock::Then); - impl NetworkingSwitchPortConfigurationInterfaceBgpPeerListThen { + pub struct NetworkingSwitchPortConfigurationBgpPeerRemoveThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationBgpPeerRemoveThen { pub fn new(inner: httpmock::Then) -> Self { Self(inner) } @@ -12228,13 +12192,8 @@ pub mod operations { self.0 } - pub fn ok(self, value: &types::BgpPeerConfig) -> Self { - Self( - self.0 - .status(200u16) - .header("content-type", "application/json") - .json_body_obj(value), - ) + pub fn no_content(self) -> Self { + Self(self.0.status(204u16)) } pub fn client_error(self, status: u16, value: &types::Error) -> Self { @@ -12258,14 +12217,13 @@ pub mod operations { } } - pub struct NetworkingSwitchPortConfigurationInterfaceBgpPeerAddWhen(httpmock::When); - impl NetworkingSwitchPortConfigurationInterfaceBgpPeerAddWhen { + pub struct NetworkingSwitchPortConfigurationGeometryViewWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationGeometryViewWhen { pub fn new(inner: httpmock::When) -> Self { Self( - inner.method(httpmock::Method::POST).path_matches( + inner.method(httpmock::Method::GET).path_matches( regex::Regex::new( - "^/v1/system/networking/switch-port-configuration/[^/]*/interface/[^/]*/\ - bgp-peer/add$", + "^/v1/system/networking/switch-port-configuration/[^/]*/geometry$", ) .unwrap(), ), @@ -12278,29 +12236,16 @@ pub mod operations { pub fn configuration(self, value: &types::NameOrId) -> Self { let re = regex::Regex::new(&format!( - "^/v1/system/networking/switch-port-configuration/{}/interface/.*/bgp-peer/add$", - value.to_string() - )) - .unwrap(); - Self(self.0.path_matches(re)) - } - - pub fn interface(self, value: &types::Name) -> Self { - let re = regex::Regex::new(&format!( - "^/v1/system/networking/switch-port-configuration/.*/interface/{}/bgp-peer/add$", + "^/v1/system/networking/switch-port-configuration/{}/geometry$", value.to_string() )) .unwrap(); Self(self.0.path_matches(re)) } - - pub fn body(self, value: &types::BgpPeer) -> Self { - Self(self.0.json_body_obj(value)) - } } - pub struct NetworkingSwitchPortConfigurationInterfaceBgpPeerAddThen(httpmock::Then); - impl NetworkingSwitchPortConfigurationInterfaceBgpPeerAddThen { + pub struct NetworkingSwitchPortConfigurationGeometryViewThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationGeometryViewThen { pub fn new(inner: httpmock::Then) -> Self { Self(inner) } @@ -12309,10 +12254,10 @@ pub mod operations { self.0 } - pub fn created(self, value: &types::BgpPeer) -> Self { + pub fn ok(self, value: &types::SwitchPortConfig) -> Self { Self( self.0 - .status(201u16) + .status(200u16) .header("content-type", "application/json") .json_body_obj(value), ) @@ -12339,14 +12284,13 @@ pub mod operations { } } - pub struct NetworkingSwitchPortConfigurationInterfaceBgpPeerRemoveWhen(httpmock::When); - impl NetworkingSwitchPortConfigurationInterfaceBgpPeerRemoveWhen { + pub struct NetworkingSwitchPortConfigurationGeometrySetWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationGeometrySetWhen { pub fn new(inner: httpmock::When) -> Self { Self( inner.method(httpmock::Method::POST).path_matches( regex::Regex::new( - "^/v1/system/networking/switch-port-configuration/[^/]*/interface/[^/]*/\ - bgp-peer/remove$", + "^/v1/system/networking/switch-port-configuration/[^/]*/geometry$", ) .unwrap(), ), @@ -12359,29 +12303,20 @@ pub mod operations { pub fn configuration(self, value: &types::NameOrId) -> Self { let re = regex::Regex::new(&format!( - "^/v1/system/networking/switch-port-configuration/{}/interface/.*/bgp-peer/remove$", - value.to_string() - )) - .unwrap(); - Self(self.0.path_matches(re)) - } - - pub fn interface(self, value: &types::Name) -> Self { - let re = regex::Regex::new(&format!( - "^/v1/system/networking/switch-port-configuration/.*/interface/{}/bgp-peer/remove$", + "^/v1/system/networking/switch-port-configuration/{}/geometry$", value.to_string() )) .unwrap(); Self(self.0.path_matches(re)) } - pub fn body(self, value: &types::BgpPeer) -> Self { + pub fn body(self, value: &types::SwitchPortConfigCreate) -> Self { Self(self.0.json_body_obj(value)) } } - pub struct NetworkingSwitchPortConfigurationInterfaceBgpPeerRemoveThen(httpmock::Then); - impl NetworkingSwitchPortConfigurationInterfaceBgpPeerRemoveThen { + pub struct NetworkingSwitchPortConfigurationGeometrySetThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationGeometrySetThen { pub fn new(inner: httpmock::Then) -> Self { Self(inner) } @@ -12390,8 +12325,13 @@ pub mod operations { self.0 } - pub fn no_content(self) -> Self { - Self(self.0.status(204u16)) + pub fn created(self, value: &types::SwitchPortConfig) -> Self { + Self( + self.0 + .status(201u16) + .header("content-type", "application/json") + .json_body_obj(value), + ) } pub fn client_error(self, status: u16, value: &types::Error) -> Self { @@ -12415,14 +12355,13 @@ pub mod operations { } } - pub struct NetworkingSwitchPortConfigurationInterfaceRouteListWhen(httpmock::When); - impl NetworkingSwitchPortConfigurationInterfaceRouteListWhen { + pub struct NetworkingSwitchPortConfigurationLinkListWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationLinkListWhen { pub fn new(inner: httpmock::When) -> Self { Self( inner.method(httpmock::Method::GET).path_matches( regex::Regex::new( - "^/v1/system/networking/switch-port-configuration/[^/]*/interface/[^/]*/\ - route$", + "^/v1/system/networking/switch-port-configuration/[^/]*/link$", ) .unwrap(), ), @@ -12435,16 +12374,7 @@ pub mod operations { pub fn configuration(self, value: &types::NameOrId) -> Self { let re = regex::Regex::new(&format!( - "^/v1/system/networking/switch-port-configuration/{}/interface/.*/route$", - value.to_string() - )) - .unwrap(); - Self(self.0.path_matches(re)) - } - - pub fn interface(self, value: &types::Name) -> Self { - let re = regex::Regex::new(&format!( - "^/v1/system/networking/switch-port-configuration/.*/interface/{}/route$", + "^/v1/system/networking/switch-port-configuration/{}/link$", value.to_string() )) .unwrap(); @@ -12452,8 +12382,8 @@ pub mod operations { } } - pub struct NetworkingSwitchPortConfigurationInterfaceRouteListThen(httpmock::Then); - impl NetworkingSwitchPortConfigurationInterfaceRouteListThen { + pub struct NetworkingSwitchPortConfigurationLinkListThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationLinkListThen { pub fn new(inner: httpmock::Then) -> Self { Self(inner) } @@ -12462,7 +12392,7 @@ pub mod operations { self.0 } - pub fn ok(self, value: &types::RouteConfig) -> Self { + pub fn ok(self, value: &Vec) -> Self { Self( self.0 .status(200u16) @@ -12492,14 +12422,13 @@ pub mod operations { } } - pub struct NetworkingSwitchPortConfigurationInterfaceRouteAddWhen(httpmock::When); - impl NetworkingSwitchPortConfigurationInterfaceRouteAddWhen { + pub struct NetworkingSwitchPortConfigurationLinkCreateWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationLinkCreateWhen { pub fn new(inner: httpmock::When) -> Self { Self( inner.method(httpmock::Method::POST).path_matches( regex::Regex::new( - "^/v1/system/networking/switch-port-configuration/[^/]*/interface/[^/]*/\ - route/add$", + "^/v1/system/networking/switch-port-configuration/[^/]*/link$", ) .unwrap(), ), @@ -12512,29 +12441,20 @@ pub mod operations { pub fn configuration(self, value: &types::NameOrId) -> Self { let re = regex::Regex::new(&format!( - "^/v1/system/networking/switch-port-configuration/{}/interface/.*/route/add$", - value.to_string() - )) - .unwrap(); - Self(self.0.path_matches(re)) - } - - pub fn interface(self, value: &types::Name) -> Self { - let re = regex::Regex::new(&format!( - "^/v1/system/networking/switch-port-configuration/.*/interface/{}/route/add$", + "^/v1/system/networking/switch-port-configuration/{}/link$", value.to_string() )) .unwrap(); Self(self.0.path_matches(re)) } - pub fn body(self, value: &types::Route) -> Self { + pub fn body(self, value: &types::NamedLinkConfigCreate) -> Self { Self(self.0.json_body_obj(value)) } } - pub struct NetworkingSwitchPortConfigurationInterfaceRouteAddThen(httpmock::Then); - impl NetworkingSwitchPortConfigurationInterfaceRouteAddThen { + pub struct NetworkingSwitchPortConfigurationLinkCreateThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationLinkCreateThen { pub fn new(inner: httpmock::Then) -> Self { Self(inner) } @@ -12543,7 +12463,7 @@ pub mod operations { self.0 } - pub fn created(self, value: &types::Route) -> Self { + pub fn created(self, value: &types::SwitchPortLinkConfig) -> Self { Self( self.0 .status(201u16) @@ -12573,14 +12493,13 @@ pub mod operations { } } - pub struct NetworkingSwitchPortConfigurationInterfaceRouteRemoveWhen(httpmock::When); - impl NetworkingSwitchPortConfigurationInterfaceRouteRemoveWhen { + pub struct NetworkingSwitchPortConfigurationLinkViewWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationLinkViewWhen { pub fn new(inner: httpmock::When) -> Self { Self( - inner.method(httpmock::Method::POST).path_matches( + inner.method(httpmock::Method::GET).path_matches( regex::Regex::new( - "^/v1/system/networking/switch-port-configuration/[^/]*/interface/[^/]*/\ - route/remove$", + "^/v1/system/networking/switch-port-configuration/[^/]*/link/[^/]*$", ) .unwrap(), ), @@ -12593,29 +12512,25 @@ pub mod operations { pub fn configuration(self, value: &types::NameOrId) -> Self { let re = regex::Regex::new(&format!( - "^/v1/system/networking/switch-port-configuration/{}/interface/.*/route/remove$", + "^/v1/system/networking/switch-port-configuration/{}/link/.*$", value.to_string() )) .unwrap(); Self(self.0.path_matches(re)) } - pub fn interface(self, value: &types::Name) -> Self { + pub fn link(self, value: &types::Name) -> Self { let re = regex::Regex::new(&format!( - "^/v1/system/networking/switch-port-configuration/.*/interface/{}/route/remove$", + "^/v1/system/networking/switch-port-configuration/.*/link/{}$", value.to_string() )) .unwrap(); Self(self.0.path_matches(re)) } - - pub fn body(self, value: &types::Route) -> Self { - Self(self.0.json_body_obj(value)) - } } - pub struct NetworkingSwitchPortConfigurationInterfaceRouteRemoveThen(httpmock::Then); - impl NetworkingSwitchPortConfigurationInterfaceRouteRemoveThen { + pub struct NetworkingSwitchPortConfigurationLinkViewThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationLinkViewThen { pub fn new(inner: httpmock::Then) -> Self { Self(inner) } @@ -12624,8 +12539,13 @@ pub mod operations { self.0 } - pub fn no_content(self) -> Self { - Self(self.0.status(204u16)) + pub fn ok(self, value: &types::SwitchPortLinkConfig) -> Self { + Self( + self.0 + .status(200u16) + .header("content-type", "application/json") + .json_body_obj(value), + ) } pub fn client_error(self, status: u16, value: &types::Error) -> Self { @@ -12649,13 +12569,13 @@ pub mod operations { } } - pub struct NetworkingSwitchPortConfigurationLinkListWhen(httpmock::When); - impl NetworkingSwitchPortConfigurationLinkListWhen { + pub struct NetworkingSwitchPortConfigurationLinkDeleteWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationLinkDeleteWhen { pub fn new(inner: httpmock::When) -> Self { Self( - inner.method(httpmock::Method::GET).path_matches( + inner.method(httpmock::Method::DELETE).path_matches( regex::Regex::new( - "^/v1/system/networking/switch-port-configuration/[^/]*/link$", + "^/v1/system/networking/switch-port-configuration/[^/]*/link/[^/]*$", ) .unwrap(), ), @@ -12668,7 +12588,16 @@ pub mod operations { pub fn configuration(self, value: &types::NameOrId) -> Self { let re = regex::Regex::new(&format!( - "^/v1/system/networking/switch-port-configuration/{}/link$", + "^/v1/system/networking/switch-port-configuration/{}/link/.*$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + + pub fn link(self, value: &types::Name) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/switch-port-configuration/.*/link/{}$", value.to_string() )) .unwrap(); @@ -12676,8 +12605,8 @@ pub mod operations { } } - pub struct NetworkingSwitchPortConfigurationLinkListThen(httpmock::Then); - impl NetworkingSwitchPortConfigurationLinkListThen { + pub struct NetworkingSwitchPortConfigurationLinkDeleteThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationLinkDeleteThen { pub fn new(inner: httpmock::Then) -> Self { Self(inner) } @@ -12686,13 +12615,8 @@ pub mod operations { self.0 } - pub fn ok(self, value: &Vec) -> Self { - Self( - self.0 - .status(200u16) - .header("content-type", "application/json") - .json_body_obj(value), - ) + pub fn no_content(self) -> Self { + Self(self.0.status(204u16)) } pub fn client_error(self, status: u16, value: &types::Error) -> Self { @@ -12716,13 +12640,13 @@ pub mod operations { } } - pub struct NetworkingSwitchPortConfigurationLinkCreateWhen(httpmock::When); - impl NetworkingSwitchPortConfigurationLinkCreateWhen { + pub struct NetworkingSwitchPortConfigurationRouteListWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationRouteListWhen { pub fn new(inner: httpmock::When) -> Self { Self( - inner.method(httpmock::Method::POST).path_matches( + inner.method(httpmock::Method::GET).path_matches( regex::Regex::new( - "^/v1/system/networking/switch-port-configuration/[^/]*/link$", + "^/v1/system/networking/switch-port-configuration/[^/]*/route$", ) .unwrap(), ), @@ -12735,20 +12659,16 @@ pub mod operations { pub fn configuration(self, value: &types::NameOrId) -> Self { let re = regex::Regex::new(&format!( - "^/v1/system/networking/switch-port-configuration/{}/link$", + "^/v1/system/networking/switch-port-configuration/{}/route$", value.to_string() )) .unwrap(); Self(self.0.path_matches(re)) } - - pub fn body(self, value: &types::NamedLinkConfigCreate) -> Self { - Self(self.0.json_body_obj(value)) - } } - pub struct NetworkingSwitchPortConfigurationLinkCreateThen(httpmock::Then); - impl NetworkingSwitchPortConfigurationLinkCreateThen { + pub struct NetworkingSwitchPortConfigurationRouteListThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationRouteListThen { pub fn new(inner: httpmock::Then) -> Self { Self(inner) } @@ -12757,10 +12677,10 @@ pub mod operations { self.0 } - pub fn created(self, value: &types::SwitchPortLinkConfig) -> Self { + pub fn ok(self, value: &types::RouteConfig) -> Self { Self( self.0 - .status(201u16) + .status(200u16) .header("content-type", "application/json") .json_body_obj(value), ) @@ -12787,13 +12707,13 @@ pub mod operations { } } - pub struct NetworkingSwitchPortConfigurationLinkViewWhen(httpmock::When); - impl NetworkingSwitchPortConfigurationLinkViewWhen { + pub struct NetworkingSwitchPortConfigurationRouteAddWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationRouteAddWhen { pub fn new(inner: httpmock::When) -> Self { Self( - inner.method(httpmock::Method::GET).path_matches( + inner.method(httpmock::Method::POST).path_matches( regex::Regex::new( - "^/v1/system/networking/switch-port-configuration/[^/]*/link/[^/]*$", + "^/v1/system/networking/switch-port-configuration/[^/]*/route/add$", ) .unwrap(), ), @@ -12806,25 +12726,20 @@ pub mod operations { pub fn configuration(self, value: &types::NameOrId) -> Self { let re = regex::Regex::new(&format!( - "^/v1/system/networking/switch-port-configuration/{}/link/.*$", + "^/v1/system/networking/switch-port-configuration/{}/route/add$", value.to_string() )) .unwrap(); Self(self.0.path_matches(re)) } - pub fn link(self, value: &types::Name) -> Self { - let re = regex::Regex::new(&format!( - "^/v1/system/networking/switch-port-configuration/.*/link/{}$", - value.to_string() - )) - .unwrap(); - Self(self.0.path_matches(re)) + pub fn body(self, value: &types::Route) -> Self { + Self(self.0.json_body_obj(value)) } } - pub struct NetworkingSwitchPortConfigurationLinkViewThen(httpmock::Then); - impl NetworkingSwitchPortConfigurationLinkViewThen { + pub struct NetworkingSwitchPortConfigurationRouteAddThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationRouteAddThen { pub fn new(inner: httpmock::Then) -> Self { Self(inner) } @@ -12833,10 +12748,10 @@ pub mod operations { self.0 } - pub fn ok(self, value: &types::SwitchPortLinkConfig) -> Self { + pub fn created(self, value: &types::Route) -> Self { Self( self.0 - .status(200u16) + .status(201u16) .header("content-type", "application/json") .json_body_obj(value), ) @@ -12863,13 +12778,13 @@ pub mod operations { } } - pub struct NetworkingSwitchPortConfigurationLinkDeleteWhen(httpmock::When); - impl NetworkingSwitchPortConfigurationLinkDeleteWhen { + pub struct NetworkingSwitchPortConfigurationRouteRemoveWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationRouteRemoveWhen { pub fn new(inner: httpmock::When) -> Self { Self( - inner.method(httpmock::Method::DELETE).path_matches( + inner.method(httpmock::Method::POST).path_matches( regex::Regex::new( - "^/v1/system/networking/switch-port-configuration/[^/]*/link/[^/]*$", + "^/v1/system/networking/switch-port-configuration/[^/]*/route/remove$", ) .unwrap(), ), @@ -12882,25 +12797,20 @@ pub mod operations { pub fn configuration(self, value: &types::NameOrId) -> Self { let re = regex::Regex::new(&format!( - "^/v1/system/networking/switch-port-configuration/{}/link/.*$", + "^/v1/system/networking/switch-port-configuration/{}/route/remove$", value.to_string() )) .unwrap(); Self(self.0.path_matches(re)) } - pub fn link(self, value: &types::Name) -> Self { - let re = regex::Regex::new(&format!( - "^/v1/system/networking/switch-port-configuration/.*/link/{}$", - value.to_string() - )) - .unwrap(); - Self(self.0.path_matches(re)) + pub fn body(self, value: &types::Route) -> Self { + Self(self.0.json_body_obj(value)) } } - pub struct NetworkingSwitchPortConfigurationLinkDeleteThen(httpmock::Then); - impl NetworkingSwitchPortConfigurationLinkDeleteThen { + pub struct NetworkingSwitchPortConfigurationRouteRemoveThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationRouteRemoveThen { pub fn new(inner: httpmock::Then) -> Self { Self(inner) } @@ -17608,98 +17518,59 @@ pub trait MockServerExt { operations::NetworkingSwitchPortConfigurationViewWhen, operations::NetworkingSwitchPortConfigurationViewThen, ); - fn networking_switch_port_configuration_geometry_view(&self, config_fn: F) -> httpmock::Mock + fn networking_switch_port_configuration_address_list(&self, config_fn: F) -> httpmock::Mock where F: FnOnce( - operations::NetworkingSwitchPortConfigurationGeometryViewWhen, - operations::NetworkingSwitchPortConfigurationGeometryViewThen, + operations::NetworkingSwitchPortConfigurationAddressListWhen, + operations::NetworkingSwitchPortConfigurationAddressListThen, ); - fn networking_switch_port_configuration_geometry_set(&self, config_fn: F) -> httpmock::Mock + fn networking_switch_port_configuration_address_add(&self, config_fn: F) -> httpmock::Mock where F: FnOnce( - operations::NetworkingSwitchPortConfigurationGeometrySetWhen, - operations::NetworkingSwitchPortConfigurationGeometrySetThen, + operations::NetworkingSwitchPortConfigurationAddressAddWhen, + operations::NetworkingSwitchPortConfigurationAddressAddThen, ); - fn networking_switch_port_configuration_interface_address_list( + fn networking_switch_port_configuration_address_remove( &self, config_fn: F, ) -> httpmock::Mock where F: FnOnce( - operations::NetworkingSwitchPortConfigurationInterfaceAddressListWhen, - operations::NetworkingSwitchPortConfigurationInterfaceAddressListThen, + operations::NetworkingSwitchPortConfigurationAddressRemoveWhen, + operations::NetworkingSwitchPortConfigurationAddressRemoveThen, ); - fn networking_switch_port_configuration_interface_address_add( - &self, - config_fn: F, - ) -> httpmock::Mock + fn networking_switch_port_configuration_bgp_peer_list(&self, config_fn: F) -> httpmock::Mock where F: FnOnce( - operations::NetworkingSwitchPortConfigurationInterfaceAddressAddWhen, - operations::NetworkingSwitchPortConfigurationInterfaceAddressAddThen, + operations::NetworkingSwitchPortConfigurationBgpPeerListWhen, + operations::NetworkingSwitchPortConfigurationBgpPeerListThen, ); - fn networking_switch_port_configuration_interface_address_remove( - &self, - config_fn: F, - ) -> httpmock::Mock + fn networking_switch_port_configuration_bgp_peer_add(&self, config_fn: F) -> httpmock::Mock where F: FnOnce( - operations::NetworkingSwitchPortConfigurationInterfaceAddressRemoveWhen, - operations::NetworkingSwitchPortConfigurationInterfaceAddressRemoveThen, + operations::NetworkingSwitchPortConfigurationBgpPeerAddWhen, + operations::NetworkingSwitchPortConfigurationBgpPeerAddThen, ); - fn networking_switch_port_configuration_interface_bgp_peer_list( + fn networking_switch_port_configuration_bgp_peer_remove( &self, config_fn: F, ) -> httpmock::Mock where F: FnOnce( - operations::NetworkingSwitchPortConfigurationInterfaceBgpPeerListWhen, - operations::NetworkingSwitchPortConfigurationInterfaceBgpPeerListThen, + operations::NetworkingSwitchPortConfigurationBgpPeerRemoveWhen, + operations::NetworkingSwitchPortConfigurationBgpPeerRemoveThen, ); - fn networking_switch_port_configuration_interface_bgp_peer_add( - &self, - config_fn: F, - ) -> httpmock::Mock - where - F: FnOnce( - operations::NetworkingSwitchPortConfigurationInterfaceBgpPeerAddWhen, - operations::NetworkingSwitchPortConfigurationInterfaceBgpPeerAddThen, - ); - fn networking_switch_port_configuration_interface_bgp_peer_remove( - &self, - config_fn: F, - ) -> httpmock::Mock - where - F: FnOnce( - operations::NetworkingSwitchPortConfigurationInterfaceBgpPeerRemoveWhen, - operations::NetworkingSwitchPortConfigurationInterfaceBgpPeerRemoveThen, - ); - fn networking_switch_port_configuration_interface_route_list( - &self, - config_fn: F, - ) -> httpmock::Mock - where - F: FnOnce( - operations::NetworkingSwitchPortConfigurationInterfaceRouteListWhen, - operations::NetworkingSwitchPortConfigurationInterfaceRouteListThen, - ); - fn networking_switch_port_configuration_interface_route_add( - &self, - config_fn: F, - ) -> httpmock::Mock + fn networking_switch_port_configuration_geometry_view(&self, config_fn: F) -> httpmock::Mock where F: FnOnce( - operations::NetworkingSwitchPortConfigurationInterfaceRouteAddWhen, - operations::NetworkingSwitchPortConfigurationInterfaceRouteAddThen, + operations::NetworkingSwitchPortConfigurationGeometryViewWhen, + operations::NetworkingSwitchPortConfigurationGeometryViewThen, ); - fn networking_switch_port_configuration_interface_route_remove( - &self, - config_fn: F, - ) -> httpmock::Mock + fn networking_switch_port_configuration_geometry_set(&self, config_fn: F) -> httpmock::Mock where F: FnOnce( - operations::NetworkingSwitchPortConfigurationInterfaceRouteRemoveWhen, - operations::NetworkingSwitchPortConfigurationInterfaceRouteRemoveThen, + operations::NetworkingSwitchPortConfigurationGeometrySetWhen, + operations::NetworkingSwitchPortConfigurationGeometrySetThen, ); fn networking_switch_port_configuration_link_list(&self, config_fn: F) -> httpmock::Mock where @@ -17725,6 +17596,24 @@ pub trait MockServerExt { operations::NetworkingSwitchPortConfigurationLinkDeleteWhen, operations::NetworkingSwitchPortConfigurationLinkDeleteThen, ); + fn networking_switch_port_configuration_route_list(&self, config_fn: F) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationRouteListWhen, + operations::NetworkingSwitchPortConfigurationRouteListThen, + ); + fn networking_switch_port_configuration_route_add(&self, config_fn: F) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationRouteAddWhen, + operations::NetworkingSwitchPortConfigurationRouteAddThen, + ); + fn networking_switch_port_configuration_route_remove(&self, config_fn: F) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationRouteRemoveWhen, + operations::NetworkingSwitchPortConfigurationRouteRemoveThen, + ); fn system_policy_view(&self, config_fn: F) -> httpmock::Mock where F: FnOnce(operations::SystemPolicyViewWhen, operations::SystemPolicyViewThen); @@ -19816,254 +19705,230 @@ impl MockServerExt for httpmock::MockServer { }) } - fn networking_switch_port_configuration_geometry_view(&self, config_fn: F) -> httpmock::Mock + fn networking_switch_port_configuration_address_list(&self, config_fn: F) -> httpmock::Mock where F: FnOnce( - operations::NetworkingSwitchPortConfigurationGeometryViewWhen, - operations::NetworkingSwitchPortConfigurationGeometryViewThen, + operations::NetworkingSwitchPortConfigurationAddressListWhen, + operations::NetworkingSwitchPortConfigurationAddressListThen, ), { self.mock(|when, then| { config_fn( - operations::NetworkingSwitchPortConfigurationGeometryViewWhen::new(when), - operations::NetworkingSwitchPortConfigurationGeometryViewThen::new(then), + operations::NetworkingSwitchPortConfigurationAddressListWhen::new(when), + operations::NetworkingSwitchPortConfigurationAddressListThen::new(then), ) }) } - fn networking_switch_port_configuration_geometry_set(&self, config_fn: F) -> httpmock::Mock + fn networking_switch_port_configuration_address_add(&self, config_fn: F) -> httpmock::Mock where F: FnOnce( - operations::NetworkingSwitchPortConfigurationGeometrySetWhen, - operations::NetworkingSwitchPortConfigurationGeometrySetThen, + operations::NetworkingSwitchPortConfigurationAddressAddWhen, + operations::NetworkingSwitchPortConfigurationAddressAddThen, ), { self.mock(|when, then| { config_fn( - operations::NetworkingSwitchPortConfigurationGeometrySetWhen::new(when), - operations::NetworkingSwitchPortConfigurationGeometrySetThen::new(then), + operations::NetworkingSwitchPortConfigurationAddressAddWhen::new(when), + operations::NetworkingSwitchPortConfigurationAddressAddThen::new(then), ) }) } - fn networking_switch_port_configuration_interface_address_list( - &self, - config_fn: F, - ) -> httpmock::Mock + fn networking_switch_port_configuration_address_remove(&self, config_fn: F) -> httpmock::Mock where F: FnOnce( - operations::NetworkingSwitchPortConfigurationInterfaceAddressListWhen, - operations::NetworkingSwitchPortConfigurationInterfaceAddressListThen, + operations::NetworkingSwitchPortConfigurationAddressRemoveWhen, + operations::NetworkingSwitchPortConfigurationAddressRemoveThen, ), { self.mock(|when, then| { config_fn( - operations::NetworkingSwitchPortConfigurationInterfaceAddressListWhen::new(when), - operations::NetworkingSwitchPortConfigurationInterfaceAddressListThen::new(then), + operations::NetworkingSwitchPortConfigurationAddressRemoveWhen::new(when), + operations::NetworkingSwitchPortConfigurationAddressRemoveThen::new(then), ) }) } - fn networking_switch_port_configuration_interface_address_add( - &self, - config_fn: F, - ) -> httpmock::Mock + fn networking_switch_port_configuration_bgp_peer_list(&self, config_fn: F) -> httpmock::Mock where F: FnOnce( - operations::NetworkingSwitchPortConfigurationInterfaceAddressAddWhen, - operations::NetworkingSwitchPortConfigurationInterfaceAddressAddThen, + operations::NetworkingSwitchPortConfigurationBgpPeerListWhen, + operations::NetworkingSwitchPortConfigurationBgpPeerListThen, ), { self.mock(|when, then| { config_fn( - operations::NetworkingSwitchPortConfigurationInterfaceAddressAddWhen::new(when), - operations::NetworkingSwitchPortConfigurationInterfaceAddressAddThen::new(then), + operations::NetworkingSwitchPortConfigurationBgpPeerListWhen::new(when), + operations::NetworkingSwitchPortConfigurationBgpPeerListThen::new(then), ) }) } - fn networking_switch_port_configuration_interface_address_remove( - &self, - config_fn: F, - ) -> httpmock::Mock + fn networking_switch_port_configuration_bgp_peer_add(&self, config_fn: F) -> httpmock::Mock where F: FnOnce( - operations::NetworkingSwitchPortConfigurationInterfaceAddressRemoveWhen, - operations::NetworkingSwitchPortConfigurationInterfaceAddressRemoveThen, + operations::NetworkingSwitchPortConfigurationBgpPeerAddWhen, + operations::NetworkingSwitchPortConfigurationBgpPeerAddThen, ), { self.mock(|when, then| { config_fn( - operations::NetworkingSwitchPortConfigurationInterfaceAddressRemoveWhen::new(when), - operations::NetworkingSwitchPortConfigurationInterfaceAddressRemoveThen::new(then), + operations::NetworkingSwitchPortConfigurationBgpPeerAddWhen::new(when), + operations::NetworkingSwitchPortConfigurationBgpPeerAddThen::new(then), ) }) } - fn networking_switch_port_configuration_interface_bgp_peer_list( + fn networking_switch_port_configuration_bgp_peer_remove( &self, config_fn: F, ) -> httpmock::Mock where F: FnOnce( - operations::NetworkingSwitchPortConfigurationInterfaceBgpPeerListWhen, - operations::NetworkingSwitchPortConfigurationInterfaceBgpPeerListThen, + operations::NetworkingSwitchPortConfigurationBgpPeerRemoveWhen, + operations::NetworkingSwitchPortConfigurationBgpPeerRemoveThen, ), { self.mock(|when, then| { config_fn( - operations::NetworkingSwitchPortConfigurationInterfaceBgpPeerListWhen::new(when), - operations::NetworkingSwitchPortConfigurationInterfaceBgpPeerListThen::new(then), + operations::NetworkingSwitchPortConfigurationBgpPeerRemoveWhen::new(when), + operations::NetworkingSwitchPortConfigurationBgpPeerRemoveThen::new(then), ) }) } - fn networking_switch_port_configuration_interface_bgp_peer_add( - &self, - config_fn: F, - ) -> httpmock::Mock + fn networking_switch_port_configuration_geometry_view(&self, config_fn: F) -> httpmock::Mock where F: FnOnce( - operations::NetworkingSwitchPortConfigurationInterfaceBgpPeerAddWhen, - operations::NetworkingSwitchPortConfigurationInterfaceBgpPeerAddThen, + operations::NetworkingSwitchPortConfigurationGeometryViewWhen, + operations::NetworkingSwitchPortConfigurationGeometryViewThen, ), { self.mock(|when, then| { config_fn( - operations::NetworkingSwitchPortConfigurationInterfaceBgpPeerAddWhen::new(when), - operations::NetworkingSwitchPortConfigurationInterfaceBgpPeerAddThen::new(then), + operations::NetworkingSwitchPortConfigurationGeometryViewWhen::new(when), + operations::NetworkingSwitchPortConfigurationGeometryViewThen::new(then), ) }) } - fn networking_switch_port_configuration_interface_bgp_peer_remove( - &self, - config_fn: F, - ) -> httpmock::Mock + fn networking_switch_port_configuration_geometry_set(&self, config_fn: F) -> httpmock::Mock where F: FnOnce( - operations::NetworkingSwitchPortConfigurationInterfaceBgpPeerRemoveWhen, - operations::NetworkingSwitchPortConfigurationInterfaceBgpPeerRemoveThen, + operations::NetworkingSwitchPortConfigurationGeometrySetWhen, + operations::NetworkingSwitchPortConfigurationGeometrySetThen, ), { self.mock(|when, then| { config_fn( - operations::NetworkingSwitchPortConfigurationInterfaceBgpPeerRemoveWhen::new(when), - operations::NetworkingSwitchPortConfigurationInterfaceBgpPeerRemoveThen::new(then), + operations::NetworkingSwitchPortConfigurationGeometrySetWhen::new(when), + operations::NetworkingSwitchPortConfigurationGeometrySetThen::new(then), ) }) } - fn networking_switch_port_configuration_interface_route_list( - &self, - config_fn: F, - ) -> httpmock::Mock + fn networking_switch_port_configuration_link_list(&self, config_fn: F) -> httpmock::Mock where F: FnOnce( - operations::NetworkingSwitchPortConfigurationInterfaceRouteListWhen, - operations::NetworkingSwitchPortConfigurationInterfaceRouteListThen, + operations::NetworkingSwitchPortConfigurationLinkListWhen, + operations::NetworkingSwitchPortConfigurationLinkListThen, ), { self.mock(|when, then| { config_fn( - operations::NetworkingSwitchPortConfigurationInterfaceRouteListWhen::new(when), - operations::NetworkingSwitchPortConfigurationInterfaceRouteListThen::new(then), + operations::NetworkingSwitchPortConfigurationLinkListWhen::new(when), + operations::NetworkingSwitchPortConfigurationLinkListThen::new(then), ) }) } - fn networking_switch_port_configuration_interface_route_add( - &self, - config_fn: F, - ) -> httpmock::Mock + fn networking_switch_port_configuration_link_create(&self, config_fn: F) -> httpmock::Mock where F: FnOnce( - operations::NetworkingSwitchPortConfigurationInterfaceRouteAddWhen, - operations::NetworkingSwitchPortConfigurationInterfaceRouteAddThen, + operations::NetworkingSwitchPortConfigurationLinkCreateWhen, + operations::NetworkingSwitchPortConfigurationLinkCreateThen, ), { self.mock(|when, then| { config_fn( - operations::NetworkingSwitchPortConfigurationInterfaceRouteAddWhen::new(when), - operations::NetworkingSwitchPortConfigurationInterfaceRouteAddThen::new(then), + operations::NetworkingSwitchPortConfigurationLinkCreateWhen::new(when), + operations::NetworkingSwitchPortConfigurationLinkCreateThen::new(then), ) }) } - fn networking_switch_port_configuration_interface_route_remove( - &self, - config_fn: F, - ) -> httpmock::Mock + fn networking_switch_port_configuration_link_view(&self, config_fn: F) -> httpmock::Mock where F: FnOnce( - operations::NetworkingSwitchPortConfigurationInterfaceRouteRemoveWhen, - operations::NetworkingSwitchPortConfigurationInterfaceRouteRemoveThen, + operations::NetworkingSwitchPortConfigurationLinkViewWhen, + operations::NetworkingSwitchPortConfigurationLinkViewThen, ), { self.mock(|when, then| { config_fn( - operations::NetworkingSwitchPortConfigurationInterfaceRouteRemoveWhen::new(when), - operations::NetworkingSwitchPortConfigurationInterfaceRouteRemoveThen::new(then), + operations::NetworkingSwitchPortConfigurationLinkViewWhen::new(when), + operations::NetworkingSwitchPortConfigurationLinkViewThen::new(then), ) }) } - fn networking_switch_port_configuration_link_list(&self, config_fn: F) -> httpmock::Mock + fn networking_switch_port_configuration_link_delete(&self, config_fn: F) -> httpmock::Mock where F: FnOnce( - operations::NetworkingSwitchPortConfigurationLinkListWhen, - operations::NetworkingSwitchPortConfigurationLinkListThen, + operations::NetworkingSwitchPortConfigurationLinkDeleteWhen, + operations::NetworkingSwitchPortConfigurationLinkDeleteThen, ), { self.mock(|when, then| { config_fn( - operations::NetworkingSwitchPortConfigurationLinkListWhen::new(when), - operations::NetworkingSwitchPortConfigurationLinkListThen::new(then), + operations::NetworkingSwitchPortConfigurationLinkDeleteWhen::new(when), + operations::NetworkingSwitchPortConfigurationLinkDeleteThen::new(then), ) }) } - fn networking_switch_port_configuration_link_create(&self, config_fn: F) -> httpmock::Mock + fn networking_switch_port_configuration_route_list(&self, config_fn: F) -> httpmock::Mock where F: FnOnce( - operations::NetworkingSwitchPortConfigurationLinkCreateWhen, - operations::NetworkingSwitchPortConfigurationLinkCreateThen, + operations::NetworkingSwitchPortConfigurationRouteListWhen, + operations::NetworkingSwitchPortConfigurationRouteListThen, ), { self.mock(|when, then| { config_fn( - operations::NetworkingSwitchPortConfigurationLinkCreateWhen::new(when), - operations::NetworkingSwitchPortConfigurationLinkCreateThen::new(then), + operations::NetworkingSwitchPortConfigurationRouteListWhen::new(when), + operations::NetworkingSwitchPortConfigurationRouteListThen::new(then), ) }) } - fn networking_switch_port_configuration_link_view(&self, config_fn: F) -> httpmock::Mock + fn networking_switch_port_configuration_route_add(&self, config_fn: F) -> httpmock::Mock where F: FnOnce( - operations::NetworkingSwitchPortConfigurationLinkViewWhen, - operations::NetworkingSwitchPortConfigurationLinkViewThen, + operations::NetworkingSwitchPortConfigurationRouteAddWhen, + operations::NetworkingSwitchPortConfigurationRouteAddThen, ), { self.mock(|when, then| { config_fn( - operations::NetworkingSwitchPortConfigurationLinkViewWhen::new(when), - operations::NetworkingSwitchPortConfigurationLinkViewThen::new(then), + operations::NetworkingSwitchPortConfigurationRouteAddWhen::new(when), + operations::NetworkingSwitchPortConfigurationRouteAddThen::new(then), ) }) } - fn networking_switch_port_configuration_link_delete(&self, config_fn: F) -> httpmock::Mock + fn networking_switch_port_configuration_route_remove(&self, config_fn: F) -> httpmock::Mock where F: FnOnce( - operations::NetworkingSwitchPortConfigurationLinkDeleteWhen, - operations::NetworkingSwitchPortConfigurationLinkDeleteThen, + operations::NetworkingSwitchPortConfigurationRouteRemoveWhen, + operations::NetworkingSwitchPortConfigurationRouteRemoveThen, ), { self.mock(|when, then| { config_fn( - operations::NetworkingSwitchPortConfigurationLinkDeleteWhen::new(when), - operations::NetworkingSwitchPortConfigurationLinkDeleteThen::new(then), + operations::NetworkingSwitchPortConfigurationRouteRemoveWhen::new(when), + operations::NetworkingSwitchPortConfigurationRouteRemoveThen::new(then), ) }) } diff --git a/sdk/src/generated_sdk.rs b/sdk/src/generated_sdk.rs index a4505235..92b89627 100644 --- a/sdk/src/generated_sdk.rs +++ b/sdk/src/generated_sdk.rs @@ -106,6 +106,84 @@ pub mod types { } } + /// An address to be added or removed from an interface + /// + ///
JSON schema + /// + /// ```json + /// { + /// "description": "An address to be added or removed from an interface", + /// "type": "object", + /// "required": [ + /// "address", + /// "address_lot", + /// "interface" + /// ], + /// "properties": { + /// "address": { + /// "description": "The address and prefix length of this address.", + /// "allOf": [ + /// { + /// "$ref": "#/components/schemas/IpNet" + /// } + /// ] + /// }, + /// "address_lot": { + /// "description": "The address lot this address is drawn from.", + /// "allOf": [ + /// { + /// "$ref": "#/components/schemas/NameOrId" + /// } + /// ] + /// }, + /// "interface": { + /// "description": "The name of the interface", + /// "allOf": [ + /// { + /// "$ref": "#/components/schemas/Name" + /// } + /// ] + /// }, + /// "vlan_id": { + /// "description": "Optional VLAN ID for this address", + /// "type": [ + /// "integer", + /// "null" + /// ], + /// "format": "uint16", + /// "minimum": 0.0 + /// } + /// } + /// } + /// ``` + ///
+ #[derive( + :: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, schemars :: JsonSchema, + )] + pub struct AddressAddRemove { + /// The address and prefix length of this address. + pub address: IpNet, + /// The address lot this address is drawn from. + pub address_lot: NameOrId, + /// The name of the interface + pub interface: Name, + /// Optional VLAN ID for this address + #[serde(default, skip_serializing_if = "Option::is_none")] + pub vlan_id: Option, + } + + impl From<&AddressAddRemove> for AddressAddRemove { + fn from(value: &AddressAddRemove) -> Self { + value.clone() + } + } + + impl AddressAddRemove { + pub fn builder() -> builder::AddressAddRemove { + Default::default() + } + } + /// A set of addresses associated with a port configuration. /// ///
JSON schema @@ -27281,6 +27359,91 @@ pub mod types { } } + #[derive(Clone, Debug)] + pub struct AddressAddRemove { + address: Result, + address_lot: Result, + interface: Result, + vlan_id: Result, String>, + } + + impl Default for AddressAddRemove { + fn default() -> Self { + Self { + address: Err("no value supplied for address".to_string()), + address_lot: Err("no value supplied for address_lot".to_string()), + interface: Err("no value supplied for interface".to_string()), + vlan_id: Ok(Default::default()), + } + } + } + + impl AddressAddRemove { + pub fn address(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.address = value + .try_into() + .map_err(|e| format!("error converting supplied value for address: {}", e)); + self + } + pub fn address_lot(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.address_lot = value + .try_into() + .map_err(|e| format!("error converting supplied value for address_lot: {}", e)); + self + } + pub fn interface(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.interface = value + .try_into() + .map_err(|e| format!("error converting supplied value for interface: {}", e)); + self + } + pub fn vlan_id(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.vlan_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for vlan_id: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::AddressAddRemove { + type Error = super::error::ConversionError; + fn try_from(value: AddressAddRemove) -> Result { + Ok(Self { + address: value.address?, + address_lot: value.address_lot?, + interface: value.interface?, + vlan_id: value.vlan_id?, + }) + } + } + + impl From for AddressAddRemove { + fn from(value: super::AddressAddRemove) -> Self { + Self { + address: Ok(value.address), + address_lot: Ok(value.address_lot), + interface: Ok(value.interface), + vlan_id: Ok(value.vlan_id), + } + } + } + #[derive(Clone, Debug)] pub struct AddressConfig { addresses: Result, String>, @@ -49979,236 +50142,160 @@ pub trait ClientSystemNetworkingExt { fn networking_switch_port_configuration_view( &self, ) -> builder::NetworkingSwitchPortConfigurationView; - /// Get switch port geometry for a provided switch port configuration - /// - /// Sends a `GET` request to - /// `/v1/system/networking/switch-port-configuration/{configuration}/ - /// geometry` - /// - /// Arguments: - /// - `configuration`: A name or id to use when selecting a switch port - /// configuration. - /// ```ignore - /// let response = client.networking_switch_port_configuration_geometry_view() - /// .configuration(configuration) - /// .send() - /// .await; - /// ``` - fn networking_switch_port_configuration_geometry_view( - &self, - ) -> builder::NetworkingSwitchPortConfigurationGeometryView; - /// Set switch port geometry for a provided switch port configuration - /// - /// Sends a `POST` request to - /// `/v1/system/networking/switch-port-configuration/{configuration}/ - /// geometry` - /// - /// Arguments: - /// - `configuration`: A name or id to use when selecting a switch port - /// configuration. - /// - `body` - /// ```ignore - /// let response = client.networking_switch_port_configuration_geometry_set() - /// .configuration(configuration) - /// .body(body) - /// .send() - /// .await; - /// ``` - fn networking_switch_port_configuration_geometry_set( - &self, - ) -> builder::NetworkingSwitchPortConfigurationGeometrySet; /// List addresses assigned to a provided interface configuration /// /// Sends a `GET` request to /// `/v1/system/networking/switch-port-configuration/{configuration}/ - /// interface/{interface}/address` + /// address` /// /// Arguments: /// - `configuration`: A name or id to use when selecting a switch port /// configuration. - /// - `interface`: Interface name /// ```ignore - /// let response = client.networking_switch_port_configuration_interface_address_list() + /// let response = client.networking_switch_port_configuration_address_list() /// .configuration(configuration) - /// .interface(interface) /// .send() /// .await; /// ``` - fn networking_switch_port_configuration_interface_address_list( + fn networking_switch_port_configuration_address_list( &self, - ) -> builder::NetworkingSwitchPortConfigurationInterfaceAddressList; + ) -> builder::NetworkingSwitchPortConfigurationAddressList; /// Add address to an interface configuration /// /// Sends a `POST` request to /// `/v1/system/networking/switch-port-configuration/{configuration}/ - /// interface/{interface}/address/add` + /// address/add` /// /// Arguments: /// - `configuration`: A name or id to use when selecting a switch port /// configuration. - /// - `interface`: Interface name /// - `body` /// ```ignore - /// let response = client.networking_switch_port_configuration_interface_address_add() + /// let response = client.networking_switch_port_configuration_address_add() /// .configuration(configuration) - /// .interface(interface) /// .body(body) /// .send() /// .await; /// ``` - fn networking_switch_port_configuration_interface_address_add( + fn networking_switch_port_configuration_address_add( &self, - ) -> builder::NetworkingSwitchPortConfigurationInterfaceAddressAdd; + ) -> builder::NetworkingSwitchPortConfigurationAddressAdd; /// Remove address from an interface configuration /// /// Sends a `POST` request to /// `/v1/system/networking/switch-port-configuration/{configuration}/ - /// interface/{interface}/address/remove` + /// address/remove` /// /// Arguments: /// - `configuration`: A name or id to use when selecting a switch port /// configuration. - /// - `interface`: Interface name /// - `body` /// ```ignore - /// let response = client.networking_switch_port_configuration_interface_address_remove() + /// let response = client.networking_switch_port_configuration_address_remove() /// .configuration(configuration) - /// .interface(interface) /// .body(body) /// .send() /// .await; /// ``` - fn networking_switch_port_configuration_interface_address_remove( + fn networking_switch_port_configuration_address_remove( &self, - ) -> builder::NetworkingSwitchPortConfigurationInterfaceAddressRemove; + ) -> builder::NetworkingSwitchPortConfigurationAddressRemove; /// List bgp peers assigned to a provided interface configuration /// /// Sends a `GET` request to /// `/v1/system/networking/switch-port-configuration/{configuration}/ - /// interface/{interface}/bgp-peer` + /// bgp-peer` /// /// Arguments: /// - `configuration`: A name or id to use when selecting a switch port /// configuration. - /// - `interface`: Interface name /// ```ignore - /// let response = client.networking_switch_port_configuration_interface_bgp_peer_list() + /// let response = client.networking_switch_port_configuration_bgp_peer_list() /// .configuration(configuration) - /// .interface(interface) /// .send() /// .await; /// ``` - fn networking_switch_port_configuration_interface_bgp_peer_list( + fn networking_switch_port_configuration_bgp_peer_list( &self, - ) -> builder::NetworkingSwitchPortConfigurationInterfaceBgpPeerList; + ) -> builder::NetworkingSwitchPortConfigurationBgpPeerList; /// Add bgp peer to an interface configuration /// /// Sends a `POST` request to /// `/v1/system/networking/switch-port-configuration/{configuration}/ - /// interface/{interface}/bgp-peer/add` + /// bgp-peer/add` /// /// Arguments: /// - `configuration`: A name or id to use when selecting a switch port /// configuration. - /// - `interface`: Interface name /// - `body` /// ```ignore - /// let response = client.networking_switch_port_configuration_interface_bgp_peer_add() + /// let response = client.networking_switch_port_configuration_bgp_peer_add() /// .configuration(configuration) - /// .interface(interface) /// .body(body) /// .send() /// .await; /// ``` - fn networking_switch_port_configuration_interface_bgp_peer_add( + fn networking_switch_port_configuration_bgp_peer_add( &self, - ) -> builder::NetworkingSwitchPortConfigurationInterfaceBgpPeerAdd; + ) -> builder::NetworkingSwitchPortConfigurationBgpPeerAdd; /// Remove bgp peer from an interface configuration /// /// Sends a `POST` request to /// `/v1/system/networking/switch-port-configuration/{configuration}/ - /// interface/{interface}/bgp-peer/remove` + /// bgp-peer/remove` /// /// Arguments: /// - `configuration`: A name or id to use when selecting a switch port /// configuration. - /// - `interface`: Interface name /// - `body` /// ```ignore - /// let response = client.networking_switch_port_configuration_interface_bgp_peer_remove() + /// let response = client.networking_switch_port_configuration_bgp_peer_remove() /// .configuration(configuration) - /// .interface(interface) /// .body(body) /// .send() /// .await; /// ``` - fn networking_switch_port_configuration_interface_bgp_peer_remove( + fn networking_switch_port_configuration_bgp_peer_remove( &self, - ) -> builder::NetworkingSwitchPortConfigurationInterfaceBgpPeerRemove; - /// List routes assigned to a provided interface configuration + ) -> builder::NetworkingSwitchPortConfigurationBgpPeerRemove; + /// Get switch port geometry for a provided switch port configuration /// /// Sends a `GET` request to /// `/v1/system/networking/switch-port-configuration/{configuration}/ - /// interface/{interface}/route` - /// - /// Arguments: - /// - `configuration`: A name or id to use when selecting a switch port - /// configuration. - /// - `interface`: Interface name - /// ```ignore - /// let response = client.networking_switch_port_configuration_interface_route_list() - /// .configuration(configuration) - /// .interface(interface) - /// .send() - /// .await; - /// ``` - fn networking_switch_port_configuration_interface_route_list( - &self, - ) -> builder::NetworkingSwitchPortConfigurationInterfaceRouteList; - /// Add route to an interface configuration - /// - /// Sends a `POST` request to - /// `/v1/system/networking/switch-port-configuration/{configuration}/ - /// interface/{interface}/route/add` + /// geometry` /// /// Arguments: /// - `configuration`: A name or id to use when selecting a switch port /// configuration. - /// - `interface`: Interface name - /// - `body` /// ```ignore - /// let response = client.networking_switch_port_configuration_interface_route_add() + /// let response = client.networking_switch_port_configuration_geometry_view() /// .configuration(configuration) - /// .interface(interface) - /// .body(body) /// .send() /// .await; /// ``` - fn networking_switch_port_configuration_interface_route_add( + fn networking_switch_port_configuration_geometry_view( &self, - ) -> builder::NetworkingSwitchPortConfigurationInterfaceRouteAdd; - /// Remove address from an interface configuration + ) -> builder::NetworkingSwitchPortConfigurationGeometryView; + /// Set switch port geometry for a provided switch port configuration /// /// Sends a `POST` request to /// `/v1/system/networking/switch-port-configuration/{configuration}/ - /// interface/{interface}/route/remove` + /// geometry` /// /// Arguments: /// - `configuration`: A name or id to use when selecting a switch port /// configuration. - /// - `interface`: Interface name /// - `body` /// ```ignore - /// let response = client.networking_switch_port_configuration_interface_route_remove() + /// let response = client.networking_switch_port_configuration_geometry_set() /// .configuration(configuration) - /// .interface(interface) /// .body(body) /// .send() /// .await; /// ``` - fn networking_switch_port_configuration_interface_route_remove( + fn networking_switch_port_configuration_geometry_set( &self, - ) -> builder::NetworkingSwitchPortConfigurationInterfaceRouteRemove; + ) -> builder::NetworkingSwitchPortConfigurationGeometrySet; /// List links for a provided switch port configuration /// /// Sends a `GET` request to @@ -50285,6 +50372,63 @@ pub trait ClientSystemNetworkingExt { fn networking_switch_port_configuration_link_delete( &self, ) -> builder::NetworkingSwitchPortConfigurationLinkDelete; + /// List routes assigned to a provided interface configuration + /// + /// Sends a `GET` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/route` + /// + /// Arguments: + /// - `configuration`: A name or id to use when selecting a switch port + /// configuration. + /// ```ignore + /// let response = client.networking_switch_port_configuration_route_list() + /// .configuration(configuration) + /// .send() + /// .await; + /// ``` + fn networking_switch_port_configuration_route_list( + &self, + ) -> builder::NetworkingSwitchPortConfigurationRouteList; + /// Add route to an interface configuration + /// + /// Sends a `POST` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/route/ + /// add` + /// + /// Arguments: + /// - `configuration`: A name or id to use when selecting a switch port + /// configuration. + /// - `body` + /// ```ignore + /// let response = client.networking_switch_port_configuration_route_add() + /// .configuration(configuration) + /// .body(body) + /// .send() + /// .await; + /// ``` + fn networking_switch_port_configuration_route_add( + &self, + ) -> builder::NetworkingSwitchPortConfigurationRouteAdd; + /// Remove address from an interface configuration + /// + /// Sends a `POST` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/route/ + /// remove` + /// + /// Arguments: + /// - `configuration`: A name or id to use when selecting a switch port + /// configuration. + /// - `body` + /// ```ignore + /// let response = client.networking_switch_port_configuration_route_remove() + /// .configuration(configuration) + /// .body(body) + /// .send() + /// .await; + /// ``` + fn networking_switch_port_configuration_route_remove( + &self, + ) -> builder::NetworkingSwitchPortConfigurationRouteRemove; } impl ClientSystemNetworkingExt for Client { @@ -50480,70 +50624,52 @@ impl ClientSystemNetworkingExt for Client { builder::NetworkingSwitchPortConfigurationView::new(self) } - fn networking_switch_port_configuration_geometry_view( + fn networking_switch_port_configuration_address_list( &self, - ) -> builder::NetworkingSwitchPortConfigurationGeometryView { - builder::NetworkingSwitchPortConfigurationGeometryView::new(self) - } - - fn networking_switch_port_configuration_geometry_set( - &self, - ) -> builder::NetworkingSwitchPortConfigurationGeometrySet { - builder::NetworkingSwitchPortConfigurationGeometrySet::new(self) + ) -> builder::NetworkingSwitchPortConfigurationAddressList { + builder::NetworkingSwitchPortConfigurationAddressList::new(self) } - fn networking_switch_port_configuration_interface_address_list( + fn networking_switch_port_configuration_address_add( &self, - ) -> builder::NetworkingSwitchPortConfigurationInterfaceAddressList { - builder::NetworkingSwitchPortConfigurationInterfaceAddressList::new(self) + ) -> builder::NetworkingSwitchPortConfigurationAddressAdd { + builder::NetworkingSwitchPortConfigurationAddressAdd::new(self) } - fn networking_switch_port_configuration_interface_address_add( + fn networking_switch_port_configuration_address_remove( &self, - ) -> builder::NetworkingSwitchPortConfigurationInterfaceAddressAdd { - builder::NetworkingSwitchPortConfigurationInterfaceAddressAdd::new(self) + ) -> builder::NetworkingSwitchPortConfigurationAddressRemove { + builder::NetworkingSwitchPortConfigurationAddressRemove::new(self) } - fn networking_switch_port_configuration_interface_address_remove( + fn networking_switch_port_configuration_bgp_peer_list( &self, - ) -> builder::NetworkingSwitchPortConfigurationInterfaceAddressRemove { - builder::NetworkingSwitchPortConfigurationInterfaceAddressRemove::new(self) + ) -> builder::NetworkingSwitchPortConfigurationBgpPeerList { + builder::NetworkingSwitchPortConfigurationBgpPeerList::new(self) } - fn networking_switch_port_configuration_interface_bgp_peer_list( + fn networking_switch_port_configuration_bgp_peer_add( &self, - ) -> builder::NetworkingSwitchPortConfigurationInterfaceBgpPeerList { - builder::NetworkingSwitchPortConfigurationInterfaceBgpPeerList::new(self) + ) -> builder::NetworkingSwitchPortConfigurationBgpPeerAdd { + builder::NetworkingSwitchPortConfigurationBgpPeerAdd::new(self) } - fn networking_switch_port_configuration_interface_bgp_peer_add( + fn networking_switch_port_configuration_bgp_peer_remove( &self, - ) -> builder::NetworkingSwitchPortConfigurationInterfaceBgpPeerAdd { - builder::NetworkingSwitchPortConfigurationInterfaceBgpPeerAdd::new(self) + ) -> builder::NetworkingSwitchPortConfigurationBgpPeerRemove { + builder::NetworkingSwitchPortConfigurationBgpPeerRemove::new(self) } - fn networking_switch_port_configuration_interface_bgp_peer_remove( - &self, - ) -> builder::NetworkingSwitchPortConfigurationInterfaceBgpPeerRemove { - builder::NetworkingSwitchPortConfigurationInterfaceBgpPeerRemove::new(self) - } - - fn networking_switch_port_configuration_interface_route_list( - &self, - ) -> builder::NetworkingSwitchPortConfigurationInterfaceRouteList { - builder::NetworkingSwitchPortConfigurationInterfaceRouteList::new(self) - } - - fn networking_switch_port_configuration_interface_route_add( + fn networking_switch_port_configuration_geometry_view( &self, - ) -> builder::NetworkingSwitchPortConfigurationInterfaceRouteAdd { - builder::NetworkingSwitchPortConfigurationInterfaceRouteAdd::new(self) + ) -> builder::NetworkingSwitchPortConfigurationGeometryView { + builder::NetworkingSwitchPortConfigurationGeometryView::new(self) } - fn networking_switch_port_configuration_interface_route_remove( + fn networking_switch_port_configuration_geometry_set( &self, - ) -> builder::NetworkingSwitchPortConfigurationInterfaceRouteRemove { - builder::NetworkingSwitchPortConfigurationInterfaceRouteRemove::new(self) + ) -> builder::NetworkingSwitchPortConfigurationGeometrySet { + builder::NetworkingSwitchPortConfigurationGeometrySet::new(self) } fn networking_switch_port_configuration_link_list( @@ -50569,6 +50695,24 @@ impl ClientSystemNetworkingExt for Client { ) -> builder::NetworkingSwitchPortConfigurationLinkDelete { builder::NetworkingSwitchPortConfigurationLinkDelete::new(self) } + + fn networking_switch_port_configuration_route_list( + &self, + ) -> builder::NetworkingSwitchPortConfigurationRouteList { + builder::NetworkingSwitchPortConfigurationRouteList::new(self) + } + + fn networking_switch_port_configuration_route_add( + &self, + ) -> builder::NetworkingSwitchPortConfigurationRouteAdd { + builder::NetworkingSwitchPortConfigurationRouteAdd::new(self) + } + + fn networking_switch_port_configuration_route_remove( + &self, + ) -> builder::NetworkingSwitchPortConfigurationRouteRemove { + builder::NetworkingSwitchPortConfigurationRouteRemove::new(self) + } } /// Silos represent a logical partition of users and resources. @@ -66737,16 +66881,16 @@ pub mod builder { } /// Builder for - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_geometry_view`] + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_address_list`] /// - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_geometry_view`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_geometry_view + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_address_list`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_address_list #[derive(Debug, Clone)] - pub struct NetworkingSwitchPortConfigurationGeometryView<'a> { + pub struct NetworkingSwitchPortConfigurationAddressList<'a> { client: &'a super::Client, configuration: Result, } - impl<'a> NetworkingSwitchPortConfigurationGeometryView<'a> { + impl<'a> NetworkingSwitchPortConfigurationAddressList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, @@ -66766,17 +66910,18 @@ pub mod builder { /// Sends a `GET` request to /// `/v1/system/networking/switch-port-configuration/{configuration}/ - /// geometry` + /// address` pub async fn send( self, - ) -> Result, Error> { + ) -> Result>, Error> + { let Self { client, configuration, } = self; let configuration = configuration.map_err(Error::InvalidRequest)?; let url = format!( - "{}/v1/system/networking/switch-port-configuration/{}/geometry", + "{}/v1/system/networking/switch-port-configuration/{}/address", client.baseurl, encode_path(&configuration.to_string()), ); @@ -66805,22 +66950,22 @@ pub mod builder { } /// Builder for - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_geometry_set`] + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_address_add`] /// - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_geometry_set`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_geometry_set + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_address_add`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_address_add #[derive(Debug, Clone)] - pub struct NetworkingSwitchPortConfigurationGeometrySet<'a> { + pub struct NetworkingSwitchPortConfigurationAddressAdd<'a> { client: &'a super::Client, configuration: Result, - body: Result, + body: Result, } - impl<'a> NetworkingSwitchPortConfigurationGeometrySet<'a> { + impl<'a> NetworkingSwitchPortConfigurationAddressAdd<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, configuration: Err("configuration was not initialized".to_string()), - body: Ok(types::builder::SwitchPortConfigCreate::default()), + body: Ok(types::builder::AddressAddRemove::default()), } } @@ -66836,23 +66981,21 @@ pub mod builder { pub fn body(mut self, value: V) -> Self where - V: std::convert::TryInto, - >::Error: std::fmt::Display, + V: std::convert::TryInto, + >::Error: std::fmt::Display, { - self.body = value.try_into().map(From::from).map_err(|s| { - format!( - "conversion to `SwitchPortConfigCreate` for body failed: {}", - s - ) - }); + self.body = value + .try_into() + .map(From::from) + .map_err(|s| format!("conversion to `AddressAddRemove` for body failed: {}", s)); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce( - types::builder::SwitchPortConfigCreate, - ) -> types::builder::SwitchPortConfigCreate, + types::builder::AddressAddRemove, + ) -> types::builder::AddressAddRemove, { self.body = self.body.map(f); self @@ -66860,10 +67003,10 @@ pub mod builder { /// Sends a `POST` request to /// `/v1/system/networking/switch-port-configuration/{configuration}/ - /// geometry` + /// address/add` pub async fn send( self, - ) -> Result, Error> { + ) -> Result, Error> { let Self { client, configuration, @@ -66871,10 +67014,10 @@ pub mod builder { } = self; let configuration = configuration.map_err(Error::InvalidRequest)?; let body = body - .and_then(|v| types::SwitchPortConfigCreate::try_from(v).map_err(|e| e.to_string())) + .and_then(|v| types::AddressAddRemove::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; let url = format!( - "{}/v1/system/networking/switch-port-configuration/{}/geometry", + "{}/v1/system/networking/switch-port-configuration/{}/address/add", client.baseurl, encode_path(&configuration.to_string()), ); @@ -66904,22 +67047,22 @@ pub mod builder { } /// Builder for - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_interface_address_list`] + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_address_remove`] /// - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_interface_address_list`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_interface_address_list + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_address_remove`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_address_remove #[derive(Debug, Clone)] - pub struct NetworkingSwitchPortConfigurationInterfaceAddressList<'a> { + pub struct NetworkingSwitchPortConfigurationAddressRemove<'a> { client: &'a super::Client, configuration: Result, - interface: Result, + body: Result, } - impl<'a> NetworkingSwitchPortConfigurationInterfaceAddressList<'a> { + impl<'a> NetworkingSwitchPortConfigurationAddressRemove<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, configuration: Err("configuration was not initialized".to_string()), - interface: Err("interface was not initialized".to_string()), + body: Ok(types::builder::AddressAddRemove::default()), } } @@ -66933,49 +67076,60 @@ pub mod builder { self } - pub fn interface(mut self, value: V) -> Self + pub fn body(mut self, value: V) -> Self where - V: std::convert::TryInto, + V: std::convert::TryInto, + >::Error: std::fmt::Display, { - self.interface = value + self.body = value .try_into() - .map_err(|_| "conversion to `Name` for interface failed".to_string()); + .map(From::from) + .map_err(|s| format!("conversion to `AddressAddRemove` for body failed: {}", s)); self } - /// Sends a `GET` request to - /// `/v1/system/networking/switch-port-configuration/{configuration}/ - /// interface/{interface}/address` - pub async fn send( - self, - ) -> Result>, Error> + pub fn body_map(mut self, f: F) -> Self + where + F: std::ops::FnOnce( + types::builder::AddressAddRemove, + ) -> types::builder::AddressAddRemove, { + self.body = self.body.map(f); + self + } + + /// Sends a `POST` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// address/remove` + pub async fn send(self) -> Result, Error> { let Self { client, configuration, - interface, + body, } = self; let configuration = configuration.map_err(Error::InvalidRequest)?; - let interface = interface.map_err(Error::InvalidRequest)?; + let body = body + .and_then(|v| types::AddressAddRemove::try_from(v).map_err(|e| e.to_string())) + .map_err(Error::InvalidRequest)?; let url = format!( - "{}/v1/system/networking/switch-port-configuration/{}/interface/{}/address", + "{}/v1/system/networking/switch-port-configuration/{}/address/remove", client.baseurl, encode_path(&configuration.to_string()), - encode_path(&interface.to_string()), ); #[allow(unused_mut)] let mut request = client .client - .get(url) + .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) + .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, + 204u16 => Ok(ResponseValue::empty(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), @@ -66988,24 +67142,20 @@ pub mod builder { } /// Builder for - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_interface_address_add`] + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_list`] /// - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_interface_address_add`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_interface_address_add + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_list`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_list #[derive(Debug, Clone)] - pub struct NetworkingSwitchPortConfigurationInterfaceAddressAdd<'a> { + pub struct NetworkingSwitchPortConfigurationBgpPeerList<'a> { client: &'a super::Client, configuration: Result, - interface: Result, - body: Result, } - impl<'a> NetworkingSwitchPortConfigurationInterfaceAddressAdd<'a> { + impl<'a> NetworkingSwitchPortConfigurationBgpPeerList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, configuration: Err("configuration was not initialized".to_string()), - interface: Err("interface was not initialized".to_string()), - body: Ok(types::builder::Address::default()), } } @@ -67019,31 +67169,91 @@ pub mod builder { self } - pub fn interface(mut self, value: V) -> Self + /// Sends a `GET` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// bgp-peer` + pub async fn send( + self, + ) -> Result, Error> { + let Self { + client, + configuration, + } = self; + let configuration = configuration.map_err(Error::InvalidRequest)?; + let url = format!( + "{}/v1/system/networking/switch-port-configuration/{}/bgp-peer", + client.baseurl, + encode_path(&configuration.to_string()), + ); + #[allow(unused_mut)] + let mut request = client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + } + + /// Builder for + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_add`] + /// + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_add`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_add + #[derive(Debug, Clone)] + pub struct NetworkingSwitchPortConfigurationBgpPeerAdd<'a> { + client: &'a super::Client, + configuration: Result, + body: Result, + } + + impl<'a> NetworkingSwitchPortConfigurationBgpPeerAdd<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client: client, + configuration: Err("configuration was not initialized".to_string()), + body: Ok(types::builder::BgpPeer::default()), + } + } + + pub fn configuration(mut self, value: V) -> Self where - V: std::convert::TryInto, + V: std::convert::TryInto, { - self.interface = value + self.configuration = value .try_into() - .map_err(|_| "conversion to `Name` for interface failed".to_string()); + .map_err(|_| "conversion to `NameOrId` for configuration failed".to_string()); self } pub fn body(mut self, value: V) -> Self where - V: std::convert::TryInto, - >::Error: std::fmt::Display, + V: std::convert::TryInto, + >::Error: std::fmt::Display, { self.body = value .try_into() .map(From::from) - .map_err(|s| format!("conversion to `Address` for body failed: {}", s)); + .map_err(|s| format!("conversion to `BgpPeer` for body failed: {}", s)); self } pub fn body_map(mut self, f: F) -> Self where - F: std::ops::FnOnce(types::builder::Address) -> types::builder::Address, + F: std::ops::FnOnce(types::builder::BgpPeer) -> types::builder::BgpPeer, { self.body = self.body.map(f); self @@ -67051,26 +67261,21 @@ pub mod builder { /// Sends a `POST` request to /// `/v1/system/networking/switch-port-configuration/{configuration}/ - /// interface/{interface}/address/add` - pub async fn send( - self, - ) -> Result, Error> { + /// bgp-peer/add` + pub async fn send(self) -> Result, Error> { let Self { client, configuration, - interface, body, } = self; let configuration = configuration.map_err(Error::InvalidRequest)?; - let interface = interface.map_err(Error::InvalidRequest)?; let body = body - .and_then(|v| types::Address::try_from(v).map_err(|e| e.to_string())) + .and_then(|v| types::BgpPeer::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; let url = format!( - "{}/v1/system/networking/switch-port-configuration/{}/interface/{}/address/add", + "{}/v1/system/networking/switch-port-configuration/{}/bgp-peer/add", client.baseurl, encode_path(&configuration.to_string()), - encode_path(&interface.to_string()), ); #[allow(unused_mut)] let mut request = client @@ -67098,24 +67303,22 @@ pub mod builder { } /// Builder for - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_interface_address_remove`] + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_remove`] /// - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_interface_address_remove`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_interface_address_remove + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_remove`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_remove #[derive(Debug, Clone)] - pub struct NetworkingSwitchPortConfigurationInterfaceAddressRemove<'a> { + pub struct NetworkingSwitchPortConfigurationBgpPeerRemove<'a> { client: &'a super::Client, configuration: Result, - interface: Result, - body: Result, + body: Result, } - impl<'a> NetworkingSwitchPortConfigurationInterfaceAddressRemove<'a> { + impl<'a> NetworkingSwitchPortConfigurationBgpPeerRemove<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, configuration: Err("configuration was not initialized".to_string()), - interface: Err("interface was not initialized".to_string()), - body: Ok(types::builder::Address::default()), + body: Ok(types::builder::BgpPeer::default()), } } @@ -67129,31 +67332,21 @@ pub mod builder { self } - pub fn interface(mut self, value: V) -> Self - where - V: std::convert::TryInto, - { - self.interface = value - .try_into() - .map_err(|_| "conversion to `Name` for interface failed".to_string()); - self - } - pub fn body(mut self, value: V) -> Self where - V: std::convert::TryInto, - >::Error: std::fmt::Display, + V: std::convert::TryInto, + >::Error: std::fmt::Display, { self.body = value .try_into() .map(From::from) - .map_err(|s| format!("conversion to `Address` for body failed: {}", s)); + .map_err(|s| format!("conversion to `BgpPeer` for body failed: {}", s)); self } pub fn body_map(mut self, f: F) -> Self where - F: std::ops::FnOnce(types::builder::Address) -> types::builder::Address, + F: std::ops::FnOnce(types::builder::BgpPeer) -> types::builder::BgpPeer, { self.body = self.body.map(f); self @@ -67161,24 +67354,21 @@ pub mod builder { /// Sends a `POST` request to /// `/v1/system/networking/switch-port-configuration/{configuration}/ - /// interface/{interface}/address/remove` + /// bgp-peer/remove` pub async fn send(self) -> Result, Error> { let Self { client, configuration, - interface, body, } = self; let configuration = configuration.map_err(Error::InvalidRequest)?; - let interface = interface.map_err(Error::InvalidRequest)?; let body = body - .and_then(|v| types::Address::try_from(v).map_err(|e| e.to_string())) + .and_then(|v| types::BgpPeer::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; let url = format!( - "{}/v1/system/networking/switch-port-configuration/{}/interface/{}/address/remove", + "{}/v1/system/networking/switch-port-configuration/{}/bgp-peer/remove", client.baseurl, encode_path(&configuration.to_string()), - encode_path(&interface.to_string()), ); #[allow(unused_mut)] let mut request = client @@ -67206,22 +67396,20 @@ pub mod builder { } /// Builder for - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_interface_bgp_peer_list`] + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_geometry_view`] /// - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_interface_bgp_peer_list`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_interface_bgp_peer_list + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_geometry_view`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_geometry_view #[derive(Debug, Clone)] - pub struct NetworkingSwitchPortConfigurationInterfaceBgpPeerList<'a> { + pub struct NetworkingSwitchPortConfigurationGeometryView<'a> { client: &'a super::Client, configuration: Result, - interface: Result, } - impl<'a> NetworkingSwitchPortConfigurationInterfaceBgpPeerList<'a> { + impl<'a> NetworkingSwitchPortConfigurationGeometryView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, configuration: Err("configuration was not initialized".to_string()), - interface: Err("interface was not initialized".to_string()), } } @@ -67235,34 +67423,21 @@ pub mod builder { self } - pub fn interface(mut self, value: V) -> Self - where - V: std::convert::TryInto, - { - self.interface = value - .try_into() - .map_err(|_| "conversion to `Name` for interface failed".to_string()); - self - } - /// Sends a `GET` request to /// `/v1/system/networking/switch-port-configuration/{configuration}/ - /// interface/{interface}/bgp-peer` + /// geometry` pub async fn send( self, - ) -> Result, Error> { + ) -> Result, Error> { let Self { client, configuration, - interface, } = self; let configuration = configuration.map_err(Error::InvalidRequest)?; - let interface = interface.map_err(Error::InvalidRequest)?; let url = format!( - "{}/v1/system/networking/switch-port-configuration/{}/interface/{}/bgp-peer", + "{}/v1/system/networking/switch-port-configuration/{}/geometry", client.baseurl, encode_path(&configuration.to_string()), - encode_path(&interface.to_string()), ); #[allow(unused_mut)] let mut request = client @@ -67289,24 +67464,22 @@ pub mod builder { } /// Builder for - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_interface_bgp_peer_add`] + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_geometry_set`] /// - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_interface_bgp_peer_add`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_interface_bgp_peer_add + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_geometry_set`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_geometry_set #[derive(Debug, Clone)] - pub struct NetworkingSwitchPortConfigurationInterfaceBgpPeerAdd<'a> { + pub struct NetworkingSwitchPortConfigurationGeometrySet<'a> { client: &'a super::Client, configuration: Result, - interface: Result, - body: Result, + body: Result, } - impl<'a> NetworkingSwitchPortConfigurationInterfaceBgpPeerAdd<'a> { + impl<'a> NetworkingSwitchPortConfigurationGeometrySet<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, configuration: Err("configuration was not initialized".to_string()), - interface: Err("interface was not initialized".to_string()), - body: Ok(types::builder::BgpPeer::default()), + body: Ok(types::builder::SwitchPortConfigCreate::default()), } } @@ -67320,31 +67493,25 @@ pub mod builder { self } - pub fn interface(mut self, value: V) -> Self - where - V: std::convert::TryInto, - { - self.interface = value - .try_into() - .map_err(|_| "conversion to `Name` for interface failed".to_string()); - self - } - pub fn body(mut self, value: V) -> Self where - V: std::convert::TryInto, - >::Error: std::fmt::Display, + V: std::convert::TryInto, + >::Error: std::fmt::Display, { - self.body = value - .try_into() - .map(From::from) - .map_err(|s| format!("conversion to `BgpPeer` for body failed: {}", s)); + self.body = value.try_into().map(From::from).map_err(|s| { + format!( + "conversion to `SwitchPortConfigCreate` for body failed: {}", + s + ) + }); self } pub fn body_map(mut self, f: F) -> Self where - F: std::ops::FnOnce(types::builder::BgpPeer) -> types::builder::BgpPeer, + F: std::ops::FnOnce( + types::builder::SwitchPortConfigCreate, + ) -> types::builder::SwitchPortConfigCreate, { self.body = self.body.map(f); self @@ -67352,24 +67519,23 @@ pub mod builder { /// Sends a `POST` request to /// `/v1/system/networking/switch-port-configuration/{configuration}/ - /// interface/{interface}/bgp-peer/add` - pub async fn send(self) -> Result, Error> { + /// geometry` + pub async fn send( + self, + ) -> Result, Error> { let Self { client, configuration, - interface, body, } = self; let configuration = configuration.map_err(Error::InvalidRequest)?; - let interface = interface.map_err(Error::InvalidRequest)?; let body = body - .and_then(|v| types::BgpPeer::try_from(v).map_err(|e| e.to_string())) + .and_then(|v| types::SwitchPortConfigCreate::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; let url = format!( - "{}/v1/system/networking/switch-port-configuration/{}/interface/{}/bgp-peer/add", + "{}/v1/system/networking/switch-port-configuration/{}/geometry", client.baseurl, encode_path(&configuration.to_string()), - encode_path(&interface.to_string()), ); #[allow(unused_mut)] let mut request = client @@ -67397,24 +67563,20 @@ pub mod builder { } /// Builder for - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_interface_bgp_peer_remove`] + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_link_list`] /// - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_interface_bgp_peer_remove`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_interface_bgp_peer_remove + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_link_list`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_link_list #[derive(Debug, Clone)] - pub struct NetworkingSwitchPortConfigurationInterfaceBgpPeerRemove<'a> { + pub struct NetworkingSwitchPortConfigurationLinkList<'a> { client: &'a super::Client, configuration: Result, - interface: Result, - body: Result, } - impl<'a> NetworkingSwitchPortConfigurationInterfaceBgpPeerRemove<'a> { + impl<'a> NetworkingSwitchPortConfigurationLinkList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, configuration: Err("configuration was not initialized".to_string()), - interface: Err("interface was not initialized".to_string()), - body: Ok(types::builder::BgpPeer::default()), } } @@ -67428,71 +67590,35 @@ pub mod builder { self } - pub fn interface(mut self, value: V) -> Self - where - V: std::convert::TryInto, - { - self.interface = value - .try_into() - .map_err(|_| "conversion to `Name` for interface failed".to_string()); - self - } - - pub fn body(mut self, value: V) -> Self - where - V: std::convert::TryInto, - >::Error: std::fmt::Display, - { - self.body = value - .try_into() - .map(From::from) - .map_err(|s| format!("conversion to `BgpPeer` for body failed: {}", s)); - self - } - - pub fn body_map(mut self, f: F) -> Self - where - F: std::ops::FnOnce(types::builder::BgpPeer) -> types::builder::BgpPeer, - { - self.body = self.body.map(f); - self - } - - /// Sends a `POST` request to + /// Sends a `GET` request to /// `/v1/system/networking/switch-port-configuration/{configuration}/ - /// interface/{interface}/bgp-peer/remove` - pub async fn send(self) -> Result, Error> { + /// link` + pub async fn send( + self, + ) -> Result>, Error> { let Self { client, configuration, - interface, - body, } = self; let configuration = configuration.map_err(Error::InvalidRequest)?; - let interface = interface.map_err(Error::InvalidRequest)?; - let body = body - .and_then(|v| types::BgpPeer::try_from(v).map_err(|e| e.to_string())) - .map_err(Error::InvalidRequest)?; let url = format!( - "{}/v1/system/networking/switch-port-configuration/{}/interface/{}/bgp-peer/remove", + "{}/v1/system/networking/switch-port-configuration/{}/link", client.baseurl, encode_path(&configuration.to_string()), - encode_path(&interface.to_string()), ); #[allow(unused_mut)] let mut request = client .client - .post(url) + .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), + 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), @@ -67505,22 +67631,22 @@ pub mod builder { } /// Builder for - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_interface_route_list`] + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_link_create`] /// - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_interface_route_list`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_interface_route_list + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_link_create`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_link_create #[derive(Debug, Clone)] - pub struct NetworkingSwitchPortConfigurationInterfaceRouteList<'a> { + pub struct NetworkingSwitchPortConfigurationLinkCreate<'a> { client: &'a super::Client, configuration: Result, - interface: Result, + body: Result, } - impl<'a> NetworkingSwitchPortConfigurationInterfaceRouteList<'a> { + impl<'a> NetworkingSwitchPortConfigurationLinkCreate<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, configuration: Err("configuration was not initialized".to_string()), - interface: Err("interface was not initialized".to_string()), + body: Ok(types::builder::NamedLinkConfigCreate::default()), } } @@ -67534,46 +67660,64 @@ pub mod builder { self } - pub fn interface(mut self, value: V) -> Self + pub fn body(mut self, value: V) -> Self where - V: std::convert::TryInto, + V: std::convert::TryInto, + >::Error: std::fmt::Display, { - self.interface = value - .try_into() - .map_err(|_| "conversion to `Name` for interface failed".to_string()); + self.body = value.try_into().map(From::from).map_err(|s| { + format!( + "conversion to `NamedLinkConfigCreate` for body failed: {}", + s + ) + }); self } - /// Sends a `GET` request to + pub fn body_map(mut self, f: F) -> Self + where + F: std::ops::FnOnce( + types::builder::NamedLinkConfigCreate, + ) -> types::builder::NamedLinkConfigCreate, + { + self.body = self.body.map(f); + self + } + + /// Sends a `POST` request to /// `/v1/system/networking/switch-port-configuration/{configuration}/ - /// interface/{interface}/route` - pub async fn send(self) -> Result, Error> { + /// link` + pub async fn send( + self, + ) -> Result, Error> { let Self { client, configuration, - interface, + body, } = self; let configuration = configuration.map_err(Error::InvalidRequest)?; - let interface = interface.map_err(Error::InvalidRequest)?; + let body = body + .and_then(|v| types::NamedLinkConfigCreate::try_from(v).map_err(|e| e.to_string())) + .map_err(Error::InvalidRequest)?; let url = format!( - "{}/v1/system/networking/switch-port-configuration/{}/interface/{}/route", + "{}/v1/system/networking/switch-port-configuration/{}/link", client.baseurl, encode_path(&configuration.to_string()), - encode_path(&interface.to_string()), ); #[allow(unused_mut)] let mut request = client .client - .get(url) + .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) + .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, + 201u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), @@ -67586,24 +67730,22 @@ pub mod builder { } /// Builder for - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_interface_route_add`] + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_link_view`] /// - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_interface_route_add`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_interface_route_add + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_link_view`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_link_view #[derive(Debug, Clone)] - pub struct NetworkingSwitchPortConfigurationInterfaceRouteAdd<'a> { + pub struct NetworkingSwitchPortConfigurationLinkView<'a> { client: &'a super::Client, configuration: Result, - interface: Result, - body: Result, + link: Result, } - impl<'a> NetworkingSwitchPortConfigurationInterfaceRouteAdd<'a> { + impl<'a> NetworkingSwitchPortConfigurationLinkView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, configuration: Err("configuration was not initialized".to_string()), - interface: Err("interface was not initialized".to_string()), - body: Ok(types::builder::Route::default()), + link: Err("link was not initialized".to_string()), } } @@ -67617,71 +67759,48 @@ pub mod builder { self } - pub fn interface(mut self, value: V) -> Self + pub fn link(mut self, value: V) -> Self where V: std::convert::TryInto, { - self.interface = value - .try_into() - .map_err(|_| "conversion to `Name` for interface failed".to_string()); - self - } - - pub fn body(mut self, value: V) -> Self - where - V: std::convert::TryInto, - >::Error: std::fmt::Display, - { - self.body = value + self.link = value .try_into() - .map(From::from) - .map_err(|s| format!("conversion to `Route` for body failed: {}", s)); - self - } - - pub fn body_map(mut self, f: F) -> Self - where - F: std::ops::FnOnce(types::builder::Route) -> types::builder::Route, - { - self.body = self.body.map(f); + .map_err(|_| "conversion to `Name` for link failed".to_string()); self } - /// Sends a `POST` request to + /// Sends a `GET` request to /// `/v1/system/networking/switch-port-configuration/{configuration}/ - /// interface/{interface}/route/add` - pub async fn send(self) -> Result, Error> { + /// link/{link}` + pub async fn send( + self, + ) -> Result, Error> { let Self { client, configuration, - interface, - body, + link, } = self; let configuration = configuration.map_err(Error::InvalidRequest)?; - let interface = interface.map_err(Error::InvalidRequest)?; - let body = body - .and_then(|v| types::Route::try_from(v).map_err(|e| e.to_string())) - .map_err(Error::InvalidRequest)?; + let link = link.map_err(Error::InvalidRequest)?; let url = format!( - "{}/v1/system/networking/switch-port-configuration/{}/interface/{}/route/add", + "{}/v1/system/networking/switch-port-configuration/{}/link/{}", client.baseurl, encode_path(&configuration.to_string()), - encode_path(&interface.to_string()), + encode_path(&link.to_string()), ); #[allow(unused_mut)] let mut request = client .client - .post(url) + .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, + 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), @@ -67694,24 +67813,22 @@ pub mod builder { } /// Builder for - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_interface_route_remove`] + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_link_delete`] /// - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_interface_route_remove`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_interface_route_remove + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_link_delete`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_link_delete #[derive(Debug, Clone)] - pub struct NetworkingSwitchPortConfigurationInterfaceRouteRemove<'a> { + pub struct NetworkingSwitchPortConfigurationLinkDelete<'a> { client: &'a super::Client, configuration: Result, - interface: Result, - body: Result, + link: Result, } - impl<'a> NetworkingSwitchPortConfigurationInterfaceRouteRemove<'a> { + impl<'a> NetworkingSwitchPortConfigurationLinkDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, configuration: Err("configuration was not initialized".to_string()), - interface: Err("interface was not initialized".to_string()), - body: Ok(types::builder::Route::default()), + link: Err("link was not initialized".to_string()), } } @@ -67725,66 +67842,41 @@ pub mod builder { self } - pub fn interface(mut self, value: V) -> Self + pub fn link(mut self, value: V) -> Self where V: std::convert::TryInto, { - self.interface = value - .try_into() - .map_err(|_| "conversion to `Name` for interface failed".to_string()); - self - } - - pub fn body(mut self, value: V) -> Self - where - V: std::convert::TryInto, - >::Error: std::fmt::Display, - { - self.body = value + self.link = value .try_into() - .map(From::from) - .map_err(|s| format!("conversion to `Route` for body failed: {}", s)); - self - } - - pub fn body_map(mut self, f: F) -> Self - where - F: std::ops::FnOnce(types::builder::Route) -> types::builder::Route, - { - self.body = self.body.map(f); + .map_err(|_| "conversion to `Name` for link failed".to_string()); self } - /// Sends a `POST` request to + /// Sends a `DELETE` request to /// `/v1/system/networking/switch-port-configuration/{configuration}/ - /// interface/{interface}/route/remove` + /// link/{link}` pub async fn send(self) -> Result, Error> { let Self { client, configuration, - interface, - body, + link, } = self; let configuration = configuration.map_err(Error::InvalidRequest)?; - let interface = interface.map_err(Error::InvalidRequest)?; - let body = body - .and_then(|v| types::Route::try_from(v).map_err(|e| e.to_string())) - .map_err(Error::InvalidRequest)?; + let link = link.map_err(Error::InvalidRequest)?; let url = format!( - "{}/v1/system/networking/switch-port-configuration/{}/interface/{}/route/remove", + "{}/v1/system/networking/switch-port-configuration/{}/link/{}", client.baseurl, encode_path(&configuration.to_string()), - encode_path(&interface.to_string()), + encode_path(&link.to_string()), ); #[allow(unused_mut)] let mut request = client .client - .post(url) + .delete(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; @@ -67802,16 +67894,16 @@ pub mod builder { } /// Builder for - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_link_list`] + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_route_list`] /// - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_link_list`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_link_list + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_route_list`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_route_list #[derive(Debug, Clone)] - pub struct NetworkingSwitchPortConfigurationLinkList<'a> { + pub struct NetworkingSwitchPortConfigurationRouteList<'a> { client: &'a super::Client, configuration: Result, } - impl<'a> NetworkingSwitchPortConfigurationLinkList<'a> { + impl<'a> NetworkingSwitchPortConfigurationRouteList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, @@ -67831,17 +67923,15 @@ pub mod builder { /// Sends a `GET` request to /// `/v1/system/networking/switch-port-configuration/{configuration}/ - /// link` - pub async fn send( - self, - ) -> Result>, Error> { + /// route` + pub async fn send(self) -> Result, Error> { let Self { client, configuration, } = self; let configuration = configuration.map_err(Error::InvalidRequest)?; let url = format!( - "{}/v1/system/networking/switch-port-configuration/{}/link", + "{}/v1/system/networking/switch-port-configuration/{}/route", client.baseurl, encode_path(&configuration.to_string()), ); @@ -67870,22 +67960,22 @@ pub mod builder { } /// Builder for - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_link_create`] + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_route_add`] /// - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_link_create`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_link_create + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_route_add`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_route_add #[derive(Debug, Clone)] - pub struct NetworkingSwitchPortConfigurationLinkCreate<'a> { + pub struct NetworkingSwitchPortConfigurationRouteAdd<'a> { client: &'a super::Client, configuration: Result, - body: Result, + body: Result, } - impl<'a> NetworkingSwitchPortConfigurationLinkCreate<'a> { + impl<'a> NetworkingSwitchPortConfigurationRouteAdd<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, configuration: Err("configuration was not initialized".to_string()), - body: Ok(types::builder::NamedLinkConfigCreate::default()), + body: Ok(types::builder::Route::default()), } } @@ -67901,23 +67991,19 @@ pub mod builder { pub fn body(mut self, value: V) -> Self where - V: std::convert::TryInto, - >::Error: std::fmt::Display, + V: std::convert::TryInto, + >::Error: std::fmt::Display, { - self.body = value.try_into().map(From::from).map_err(|s| { - format!( - "conversion to `NamedLinkConfigCreate` for body failed: {}", - s - ) - }); + self.body = value + .try_into() + .map(From::from) + .map_err(|s| format!("conversion to `Route` for body failed: {}", s)); self } pub fn body_map(mut self, f: F) -> Self where - F: std::ops::FnOnce( - types::builder::NamedLinkConfigCreate, - ) -> types::builder::NamedLinkConfigCreate, + F: std::ops::FnOnce(types::builder::Route) -> types::builder::Route, { self.body = self.body.map(f); self @@ -67925,10 +68011,8 @@ pub mod builder { /// Sends a `POST` request to /// `/v1/system/networking/switch-port-configuration/{configuration}/ - /// link` - pub async fn send( - self, - ) -> Result, Error> { + /// route/add` + pub async fn send(self) -> Result, Error> { let Self { client, configuration, @@ -67936,10 +68020,10 @@ pub mod builder { } = self; let configuration = configuration.map_err(Error::InvalidRequest)?; let body = body - .and_then(|v| types::NamedLinkConfigCreate::try_from(v).map_err(|e| e.to_string())) + .and_then(|v| types::Route::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; let url = format!( - "{}/v1/system/networking/switch-port-configuration/{}/link", + "{}/v1/system/networking/switch-port-configuration/{}/route/add", client.baseurl, encode_path(&configuration.to_string()), ); @@ -67969,22 +68053,22 @@ pub mod builder { } /// Builder for - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_link_view`] + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_route_remove`] /// - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_link_view`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_link_view + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_route_remove`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_route_remove #[derive(Debug, Clone)] - pub struct NetworkingSwitchPortConfigurationLinkView<'a> { + pub struct NetworkingSwitchPortConfigurationRouteRemove<'a> { client: &'a super::Client, configuration: Result, - link: Result, + body: Result, } - impl<'a> NetworkingSwitchPortConfigurationLinkView<'a> { + impl<'a> NetworkingSwitchPortConfigurationRouteRemove<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, configuration: Err("configuration was not initialized".to_string()), - link: Err("link was not initialized".to_string()), + body: Ok(types::builder::Route::default()), } } @@ -67998,124 +68082,53 @@ pub mod builder { self } - pub fn link(mut self, value: V) -> Self - where - V: std::convert::TryInto, - { - self.link = value - .try_into() - .map_err(|_| "conversion to `Name` for link failed".to_string()); - self - } - - /// Sends a `GET` request to - /// `/v1/system/networking/switch-port-configuration/{configuration}/ - /// link/{link}` - pub async fn send( - self, - ) -> Result, Error> { - let Self { - client, - configuration, - link, - } = self; - let configuration = configuration.map_err(Error::InvalidRequest)?; - let link = link.map_err(Error::InvalidRequest)?; - let url = format!( - "{}/v1/system/networking/switch-port-configuration/{}/link/{}", - client.baseurl, - encode_path(&configuration.to_string()), - encode_path(&link.to_string()), - ); - #[allow(unused_mut)] - let mut request = client - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = client.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - 400u16..=499u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - 500u16..=599u16 => Err(Error::ErrorResponse( - ResponseValue::from_response(response).await?, - )), - _ => Err(Error::UnexpectedResponse(response)), - } - } - } - - /// Builder for - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_link_delete`] - /// - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_link_delete`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_link_delete - #[derive(Debug, Clone)] - pub struct NetworkingSwitchPortConfigurationLinkDelete<'a> { - client: &'a super::Client, - configuration: Result, - link: Result, - } - - impl<'a> NetworkingSwitchPortConfigurationLinkDelete<'a> { - pub fn new(client: &'a super::Client) -> Self { - Self { - client: client, - configuration: Err("configuration was not initialized".to_string()), - link: Err("link was not initialized".to_string()), - } - } - - pub fn configuration(mut self, value: V) -> Self + pub fn body(mut self, value: V) -> Self where - V: std::convert::TryInto, + V: std::convert::TryInto, + >::Error: std::fmt::Display, { - self.configuration = value + self.body = value .try_into() - .map_err(|_| "conversion to `NameOrId` for configuration failed".to_string()); + .map(From::from) + .map_err(|s| format!("conversion to `Route` for body failed: {}", s)); self } - pub fn link(mut self, value: V) -> Self + pub fn body_map(mut self, f: F) -> Self where - V: std::convert::TryInto, + F: std::ops::FnOnce(types::builder::Route) -> types::builder::Route, { - self.link = value - .try_into() - .map_err(|_| "conversion to `Name` for link failed".to_string()); + self.body = self.body.map(f); self } - /// Sends a `DELETE` request to + /// Sends a `POST` request to /// `/v1/system/networking/switch-port-configuration/{configuration}/ - /// link/{link}` + /// route/remove` pub async fn send(self) -> Result, Error> { let Self { client, configuration, - link, + body, } = self; let configuration = configuration.map_err(Error::InvalidRequest)?; - let link = link.map_err(Error::InvalidRequest)?; + let body = body + .and_then(|v| types::Route::try_from(v).map_err(|e| e.to_string())) + .map_err(Error::InvalidRequest)?; let url = format!( - "{}/v1/system/networking/switch-port-configuration/{}/link/{}", + "{}/v1/system/networking/switch-port-configuration/{}/route/remove", client.baseurl, encode_path(&configuration.to_string()), - encode_path(&link.to_string()), ); #[allow(unused_mut)] let mut request = client .client - .delete(url) + .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) + .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; From 4fc01debe7abb3ce1bccaca197a3138e79f3e675 Mon Sep 17 00:00:00 2001 From: Levon Tarver Date: Fri, 30 Aug 2024 06:38:06 +0000 Subject: [PATCH 3/8] WIP: route add / remove / list --- cli/src/generated_cli.rs | 26 ++- oxide.json | 58 ++++++- sdk-httpmock/src/generated_httpmock.rs | 8 +- sdk/src/generated_sdk.rs | 226 +++++++++++++++++++++++-- 4 files changed, 292 insertions(+), 26 deletions(-) diff --git a/cli/src/generated_cli.rs b/cli/src/generated_cli.rs index f6e7e5a8..ca994cfd 100644 --- a/cli/src/generated_cli.rs +++ b/cli/src/generated_cli.rs @@ -5310,6 +5310,13 @@ impl Cli { .required_unless_present("json-body") .help("The route gateway."), ) + .arg( + clap::Arg::new("interface") + .long("interface") + .value_parser(clap::value_parser!(types::Name)) + .required_unless_present("json-body") + .help("The interface to configure the route on"), + ) .arg( clap::Arg::new("local-pref") .long("local-pref") @@ -5367,6 +5374,13 @@ impl Cli { .required_unless_present("json-body") .help("The route gateway."), ) + .arg( + clap::Arg::new("interface") + .long("interface") + .value_parser(clap::value_parser!(types::Name)) + .required_unless_present("json-body") + .help("The interface to configure the route on"), + ) .arg( clap::Arg::new("local-pref") .long("local-pref") @@ -12865,6 +12879,10 @@ impl Cli { request = request.body_map(|body| body.gw(value.clone())) } + if let Some(value) = matches.get_one::("interface") { + request = request.body_map(|body| body.interface(value.clone())) + } + if let Some(value) = matches.get_one::("local-pref") { request = request.body_map(|body| body.local_pref(value.clone())) } @@ -12875,7 +12893,7 @@ impl Cli { if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } @@ -12913,6 +12931,10 @@ impl Cli { request = request.body_map(|body| body.gw(value.clone())) } + if let Some(value) = matches.get_one::("interface") { + request = request.body_map(|body| body.interface(value.clone())) + } + if let Some(value) = matches.get_one::("local-pref") { request = request.body_map(|body| body.local_pref(value.clone())) } @@ -12923,7 +12945,7 @@ impl Cli { if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } diff --git a/oxide.json b/oxide.json index 84295088..bc6fe94a 100644 --- a/oxide.json +++ b/oxide.json @@ -7807,7 +7807,11 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/RouteConfig" + "title": "Array_of_SwitchPortRouteConfig", + "type": "array", + "items": { + "$ref": "#/components/schemas/SwitchPortRouteConfig" + } } } } @@ -7843,7 +7847,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Route" + "$ref": "#/components/schemas/RouteAddRemove" } } }, @@ -7855,7 +7859,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Route" + "$ref": "#/components/schemas/SwitchPortRouteConfig" } } } @@ -7891,7 +7895,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Route" + "$ref": "#/components/schemas/RouteAddRemove" } } }, @@ -18182,6 +18186,52 @@ "gw" ] }, + "RouteAddRemove": { + "description": "A route to a destination network through a gateway address to add or remove to an interface.", + "type": "object", + "properties": { + "dst": { + "description": "The route destination.", + "allOf": [ + { + "$ref": "#/components/schemas/IpNet" + } + ] + }, + "gw": { + "description": "The route gateway.", + "type": "string", + "format": "ip" + }, + "interface": { + "description": "The interface to configure the route on", + "allOf": [ + { + "$ref": "#/components/schemas/Name" + } + ] + }, + "local_pref": { + "nullable": true, + "description": "Local preference for route. Higher preference indictes precedence within and across protocols.", + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "vid": { + "nullable": true, + "description": "VLAN id the gateway is reachable over.", + "type": "integer", + "format": "uint16", + "minimum": 0 + } + }, + "required": [ + "dst", + "gw", + "interface" + ] + }, "RouteConfig": { "description": "Route configuration data associated with a switch port configuration.", "type": "object", diff --git a/sdk-httpmock/src/generated_httpmock.rs b/sdk-httpmock/src/generated_httpmock.rs index 2cfc56ea..a68d9bb2 100644 --- a/sdk-httpmock/src/generated_httpmock.rs +++ b/sdk-httpmock/src/generated_httpmock.rs @@ -12677,7 +12677,7 @@ pub mod operations { self.0 } - pub fn ok(self, value: &types::RouteConfig) -> Self { + pub fn ok(self, value: &Vec) -> Self { Self( self.0 .status(200u16) @@ -12733,7 +12733,7 @@ pub mod operations { Self(self.0.path_matches(re)) } - pub fn body(self, value: &types::Route) -> Self { + pub fn body(self, value: &types::RouteAddRemove) -> Self { Self(self.0.json_body_obj(value)) } } @@ -12748,7 +12748,7 @@ pub mod operations { self.0 } - pub fn created(self, value: &types::Route) -> Self { + pub fn created(self, value: &types::SwitchPortRouteConfig) -> Self { Self( self.0 .status(201u16) @@ -12804,7 +12804,7 @@ pub mod operations { Self(self.0.path_matches(re)) } - pub fn body(self, value: &types::Route) -> Self { + pub fn body(self, value: &types::RouteAddRemove) -> Self { Self(self.0.json_body_obj(value)) } } diff --git a/sdk/src/generated_sdk.rs b/sdk/src/generated_sdk.rs index 92b89627..8380176a 100644 --- a/sdk/src/generated_sdk.rs +++ b/sdk/src/generated_sdk.rs @@ -17989,6 +17989,97 @@ pub mod types { } } + /// A route to a destination network through a gateway address to add or + /// remove to an interface. + /// + ///
JSON schema + /// + /// ```json + /// { + /// "description": "A route to a destination network through a gateway + /// address to add or remove to an interface.", + /// "type": "object", + /// "required": [ + /// "dst", + /// "gw", + /// "interface" + /// ], + /// "properties": { + /// "dst": { + /// "description": "The route destination.", + /// "allOf": [ + /// { + /// "$ref": "#/components/schemas/IpNet" + /// } + /// ] + /// }, + /// "gw": { + /// "description": "The route gateway.", + /// "type": "string", + /// "format": "ip" + /// }, + /// "interface": { + /// "description": "The interface to configure the route on", + /// "allOf": [ + /// { + /// "$ref": "#/components/schemas/Name" + /// } + /// ] + /// }, + /// "local_pref": { + /// "description": "Local preference for route. Higher preference + /// indictes precedence within and across protocols.", + /// "type": [ + /// "integer", + /// "null" + /// ], + /// "format": "uint32", + /// "minimum": 0.0 + /// }, + /// "vid": { + /// "description": "VLAN id the gateway is reachable over.", + /// "type": [ + /// "integer", + /// "null" + /// ], + /// "format": "uint16", + /// "minimum": 0.0 + /// } + /// } + /// } + /// ``` + ///
+ #[derive( + :: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, schemars :: JsonSchema, + )] + pub struct RouteAddRemove { + /// The route destination. + pub dst: IpNet, + /// The route gateway. + pub gw: std::net::IpAddr, + /// The interface to configure the route on + pub interface: Name, + /// Local preference for route. Higher preference indictes precedence + /// within and across protocols. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub local_pref: Option, + /// VLAN id the gateway is reachable over. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub vid: Option, + } + + impl From<&RouteAddRemove> for RouteAddRemove { + fn from(value: &RouteAddRemove) -> Self { + value.clone() + } + } + + impl RouteAddRemove { + pub fn builder() -> builder::RouteAddRemove { + Default::default() + } + } + /// Route configuration data associated with a switch port configuration. /// ///
JSON schema @@ -39601,6 +39692,105 @@ pub mod types { } } + #[derive(Clone, Debug)] + pub struct RouteAddRemove { + dst: Result, + gw: Result, + interface: Result, + local_pref: Result, String>, + vid: Result, String>, + } + + impl Default for RouteAddRemove { + fn default() -> Self { + Self { + dst: Err("no value supplied for dst".to_string()), + gw: Err("no value supplied for gw".to_string()), + interface: Err("no value supplied for interface".to_string()), + local_pref: Ok(Default::default()), + vid: Ok(Default::default()), + } + } + } + + impl RouteAddRemove { + pub fn dst(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.dst = value + .try_into() + .map_err(|e| format!("error converting supplied value for dst: {}", e)); + self + } + pub fn gw(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.gw = value + .try_into() + .map_err(|e| format!("error converting supplied value for gw: {}", e)); + self + } + pub fn interface(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.interface = value + .try_into() + .map_err(|e| format!("error converting supplied value for interface: {}", e)); + self + } + pub fn local_pref(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.local_pref = value + .try_into() + .map_err(|e| format!("error converting supplied value for local_pref: {}", e)); + self + } + pub fn vid(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.vid = value + .try_into() + .map_err(|e| format!("error converting supplied value for vid: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::RouteAddRemove { + type Error = super::error::ConversionError; + fn try_from(value: RouteAddRemove) -> Result { + Ok(Self { + dst: value.dst?, + gw: value.gw?, + interface: value.interface?, + local_pref: value.local_pref?, + vid: value.vid?, + }) + } + } + + impl From for RouteAddRemove { + fn from(value: super::RouteAddRemove) -> Self { + Self { + dst: Ok(value.dst), + gw: Ok(value.gw), + interface: Ok(value.interface), + local_pref: Ok(value.local_pref), + vid: Ok(value.vid), + } + } + } + #[derive(Clone, Debug)] pub struct RouteConfig { routes: Result, String>, @@ -67924,7 +68114,9 @@ pub mod builder { /// Sends a `GET` request to /// `/v1/system/networking/switch-port-configuration/{configuration}/ /// route` - pub async fn send(self) -> Result, Error> { + pub async fn send( + self, + ) -> Result>, Error> { let Self { client, configuration, @@ -67967,7 +68159,7 @@ pub mod builder { pub struct NetworkingSwitchPortConfigurationRouteAdd<'a> { client: &'a super::Client, configuration: Result, - body: Result, + body: Result, } impl<'a> NetworkingSwitchPortConfigurationRouteAdd<'a> { @@ -67975,7 +68167,7 @@ pub mod builder { Self { client: client, configuration: Err("configuration was not initialized".to_string()), - body: Ok(types::builder::Route::default()), + body: Ok(types::builder::RouteAddRemove::default()), } } @@ -67991,19 +68183,19 @@ pub mod builder { pub fn body(mut self, value: V) -> Self where - V: std::convert::TryInto, - >::Error: std::fmt::Display, + V: std::convert::TryInto, + >::Error: std::fmt::Display, { self.body = value .try_into() .map(From::from) - .map_err(|s| format!("conversion to `Route` for body failed: {}", s)); + .map_err(|s| format!("conversion to `RouteAddRemove` for body failed: {}", s)); self } pub fn body_map(mut self, f: F) -> Self where - F: std::ops::FnOnce(types::builder::Route) -> types::builder::Route, + F: std::ops::FnOnce(types::builder::RouteAddRemove) -> types::builder::RouteAddRemove, { self.body = self.body.map(f); self @@ -68012,7 +68204,9 @@ pub mod builder { /// Sends a `POST` request to /// `/v1/system/networking/switch-port-configuration/{configuration}/ /// route/add` - pub async fn send(self) -> Result, Error> { + pub async fn send( + self, + ) -> Result, Error> { let Self { client, configuration, @@ -68020,7 +68214,7 @@ pub mod builder { } = self; let configuration = configuration.map_err(Error::InvalidRequest)?; let body = body - .and_then(|v| types::Route::try_from(v).map_err(|e| e.to_string())) + .and_then(|v| types::RouteAddRemove::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; let url = format!( "{}/v1/system/networking/switch-port-configuration/{}/route/add", @@ -68060,7 +68254,7 @@ pub mod builder { pub struct NetworkingSwitchPortConfigurationRouteRemove<'a> { client: &'a super::Client, configuration: Result, - body: Result, + body: Result, } impl<'a> NetworkingSwitchPortConfigurationRouteRemove<'a> { @@ -68068,7 +68262,7 @@ pub mod builder { Self { client: client, configuration: Err("configuration was not initialized".to_string()), - body: Ok(types::builder::Route::default()), + body: Ok(types::builder::RouteAddRemove::default()), } } @@ -68084,19 +68278,19 @@ pub mod builder { pub fn body(mut self, value: V) -> Self where - V: std::convert::TryInto, - >::Error: std::fmt::Display, + V: std::convert::TryInto, + >::Error: std::fmt::Display, { self.body = value .try_into() .map(From::from) - .map_err(|s| format!("conversion to `Route` for body failed: {}", s)); + .map_err(|s| format!("conversion to `RouteAddRemove` for body failed: {}", s)); self } pub fn body_map(mut self, f: F) -> Self where - F: std::ops::FnOnce(types::builder::Route) -> types::builder::Route, + F: std::ops::FnOnce(types::builder::RouteAddRemove) -> types::builder::RouteAddRemove, { self.body = self.body.map(f); self @@ -68113,7 +68307,7 @@ pub mod builder { } = self; let configuration = configuration.map_err(Error::InvalidRequest)?; let body = body - .and_then(|v| types::Route::try_from(v).map_err(|e| e.to_string())) + .and_then(|v| types::RouteAddRemove::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; let url = format!( "{}/v1/system/networking/switch-port-configuration/{}/route/remove", From d8c665b859a6ad7bef1def1da816bb3bee9e10af Mon Sep 17 00:00:00 2001 From: Levon Tarver Date: Fri, 30 Aug 2024 19:42:16 +0000 Subject: [PATCH 4/8] don't require entire peer config for peer removal --- cli/src/generated_cli.rs | 150 +---------------------- cli/tests/test_net.rs | 8 +- oxide.json | 38 +++++- sdk-httpmock/src/generated_httpmock.rs | 4 +- sdk/src/generated_sdk.rs | 158 +++++++++++++++++++++++-- 5 files changed, 191 insertions(+), 167 deletions(-) diff --git a/cli/src/generated_cli.rs b/cli/src/generated_cli.rs index ca994cfd..71069a16 100644 --- a/cli/src/generated_cli.rs +++ b/cli/src/generated_cli.rs @@ -4957,50 +4957,6 @@ impl Cli { .required(true) .help("A name or id to use when selecting a switch port configuration."), ) - .arg( - clap::Arg::new("connect-retry") - .long("connect-retry") - .value_parser(clap::value_parser!(u32)) - .required_unless_present("json-body") - .help("How long to to wait between TCP connection retries (seconds)."), - ) - .arg( - clap::Arg::new("delay-open") - .long("delay-open") - .value_parser(clap::value_parser!(u32)) - .required_unless_present("json-body") - .help( - "How long to delay sending an open request after establishing a TCP \ - session (seconds).", - ), - ) - .arg( - clap::Arg::new("enforce-first-as") - .long("enforce-first-as") - .value_parser(clap::value_parser!(bool)) - .required_unless_present("json-body") - .help( - "Enforce that the first AS in paths received from this peer is the peer's \ - AS.", - ), - ) - .arg( - clap::Arg::new("hold-time") - .long("hold-time") - .value_parser(clap::value_parser!(u32)) - .required_unless_present("json-body") - .help("How long to hold peer connections between keepalives (seconds)."), - ) - .arg( - clap::Arg::new("idle-hold-time") - .long("idle-hold-time") - .value_parser(clap::value_parser!(u32)) - .required_unless_present("json-body") - .help( - "How long to hold a peer in idle before attempting a new session \ - (seconds).", - ), - ) .arg( clap::Arg::new("interface-name") .long("interface-name") @@ -5013,63 +4969,11 @@ impl Cli { could be vlan47 to refer to a VLAN interface.", ), ) - .arg( - clap::Arg::new("keepalive") - .long("keepalive") - .value_parser(clap::value_parser!(u32)) - .required_unless_present("json-body") - .help("How often to send keepalive requests (seconds)."), - ) - .arg( - clap::Arg::new("local-pref") - .long("local-pref") - .value_parser(clap::value_parser!(u32)) - .required(false) - .help("Apply a local preference to routes received from this peer."), - ) - .arg( - clap::Arg::new("md5-auth-key") - .long("md5-auth-key") - .value_parser(clap::value_parser!(String)) - .required(false) - .help("Use the given key for TCP-MD5 authentication with the peer."), - ) - .arg( - clap::Arg::new("min-ttl") - .long("min-ttl") - .value_parser(clap::value_parser!(u8)) - .required(false) - .help("Require messages from a peer have a minimum IP time to live field."), - ) - .arg( - clap::Arg::new("multi-exit-discriminator") - .long("multi-exit-discriminator") - .value_parser(clap::value_parser!(u32)) - .required(false) - .help( - "Apply the provided multi-exit discriminator (MED) updates sent to the \ - peer.", - ), - ) - .arg( - clap::Arg::new("remote-asn") - .long("remote-asn") - .value_parser(clap::value_parser!(u32)) - .required(false) - .help("Require that a peer has a specified ASN."), - ) - .arg( - clap::Arg::new("vlan-id") - .long("vlan-id") - .value_parser(clap::value_parser!(u16)) - .required(false) - .help("Associate a VLAN ID with a peer."), - ) .arg( clap::Arg::new("json-body") .long("json-body") .value_name("JSON-FILE") - .required(true) + .required(false) .value_parser(clap::value_parser!(std::path::PathBuf)) .help("Path to a file that contains the full json body."), ) @@ -5412,7 +5316,7 @@ impl Cli { .action(clap::ArgAction::SetTrue) .help("XXX"), ) - .about("Remove address from an interface configuration") + .about("Remove route from an interface configuration") } pub fn cli_system_policy_view() -> clap::Command { @@ -12561,61 +12465,13 @@ impl Cli { request = request.configuration(value.clone()); } - if let Some(value) = matches.get_one::("connect-retry") { - request = request.body_map(|body| body.connect_retry(value.clone())) - } - - if let Some(value) = matches.get_one::("delay-open") { - request = request.body_map(|body| body.delay_open(value.clone())) - } - - if let Some(value) = matches.get_one::("enforce-first-as") { - request = request.body_map(|body| body.enforce_first_as(value.clone())) - } - - if let Some(value) = matches.get_one::("hold-time") { - request = request.body_map(|body| body.hold_time(value.clone())) - } - - if let Some(value) = matches.get_one::("idle-hold-time") { - request = request.body_map(|body| body.idle_hold_time(value.clone())) - } - if let Some(value) = matches.get_one::("interface-name") { request = request.body_map(|body| body.interface_name(value.clone())) } - if let Some(value) = matches.get_one::("keepalive") { - request = request.body_map(|body| body.keepalive(value.clone())) - } - - if let Some(value) = matches.get_one::("local-pref") { - request = request.body_map(|body| body.local_pref(value.clone())) - } - - if let Some(value) = matches.get_one::("md5-auth-key") { - request = request.body_map(|body| body.md5_auth_key(value.clone())) - } - - if let Some(value) = matches.get_one::("min-ttl") { - request = request.body_map(|body| body.min_ttl(value.clone())) - } - - if let Some(value) = matches.get_one::("multi-exit-discriminator") { - request = request.body_map(|body| body.multi_exit_discriminator(value.clone())) - } - - if let Some(value) = matches.get_one::("remote-asn") { - request = request.body_map(|body| body.remote_asn(value.clone())) - } - - if let Some(value) = matches.get_one::("vlan-id") { - request = request.body_map(|body| body.vlan_id(value.clone())) - } - if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } diff --git a/cli/tests/test_net.rs b/cli/tests/test_net.rs index f00ae634..caaceac2 100644 --- a/cli/tests/test_net.rs +++ b/cli/tests/test_net.rs @@ -280,14 +280,14 @@ fn test_port_config() { }; let mock_switch0_qsfp0_settings_view = - server.networking_switch_port_settings_view(|when, then| { - when.port(&NameOrId::Id(ports.items[0].port_settings_id.unwrap())); + server.networking_switch_port_configuration_view(|when, then| { + when.configuration(&NameOrId::Id(ports.items[0].port_settings_id.unwrap())); then.ok(&switch0_qsfp0_view); }); let mock_switch1_qsfp0_settings_view = - server.networking_switch_port_settings_view(|when, then| { - when.port(&NameOrId::Id(ports.items[1].port_settings_id.unwrap())); + server.networking_switch_port_configuration_view(|when, then| { + when.configuration(&NameOrId::Id(ports.items[1].port_settings_id.unwrap())); then.ok(&switch1_qsfp0_view); }); diff --git a/oxide.json b/oxide.json index bc6fe94a..38f70e87 100644 --- a/oxide.json +++ b/oxide.json @@ -7423,7 +7423,11 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BgpPeerConfig" + "title": "Array_of_BgpPeer", + "type": "array", + "items": { + "$ref": "#/components/schemas/BgpPeer" + } } } } @@ -7507,7 +7511,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BgpPeer" + "$ref": "#/components/schemas/BgpPeerRemove" } } }, @@ -7878,7 +7882,7 @@ "tags": [ "system/networking" ], - "summary": "Remove address from an interface configuration", + "summary": "Remove route from an interface configuration", "operationId": "networking_switch_port_configuration_route_remove", "parameters": [ { @@ -11421,6 +11425,34 @@ "peers" ] }, + "BgpPeerRemove": { + "description": "A BGP peer configuration to remove from an interface", + "type": "object", + "properties": { + "addr": { + "description": "The address of the host to peer with.", + "type": "string", + "format": "ip" + }, + "bgp_config": { + "description": "The global BGP configuration used for establishing a session with this peer.", + "allOf": [ + { + "$ref": "#/components/schemas/NameOrId" + } + ] + }, + "interface_name": { + "description": "The name of interface to peer on. This is relative to the port configuration this BGP peer configuration is a part of. For example this value could be phy0 to refer to a primary physical interface. Or it could be vlan47 to refer to a VLAN interface.", + "type": "string" + } + }, + "required": [ + "addr", + "bgp_config", + "interface_name" + ] + }, "BgpPeerState": { "description": "The current state of a BGP peer.", "oneOf": [ diff --git a/sdk-httpmock/src/generated_httpmock.rs b/sdk-httpmock/src/generated_httpmock.rs index a68d9bb2..a3f8d9aa 100644 --- a/sdk-httpmock/src/generated_httpmock.rs +++ b/sdk-httpmock/src/generated_httpmock.rs @@ -12050,7 +12050,7 @@ pub mod operations { self.0 } - pub fn ok(self, value: &types::BgpPeerConfig) -> Self { + pub fn ok(self, value: &Vec) -> Self { Self( self.0 .status(200u16) @@ -12177,7 +12177,7 @@ pub mod operations { Self(self.0.path_matches(re)) } - pub fn body(self, value: &types::BgpPeer) -> Self { + pub fn body(self, value: &types::BgpPeerRemove) -> Self { Self(self.0.json_body_obj(value)) } } diff --git a/sdk/src/generated_sdk.rs b/sdk/src/generated_sdk.rs index 8380176a..4594981e 100644 --- a/sdk/src/generated_sdk.rs +++ b/sdk/src/generated_sdk.rs @@ -2504,6 +2504,73 @@ pub mod types { } } + /// A BGP peer configuration to remove from an interface + /// + ///
JSON schema + /// + /// ```json + /// { + /// "description": "A BGP peer configuration to remove from an interface", + /// "type": "object", + /// "required": [ + /// "addr", + /// "bgp_config", + /// "interface_name" + /// ], + /// "properties": { + /// "addr": { + /// "description": "The address of the host to peer with.", + /// "type": "string", + /// "format": "ip" + /// }, + /// "bgp_config": { + /// "description": "The global BGP configuration used for establishing + /// a session with this peer.", + /// "allOf": [ + /// { + /// "$ref": "#/components/schemas/NameOrId" + /// } + /// ] + /// }, + /// "interface_name": { + /// "description": "The name of interface to peer on. This is relative + /// to the port configuration this BGP peer configuration is a part of. For + /// example this value could be phy0 to refer to a primary physical + /// interface. Or it could be vlan47 to refer to a VLAN interface.", + /// "type": "string" + /// } + /// } + /// } + /// ``` + ///
+ #[derive( + :: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, schemars :: JsonSchema, + )] + pub struct BgpPeerRemove { + /// The address of the host to peer with. + pub addr: std::net::IpAddr, + /// The global BGP configuration used for establishing a session with + /// this peer. + pub bgp_config: NameOrId, + /// The name of interface to peer on. This is relative to the port + /// configuration this BGP peer configuration is a part of. For example + /// this value could be phy0 to refer to a primary physical interface. + /// Or it could be vlan47 to refer to a VLAN interface. + pub interface_name: String, + } + + impl From<&BgpPeerRemove> for BgpPeerRemove { + fn from(value: &BgpPeerRemove) -> Self { + value.clone() + } + } + + impl BgpPeerRemove { + pub fn builder() -> builder::BgpPeerRemove { + Default::default() + } + } + /// The current state of a BGP peer. /// ///
JSON schema @@ -29651,6 +29718,77 @@ pub mod types { } } + #[derive(Clone, Debug)] + pub struct BgpPeerRemove { + addr: Result, + bgp_config: Result, + interface_name: Result, + } + + impl Default for BgpPeerRemove { + fn default() -> Self { + Self { + addr: Err("no value supplied for addr".to_string()), + bgp_config: Err("no value supplied for bgp_config".to_string()), + interface_name: Err("no value supplied for interface_name".to_string()), + } + } + } + + impl BgpPeerRemove { + pub fn addr(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.addr = value + .try_into() + .map_err(|e| format!("error converting supplied value for addr: {}", e)); + self + } + pub fn bgp_config(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.bgp_config = value + .try_into() + .map_err(|e| format!("error converting supplied value for bgp_config: {}", e)); + self + } + pub fn interface_name(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.interface_name = value.try_into().map_err(|e| { + format!("error converting supplied value for interface_name: {}", e) + }); + self + } + } + + impl std::convert::TryFrom for super::BgpPeerRemove { + type Error = super::error::ConversionError; + fn try_from(value: BgpPeerRemove) -> Result { + Ok(Self { + addr: value.addr?, + bgp_config: value.bgp_config?, + interface_name: value.interface_name?, + }) + } + } + + impl From for BgpPeerRemove { + fn from(value: super::BgpPeerRemove) -> Self { + Self { + addr: Ok(value.addr), + bgp_config: Ok(value.bgp_config), + interface_name: Ok(value.interface_name), + } + } + } + #[derive(Clone, Debug)] pub struct BgpPeerStatus { addr: Result, @@ -50599,7 +50737,7 @@ pub trait ClientSystemNetworkingExt { fn networking_switch_port_configuration_route_add( &self, ) -> builder::NetworkingSwitchPortConfigurationRouteAdd; - /// Remove address from an interface configuration + /// Remove route from an interface configuration /// /// Sends a `POST` request to /// `/v1/system/networking/switch-port-configuration/{configuration}/route/ @@ -67362,9 +67500,7 @@ pub mod builder { /// Sends a `GET` request to /// `/v1/system/networking/switch-port-configuration/{configuration}/ /// bgp-peer` - pub async fn send( - self, - ) -> Result, Error> { + pub async fn send(self) -> Result>, Error> { let Self { client, configuration, @@ -67500,7 +67636,7 @@ pub mod builder { pub struct NetworkingSwitchPortConfigurationBgpPeerRemove<'a> { client: &'a super::Client, configuration: Result, - body: Result, + body: Result, } impl<'a> NetworkingSwitchPortConfigurationBgpPeerRemove<'a> { @@ -67508,7 +67644,7 @@ pub mod builder { Self { client: client, configuration: Err("configuration was not initialized".to_string()), - body: Ok(types::builder::BgpPeer::default()), + body: Ok(types::builder::BgpPeerRemove::default()), } } @@ -67524,19 +67660,19 @@ pub mod builder { pub fn body(mut self, value: V) -> Self where - V: std::convert::TryInto, - >::Error: std::fmt::Display, + V: std::convert::TryInto, + >::Error: std::fmt::Display, { self.body = value .try_into() .map(From::from) - .map_err(|s| format!("conversion to `BgpPeer` for body failed: {}", s)); + .map_err(|s| format!("conversion to `BgpPeerRemove` for body failed: {}", s)); self } pub fn body_map(mut self, f: F) -> Self where - F: std::ops::FnOnce(types::builder::BgpPeer) -> types::builder::BgpPeer, + F: std::ops::FnOnce(types::builder::BgpPeerRemove) -> types::builder::BgpPeerRemove, { self.body = self.body.map(f); self @@ -67553,7 +67689,7 @@ pub mod builder { } = self; let configuration = configuration.map_err(Error::InvalidRequest)?; let body = body - .and_then(|v| types::BgpPeer::try_from(v).map_err(|e| e.to_string())) + .and_then(|v| types::BgpPeerRemove::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; let url = format!( "{}/v1/system/networking/switch-port-configuration/{}/bgp-peer/remove", From ee3dfcc25465393d06fa8d4228a1539fd1e675de Mon Sep 17 00:00:00 2001 From: Levon Tarver Date: Sat, 31 Aug 2024 15:53:30 +0000 Subject: [PATCH 5/8] WIP: finish roughing out bgp import/export/community endpoints --- cli/docs/cli.json | 1225 ++++++- cli/src/cli_builder.rs | 30 + cli/src/cmd_net.rs | 4 +- cli/src/generated_cli.rs | 4119 +++++++++++++++--------- cli/tests/data/json-body-required.txt | 3 +- cli/tests/test_net.rs | 16 +- oxide.json | 682 +++- sdk-httpmock/src/generated_httpmock.rs | 884 +++++ sdk/src/generated_sdk.rs | 3244 +++++++++++++++---- 9 files changed, 7934 insertions(+), 2273 deletions(-) diff --git a/cli/docs/cli.json b/cli/docs/cli.json index 02c51b2e..d05b0c2f 100644 --- a/cli/docs/cli.json +++ b/cli/docs/cli.json @@ -217,8 +217,7 @@ "long_about": "Permanently delete a certificate. This operation cannot be undone.", "args": [ { - "long": "certificate", - "help": "Name or ID of the certificate" + "long": "certificate" }, { "long": "profile", @@ -257,8 +256,7 @@ "long_about": "Returns the details of a specific certificate", "args": [ { - "long": "certificate", - "help": "Name or ID of the certificate" + "long": "certificate" }, { "long": "profile", @@ -3011,7 +3009,7 @@ }, { "long": "user-id", - "help": "The user's internal ID" + "help": "The user's internal id" } ] }, @@ -3039,7 +3037,7 @@ }, { "long": "user-id", - "help": "The user's internal ID" + "help": "The user's internal id" } ] } @@ -3387,7 +3385,7 @@ }, { "long": "user-id", - "help": "The user's internal ID" + "help": "The user's internal id" } ] } @@ -3682,7 +3680,7 @@ }, { "long": "rack-id", - "help": "ID of the rack" + "help": "The rack's unique ID." } ] } @@ -3916,60 +3914,72 @@ ], "subcommands": [ { - "name": "apply-settings", - "about": "Apply switch port settings", + "name": "configuration", "args": [ - { - "long": "json-body", - "help": "Path to a file that contains the full json body." - }, - { - "long": "json-body-template", - "help": "XXX" - }, - { - "long": "port", - "help": "A name to use when selecting switch ports." - }, - { - "long": "port-settings", - "help": "A name or id to use when applying switch port settings." - }, { "long": "profile", "help": "Configuration profile to use for commands", "global": true - }, - { - "long": "rack-id", - "help": "A rack id to use when selecting switch ports." - }, - { - "long": "switch-location", - "help": "A switch location to use when selecting switch ports." } - ] - }, - { - "name": "clear-settings", - "about": "Clear switch port settings", - "args": [ - { - "long": "port", - "help": "A name to use when selecting switch ports." - }, - { - "long": "profile", - "help": "Configuration profile to use for commands", - "global": true - }, + ], + "subcommands": [ { - "long": "rack-id", - "help": "A rack id to use when selecting switch ports." + "name": "apply", + "about": "Apply switch port settings", + "args": [ + { + "long": "json-body", + "help": "Path to a file that contains the full json body." + }, + { + "long": "json-body-template", + "help": "XXX" + }, + { + "long": "port", + "help": "A name to use when selecting switch ports." + }, + { + "long": "port-settings", + "help": "A name or id to use when applying switch port settings." + }, + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + }, + { + "long": "rack-id", + "help": "A rack id to use when selecting switch ports." + }, + { + "long": "switch-location", + "help": "A switch location to use when selecting switch ports." + } + ] }, { - "long": "switch-location", - "help": "A switch location to use when selecting switch ports." + "name": "remove", + "about": "Clear switch port settings", + "args": [ + { + "long": "port", + "help": "A name to use when selecting switch ports." + }, + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + }, + { + "long": "rack-id", + "help": "A rack id to use when selecting switch ports." + }, + { + "long": "switch-location", + "help": "A switch location to use when selecting switch ports." + } + ] } ] }, @@ -4217,6 +4227,37 @@ } ], "subcommands": [ + { + "name": "add", + "about": "Add block to address lot", + "args": [ + { + "long": "address-lot", + "help": "Name or ID of the address lot" + }, + { + "long": "first-address", + "help": "The first address in the lot (inclusive)." + }, + { + "long": "json-body", + "help": "Path to a file that contains the full json body." + }, + { + "long": "json-body-template", + "help": "XXX" + }, + { + "long": "last-address", + "help": "The last address in the lot (inclusive)." + }, + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + } + ] + }, { "name": "list", "about": "List blocks in address lot", @@ -4241,6 +4282,37 @@ ] } ] + }, + { + "name": "remove", + "about": "Remove block from address lot", + "args": [ + { + "long": "address-lot", + "help": "Name or ID of the address lot" + }, + { + "long": "first-address", + "help": "The first address in the lot (inclusive)." + }, + { + "long": "json-body", + "help": "Path to a file that contains the full json body." + }, + { + "long": "json-body-template", + "help": "XXX" + }, + { + "long": "last-address", + "help": "The last address in the lot (inclusive)." + }, + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + } + ] } ] }, @@ -5679,7 +5751,7 @@ ] }, { - "name": "switch-port-settings", + "name": "switch-port", "args": [ { "long": "profile", @@ -5689,72 +5761,1012 @@ ], "subcommands": [ { - "name": "create", - "about": "Create switch port settings", + "name": "configuration", "args": [ { - "long": "description" - }, + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + } + ], + "subcommands": [ { - "long": "json-body", - "help": "Path to a file that contains the full json body." + "name": "address", + "args": [ + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + } + ], + "subcommands": [ + { + "name": "add", + "about": "Add address to an interface configuration", + "args": [ + { + "long": "address", + "help": "The address and prefix length of this address." + }, + { + "long": "address-lot", + "help": "The address lot this address is drawn from." + }, + { + "long": "configuration", + "help": "A name or id to use when selecting a switch port configuration." + }, + { + "long": "interface", + "help": "The name of the interface" + }, + { + "long": "json-body", + "help": "Path to a file that contains the full json body." + }, + { + "long": "json-body-template", + "help": "XXX" + }, + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + }, + { + "long": "vlan-id", + "help": "Optional VLAN ID for this address" + } + ] + }, + { + "name": "list", + "about": "List addresses assigned to a provided interface configuration", + "args": [ + { + "long": "configuration", + "help": "A name or id to use when selecting a switch port configuration." + }, + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + } + ] + }, + { + "name": "remove", + "about": "Remove address from an interface configuration", + "args": [ + { + "long": "address", + "help": "The address and prefix length of this address." + }, + { + "long": "address-lot", + "help": "The address lot this address is drawn from." + }, + { + "long": "configuration", + "help": "A name or id to use when selecting a switch port configuration." + }, + { + "long": "interface", + "help": "The name of the interface" + }, + { + "long": "json-body", + "help": "Path to a file that contains the full json body." + }, + { + "long": "json-body-template", + "help": "XXX" + }, + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + }, + { + "long": "vlan-id", + "help": "Optional VLAN ID for this address" + } + ] + } + ] }, { - "long": "json-body-template", - "help": "XXX" + "name": "bgp", + "args": [ + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + } + ], + "subcommands": [ + { + "name": "peer", + "args": [ + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + } + ], + "subcommands": [ + { + "name": "add", + "about": "Add bgp peer to an interface configuration", + "args": [ + { + "long": "addr", + "help": "The address of th e host to peer with." + }, + { + "long": "allow-export-list-active", + "values": [ + "true", + "false" + ], + "help": "Enable export policies" + }, + { + "long": "allow-import-list-active", + "values": [ + "true", + "false" + ], + "help": "Enable import policies" + }, + { + "long": "bgp-config", + "help": "The global BGP configuration used for establishing a session with this peer." + }, + { + "long": "configuration", + "help": "A name or id to use when selecting a switch port configuration." + }, + { + "long": "connect-retry", + "help": "How long to to wait between TCP connection retries (seconds)." + }, + { + "long": "delay-open", + "help": "How long to delay sending an open request after establishing a TCP session (seconds)." + }, + { + "long": "enforce-first-as", + "values": [ + "true", + "false" + ], + "help": "Enforce that the first AS in paths received from this peer is the peer's AS." + }, + { + "long": "hold-time", + "help": "How long to hold peer connections between keepalives (seconds)." + }, + { + "long": "idle-hold-time", + "help": "How long to hold a peer in idle before attempting a new session (seconds)." + }, + { + "long": "interface-name", + "help": "The name of interface to peer on. This is relative to the port configuration this BGP peer configuration is a part of. For example this value could be phy0 to refer to a primary physical interface. Or it could be vlan47 to refer to a VLAN interface." + }, + { + "long": "json-body", + "help": "Path to a file that contains the full json body." + }, + { + "long": "json-body-template", + "help": "XXX" + }, + { + "long": "keepalive", + "help": "How often to send keepalive requests (seconds)." + }, + { + "long": "local-pref", + "help": "Apply a local preference to routes received from this peer." + }, + { + "long": "md5-auth-key", + "help": "Use the given key for TCP-MD5 authentication with the peer." + }, + { + "long": "min-ttl", + "help": "Require messages from a peer have a minimum IP time to live field." + }, + { + "long": "multi-exit-discriminator", + "help": "Apply the provided multi-exit discriminator (MED) updates sent to the peer." + }, + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + }, + { + "long": "remote-asn", + "help": "Require that a peer has a specified ASN." + }, + { + "long": "vlan-id", + "help": "Associate a VLAN ID with a peer." + } + ] + }, + { + "name": "allow", + "args": [ + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + } + ], + "subcommands": [ + { + "name": "export", + "args": [ + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + } + ], + "subcommands": [ + { + "name": "add", + "about": "Add prefix to bgp peer allowed export list", + "args": [ + { + "long": "configuration", + "help": "A name or id to use when selecting a switch port configuration." + }, + { + "long": "interface", + "help": "The interface the peer is configured on" + }, + { + "long": "json-body", + "help": "Path to a file that contains the full json body." + }, + { + "long": "json-body-template", + "help": "XXX" + }, + { + "long": "peer-address", + "help": "An address identifying the target bgp peer" + }, + { + "long": "prefix", + "help": "The allowed prefix to add or remove" + }, + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + } + ] + }, + { + "name": "list", + "about": "List prefixes allowed to be exported by a given bgp peer", + "args": [ + { + "long": "configuration", + "help": "A name or id to use when selecting a switch port configuration." + }, + { + "long": "peer-address", + "help": "An address identifying a configured bgp peer." + }, + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + } + ] + }, + { + "name": "remove", + "about": "Remove prefix from bgp peer allowed export list", + "args": [ + { + "long": "configuration", + "help": "A name or id to use when selecting a switch port configuration." + }, + { + "long": "interface", + "help": "The interface the peer is configured on" + }, + { + "long": "json-body", + "help": "Path to a file that contains the full json body." + }, + { + "long": "json-body-template", + "help": "XXX" + }, + { + "long": "peer-address", + "help": "An address identifying the target bgp peer" + }, + { + "long": "prefix", + "help": "The allowed prefix to add or remove" + }, + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + } + ] + } + ] + }, + { + "name": "import", + "args": [ + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + } + ], + "subcommands": [ + { + "name": "add", + "about": "Add prefix to bgp peer allowed import list", + "args": [ + { + "long": "configuration", + "help": "A name or id to use when selecting a switch port configuration." + }, + { + "long": "interface", + "help": "The interface the peer is configured on" + }, + { + "long": "json-body", + "help": "Path to a file that contains the full json body." + }, + { + "long": "json-body-template", + "help": "XXX" + }, + { + "long": "peer-address", + "help": "An address identifying the target bgp peer" + }, + { + "long": "prefix", + "help": "The allowed prefix to add or remove" + }, + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + } + ] + }, + { + "name": "list", + "about": "List prefixes allowed to be imported by a given bgp peer", + "args": [ + { + "long": "configuration", + "help": "A name or id to use when selecting a switch port configuration." + }, + { + "long": "peer-address", + "help": "An address identifying a configured bgp peer." + }, + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + } + ] + }, + { + "name": "remove", + "about": "Remove prefix from bgp peer allowed import list", + "args": [ + { + "long": "configuration", + "help": "A name or id to use when selecting a switch port configuration." + }, + { + "long": "interface", + "help": "The interface the peer is configured on" + }, + { + "long": "json-body", + "help": "Path to a file that contains the full json body." + }, + { + "long": "json-body-template", + "help": "XXX" + }, + { + "long": "peer-address", + "help": "An address identifying the target bgp peer" + }, + { + "long": "prefix", + "help": "The allowed prefix to add or remove" + }, + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + } + ] + } + ] + } + ] + }, + { + "name": "community", + "args": [ + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + } + ], + "subcommands": [ + { + "name": "add", + "about": "Add community to bgp peer", + "args": [ + { + "long": "community", + "help": "The community to add or remove" + }, + { + "long": "configuration", + "help": "A name or id to use when selecting a switch port configuration." + }, + { + "long": "interface", + "help": "The interface the peer is configured on" + }, + { + "long": "json-body", + "help": "Path to a file that contains the full json body." + }, + { + "long": "json-body-template", + "help": "XXX" + }, + { + "long": "peer-address", + "help": "An address identifying the target bgp peer" + }, + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + } + ] + }, + { + "name": "list", + "about": "List communities assigned to a bgp peer", + "args": [ + { + "long": "configuration", + "help": "A name or id to use when selecting a switch port configuration." + }, + { + "long": "peer-address", + "help": "An address identifying a configured bgp peer." + }, + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + } + ] + }, + { + "name": "remove", + "about": "Remove community from bgp peer", + "args": [ + { + "long": "community", + "help": "The community to add or remove" + }, + { + "long": "configuration", + "help": "A name or id to use when selecting a switch port configuration." + }, + { + "long": "interface", + "help": "The interface the peer is configured on" + }, + { + "long": "json-body", + "help": "Path to a file that contains the full json body." + }, + { + "long": "json-body-template", + "help": "XXX" + }, + { + "long": "peer-address", + "help": "An address identifying the target bgp peer" + }, + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + } + ] + } + ] + }, + { + "name": "list", + "about": "List bgp peers assigned to a provided interface configuration", + "args": [ + { + "long": "configuration", + "help": "A name or id to use when selecting a switch port configuration." + }, + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + } + ] + }, + { + "name": "remove", + "about": "Remove bgp peer from an interface configuration", + "args": [ + { + "long": "addr", + "help": "The address of the host to peer with." + }, + { + "long": "bgp-config", + "help": "The global BGP configuration used for establishing a session with this peer." + }, + { + "long": "configuration", + "help": "A name or id to use when selecting a switch port configuration." + }, + { + "long": "interface-name", + "help": "The name of interface to peer on. This is relative to the port configuration this BGP peer configuration is a part of. For example this value could be phy0 to refer to a primary physical interface. Or it could be vlan47 to refer to a VLAN interface." + }, + { + "long": "json-body", + "help": "Path to a file that contains the full json body." + }, + { + "long": "json-body-template", + "help": "XXX" + }, + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + } + ] + } + ] + } + ] }, { - "long": "name" + "name": "create", + "about": "Create switch port settings", + "args": [ + { + "long": "description" + }, + { + "long": "json-body", + "help": "Path to a file that contains the full json body." + }, + { + "long": "json-body-template", + "help": "XXX" + }, + { + "long": "name" + }, + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + } + ] }, { - "long": "profile", - "help": "Configuration profile to use for commands", - "global": true - } - ] - }, - { - "name": "delete", - "about": "Delete switch port settings", - "args": [ - { - "long": "port-settings", - "help": "An optional name or id to use when selecting port settings." + "name": "delete", + "about": "Delete switch port settings", + "args": [ + { + "long": "configuration", + "help": "An optional name or id to use when selecting a switch port configuration." + }, + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + } + ] }, { - "long": "profile", - "help": "Configuration profile to use for commands", - "global": true - } - ] - }, - { - "name": "list", - "about": "List switch port settings", - "args": [ + "name": "geometry", + "args": [ + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + } + ], + "subcommands": [ + { + "name": "set", + "about": "Set switch port geometry for a provided switch port configuration", + "args": [ + { + "long": "configuration", + "help": "A name or id to use when selecting a switch port configuration." + }, + { + "long": "geometry", + "values": [ + "qsfp28x1", + "qsfp28x2", + "sfp28x4" + ], + "help": "Link geometry for the switch port." + }, + { + "long": "json-body", + "help": "Path to a file that contains the full json body." + }, + { + "long": "json-body-template", + "help": "XXX" + }, + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + } + ] + }, + { + "name": "view", + "about": "Get switch port geometry for a provided switch port configuration", + "args": [ + { + "long": "configuration", + "help": "A name or id to use when selecting a switch port configuration." + }, + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + } + ] + } + ] + }, { - "long": "limit", - "help": "Maximum number of items returned by a single call" + "name": "link", + "args": [ + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + } + ], + "subcommands": [ + { + "name": "create", + "about": "Create a link for a provided switch port configuration", + "args": [ + { + "long": "autoneg", + "values": [ + "true", + "false" + ], + "help": "Whether or not to set autonegotiation" + }, + { + "long": "configuration", + "help": "A name or id to use when selecting a switch port configuration." + }, + { + "long": "fec", + "values": [ + "firecode", + "none", + "rs" + ], + "help": "The forward error correction mode of the link." + }, + { + "long": "json-body", + "help": "Path to a file that contains the full json body." + }, + { + "long": "json-body-template", + "help": "XXX" + }, + { + "long": "lldp-config", + "help": "The optional link-layer discovery protocol (LLDP) configuration for the link." + }, + { + "long": "mtu", + "help": "Maximum transmission unit for the link." + }, + { + "long": "name", + "help": "Name of link" + }, + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + }, + { + "long": "speed", + "values": [ + "speed0_g", + "speed1_g", + "speed10_g", + "speed25_g", + "speed40_g", + "speed50_g", + "speed100_g", + "speed200_g", + "speed400_g" + ], + "help": "The speed of the link." + } + ] + }, + { + "name": "delete", + "about": "Delete a link for a provided switch port configuration", + "args": [ + { + "long": "configuration", + "help": "A name or id to use when selecting a switch port configuration." + }, + { + "long": "link", + "help": "Link name" + }, + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + } + ] + }, + { + "name": "list", + "about": "List links for a provided switch port configuration", + "args": [ + { + "long": "configuration", + "help": "A name or id to use when selecting a switch port configuration." + }, + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + } + ] + }, + { + "name": "view", + "about": "View a link for a provided switch port configuration", + "args": [ + { + "long": "configuration", + "help": "A name or id to use when selecting a switch port configuration." + }, + { + "long": "link", + "help": "Link name" + }, + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + } + ] + } + ] }, { - "long": "port-settings", - "help": "An optional name or id to use when selecting port settings." + "name": "list", + "about": "List switch port settings", + "args": [ + { + "long": "configuration", + "help": "An optional name or id to use when selecting a switch port configuration." + }, + { + "long": "limit", + "help": "Maximum number of items returned by a single call" + }, + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + }, + { + "long": "sort-by", + "values": [ + "name_ascending", + "name_descending", + "id_ascending" + ] + } + ] }, { - "long": "profile", - "help": "Configuration profile to use for commands", - "global": true + "name": "route", + "args": [ + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + } + ], + "subcommands": [ + { + "name": "add", + "about": "Add route to an interface configuration", + "args": [ + { + "long": "configuration", + "help": "A name or id to use when selecting a switch port configuration." + }, + { + "long": "dst", + "help": "The route destination." + }, + { + "long": "gw", + "help": "The route gateway." + }, + { + "long": "interface", + "help": "The interface to configure the route on" + }, + { + "long": "json-body", + "help": "Path to a file that contains the full json body." + }, + { + "long": "json-body-template", + "help": "XXX" + }, + { + "long": "local-pref", + "help": "Local preference for route. Higher preference indictes precedence within and across protocols." + }, + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + }, + { + "long": "vid", + "help": "VLAN id the gateway is reachable over." + } + ] + }, + { + "name": "list", + "about": "List routes assigned to a provided interface configuration", + "args": [ + { + "long": "configuration", + "help": "A name or id to use when selecting a switch port configuration." + }, + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + } + ] + }, + { + "name": "remove", + "about": "Remove route from an interface configuration", + "args": [ + { + "long": "configuration", + "help": "A name or id to use when selecting a switch port configuration." + }, + { + "long": "dst", + "help": "The route destination." + }, + { + "long": "gw", + "help": "The route gateway." + }, + { + "long": "interface", + "help": "The interface to configure the route on" + }, + { + "long": "json-body", + "help": "Path to a file that contains the full json body." + }, + { + "long": "json-body-template", + "help": "XXX" + }, + { + "long": "local-pref", + "help": "Local preference for route. Higher preference indictes precedence within and across protocols." + }, + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + }, + { + "long": "vid", + "help": "VLAN id the gateway is reachable over." + } + ] + } + ] }, { - "long": "sort-by", - "values": [ - "name_ascending", - "name_descending", - "id_ascending" + "name": "view", + "about": "Get information about a named set of switch-port-settings", + "args": [ + { + "long": "configuration", + "help": "A name or id to use when selecting a switch port configuration." + }, + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + } ] } ] - }, + } + ] + }, + { + "name": "switch-port-settings", + "args": [ + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + } + ], + "subcommands": [ { "name": "show", "about": "Get the configuration of switch ports.", @@ -5765,21 +6777,6 @@ "global": true } ] - }, - { - "name": "view", - "about": "Get information about switch port", - "args": [ - { - "long": "port", - "help": "A name or id to use when selecting switch port settings info objects." - }, - { - "long": "profile", - "help": "Configuration profile to use for commands", - "global": true - } - ] } ] } diff --git a/cli/src/cli_builder.rs b/cli/src/cli_builder.rs index fc0f9e01..d0534a24 100644 --- a/cli/src/cli_builder.rs +++ b/cli/src/cli_builder.rs @@ -507,6 +507,36 @@ fn xxx<'a>(command: CliCommand) -> Option<&'a str> { Some("system networking switch-port configuration route remove") } + CliCommand::NetworkingSwitchPortConfigurationBgpPeerAllowImportList => { + Some("system networking switch-port configuration bgp peer allow import list") + } + CliCommand::NetworkingSwitchPortConfigurationBgpPeerAllowImportAdd => { + Some("system networking switch-port configuration bgp peer allow import add") + } + CliCommand::NetworkingSwitchPortConfigurationBgpPeerAllowImportRemove => { + Some("system networking switch-port configuration bgp peer allow import remove") + } + + CliCommand::NetworkingSwitchPortConfigurationBgpPeerAllowExportList => { + Some("system networking switch-port configuration bgp peer allow export list") + } + CliCommand::NetworkingSwitchPortConfigurationBgpPeerAllowExportAdd => { + Some("system networking switch-port configuration bgp peer allow export add") + } + CliCommand::NetworkingSwitchPortConfigurationBgpPeerAllowExportRemove => { + Some("system networking switch-port configuration bgp peer allow export remove") + } + + CliCommand::NetworkingSwitchPortConfigurationBgpPeerCommunityList => { + Some("system networking switch-port configuration bgp peer community list") + } + CliCommand::NetworkingSwitchPortConfigurationBgpPeerCommunityAdd => { + Some("system networking switch-port configuration bgp peer community add") + } + CliCommand::NetworkingSwitchPortConfigurationBgpPeerCommunityRemove => { + Some("system networking switch-port configuration bgp peer community remove") + } + CliCommand::NetworkingSwitchPortConfigurationLinkList => { Some("system networking switch-port configuration link list") } diff --git a/cli/src/cmd_net.rs b/cli/src/cmd_net.rs index 20bc7918..39447ae6 100644 --- a/cli/src/cmd_net.rs +++ b/cli/src/cmd_net.rs @@ -14,7 +14,7 @@ use colored::*; use futures::TryStreamExt; use oxide::{ types::{ - Address, AddressConfig, BgpAnnounceSetCreate, BgpAnnouncementCreate, BgpPeer, + Address, AddressConfig, BgpAnnounceSetCreate, BgpAnnouncementCreate, BgpPeerCombined, BgpPeerConfig, BgpPeerStatus, ImportExportPolicy, IpNet, LinkConfigCreate, LinkFec, LinkSpeed, LldpLinkConfigCreate, Name, NameOrId, Route, RouteConfig, SwitchInterfaceConfigCreate, SwitchInterfaceKind, SwitchInterfaceKind2, SwitchLocation, @@ -1047,7 +1047,7 @@ impl AuthenticatedCmd for CmdBgpPeerSet { async fn run(&self, client: &Client) -> Result<()> { let mut settings = current_port_settings(client, &self.rack, &self.switch, &self.port).await?; - let peer = BgpPeer { + let peer = BgpPeerCombined { addr: self.addr, allowed_import: if self.allowed_imports.is_empty() { ImportExportPolicy::NoFiltering diff --git a/cli/src/generated_cli.rs b/cli/src/generated_cli.rs index 71069a16..a7db1968 100644 --- a/cli/src/generated_cli.rs +++ b/cli/src/generated_cli.rs @@ -220,6 +220,33 @@ impl Cli { CliCommand::NetworkingSwitchPortConfigurationBgpPeerAdd => { Self::cli_networking_switch_port_configuration_bgp_peer_add() } + CliCommand::NetworkingSwitchPortConfigurationBgpPeerAllowExportList => { + Self::cli_networking_switch_port_configuration_bgp_peer_allow_export_list() + } + CliCommand::NetworkingSwitchPortConfigurationBgpPeerAllowExportAdd => { + Self::cli_networking_switch_port_configuration_bgp_peer_allow_export_add() + } + CliCommand::NetworkingSwitchPortConfigurationBgpPeerAllowExportRemove => { + Self::cli_networking_switch_port_configuration_bgp_peer_allow_export_remove() + } + CliCommand::NetworkingSwitchPortConfigurationBgpPeerAllowImportList => { + Self::cli_networking_switch_port_configuration_bgp_peer_allow_import_list() + } + CliCommand::NetworkingSwitchPortConfigurationBgpPeerAllowImportAdd => { + Self::cli_networking_switch_port_configuration_bgp_peer_allow_import_add() + } + CliCommand::NetworkingSwitchPortConfigurationBgpPeerAllowImportRemove => { + Self::cli_networking_switch_port_configuration_bgp_peer_allow_import_remove() + } + CliCommand::NetworkingSwitchPortConfigurationBgpPeerCommunityList => { + Self::cli_networking_switch_port_configuration_bgp_peer_community_list() + } + CliCommand::NetworkingSwitchPortConfigurationBgpPeerCommunityAdd => { + Self::cli_networking_switch_port_configuration_bgp_peer_community_add() + } + CliCommand::NetworkingSwitchPortConfigurationBgpPeerCommunityRemove => { + Self::cli_networking_switch_port_configuration_bgp_peer_community_remove() + } CliCommand::NetworkingSwitchPortConfigurationBgpPeerRemove => { Self::cli_networking_switch_port_configuration_bgp_peer_remove() } @@ -4785,9 +4812,23 @@ impl Cli { .arg( clap::Arg::new("addr") .long("addr") - .value_parser(clap::value_parser!(std::net::IpAddr)) + .value_parser(clap::value_parser!(types::IpNet)) .required_unless_present("json-body") - .help("The address of the host to peer with."), + .help("The address of th e host to peer with."), + ) + .arg( + clap::Arg::new("allow-export-list-active") + .long("allow-export-list-active") + .value_parser(clap::value_parser!(bool)) + .required_unless_present("json-body") + .help("Enable export policies"), + ) + .arg( + clap::Arg::new("allow-import-list-active") + .long("allow-import-list-active") + .value_parser(clap::value_parser!(bool)) + .required_unless_present("json-body") + .help("Enable import policies"), ) .arg( clap::Arg::new("bgp-config") @@ -4918,7 +4959,7 @@ impl Cli { clap::Arg::new("json-body") .long("json-body") .value_name("JSON-FILE") - .required(true) + .required(false) .value_parser(clap::value_parser!(std::path::PathBuf)) .help("Path to a file that contains the full json body."), ) @@ -4931,25 +4972,27 @@ impl Cli { .about("Add bgp peer to an interface configuration") } - pub fn cli_networking_switch_port_configuration_bgp_peer_remove() -> clap::Command { + pub fn cli_networking_switch_port_configuration_bgp_peer_allow_export_list() -> clap::Command { clap::Command::new("") .arg( - clap::Arg::new("addr") - .long("addr") - .value_parser(clap::value_parser!(std::net::IpAddr)) - .required_unless_present("json-body") - .help("The address of the host to peer with."), + clap::Arg::new("configuration") + .long("configuration") + .value_parser(clap::value_parser!(types::NameOrId)) + .required(true) + .help("A name or id to use when selecting a switch port configuration."), ) .arg( - clap::Arg::new("bgp-config") - .long("bgp-config") - .value_parser(clap::value_parser!(types::NameOrId)) - .required_unless_present("json-body") - .help( - "The global BGP configuration used for establishing a session with this \ - peer.", - ), + clap::Arg::new("peer-address") + .long("peer-address") + .value_parser(clap::value_parser!(std::net::IpAddr)) + .required(true) + .help("An address identifying a configured bgp peer."), ) + .about("List prefixes allowed to be exported by a given bgp peer") + } + + pub fn cli_networking_switch_port_configuration_bgp_peer_allow_export_add() -> clap::Command { + clap::Command::new("") .arg( clap::Arg::new("configuration") .long("configuration") @@ -4958,16 +5001,25 @@ impl Cli { .help("A name or id to use when selecting a switch port configuration."), ) .arg( - clap::Arg::new("interface-name") - .long("interface-name") - .value_parser(clap::value_parser!(String)) + clap::Arg::new("interface") + .long("interface") + .value_parser(clap::value_parser!(types::Name)) .required_unless_present("json-body") - .help( - "The name of interface to peer on. This is relative to the port \ - configuration this BGP peer configuration is a part of. For example this \ - value could be phy0 to refer to a primary physical interface. Or it \ - could be vlan47 to refer to a VLAN interface.", - ), + .help("The interface the peer is configured on"), + ) + .arg( + clap::Arg::new("peer-address") + .long("peer-address") + .value_parser(clap::value_parser!(std::net::IpAddr)) + .required_unless_present("json-body") + .help("An address identifying the target bgp peer"), + ) + .arg( + clap::Arg::new("prefix") + .long("prefix") + .value_parser(clap::value_parser!(types::IpNet)) + .required_unless_present("json-body") + .help("The allowed prefix to add or remove"), ) .arg( clap::Arg::new("json-body") @@ -4983,10 +5035,11 @@ impl Cli { .action(clap::ArgAction::SetTrue) .help("XXX"), ) - .about("Remove bgp peer from an interface configuration") + .about("Add prefix to bgp peer allowed export list") } - pub fn cli_networking_switch_port_configuration_geometry_view() -> clap::Command { + pub fn cli_networking_switch_port_configuration_bgp_peer_allow_export_remove() -> clap::Command + { clap::Command::new("") .arg( clap::Arg::new("configuration") @@ -4995,31 +5048,26 @@ impl Cli { .required(true) .help("A name or id to use when selecting a switch port configuration."), ) - .about("Get switch port geometry for a provided switch port configuration") - } - - pub fn cli_networking_switch_port_configuration_geometry_set() -> clap::Command { - clap::Command::new("") .arg( - clap::Arg::new("configuration") - .long("configuration") - .value_parser(clap::value_parser!(types::NameOrId)) - .required(true) - .help("A name or id to use when selecting a switch port configuration."), + clap::Arg::new("interface") + .long("interface") + .value_parser(clap::value_parser!(types::Name)) + .required_unless_present("json-body") + .help("The interface the peer is configured on"), ) .arg( - clap::Arg::new("geometry") - .long("geometry") - .value_parser(clap::builder::TypedValueParser::map( - clap::builder::PossibleValuesParser::new([ - types::SwitchPortGeometry::Qsfp28x1.to_string(), - types::SwitchPortGeometry::Qsfp28x2.to_string(), - types::SwitchPortGeometry::Sfp28x4.to_string(), - ]), - |s| types::SwitchPortGeometry::try_from(s).unwrap(), - )) + clap::Arg::new("peer-address") + .long("peer-address") + .value_parser(clap::value_parser!(std::net::IpAddr)) .required_unless_present("json-body") - .help("Link geometry for the switch port."), + .help("An address identifying the target bgp peer"), + ) + .arg( + clap::Arg::new("prefix") + .long("prefix") + .value_parser(clap::value_parser!(types::IpNet)) + .required_unless_present("json-body") + .help("The allowed prefix to add or remove"), ) .arg( clap::Arg::new("json-body") @@ -5035,10 +5083,10 @@ impl Cli { .action(clap::ArgAction::SetTrue) .help("XXX"), ) - .about("Set switch port geometry for a provided switch port configuration") + .about("Remove prefix from bgp peer allowed export list") } - pub fn cli_networking_switch_port_configuration_link_list() -> clap::Command { + pub fn cli_networking_switch_port_configuration_bgp_peer_allow_import_list() -> clap::Command { clap::Command::new("") .arg( clap::Arg::new("configuration") @@ -5047,18 +5095,18 @@ impl Cli { .required(true) .help("A name or id to use when selecting a switch port configuration."), ) - .about("List links for a provided switch port configuration") + .arg( + clap::Arg::new("peer-address") + .long("peer-address") + .value_parser(clap::value_parser!(std::net::IpAddr)) + .required(true) + .help("An address identifying a configured bgp peer."), + ) + .about("List prefixes allowed to be imported by a given bgp peer") } - pub fn cli_networking_switch_port_configuration_link_create() -> clap::Command { + pub fn cli_networking_switch_port_configuration_bgp_peer_allow_import_add() -> clap::Command { clap::Command::new("") - .arg( - clap::Arg::new("autoneg") - .long("autoneg") - .value_parser(clap::value_parser!(bool)) - .required_unless_present("json-body") - .help("Whether or not to set autonegotiation"), - ) .arg( clap::Arg::new("configuration") .long("configuration") @@ -5067,62 +5115,25 @@ impl Cli { .help("A name or id to use when selecting a switch port configuration."), ) .arg( - clap::Arg::new("fec") - .long("fec") - .value_parser(clap::builder::TypedValueParser::map( - clap::builder::PossibleValuesParser::new([ - types::LinkFec::Firecode.to_string(), - types::LinkFec::None.to_string(), - types::LinkFec::Rs.to_string(), - ]), - |s| types::LinkFec::try_from(s).unwrap(), - )) - .required_unless_present("json-body") - .help("The forward error correction mode of the link."), - ) - .arg( - clap::Arg::new("lldp-config") - .long("lldp-config") - .value_parser(clap::value_parser!(types::NameOrId)) - .required(false) - .help( - "The optional link-layer discovery protocol (LLDP) configuration for the \ - link.", - ), - ) - .arg( - clap::Arg::new("mtu") - .long("mtu") - .value_parser(clap::value_parser!(u16)) + clap::Arg::new("interface") + .long("interface") + .value_parser(clap::value_parser!(types::Name)) .required_unless_present("json-body") - .help("Maximum transmission unit for the link."), + .help("The interface the peer is configured on"), ) .arg( - clap::Arg::new("name") - .long("name") - .value_parser(clap::value_parser!(types::Name)) + clap::Arg::new("peer-address") + .long("peer-address") + .value_parser(clap::value_parser!(std::net::IpAddr)) .required_unless_present("json-body") - .help("Name of link"), + .help("An address identifying the target bgp peer"), ) .arg( - clap::Arg::new("speed") - .long("speed") - .value_parser(clap::builder::TypedValueParser::map( - clap::builder::PossibleValuesParser::new([ - types::LinkSpeed::Speed0G.to_string(), - types::LinkSpeed::Speed1G.to_string(), - types::LinkSpeed::Speed10G.to_string(), - types::LinkSpeed::Speed25G.to_string(), - types::LinkSpeed::Speed40G.to_string(), - types::LinkSpeed::Speed50G.to_string(), - types::LinkSpeed::Speed100G.to_string(), - types::LinkSpeed::Speed200G.to_string(), - types::LinkSpeed::Speed400G.to_string(), - ]), - |s| types::LinkSpeed::try_from(s).unwrap(), - )) + clap::Arg::new("prefix") + .long("prefix") + .value_parser(clap::value_parser!(types::IpNet)) .required_unless_present("json-body") - .help("The speed of the link."), + .help("The allowed prefix to add or remove"), ) .arg( clap::Arg::new("json-body") @@ -5138,10 +5149,11 @@ impl Cli { .action(clap::ArgAction::SetTrue) .help("XXX"), ) - .about("Create a link for a provided switch port configuration") + .about("Add prefix to bgp peer allowed import list") } - pub fn cli_networking_switch_port_configuration_link_view() -> clap::Command { + pub fn cli_networking_switch_port_configuration_bgp_peer_allow_import_remove() -> clap::Command + { clap::Command::new("") .arg( clap::Arg::new("configuration") @@ -5151,16 +5163,44 @@ impl Cli { .help("A name or id to use when selecting a switch port configuration."), ) .arg( - clap::Arg::new("link") - .long("link") + clap::Arg::new("interface") + .long("interface") .value_parser(clap::value_parser!(types::Name)) - .required(true) - .help("Link name"), + .required_unless_present("json-body") + .help("The interface the peer is configured on"), ) - .about("View a link for a provided switch port configuration") + .arg( + clap::Arg::new("peer-address") + .long("peer-address") + .value_parser(clap::value_parser!(std::net::IpAddr)) + .required_unless_present("json-body") + .help("An address identifying the target bgp peer"), + ) + .arg( + clap::Arg::new("prefix") + .long("prefix") + .value_parser(clap::value_parser!(types::IpNet)) + .required_unless_present("json-body") + .help("The allowed prefix to add or remove"), + ) + .arg( + clap::Arg::new("json-body") + .long("json-body") + .value_name("JSON-FILE") + .required(false) + .value_parser(clap::value_parser!(std::path::PathBuf)) + .help("Path to a file that contains the full json body."), + ) + .arg( + clap::Arg::new("json-body-template") + .long("json-body-template") + .action(clap::ArgAction::SetTrue) + .help("XXX"), + ) + .about("Remove prefix from bgp peer allowed import list") } - pub fn cli_networking_switch_port_configuration_link_delete() -> clap::Command { + pub fn cli_networking_switch_port_configuration_bgp_peer_community_list() -> clap::Command { clap::Command::new("") .arg( clap::Arg::new("configuration") @@ -5170,29 +5210,24 @@ impl Cli { .help("A name or id to use when selecting a switch port configuration."), ) .arg( - clap::Arg::new("link") - .long("link") - .value_parser(clap::value_parser!(types::Name)) + clap::Arg::new("peer-address") + .long("peer-address") + .value_parser(clap::value_parser!(std::net::IpAddr)) .required(true) - .help("Link name"), + .help("An address identifying a configured bgp peer."), ) - .about("Delete a link for a provided switch port configuration") + .about("List communities assigned to a bgp peer") } - pub fn cli_networking_switch_port_configuration_route_list() -> clap::Command { + pub fn cli_networking_switch_port_configuration_bgp_peer_community_add() -> clap::Command { clap::Command::new("") .arg( - clap::Arg::new("configuration") - .long("configuration") - .value_parser(clap::value_parser!(types::NameOrId)) - .required(true) - .help("A name or id to use when selecting a switch port configuration."), + clap::Arg::new("community") + .long("community") + .value_parser(clap::value_parser!(u32)) + .required_unless_present("json-body") + .help("The community to add or remove"), ) - .about("List routes assigned to a provided interface configuration") - } - - pub fn cli_networking_switch_port_configuration_route_add() -> clap::Command { - clap::Command::new("") .arg( clap::Arg::new("configuration") .long("configuration") @@ -5200,43 +5235,19 @@ impl Cli { .required(true) .help("A name or id to use when selecting a switch port configuration."), ) - .arg( - clap::Arg::new("dst") - .long("dst") - .value_parser(clap::value_parser!(types::IpNet)) - .required_unless_present("json-body") - .help("The route destination."), - ) - .arg( - clap::Arg::new("gw") - .long("gw") - .value_parser(clap::value_parser!(std::net::IpAddr)) - .required_unless_present("json-body") - .help("The route gateway."), - ) .arg( clap::Arg::new("interface") .long("interface") .value_parser(clap::value_parser!(types::Name)) .required_unless_present("json-body") - .help("The interface to configure the route on"), - ) - .arg( - clap::Arg::new("local-pref") - .long("local-pref") - .value_parser(clap::value_parser!(u32)) - .required(false) - .help( - "Local preference for route. Higher preference indictes precedence within \ - and across protocols.", - ), + .help("The interface the peer is configured on"), ) .arg( - clap::Arg::new("vid") - .long("vid") - .value_parser(clap::value_parser!(u16)) - .required(false) - .help("VLAN id the gateway is reachable over."), + clap::Arg::new("peer-address") + .long("peer-address") + .value_parser(clap::value_parser!(std::net::IpAddr)) + .required_unless_present("json-body") + .help("An address identifying the target bgp peer"), ) .arg( clap::Arg::new("json-body") @@ -5252,15 +5263,386 @@ impl Cli { .action(clap::ArgAction::SetTrue) .help("XXX"), ) - .about("Add route to an interface configuration") + .about("Add community to bgp peer") } - pub fn cli_networking_switch_port_configuration_route_remove() -> clap::Command { + pub fn cli_networking_switch_port_configuration_bgp_peer_community_remove() -> clap::Command { clap::Command::new("") .arg( - clap::Arg::new("configuration") - .long("configuration") - .value_parser(clap::value_parser!(types::NameOrId)) + clap::Arg::new("community") + .long("community") + .value_parser(clap::value_parser!(u32)) + .required_unless_present("json-body") + .help("The community to add or remove"), + ) + .arg( + clap::Arg::new("configuration") + .long("configuration") + .value_parser(clap::value_parser!(types::NameOrId)) + .required(true) + .help("A name or id to use when selecting a switch port configuration."), + ) + .arg( + clap::Arg::new("interface") + .long("interface") + .value_parser(clap::value_parser!(types::Name)) + .required_unless_present("json-body") + .help("The interface the peer is configured on"), + ) + .arg( + clap::Arg::new("peer-address") + .long("peer-address") + .value_parser(clap::value_parser!(std::net::IpAddr)) + .required_unless_present("json-body") + .help("An address identifying the target bgp peer"), + ) + .arg( + clap::Arg::new("json-body") + .long("json-body") + .value_name("JSON-FILE") + .required(false) + .value_parser(clap::value_parser!(std::path::PathBuf)) + .help("Path to a file that contains the full json body."), + ) + .arg( + clap::Arg::new("json-body-template") + .long("json-body-template") + .action(clap::ArgAction::SetTrue) + .help("XXX"), + ) + .about("Remove community from bgp peer") + } + + pub fn cli_networking_switch_port_configuration_bgp_peer_remove() -> clap::Command { + clap::Command::new("") + .arg( + clap::Arg::new("addr") + .long("addr") + .value_parser(clap::value_parser!(std::net::IpAddr)) + .required_unless_present("json-body") + .help("The address of the host to peer with."), + ) + .arg( + clap::Arg::new("bgp-config") + .long("bgp-config") + .value_parser(clap::value_parser!(types::NameOrId)) + .required_unless_present("json-body") + .help( + "The global BGP configuration used for establishing a session with this \ + peer.", + ), + ) + .arg( + clap::Arg::new("configuration") + .long("configuration") + .value_parser(clap::value_parser!(types::NameOrId)) + .required(true) + .help("A name or id to use when selecting a switch port configuration."), + ) + .arg( + clap::Arg::new("interface-name") + .long("interface-name") + .value_parser(clap::value_parser!(String)) + .required_unless_present("json-body") + .help( + "The name of interface to peer on. This is relative to the port \ + configuration this BGP peer configuration is a part of. For example this \ + value could be phy0 to refer to a primary physical interface. Or it \ + could be vlan47 to refer to a VLAN interface.", + ), + ) + .arg( + clap::Arg::new("json-body") + .long("json-body") + .value_name("JSON-FILE") + .required(false) + .value_parser(clap::value_parser!(std::path::PathBuf)) + .help("Path to a file that contains the full json body."), + ) + .arg( + clap::Arg::new("json-body-template") + .long("json-body-template") + .action(clap::ArgAction::SetTrue) + .help("XXX"), + ) + .about("Remove bgp peer from an interface configuration") + } + + pub fn cli_networking_switch_port_configuration_geometry_view() -> clap::Command { + clap::Command::new("") + .arg( + clap::Arg::new("configuration") + .long("configuration") + .value_parser(clap::value_parser!(types::NameOrId)) + .required(true) + .help("A name or id to use when selecting a switch port configuration."), + ) + .about("Get switch port geometry for a provided switch port configuration") + } + + pub fn cli_networking_switch_port_configuration_geometry_set() -> clap::Command { + clap::Command::new("") + .arg( + clap::Arg::new("configuration") + .long("configuration") + .value_parser(clap::value_parser!(types::NameOrId)) + .required(true) + .help("A name or id to use when selecting a switch port configuration."), + ) + .arg( + clap::Arg::new("geometry") + .long("geometry") + .value_parser(clap::builder::TypedValueParser::map( + clap::builder::PossibleValuesParser::new([ + types::SwitchPortGeometry::Qsfp28x1.to_string(), + types::SwitchPortGeometry::Qsfp28x2.to_string(), + types::SwitchPortGeometry::Sfp28x4.to_string(), + ]), + |s| types::SwitchPortGeometry::try_from(s).unwrap(), + )) + .required_unless_present("json-body") + .help("Link geometry for the switch port."), + ) + .arg( + clap::Arg::new("json-body") + .long("json-body") + .value_name("JSON-FILE") + .required(false) + .value_parser(clap::value_parser!(std::path::PathBuf)) + .help("Path to a file that contains the full json body."), + ) + .arg( + clap::Arg::new("json-body-template") + .long("json-body-template") + .action(clap::ArgAction::SetTrue) + .help("XXX"), + ) + .about("Set switch port geometry for a provided switch port configuration") + } + + pub fn cli_networking_switch_port_configuration_link_list() -> clap::Command { + clap::Command::new("") + .arg( + clap::Arg::new("configuration") + .long("configuration") + .value_parser(clap::value_parser!(types::NameOrId)) + .required(true) + .help("A name or id to use when selecting a switch port configuration."), + ) + .about("List links for a provided switch port configuration") + } + + pub fn cli_networking_switch_port_configuration_link_create() -> clap::Command { + clap::Command::new("") + .arg( + clap::Arg::new("autoneg") + .long("autoneg") + .value_parser(clap::value_parser!(bool)) + .required_unless_present("json-body") + .help("Whether or not to set autonegotiation"), + ) + .arg( + clap::Arg::new("configuration") + .long("configuration") + .value_parser(clap::value_parser!(types::NameOrId)) + .required(true) + .help("A name or id to use when selecting a switch port configuration."), + ) + .arg( + clap::Arg::new("fec") + .long("fec") + .value_parser(clap::builder::TypedValueParser::map( + clap::builder::PossibleValuesParser::new([ + types::LinkFec::Firecode.to_string(), + types::LinkFec::None.to_string(), + types::LinkFec::Rs.to_string(), + ]), + |s| types::LinkFec::try_from(s).unwrap(), + )) + .required_unless_present("json-body") + .help("The forward error correction mode of the link."), + ) + .arg( + clap::Arg::new("lldp-config") + .long("lldp-config") + .value_parser(clap::value_parser!(types::NameOrId)) + .required(false) + .help( + "The optional link-layer discovery protocol (LLDP) configuration for the \ + link.", + ), + ) + .arg( + clap::Arg::new("mtu") + .long("mtu") + .value_parser(clap::value_parser!(u16)) + .required_unless_present("json-body") + .help("Maximum transmission unit for the link."), + ) + .arg( + clap::Arg::new("name") + .long("name") + .value_parser(clap::value_parser!(types::Name)) + .required_unless_present("json-body") + .help("Name of link"), + ) + .arg( + clap::Arg::new("speed") + .long("speed") + .value_parser(clap::builder::TypedValueParser::map( + clap::builder::PossibleValuesParser::new([ + types::LinkSpeed::Speed0G.to_string(), + types::LinkSpeed::Speed1G.to_string(), + types::LinkSpeed::Speed10G.to_string(), + types::LinkSpeed::Speed25G.to_string(), + types::LinkSpeed::Speed40G.to_string(), + types::LinkSpeed::Speed50G.to_string(), + types::LinkSpeed::Speed100G.to_string(), + types::LinkSpeed::Speed200G.to_string(), + types::LinkSpeed::Speed400G.to_string(), + ]), + |s| types::LinkSpeed::try_from(s).unwrap(), + )) + .required_unless_present("json-body") + .help("The speed of the link."), + ) + .arg( + clap::Arg::new("json-body") + .long("json-body") + .value_name("JSON-FILE") + .required(false) + .value_parser(clap::value_parser!(std::path::PathBuf)) + .help("Path to a file that contains the full json body."), + ) + .arg( + clap::Arg::new("json-body-template") + .long("json-body-template") + .action(clap::ArgAction::SetTrue) + .help("XXX"), + ) + .about("Create a link for a provided switch port configuration") + } + + pub fn cli_networking_switch_port_configuration_link_view() -> clap::Command { + clap::Command::new("") + .arg( + clap::Arg::new("configuration") + .long("configuration") + .value_parser(clap::value_parser!(types::NameOrId)) + .required(true) + .help("A name or id to use when selecting a switch port configuration."), + ) + .arg( + clap::Arg::new("link") + .long("link") + .value_parser(clap::value_parser!(types::Name)) + .required(true) + .help("Link name"), + ) + .about("View a link for a provided switch port configuration") + } + + pub fn cli_networking_switch_port_configuration_link_delete() -> clap::Command { + clap::Command::new("") + .arg( + clap::Arg::new("configuration") + .long("configuration") + .value_parser(clap::value_parser!(types::NameOrId)) + .required(true) + .help("A name or id to use when selecting a switch port configuration."), + ) + .arg( + clap::Arg::new("link") + .long("link") + .value_parser(clap::value_parser!(types::Name)) + .required(true) + .help("Link name"), + ) + .about("Delete a link for a provided switch port configuration") + } + + pub fn cli_networking_switch_port_configuration_route_list() -> clap::Command { + clap::Command::new("") + .arg( + clap::Arg::new("configuration") + .long("configuration") + .value_parser(clap::value_parser!(types::NameOrId)) + .required(true) + .help("A name or id to use when selecting a switch port configuration."), + ) + .about("List routes assigned to a provided interface configuration") + } + + pub fn cli_networking_switch_port_configuration_route_add() -> clap::Command { + clap::Command::new("") + .arg( + clap::Arg::new("configuration") + .long("configuration") + .value_parser(clap::value_parser!(types::NameOrId)) + .required(true) + .help("A name or id to use when selecting a switch port configuration."), + ) + .arg( + clap::Arg::new("dst") + .long("dst") + .value_parser(clap::value_parser!(types::IpNet)) + .required_unless_present("json-body") + .help("The route destination."), + ) + .arg( + clap::Arg::new("gw") + .long("gw") + .value_parser(clap::value_parser!(std::net::IpAddr)) + .required_unless_present("json-body") + .help("The route gateway."), + ) + .arg( + clap::Arg::new("interface") + .long("interface") + .value_parser(clap::value_parser!(types::Name)) + .required_unless_present("json-body") + .help("The interface to configure the route on"), + ) + .arg( + clap::Arg::new("local-pref") + .long("local-pref") + .value_parser(clap::value_parser!(u32)) + .required(false) + .help( + "Local preference for route. Higher preference indictes precedence within \ + and across protocols.", + ), + ) + .arg( + clap::Arg::new("vid") + .long("vid") + .value_parser(clap::value_parser!(u16)) + .required(false) + .help("VLAN id the gateway is reachable over."), + ) + .arg( + clap::Arg::new("json-body") + .long("json-body") + .value_name("JSON-FILE") + .required(false) + .value_parser(clap::value_parser!(std::path::PathBuf)) + .help("Path to a file that contains the full json body."), + ) + .arg( + clap::Arg::new("json-body-template") + .long("json-body-template") + .action(clap::ArgAction::SetTrue) + .help("XXX"), + ) + .about("Add route to an interface configuration") + } + + pub fn cli_networking_switch_port_configuration_route_remove() -> clap::Command { + clap::Command::new("") + .arg( + clap::Arg::new("configuration") + .long("configuration") + .value_parser(clap::value_parser!(types::NameOrId)) .required(true) .help("A name or id to use when selecting a switch port configuration."), ) @@ -7112,6 +7494,50 @@ impl Cli { self.execute_networking_switch_port_configuration_bgp_peer_add(matches) .await } + CliCommand::NetworkingSwitchPortConfigurationBgpPeerAllowExportList => { + self.execute_networking_switch_port_configuration_bgp_peer_allow_export_list( + matches, + ) + .await + } + CliCommand::NetworkingSwitchPortConfigurationBgpPeerAllowExportAdd => { + self.execute_networking_switch_port_configuration_bgp_peer_allow_export_add(matches) + .await + } + CliCommand::NetworkingSwitchPortConfigurationBgpPeerAllowExportRemove => { + self.execute_networking_switch_port_configuration_bgp_peer_allow_export_remove( + matches, + ) + .await + } + CliCommand::NetworkingSwitchPortConfigurationBgpPeerAllowImportList => { + self.execute_networking_switch_port_configuration_bgp_peer_allow_import_list( + matches, + ) + .await + } + CliCommand::NetworkingSwitchPortConfigurationBgpPeerAllowImportAdd => { + self.execute_networking_switch_port_configuration_bgp_peer_allow_import_add(matches) + .await + } + CliCommand::NetworkingSwitchPortConfigurationBgpPeerAllowImportRemove => { + self.execute_networking_switch_port_configuration_bgp_peer_allow_import_remove( + matches, + ) + .await + } + CliCommand::NetworkingSwitchPortConfigurationBgpPeerCommunityList => { + self.execute_networking_switch_port_configuration_bgp_peer_community_list(matches) + .await + } + CliCommand::NetworkingSwitchPortConfigurationBgpPeerCommunityAdd => { + self.execute_networking_switch_port_configuration_bgp_peer_community_add(matches) + .await + } + CliCommand::NetworkingSwitchPortConfigurationBgpPeerCommunityRemove => { + self.execute_networking_switch_port_configuration_bgp_peer_community_remove(matches) + .await + } CliCommand::NetworkingSwitchPortConfigurationBgpPeerRemove => { self.execute_networking_switch_port_configuration_bgp_peer_remove(matches) .await @@ -8937,11 +9363,185 @@ impl Cli { } } - pub async fn execute_project_ip_pool_list( + pub async fn execute_project_ip_pool_list( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.project_ip_pool_list(); + if let Some(value) = matches.get_one::("limit") { + request = request.limit(value.clone()); + } + + if let Some(value) = matches.get_one::("sort-by") { + request = request.sort_by(value.clone()); + } + + self.config + .execute_project_ip_pool_list(matches, &mut request)?; + self.config.list_start::(); + let mut stream = futures::StreamExt::take( + request.stream(), + matches + .get_one::("limit") + .map_or(usize::MAX, |x| x.get() as usize), + ); + loop { + match futures::TryStreamExt::try_next(&mut stream).await { + Err(r) => { + self.config.list_end_error(&r); + return Err(anyhow::Error::new(r)); + } + Ok(None) => { + self.config + .list_end_success::(); + return Ok(()); + } + Ok(Some(value)) => { + self.config.list_item(&value); + } + } + } + } + + pub async fn execute_project_ip_pool_view( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.project_ip_pool_view(); + if let Some(value) = matches.get_one::("pool") { + request = request.pool(value.clone()); + } + + self.config + .execute_project_ip_pool_view(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) + } + } + } + + pub async fn execute_login_local(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.login_local(); + if let Some(value) = matches.get_one::("password") { + request = request.body_map(|body| body.password(value.clone())) + } + + if let Some(value) = matches.get_one::("silo-name") { + request = request.silo_name(value.clone()); + } + + if let Some(value) = matches.get_one::("username") { + request = request.body_map(|body| body.username(value.clone())) + } + + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = + serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); + } + + self.config.execute_login_local(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_no_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) + } + } + } + + pub async fn execute_logout(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.logout(); + self.config.execute_logout(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_no_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) + } + } + } + + pub async fn execute_current_user_view( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.current_user_view(); + self.config + .execute_current_user_view(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) + } + } + } + + pub async fn execute_current_user_groups( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.current_user_groups(); + if let Some(value) = matches.get_one::("limit") { + request = request.limit(value.clone()); + } + + if let Some(value) = matches.get_one::("sort-by") { + request = request.sort_by(value.clone()); + } + + self.config + .execute_current_user_groups(matches, &mut request)?; + self.config.list_start::(); + let mut stream = futures::StreamExt::take( + request.stream(), + matches + .get_one::("limit") + .map_or(usize::MAX, |x| x.get() as usize), + ); + loop { + match futures::TryStreamExt::try_next(&mut stream).await { + Err(r) => { + self.config.list_end_error(&r); + return Err(anyhow::Error::new(r)); + } + Ok(None) => { + self.config.list_end_success::(); + return Ok(()); + } + Ok(Some(value)) => { + self.config.list_item(&value); + } + } + } + } + + pub async fn execute_current_user_ssh_key_list( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.project_ip_pool_list(); + let mut request = self.client.current_user_ssh_key_list(); if let Some(value) = matches.get_one::("limit") { request = request.limit(value.clone()); } @@ -8951,8 +9551,8 @@ impl Cli { } self.config - .execute_project_ip_pool_list(matches, &mut request)?; - self.config.list_start::(); + .execute_current_user_ssh_key_list(matches, &mut request)?; + self.config.list_start::(); let mut stream = futures::StreamExt::take( request.stream(), matches @@ -8966,8 +9566,7 @@ impl Cli { return Err(anyhow::Error::new(r)); } Ok(None) => { - self.config - .list_end_success::(); + self.config.list_end_success::(); return Ok(()); } Ok(Some(value)) => { @@ -8977,56 +9576,35 @@ impl Cli { } } - pub async fn execute_project_ip_pool_view( + pub async fn execute_current_user_ssh_key_create( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.project_ip_pool_view(); - if let Some(value) = matches.get_one::("pool") { - request = request.pool(value.clone()); - } - - self.config - .execute_project_ip_pool_view(matches, &mut request)?; - let result = request.send().await; - match result { - Ok(r) => { - self.config.success_item(&r); - Ok(()) - } - Err(r) => { - self.config.error(&r); - Err(anyhow::Error::new(r)) - } - } - } - - pub async fn execute_login_local(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.login_local(); - if let Some(value) = matches.get_one::("password") { - request = request.body_map(|body| body.password(value.clone())) + let mut request = self.client.current_user_ssh_key_create(); + if let Some(value) = matches.get_one::("description") { + request = request.body_map(|body| body.description(value.clone())) } - if let Some(value) = matches.get_one::("silo-name") { - request = request.silo_name(value.clone()); + if let Some(value) = matches.get_one::("name") { + request = request.body_map(|body| body.name(value.clone())) } - if let Some(value) = matches.get_one::("username") { - request = request.body_map(|body| body.username(value.clone())) + if let Some(value) = matches.get_one::("public-key") { + request = request.body_map(|body| body.public_key(value.clone())) } if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = - serde_json::from_str::(&body_txt).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } - self.config.execute_login_local(matches, &mut request)?; + self.config + .execute_current_user_ssh_key_create(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_no_item(&r); + self.config.success_item(&r); Ok(()) } Err(r) => { @@ -9036,13 +9614,21 @@ impl Cli { } } - pub async fn execute_logout(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.logout(); - self.config.execute_logout(matches, &mut request)?; + pub async fn execute_current_user_ssh_key_view( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.current_user_ssh_key_view(); + if let Some(value) = matches.get_one::("ssh-key") { + request = request.ssh_key(value.clone()); + } + + self.config + .execute_current_user_ssh_key_view(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_no_item(&r); + self.config.success_item(&r); Ok(()) } Err(r) => { @@ -9052,17 +9638,21 @@ impl Cli { } } - pub async fn execute_current_user_view( + pub async fn execute_current_user_ssh_key_delete( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.current_user_view(); + let mut request = self.client.current_user_ssh_key_delete(); + if let Some(value) = matches.get_one::("ssh-key") { + request = request.ssh_key(value.clone()); + } + self.config - .execute_current_user_view(matches, &mut request)?; + .execute_current_user_ssh_key_delete(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_item(&r); + self.config.success_no_item(&r); Ok(()) } Err(r) => { @@ -9072,22 +9662,35 @@ impl Cli { } } - pub async fn execute_current_user_groups( - &self, - matches: &clap::ArgMatches, - ) -> anyhow::Result<()> { - let mut request = self.client.current_user_groups(); + pub async fn execute_silo_metric(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.silo_metric(); + if let Some(value) = matches.get_one::>("end-time") { + request = request.end_time(value.clone()); + } + if let Some(value) = matches.get_one::("limit") { request = request.limit(value.clone()); } - if let Some(value) = matches.get_one::("sort-by") { - request = request.sort_by(value.clone()); + if let Some(value) = matches.get_one::("metric-name") { + request = request.metric_name(value.clone()); } - self.config - .execute_current_user_groups(matches, &mut request)?; - self.config.list_start::(); + if let Some(value) = matches.get_one::("order") { + request = request.order(value.clone()); + } + + if let Some(value) = matches.get_one::("project") { + request = request.project(value.clone()); + } + + if let Some(value) = matches.get_one::>("start-time") + { + request = request.start_time(value.clone()); + } + + self.config.execute_silo_metric(matches, &mut request)?; + self.config.list_start::(); let mut stream = futures::StreamExt::take( request.stream(), matches @@ -9101,7 +9704,8 @@ impl Cli { return Err(anyhow::Error::new(r)); } Ok(None) => { - self.config.list_end_success::(); + self.config + .list_end_success::(); return Ok(()); } Ok(Some(value)) => { @@ -9111,22 +9715,31 @@ impl Cli { } } - pub async fn execute_current_user_ssh_key_list( + pub async fn execute_instance_network_interface_list( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.current_user_ssh_key_list(); + let mut request = self.client.instance_network_interface_list(); + if let Some(value) = matches.get_one::("instance") { + request = request.instance(value.clone()); + } + if let Some(value) = matches.get_one::("limit") { request = request.limit(value.clone()); } + if let Some(value) = matches.get_one::("project") { + request = request.project(value.clone()); + } + if let Some(value) = matches.get_one::("sort-by") { request = request.sort_by(value.clone()); } self.config - .execute_current_user_ssh_key_list(matches, &mut request)?; - self.config.list_start::(); + .execute_instance_network_interface_list(matches, &mut request)?; + self.config + .list_start::(); let mut stream = futures::StreamExt::take( request.stream(), matches @@ -9140,7 +9753,8 @@ impl Cli { return Err(anyhow::Error::new(r)); } Ok(None) => { - self.config.list_end_success::(); + self.config + .list_end_success::(); return Ok(()); } Ok(Some(value)) => { @@ -9150,31 +9764,131 @@ impl Cli { } } - pub async fn execute_current_user_ssh_key_create( + pub async fn execute_instance_network_interface_create( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.current_user_ssh_key_create(); + let mut request = self.client.instance_network_interface_create(); + if let Some(value) = matches.get_one::("description") { + request = request.body_map(|body| body.description(value.clone())) + } + + if let Some(value) = matches.get_one::("instance") { + request = request.instance(value.clone()); + } + + if let Some(value) = matches.get_one::("ip") { + request = request.body_map(|body| body.ip(value.clone())) + } + + if let Some(value) = matches.get_one::("name") { + request = request.body_map(|body| body.name(value.clone())) + } + + if let Some(value) = matches.get_one::("project") { + request = request.project(value.clone()); + } + + if let Some(value) = matches.get_one::("subnet-name") { + request = request.body_map(|body| body.subnet_name(value.clone())) + } + + if let Some(value) = matches.get_one::("vpc-name") { + request = request.body_map(|body| body.vpc_name(value.clone())) + } + + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = + serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); + } + + self.config + .execute_instance_network_interface_create(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) + } + } + } + + pub async fn execute_instance_network_interface_view( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.instance_network_interface_view(); + if let Some(value) = matches.get_one::("instance") { + request = request.instance(value.clone()); + } + + if let Some(value) = matches.get_one::("interface") { + request = request.interface(value.clone()); + } + + if let Some(value) = matches.get_one::("project") { + request = request.project(value.clone()); + } + + self.config + .execute_instance_network_interface_view(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) + } + } + } + + pub async fn execute_instance_network_interface_update( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.instance_network_interface_update(); if let Some(value) = matches.get_one::("description") { request = request.body_map(|body| body.description(value.clone())) } + if let Some(value) = matches.get_one::("instance") { + request = request.instance(value.clone()); + } + + if let Some(value) = matches.get_one::("interface") { + request = request.interface(value.clone()); + } + if let Some(value) = matches.get_one::("name") { request = request.body_map(|body| body.name(value.clone())) } - if let Some(value) = matches.get_one::("public-key") { - request = request.body_map(|body| body.public_key(value.clone())) + if let Some(value) = matches.get_one::("primary") { + request = request.body_map(|body| body.primary(value.clone())) + } + + if let Some(value) = matches.get_one::("project") { + request = request.project(value.clone()); } if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); + let body_value = + serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } self.config - .execute_current_user_ssh_key_create(matches, &mut request)?; + .execute_instance_network_interface_update(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -9188,21 +9902,29 @@ impl Cli { } } - pub async fn execute_current_user_ssh_key_view( + pub async fn execute_instance_network_interface_delete( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.current_user_ssh_key_view(); - if let Some(value) = matches.get_one::("ssh-key") { - request = request.ssh_key(value.clone()); + let mut request = self.client.instance_network_interface_delete(); + if let Some(value) = matches.get_one::("instance") { + request = request.instance(value.clone()); + } + + if let Some(value) = matches.get_one::("interface") { + request = request.interface(value.clone()); + } + + if let Some(value) = matches.get_one::("project") { + request = request.project(value.clone()); } self.config - .execute_current_user_ssh_key_view(matches, &mut request)?; + .execute_instance_network_interface_delete(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_item(&r); + self.config.success_no_item(&r); Ok(()) } Err(r) => { @@ -9212,21 +9934,13 @@ impl Cli { } } - pub async fn execute_current_user_ssh_key_delete( - &self, - matches: &clap::ArgMatches, - ) -> anyhow::Result<()> { - let mut request = self.client.current_user_ssh_key_delete(); - if let Some(value) = matches.get_one::("ssh-key") { - request = request.ssh_key(value.clone()); - } - - self.config - .execute_current_user_ssh_key_delete(matches, &mut request)?; + pub async fn execute_ping(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.ping(); + self.config.execute_ping(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_no_item(&r); + self.config.success_item(&r); Ok(()) } Err(r) => { @@ -9236,35 +9950,56 @@ impl Cli { } } - pub async fn execute_silo_metric(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.silo_metric(); - if let Some(value) = matches.get_one::>("end-time") { - request = request.end_time(value.clone()); - } - - if let Some(value) = matches.get_one::("limit") { - request = request.limit(value.clone()); + pub async fn execute_policy_view(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.policy_view(); + self.config.execute_policy_view(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) + } } + } - if let Some(value) = matches.get_one::("metric-name") { - request = request.metric_name(value.clone()); + pub async fn execute_policy_update(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.policy_update(); + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); } - if let Some(value) = matches.get_one::("order") { - request = request.order(value.clone()); + self.config.execute_policy_update(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) + } } + } - if let Some(value) = matches.get_one::("project") { - request = request.project(value.clone()); + pub async fn execute_project_list(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.project_list(); + if let Some(value) = matches.get_one::("limit") { + request = request.limit(value.clone()); } - if let Some(value) = matches.get_one::>("start-time") - { - request = request.start_time(value.clone()); + if let Some(value) = matches.get_one::("sort-by") { + request = request.sort_by(value.clone()); } - self.config.execute_silo_metric(matches, &mut request)?; - self.config.list_start::(); + self.config.execute_project_list(matches, &mut request)?; + self.config.list_start::(); let mut stream = futures::StreamExt::take( request.stream(), matches @@ -9278,8 +10013,7 @@ impl Cli { return Err(anyhow::Error::new(r)); } Ok(None) => { - self.config - .list_end_success::(); + self.config.list_end_success::(); return Ok(()); } Ok(Some(value)) => { @@ -9289,70 +10023,60 @@ impl Cli { } } - pub async fn execute_instance_network_interface_list( - &self, - matches: &clap::ArgMatches, - ) -> anyhow::Result<()> { - let mut request = self.client.instance_network_interface_list(); - if let Some(value) = matches.get_one::("instance") { - request = request.instance(value.clone()); - } - - if let Some(value) = matches.get_one::("limit") { - request = request.limit(value.clone()); + pub async fn execute_project_create(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.project_create(); + if let Some(value) = matches.get_one::("description") { + request = request.body_map(|body| body.description(value.clone())) } - if let Some(value) = matches.get_one::("project") { - request = request.project(value.clone()); + if let Some(value) = matches.get_one::("name") { + request = request.body_map(|body| body.name(value.clone())) } - if let Some(value) = matches.get_one::("sort-by") { - request = request.sort_by(value.clone()); + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); } - self.config - .execute_instance_network_interface_list(matches, &mut request)?; - self.config - .list_start::(); - let mut stream = futures::StreamExt::take( - request.stream(), - matches - .get_one::("limit") - .map_or(usize::MAX, |x| x.get() as usize), - ); - loop { - match futures::TryStreamExt::try_next(&mut stream).await { - Err(r) => { - self.config.list_end_error(&r); - return Err(anyhow::Error::new(r)); - } - Ok(None) => { - self.config - .list_end_success::(); - return Ok(()); - } - Ok(Some(value)) => { - self.config.list_item(&value); - } + self.config.execute_project_create(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) } } } - pub async fn execute_instance_network_interface_create( - &self, - matches: &clap::ArgMatches, - ) -> anyhow::Result<()> { - let mut request = self.client.instance_network_interface_create(); - if let Some(value) = matches.get_one::("description") { - request = request.body_map(|body| body.description(value.clone())) + pub async fn execute_project_view(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.project_view(); + if let Some(value) = matches.get_one::("project") { + request = request.project(value.clone()); } - if let Some(value) = matches.get_one::("instance") { - request = request.instance(value.clone()); + self.config.execute_project_view(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) + } } + } - if let Some(value) = matches.get_one::("ip") { - request = request.body_map(|body| body.ip(value.clone())) + pub async fn execute_project_update(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.project_update(); + if let Some(value) = matches.get_one::("description") { + request = request.body_map(|body| body.description(value.clone())) } if let Some(value) = matches.get_one::("name") { @@ -9363,23 +10087,57 @@ impl Cli { request = request.project(value.clone()); } - if let Some(value) = matches.get_one::("subnet-name") { - request = request.body_map(|body| body.subnet_name(value.clone())) + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); } - if let Some(value) = matches.get_one::("vpc-name") { - request = request.body_map(|body| body.vpc_name(value.clone())) + self.config.execute_project_update(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) + } + } + } + + pub async fn execute_project_delete(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.project_delete(); + if let Some(value) = matches.get_one::("project") { + request = request.project(value.clone()); } - if let Some(value) = matches.get_one::("json-body") { - let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = - serde_json::from_str::(&body_txt).unwrap(); - request = request.body(body_value); + self.config.execute_project_delete(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_no_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) + } + } + } + + pub async fn execute_project_policy_view( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.project_policy_view(); + if let Some(value) = matches.get_one::("project") { + request = request.project(value.clone()); } self.config - .execute_instance_network_interface_create(matches, &mut request)?; + .execute_project_policy_view(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -9393,25 +10151,23 @@ impl Cli { } } - pub async fn execute_instance_network_interface_view( + pub async fn execute_project_policy_update( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.instance_network_interface_view(); - if let Some(value) = matches.get_one::("instance") { - request = request.instance(value.clone()); - } - - if let Some(value) = matches.get_one::("interface") { - request = request.interface(value.clone()); - } - + let mut request = self.client.project_policy_update(); if let Some(value) = matches.get_one::("project") { request = request.project(value.clone()); } + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); + } + self.config - .execute_instance_network_interface_view(matches, &mut request)?; + .execute_project_policy_update(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -9425,29 +10181,57 @@ impl Cli { } } - pub async fn execute_instance_network_interface_update( - &self, - matches: &clap::ArgMatches, - ) -> anyhow::Result<()> { - let mut request = self.client.instance_network_interface_update(); - if let Some(value) = matches.get_one::("description") { - request = request.body_map(|body| body.description(value.clone())) + pub async fn execute_snapshot_list(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.snapshot_list(); + if let Some(value) = matches.get_one::("limit") { + request = request.limit(value.clone()); } - if let Some(value) = matches.get_one::("instance") { - request = request.instance(value.clone()); + if let Some(value) = matches.get_one::("project") { + request = request.project(value.clone()); } - if let Some(value) = matches.get_one::("interface") { - request = request.interface(value.clone()); + if let Some(value) = matches.get_one::("sort-by") { + request = request.sort_by(value.clone()); } - if let Some(value) = matches.get_one::("name") { - request = request.body_map(|body| body.name(value.clone())) + self.config.execute_snapshot_list(matches, &mut request)?; + self.config.list_start::(); + let mut stream = futures::StreamExt::take( + request.stream(), + matches + .get_one::("limit") + .map_or(usize::MAX, |x| x.get() as usize), + ); + loop { + match futures::TryStreamExt::try_next(&mut stream).await { + Err(r) => { + self.config.list_end_error(&r); + return Err(anyhow::Error::new(r)); + } + Ok(None) => { + self.config.list_end_success::(); + return Ok(()); + } + Ok(Some(value)) => { + self.config.list_item(&value); + } + } } + } - if let Some(value) = matches.get_one::("primary") { - request = request.body_map(|body| body.primary(value.clone())) + pub async fn execute_snapshot_create(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.snapshot_create(); + if let Some(value) = matches.get_one::("description") { + request = request.body_map(|body| body.description(value.clone())) + } + + if let Some(value) = matches.get_one::("disk") { + request = request.body_map(|body| body.disk(value.clone())) + } + + if let Some(value) = matches.get_one::("name") { + request = request.body_map(|body| body.name(value.clone())) } if let Some(value) = matches.get_one::("project") { @@ -9456,13 +10240,11 @@ impl Cli { if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = - serde_json::from_str::(&body_txt).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } - self.config - .execute_instance_network_interface_update(matches, &mut request)?; + self.config.execute_snapshot_create(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -9476,29 +10258,21 @@ impl Cli { } } - pub async fn execute_instance_network_interface_delete( - &self, - matches: &clap::ArgMatches, - ) -> anyhow::Result<()> { - let mut request = self.client.instance_network_interface_delete(); - if let Some(value) = matches.get_one::("instance") { - request = request.instance(value.clone()); - } - - if let Some(value) = matches.get_one::("interface") { - request = request.interface(value.clone()); - } - + pub async fn execute_snapshot_view(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.snapshot_view(); if let Some(value) = matches.get_one::("project") { request = request.project(value.clone()); } - self.config - .execute_instance_network_interface_delete(matches, &mut request)?; + if let Some(value) = matches.get_one::("snapshot") { + request = request.snapshot(value.clone()); + } + + self.config.execute_snapshot_view(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_no_item(&r); + self.config.success_item(&r); Ok(()) } Err(r) => { @@ -9508,13 +10282,21 @@ impl Cli { } } - pub async fn execute_ping(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.ping(); - self.config.execute_ping(matches, &mut request)?; + pub async fn execute_snapshot_delete(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.snapshot_delete(); + if let Some(value) = matches.get_one::("project") { + request = request.project(value.clone()); + } + + if let Some(value) = matches.get_one::("snapshot") { + request = request.snapshot(value.clone()); + } + + self.config.execute_snapshot_delete(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_item(&r); + self.config.success_no_item(&r); Ok(()) } Err(r) => { @@ -9524,31 +10306,57 @@ impl Cli { } } - pub async fn execute_policy_view(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.policy_view(); - self.config.execute_policy_view(matches, &mut request)?; - let result = request.send().await; - match result { - Ok(r) => { - self.config.success_item(&r); - Ok(()) - } - Err(r) => { - self.config.error(&r); - Err(anyhow::Error::new(r)) + pub async fn execute_physical_disk_list( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.physical_disk_list(); + if let Some(value) = matches.get_one::("limit") { + request = request.limit(value.clone()); + } + + if let Some(value) = matches.get_one::("sort-by") { + request = request.sort_by(value.clone()); + } + + self.config + .execute_physical_disk_list(matches, &mut request)?; + self.config.list_start::(); + let mut stream = futures::StreamExt::take( + request.stream(), + matches + .get_one::("limit") + .map_or(usize::MAX, |x| x.get() as usize), + ); + loop { + match futures::TryStreamExt::try_next(&mut stream).await { + Err(r) => { + self.config.list_end_error(&r); + return Err(anyhow::Error::new(r)); + } + Ok(None) => { + self.config + .list_end_success::(); + return Ok(()); + } + Ok(Some(value)) => { + self.config.list_item(&value); + } } } } - pub async fn execute_policy_update(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.policy_update(); - if let Some(value) = matches.get_one::("json-body") { - let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); - request = request.body(body_value); + pub async fn execute_physical_disk_view( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.physical_disk_view(); + if let Some(value) = matches.get_one::("disk-id") { + request = request.disk_id(value.clone()); } - self.config.execute_policy_update(matches, &mut request)?; + self.config + .execute_physical_disk_view(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -9562,18 +10370,18 @@ impl Cli { } } - pub async fn execute_project_list(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.project_list(); + pub async fn execute_rack_list(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.rack_list(); if let Some(value) = matches.get_one::("limit") { request = request.limit(value.clone()); } - if let Some(value) = matches.get_one::("sort-by") { + if let Some(value) = matches.get_one::("sort-by") { request = request.sort_by(value.clone()); } - self.config.execute_project_list(matches, &mut request)?; - self.config.list_start::(); + self.config.execute_rack_list(matches, &mut request)?; + self.config.list_start::(); let mut stream = futures::StreamExt::take( request.stream(), matches @@ -9587,7 +10395,7 @@ impl Cli { return Err(anyhow::Error::new(r)); } Ok(None) => { - self.config.list_end_success::(); + self.config.list_end_success::(); return Ok(()); } Ok(Some(value)) => { @@ -9597,23 +10405,13 @@ impl Cli { } } - pub async fn execute_project_create(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.project_create(); - if let Some(value) = matches.get_one::("description") { - request = request.body_map(|body| body.description(value.clone())) - } - - if let Some(value) = matches.get_one::("name") { - request = request.body_map(|body| body.name(value.clone())) - } - - if let Some(value) = matches.get_one::("json-body") { - let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); - request = request.body(body_value); + pub async fn execute_rack_view(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.rack_view(); + if let Some(value) = matches.get_one::("rack-id") { + request = request.rack_id(value.clone()); } - self.config.execute_project_create(matches, &mut request)?; + self.config.execute_rack_view(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -9627,47 +10425,58 @@ impl Cli { } } - pub async fn execute_project_view(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.project_view(); - if let Some(value) = matches.get_one::("project") { - request = request.project(value.clone()); + pub async fn execute_sled_list(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.sled_list(); + if let Some(value) = matches.get_one::("limit") { + request = request.limit(value.clone()); } - self.config.execute_project_view(matches, &mut request)?; - let result = request.send().await; - match result { - Ok(r) => { - self.config.success_item(&r); - Ok(()) - } - Err(r) => { - self.config.error(&r); - Err(anyhow::Error::new(r)) + if let Some(value) = matches.get_one::("sort-by") { + request = request.sort_by(value.clone()); + } + + self.config.execute_sled_list(matches, &mut request)?; + self.config.list_start::(); + let mut stream = futures::StreamExt::take( + request.stream(), + matches + .get_one::("limit") + .map_or(usize::MAX, |x| x.get() as usize), + ); + loop { + match futures::TryStreamExt::try_next(&mut stream).await { + Err(r) => { + self.config.list_end_error(&r); + return Err(anyhow::Error::new(r)); + } + Ok(None) => { + self.config.list_end_success::(); + return Ok(()); + } + Ok(Some(value)) => { + self.config.list_item(&value); + } } } } - pub async fn execute_project_update(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.project_update(); - if let Some(value) = matches.get_one::("description") { - request = request.body_map(|body| body.description(value.clone())) - } - - if let Some(value) = matches.get_one::("name") { - request = request.body_map(|body| body.name(value.clone())) + pub async fn execute_sled_add(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.sled_add(); + if let Some(value) = matches.get_one::("part") { + request = request.body_map(|body| body.part(value.clone())) } - if let Some(value) = matches.get_one::("project") { - request = request.project(value.clone()); + if let Some(value) = matches.get_one::("serial") { + request = request.body_map(|body| body.serial(value.clone())) } if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } - self.config.execute_project_update(matches, &mut request)?; + self.config.execute_sled_add(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -9681,17 +10490,17 @@ impl Cli { } } - pub async fn execute_project_delete(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.project_delete(); - if let Some(value) = matches.get_one::("project") { - request = request.project(value.clone()); + pub async fn execute_sled_view(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.sled_view(); + if let Some(value) = matches.get_one::("sled-id") { + request = request.sled_id(value.clone()); } - self.config.execute_project_delete(matches, &mut request)?; + self.config.execute_sled_view(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_no_item(&r); + self.config.success_item(&r); Ok(()) } Err(r) => { @@ -9701,47 +10510,116 @@ impl Cli { } } - pub async fn execute_project_policy_view( + pub async fn execute_sled_physical_disk_list( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.project_policy_view(); - if let Some(value) = matches.get_one::("project") { - request = request.project(value.clone()); + let mut request = self.client.sled_physical_disk_list(); + if let Some(value) = matches.get_one::("limit") { + request = request.limit(value.clone()); + } + + if let Some(value) = matches.get_one::("sled-id") { + request = request.sled_id(value.clone()); + } + + if let Some(value) = matches.get_one::("sort-by") { + request = request.sort_by(value.clone()); } self.config - .execute_project_policy_view(matches, &mut request)?; - let result = request.send().await; - match result { - Ok(r) => { - self.config.success_item(&r); - Ok(()) + .execute_sled_physical_disk_list(matches, &mut request)?; + self.config.list_start::(); + let mut stream = futures::StreamExt::take( + request.stream(), + matches + .get_one::("limit") + .map_or(usize::MAX, |x| x.get() as usize), + ); + loop { + match futures::TryStreamExt::try_next(&mut stream).await { + Err(r) => { + self.config.list_end_error(&r); + return Err(anyhow::Error::new(r)); + } + Ok(None) => { + self.config + .list_end_success::(); + return Ok(()); + } + Ok(Some(value)) => { + self.config.list_item(&value); + } } - Err(r) => { - self.config.error(&r); - Err(anyhow::Error::new(r)) + } + } + + pub async fn execute_sled_instance_list( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.sled_instance_list(); + if let Some(value) = matches.get_one::("limit") { + request = request.limit(value.clone()); + } + + if let Some(value) = matches.get_one::("sled-id") { + request = request.sled_id(value.clone()); + } + + if let Some(value) = matches.get_one::("sort-by") { + request = request.sort_by(value.clone()); + } + + self.config + .execute_sled_instance_list(matches, &mut request)?; + self.config.list_start::(); + let mut stream = futures::StreamExt::take( + request.stream(), + matches + .get_one::("limit") + .map_or(usize::MAX, |x| x.get() as usize), + ); + loop { + match futures::TryStreamExt::try_next(&mut stream).await { + Err(r) => { + self.config.list_end_error(&r); + return Err(anyhow::Error::new(r)); + } + Ok(None) => { + self.config + .list_end_success::(); + return Ok(()); + } + Ok(Some(value)) => { + self.config.list_item(&value); + } } } } - pub async fn execute_project_policy_update( + pub async fn execute_sled_set_provision_policy( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.project_policy_update(); - if let Some(value) = matches.get_one::("project") { - request = request.project(value.clone()); + let mut request = self.client.sled_set_provision_policy(); + if let Some(value) = matches.get_one::("sled-id") { + request = request.sled_id(value.clone()); + } + + if let Some(value) = matches.get_one::("state") { + request = request.body_map(|body| body.state(value.clone())) } if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); + let body_value = + serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } self.config - .execute_project_policy_update(matches, &mut request)?; + .execute_sled_set_provision_policy(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -9755,22 +10633,19 @@ impl Cli { } } - pub async fn execute_snapshot_list(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.snapshot_list(); + pub async fn execute_sled_list_uninitialized( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.sled_list_uninitialized(); if let Some(value) = matches.get_one::("limit") { request = request.limit(value.clone()); } - if let Some(value) = matches.get_one::("project") { - request = request.project(value.clone()); - } - - if let Some(value) = matches.get_one::("sort-by") { - request = request.sort_by(value.clone()); - } - - self.config.execute_snapshot_list(matches, &mut request)?; - self.config.list_start::(); + self.config + .execute_sled_list_uninitialized(matches, &mut request)?; + self.config + .list_start::(); let mut stream = futures::StreamExt::take( request.stream(), matches @@ -9784,7 +10659,8 @@ impl Cli { return Err(anyhow::Error::new(r)); } Ok(None) => { - self.config.list_end_success::(); + self.config + .list_end_success::(); return Ok(()); } Ok(Some(value)) => { @@ -9794,59 +10670,84 @@ impl Cli { } } - pub async fn execute_snapshot_create(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.snapshot_create(); - if let Some(value) = matches.get_one::("description") { - request = request.body_map(|body| body.description(value.clone())) + pub async fn execute_networking_switch_port_list( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.networking_switch_port_list(); + if let Some(value) = matches.get_one::("limit") { + request = request.limit(value.clone()); } - if let Some(value) = matches.get_one::("disk") { - request = request.body_map(|body| body.disk(value.clone())) + if let Some(value) = matches.get_one::("sort-by") { + request = request.sort_by(value.clone()); } - if let Some(value) = matches.get_one::("name") { - request = request.body_map(|body| body.name(value.clone())) + if let Some(value) = matches.get_one::("switch-port-id") { + request = request.switch_port_id(value.clone()); } - if let Some(value) = matches.get_one::("project") { - request = request.project(value.clone()); + self.config + .execute_networking_switch_port_list(matches, &mut request)?; + self.config.list_start::(); + let mut stream = futures::StreamExt::take( + request.stream(), + matches + .get_one::("limit") + .map_or(usize::MAX, |x| x.get() as usize), + ); + loop { + match futures::TryStreamExt::try_next(&mut stream).await { + Err(r) => { + self.config.list_end_error(&r); + return Err(anyhow::Error::new(r)); + } + Ok(None) => { + self.config + .list_end_success::(); + return Ok(()); + } + Ok(Some(value)) => { + self.config.list_item(&value); + } + } } + } - if let Some(value) = matches.get_one::("json-body") { - let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); - request = request.body(body_value); + pub async fn execute_networking_switch_port_apply_settings( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.networking_switch_port_apply_settings(); + if let Some(value) = matches.get_one::("port") { + request = request.port(value.clone()); } - self.config.execute_snapshot_create(matches, &mut request)?; - let result = request.send().await; - match result { - Ok(r) => { - self.config.success_item(&r); - Ok(()) - } - Err(r) => { - self.config.error(&r); - Err(anyhow::Error::new(r)) - } + if let Some(value) = matches.get_one::("port-settings") { + request = request.body_map(|body| body.port_settings(value.clone())) } - } - pub async fn execute_snapshot_view(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.snapshot_view(); - if let Some(value) = matches.get_one::("project") { - request = request.project(value.clone()); + if let Some(value) = matches.get_one::("rack-id") { + request = request.rack_id(value.clone()); } - if let Some(value) = matches.get_one::("snapshot") { - request = request.snapshot(value.clone()); + if let Some(value) = matches.get_one::("switch-location") { + request = request.switch_location(value.clone()); + } + + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = + serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); } - self.config.execute_snapshot_view(matches, &mut request)?; + self.config + .execute_networking_switch_port_apply_settings(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_item(&r); + self.config.success_no_item(&r); Ok(()) } Err(r) => { @@ -9856,17 +10757,25 @@ impl Cli { } } - pub async fn execute_snapshot_delete(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.snapshot_delete(); - if let Some(value) = matches.get_one::("project") { - request = request.project(value.clone()); + pub async fn execute_networking_switch_port_clear_settings( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.networking_switch_port_clear_settings(); + if let Some(value) = matches.get_one::("port") { + request = request.port(value.clone()); } - if let Some(value) = matches.get_one::("snapshot") { - request = request.snapshot(value.clone()); + if let Some(value) = matches.get_one::("rack-id") { + request = request.rack_id(value.clone()); } - self.config.execute_snapshot_delete(matches, &mut request)?; + if let Some(value) = matches.get_one::("switch-location") { + request = request.switch_location(value.clone()); + } + + self.config + .execute_networking_switch_port_clear_settings(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -9880,57 +10789,25 @@ impl Cli { } } - pub async fn execute_physical_disk_list( + pub async fn execute_networking_switch_port_status( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.physical_disk_list(); - if let Some(value) = matches.get_one::("limit") { - request = request.limit(value.clone()); - } - - if let Some(value) = matches.get_one::("sort-by") { - request = request.sort_by(value.clone()); + let mut request = self.client.networking_switch_port_status(); + if let Some(value) = matches.get_one::("port") { + request = request.port(value.clone()); } - self.config - .execute_physical_disk_list(matches, &mut request)?; - self.config.list_start::(); - let mut stream = futures::StreamExt::take( - request.stream(), - matches - .get_one::("limit") - .map_or(usize::MAX, |x| x.get() as usize), - ); - loop { - match futures::TryStreamExt::try_next(&mut stream).await { - Err(r) => { - self.config.list_end_error(&r); - return Err(anyhow::Error::new(r)); - } - Ok(None) => { - self.config - .list_end_success::(); - return Ok(()); - } - Ok(Some(value)) => { - self.config.list_item(&value); - } - } + if let Some(value) = matches.get_one::("rack-id") { + request = request.rack_id(value.clone()); } - } - pub async fn execute_physical_disk_view( - &self, - matches: &clap::ArgMatches, - ) -> anyhow::Result<()> { - let mut request = self.client.physical_disk_view(); - if let Some(value) = matches.get_one::("disk-id") { - request = request.disk_id(value.clone()); + if let Some(value) = matches.get_one::("switch-location") { + request = request.switch_location(value.clone()); } self.config - .execute_physical_disk_view(matches, &mut request)?; + .execute_networking_switch_port_status(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -9944,8 +10821,8 @@ impl Cli { } } - pub async fn execute_rack_list(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.rack_list(); + pub async fn execute_switch_list(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.switch_list(); if let Some(value) = matches.get_one::("limit") { request = request.limit(value.clone()); } @@ -9954,8 +10831,8 @@ impl Cli { request = request.sort_by(value.clone()); } - self.config.execute_rack_list(matches, &mut request)?; - self.config.list_start::(); + self.config.execute_switch_list(matches, &mut request)?; + self.config.list_start::(); let mut stream = futures::StreamExt::take( request.stream(), matches @@ -9969,7 +10846,7 @@ impl Cli { return Err(anyhow::Error::new(r)); } Ok(None) => { - self.config.list_end_success::(); + self.config.list_end_success::(); return Ok(()); } Ok(Some(value)) => { @@ -9979,13 +10856,13 @@ impl Cli { } } - pub async fn execute_rack_view(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.rack_view(); - if let Some(value) = matches.get_one::("rack-id") { - request = request.rack_id(value.clone()); + pub async fn execute_switch_view(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.switch_view(); + if let Some(value) = matches.get_one::("switch-id") { + request = request.switch_id(value.clone()); } - self.config.execute_rack_view(matches, &mut request)?; + self.config.execute_switch_view(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -9999,18 +10876,27 @@ impl Cli { } } - pub async fn execute_sled_list(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.sled_list(); + pub async fn execute_silo_identity_provider_list( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.silo_identity_provider_list(); if let Some(value) = matches.get_one::("limit") { request = request.limit(value.clone()); } - if let Some(value) = matches.get_one::("sort-by") { + if let Some(value) = matches.get_one::("silo") { + request = request.silo(value.clone()); + } + + if let Some(value) = matches.get_one::("sort-by") { request = request.sort_by(value.clone()); } - self.config.execute_sled_list(matches, &mut request)?; - self.config.list_start::(); + self.config + .execute_silo_identity_provider_list(matches, &mut request)?; + self.config + .list_start::(); let mut stream = futures::StreamExt::take( request.stream(), matches @@ -10024,7 +10910,8 @@ impl Cli { return Err(anyhow::Error::new(r)); } Ok(None) => { - self.config.list_end_success::(); + self.config + .list_end_success::(); return Ok(()); } Ok(Some(value)) => { @@ -10034,23 +10921,27 @@ impl Cli { } } - pub async fn execute_sled_add(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.sled_add(); - if let Some(value) = matches.get_one::("part") { - request = request.body_map(|body| body.part(value.clone())) + pub async fn execute_local_idp_user_create( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.local_idp_user_create(); + if let Some(value) = matches.get_one::("external-id") { + request = request.body_map(|body| body.external_id(value.clone())) } - if let Some(value) = matches.get_one::("serial") { - request = request.body_map(|body| body.serial(value.clone())) + if let Some(value) = matches.get_one::("silo") { + request = request.silo(value.clone()); } if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } - self.config.execute_sled_add(matches, &mut request)?; + self.config + .execute_local_idp_user_create(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -10064,17 +10955,25 @@ impl Cli { } } - pub async fn execute_sled_view(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.sled_view(); - if let Some(value) = matches.get_one::("sled-id") { - request = request.sled_id(value.clone()); + pub async fn execute_local_idp_user_delete( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.local_idp_user_delete(); + if let Some(value) = matches.get_one::("silo") { + request = request.silo(value.clone()); } - self.config.execute_sled_view(matches, &mut request)?; + if let Some(value) = matches.get_one::("user-id") { + request = request.user_id(value.clone()); + } + + self.config + .execute_local_idp_user_delete(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_item(&r); + self.config.success_no_item(&r); Ok(()) } Err(r) => { @@ -10084,116 +10983,90 @@ impl Cli { } } - pub async fn execute_sled_physical_disk_list( + pub async fn execute_local_idp_user_set_password( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.sled_physical_disk_list(); - if let Some(value) = matches.get_one::("limit") { - request = request.limit(value.clone()); + let mut request = self.client.local_idp_user_set_password(); + if let Some(value) = matches.get_one::("silo") { + request = request.silo(value.clone()); } - if let Some(value) = matches.get_one::("sled-id") { - request = request.sled_id(value.clone()); + if let Some(value) = matches.get_one::("user-id") { + request = request.user_id(value.clone()); } - if let Some(value) = matches.get_one::("sort-by") { - request = request.sort_by(value.clone()); + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); } self.config - .execute_sled_physical_disk_list(matches, &mut request)?; - self.config.list_start::(); - let mut stream = futures::StreamExt::take( - request.stream(), - matches - .get_one::("limit") - .map_or(usize::MAX, |x| x.get() as usize), - ); - loop { - match futures::TryStreamExt::try_next(&mut stream).await { - Err(r) => { - self.config.list_end_error(&r); - return Err(anyhow::Error::new(r)); - } - Ok(None) => { - self.config - .list_end_success::(); - return Ok(()); - } - Ok(Some(value)) => { - self.config.list_item(&value); - } + .execute_local_idp_user_set_password(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_no_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) } } } - pub async fn execute_sled_instance_list( + pub async fn execute_saml_identity_provider_create( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.sled_instance_list(); - if let Some(value) = matches.get_one::("limit") { - request = request.limit(value.clone()); + let mut request = self.client.saml_identity_provider_create(); + if let Some(value) = matches.get_one::("acs-url") { + request = request.body_map(|body| body.acs_url(value.clone())) } - if let Some(value) = matches.get_one::("sled-id") { - request = request.sled_id(value.clone()); + if let Some(value) = matches.get_one::("description") { + request = request.body_map(|body| body.description(value.clone())) } - if let Some(value) = matches.get_one::("sort-by") { - request = request.sort_by(value.clone()); + if let Some(value) = matches.get_one::("group-attribute-name") { + request = request.body_map(|body| body.group_attribute_name(value.clone())) } - self.config - .execute_sled_instance_list(matches, &mut request)?; - self.config.list_start::(); - let mut stream = futures::StreamExt::take( - request.stream(), - matches - .get_one::("limit") - .map_or(usize::MAX, |x| x.get() as usize), - ); - loop { - match futures::TryStreamExt::try_next(&mut stream).await { - Err(r) => { - self.config.list_end_error(&r); - return Err(anyhow::Error::new(r)); - } - Ok(None) => { - self.config - .list_end_success::(); - return Ok(()); - } - Ok(Some(value)) => { - self.config.list_item(&value); - } - } + if let Some(value) = matches.get_one::("idp-entity-id") { + request = request.body_map(|body| body.idp_entity_id(value.clone())) + } + + if let Some(value) = matches.get_one::("name") { + request = request.body_map(|body| body.name(value.clone())) } - } - pub async fn execute_sled_set_provision_policy( - &self, - matches: &clap::ArgMatches, - ) -> anyhow::Result<()> { - let mut request = self.client.sled_set_provision_policy(); - if let Some(value) = matches.get_one::("sled-id") { - request = request.sled_id(value.clone()); + if let Some(value) = matches.get_one::("silo") { + request = request.silo(value.clone()); } - if let Some(value) = matches.get_one::("state") { - request = request.body_map(|body| body.state(value.clone())) + if let Some(value) = matches.get_one::("slo-url") { + request = request.body_map(|body| body.slo_url(value.clone())) + } + + if let Some(value) = matches.get_one::("sp-client-id") { + request = request.body_map(|body| body.sp_client_id(value.clone())) + } + + if let Some(value) = matches.get_one::("technical-contact-email") { + request = request.body_map(|body| body.technical_contact_email(value.clone())) } if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); let body_value = - serde_json::from_str::(&body_txt).unwrap(); + serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } self.config - .execute_sled_set_provision_policy(matches, &mut request)?; + .execute_saml_identity_provider_create(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -10207,63 +11080,46 @@ impl Cli { } } - pub async fn execute_sled_list_uninitialized( + pub async fn execute_saml_identity_provider_view( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.sled_list_uninitialized(); - if let Some(value) = matches.get_one::("limit") { - request = request.limit(value.clone()); + let mut request = self.client.saml_identity_provider_view(); + if let Some(value) = matches.get_one::("provider") { + request = request.provider(value.clone()); + } + + if let Some(value) = matches.get_one::("silo") { + request = request.silo(value.clone()); } self.config - .execute_sled_list_uninitialized(matches, &mut request)?; - self.config - .list_start::(); - let mut stream = futures::StreamExt::take( - request.stream(), - matches - .get_one::("limit") - .map_or(usize::MAX, |x| x.get() as usize), - ); - loop { - match futures::TryStreamExt::try_next(&mut stream).await { - Err(r) => { - self.config.list_end_error(&r); - return Err(anyhow::Error::new(r)); - } - Ok(None) => { - self.config - .list_end_success::(); - return Ok(()); - } - Ok(Some(value)) => { - self.config.list_item(&value); - } + .execute_saml_identity_provider_view(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) } } } - pub async fn execute_networking_switch_port_list( - &self, - matches: &clap::ArgMatches, - ) -> anyhow::Result<()> { - let mut request = self.client.networking_switch_port_list(); + pub async fn execute_ip_pool_list(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.ip_pool_list(); if let Some(value) = matches.get_one::("limit") { request = request.limit(value.clone()); } - if let Some(value) = matches.get_one::("sort-by") { + if let Some(value) = matches.get_one::("sort-by") { request = request.sort_by(value.clone()); } - if let Some(value) = matches.get_one::("switch-port-id") { - request = request.switch_port_id(value.clone()); - } - - self.config - .execute_networking_switch_port_list(matches, &mut request)?; - self.config.list_start::(); + self.config.execute_ip_pool_list(matches, &mut request)?; + self.config.list_start::(); let mut stream = futures::StreamExt::take( request.stream(), matches @@ -10277,8 +11133,7 @@ impl Cli { return Err(anyhow::Error::new(r)); } Ok(None) => { - self.config - .list_end_success::(); + self.config.list_end_success::(); return Ok(()); } Ok(Some(value)) => { @@ -10288,40 +11143,27 @@ impl Cli { } } - pub async fn execute_networking_switch_port_apply_settings( - &self, - matches: &clap::ArgMatches, - ) -> anyhow::Result<()> { - let mut request = self.client.networking_switch_port_apply_settings(); - if let Some(value) = matches.get_one::("port") { - request = request.port(value.clone()); - } - - if let Some(value) = matches.get_one::("port-settings") { - request = request.body_map(|body| body.port_settings(value.clone())) - } - - if let Some(value) = matches.get_one::("rack-id") { - request = request.rack_id(value.clone()); + pub async fn execute_ip_pool_create(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.ip_pool_create(); + if let Some(value) = matches.get_one::("description") { + request = request.body_map(|body| body.description(value.clone())) } - if let Some(value) = matches.get_one::("switch-location") { - request = request.switch_location(value.clone()); + if let Some(value) = matches.get_one::("name") { + request = request.body_map(|body| body.name(value.clone())) } if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = - serde_json::from_str::(&body_txt).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } - self.config - .execute_networking_switch_port_apply_settings(matches, &mut request)?; + self.config.execute_ip_pool_create(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_no_item(&r); + self.config.success_item(&r); Ok(()) } Err(r) => { @@ -10331,29 +11173,17 @@ impl Cli { } } - pub async fn execute_networking_switch_port_clear_settings( - &self, - matches: &clap::ArgMatches, - ) -> anyhow::Result<()> { - let mut request = self.client.networking_switch_port_clear_settings(); - if let Some(value) = matches.get_one::("port") { - request = request.port(value.clone()); - } - - if let Some(value) = matches.get_one::("rack-id") { - request = request.rack_id(value.clone()); - } - - if let Some(value) = matches.get_one::("switch-location") { - request = request.switch_location(value.clone()); + pub async fn execute_ip_pool_view(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.ip_pool_view(); + if let Some(value) = matches.get_one::("pool") { + request = request.pool(value.clone()); } - self.config - .execute_networking_switch_port_clear_settings(matches, &mut request)?; + self.config.execute_ip_pool_view(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_no_item(&r); + self.config.success_item(&r); Ok(()) } Err(r) => { @@ -10363,25 +11193,27 @@ impl Cli { } } - pub async fn execute_networking_switch_port_status( - &self, - matches: &clap::ArgMatches, - ) -> anyhow::Result<()> { - let mut request = self.client.networking_switch_port_status(); - if let Some(value) = matches.get_one::("port") { - request = request.port(value.clone()); + pub async fn execute_ip_pool_update(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.ip_pool_update(); + if let Some(value) = matches.get_one::("description") { + request = request.body_map(|body| body.description(value.clone())) } - if let Some(value) = matches.get_one::("rack-id") { - request = request.rack_id(value.clone()); + if let Some(value) = matches.get_one::("name") { + request = request.body_map(|body| body.name(value.clone())) } - if let Some(value) = matches.get_one::("switch-location") { - request = request.switch_location(value.clone()); + if let Some(value) = matches.get_one::("pool") { + request = request.pool(value.clone()); } - self.config - .execute_networking_switch_port_status(matches, &mut request)?; + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); + } + + self.config.execute_ip_pool_update(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -10395,18 +11227,42 @@ impl Cli { } } - pub async fn execute_switch_list(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.switch_list(); + pub async fn execute_ip_pool_delete(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.ip_pool_delete(); + if let Some(value) = matches.get_one::("pool") { + request = request.pool(value.clone()); + } + + self.config.execute_ip_pool_delete(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_no_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) + } + } + } + + pub async fn execute_ip_pool_range_list( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.ip_pool_range_list(); if let Some(value) = matches.get_one::("limit") { request = request.limit(value.clone()); } - if let Some(value) = matches.get_one::("sort-by") { - request = request.sort_by(value.clone()); + if let Some(value) = matches.get_one::("pool") { + request = request.pool(value.clone()); } - self.config.execute_switch_list(matches, &mut request)?; - self.config.list_start::(); + self.config + .execute_ip_pool_range_list(matches, &mut request)?; + self.config.list_start::(); let mut stream = futures::StreamExt::take( request.stream(), matches @@ -10420,7 +11276,8 @@ impl Cli { return Err(anyhow::Error::new(r)); } Ok(None) => { - self.config.list_end_success::(); + self.config + .list_end_success::(); return Ok(()); } Ok(Some(value)) => { @@ -10430,17 +11287,57 @@ impl Cli { } } - pub async fn execute_switch_view(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.switch_view(); - if let Some(value) = matches.get_one::("switch-id") { - request = request.switch_id(value.clone()); + pub async fn execute_ip_pool_range_add( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.ip_pool_range_add(); + if let Some(value) = matches.get_one::("pool") { + request = request.pool(value.clone()); + } + + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); + } + + self.config + .execute_ip_pool_range_add(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) + } + } + } + + pub async fn execute_ip_pool_range_remove( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.ip_pool_range_remove(); + if let Some(value) = matches.get_one::("pool") { + request = request.pool(value.clone()); + } + + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); } - self.config.execute_switch_view(matches, &mut request)?; + self.config + .execute_ip_pool_range_remove(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_item(&r); + self.config.success_no_item(&r); Ok(()) } Err(r) => { @@ -10450,27 +11347,26 @@ impl Cli { } } - pub async fn execute_silo_identity_provider_list( + pub async fn execute_ip_pool_silo_list( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.silo_identity_provider_list(); + let mut request = self.client.ip_pool_silo_list(); if let Some(value) = matches.get_one::("limit") { request = request.limit(value.clone()); } - if let Some(value) = matches.get_one::("silo") { - request = request.silo(value.clone()); + if let Some(value) = matches.get_one::("pool") { + request = request.pool(value.clone()); } - if let Some(value) = matches.get_one::("sort-by") { + if let Some(value) = matches.get_one::("sort-by") { request = request.sort_by(value.clone()); } self.config - .execute_silo_identity_provider_list(matches, &mut request)?; - self.config - .list_start::(); + .execute_ip_pool_silo_list(matches, &mut request)?; + self.config.list_start::(); let mut stream = futures::StreamExt::take( request.stream(), matches @@ -10485,7 +11381,7 @@ impl Cli { } Ok(None) => { self.config - .list_end_success::(); + .list_end_success::(); return Ok(()); } Ok(Some(value)) => { @@ -10495,27 +11391,31 @@ impl Cli { } } - pub async fn execute_local_idp_user_create( + pub async fn execute_ip_pool_silo_link( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.local_idp_user_create(); - if let Some(value) = matches.get_one::("external-id") { - request = request.body_map(|body| body.external_id(value.clone())) + let mut request = self.client.ip_pool_silo_link(); + if let Some(value) = matches.get_one::("is-default") { + request = request.body_map(|body| body.is_default(value.clone())) + } + + if let Some(value) = matches.get_one::("pool") { + request = request.pool(value.clone()); } if let Some(value) = matches.get_one::("silo") { - request = request.silo(value.clone()); + request = request.body_map(|body| body.silo(value.clone())) } if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } self.config - .execute_local_idp_user_create(matches, &mut request)?; + .execute_ip_pool_silo_link(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -10529,25 +11429,35 @@ impl Cli { } } - pub async fn execute_local_idp_user_delete( + pub async fn execute_ip_pool_silo_update( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.local_idp_user_delete(); + let mut request = self.client.ip_pool_silo_update(); + if let Some(value) = matches.get_one::("is-default") { + request = request.body_map(|body| body.is_default(value.clone())) + } + + if let Some(value) = matches.get_one::("pool") { + request = request.pool(value.clone()); + } + if let Some(value) = matches.get_one::("silo") { request = request.silo(value.clone()); } - if let Some(value) = matches.get_one::("user-id") { - request = request.user_id(value.clone()); + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); } self.config - .execute_local_idp_user_delete(matches, &mut request)?; + .execute_ip_pool_silo_update(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_no_item(&r); + self.config.success_item(&r); Ok(()) } Err(r) => { @@ -10557,27 +11467,21 @@ impl Cli { } } - pub async fn execute_local_idp_user_set_password( + pub async fn execute_ip_pool_silo_unlink( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.local_idp_user_set_password(); - if let Some(value) = matches.get_one::("silo") { - request = request.silo(value.clone()); - } - - if let Some(value) = matches.get_one::("user-id") { - request = request.user_id(value.clone()); + let mut request = self.client.ip_pool_silo_unlink(); + if let Some(value) = matches.get_one::("pool") { + request = request.pool(value.clone()); } - if let Some(value) = matches.get_one::("json-body") { - let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); - request = request.body(body_value); + if let Some(value) = matches.get_one::("silo") { + request = request.silo(value.clone()); } self.config - .execute_local_idp_user_set_password(matches, &mut request)?; + .execute_ip_pool_silo_unlink(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -10591,56 +11495,17 @@ impl Cli { } } - pub async fn execute_saml_identity_provider_create( + pub async fn execute_ip_pool_utilization_view( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.saml_identity_provider_create(); - if let Some(value) = matches.get_one::("acs-url") { - request = request.body_map(|body| body.acs_url(value.clone())) - } - - if let Some(value) = matches.get_one::("description") { - request = request.body_map(|body| body.description(value.clone())) - } - - if let Some(value) = matches.get_one::("group-attribute-name") { - request = request.body_map(|body| body.group_attribute_name(value.clone())) - } - - if let Some(value) = matches.get_one::("idp-entity-id") { - request = request.body_map(|body| body.idp_entity_id(value.clone())) - } - - if let Some(value) = matches.get_one::("name") { - request = request.body_map(|body| body.name(value.clone())) - } - - if let Some(value) = matches.get_one::("silo") { - request = request.silo(value.clone()); - } - - if let Some(value) = matches.get_one::("slo-url") { - request = request.body_map(|body| body.slo_url(value.clone())) - } - - if let Some(value) = matches.get_one::("sp-client-id") { - request = request.body_map(|body| body.sp_client_id(value.clone())) - } - - if let Some(value) = matches.get_one::("technical-contact-email") { - request = request.body_map(|body| body.technical_contact_email(value.clone())) - } - - if let Some(value) = matches.get_one::("json-body") { - let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = - serde_json::from_str::(&body_txt).unwrap(); - request = request.body(body_value); + let mut request = self.client.ip_pool_utilization_view(); + if let Some(value) = matches.get_one::("pool") { + request = request.pool(value.clone()); } self.config - .execute_saml_identity_provider_create(matches, &mut request)?; + .execute_ip_pool_utilization_view(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -10654,21 +11519,13 @@ impl Cli { } } - pub async fn execute_saml_identity_provider_view( + pub async fn execute_ip_pool_service_view( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.saml_identity_provider_view(); - if let Some(value) = matches.get_one::("provider") { - request = request.provider(value.clone()); - } - - if let Some(value) = matches.get_one::("silo") { - request = request.silo(value.clone()); - } - + let mut request = self.client.ip_pool_service_view(); self.config - .execute_saml_identity_provider_view(matches, &mut request)?; + .execute_ip_pool_service_view(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -10682,18 +11539,18 @@ impl Cli { } } - pub async fn execute_ip_pool_list(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.ip_pool_list(); + pub async fn execute_ip_pool_service_range_list( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.ip_pool_service_range_list(); if let Some(value) = matches.get_one::("limit") { request = request.limit(value.clone()); } - if let Some(value) = matches.get_one::("sort-by") { - request = request.sort_by(value.clone()); - } - - self.config.execute_ip_pool_list(matches, &mut request)?; - self.config.list_start::(); + self.config + .execute_ip_pool_service_range_list(matches, &mut request)?; + self.config.list_start::(); let mut stream = futures::StreamExt::take( request.stream(), matches @@ -10707,7 +11564,8 @@ impl Cli { return Err(anyhow::Error::new(r)); } Ok(None) => { - self.config.list_end_success::(); + self.config + .list_end_success::(); return Ok(()); } Ok(Some(value)) => { @@ -10717,43 +11575,19 @@ impl Cli { } } - pub async fn execute_ip_pool_create(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.ip_pool_create(); - if let Some(value) = matches.get_one::("description") { - request = request.body_map(|body| body.description(value.clone())) - } - - if let Some(value) = matches.get_one::("name") { - request = request.body_map(|body| body.name(value.clone())) - } - + pub async fn execute_ip_pool_service_range_add( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.ip_pool_service_range_add(); if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } - self.config.execute_ip_pool_create(matches, &mut request)?; - let result = request.send().await; - match result { - Ok(r) => { - self.config.success_item(&r); - Ok(()) - } - Err(r) => { - self.config.error(&r); - Err(anyhow::Error::new(r)) - } - } - } - - pub async fn execute_ip_pool_view(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.ip_pool_view(); - if let Some(value) = matches.get_one::("pool") { - request = request.pool(value.clone()); - } - - self.config.execute_ip_pool_view(matches, &mut request)?; + self.config + .execute_ip_pool_service_range_add(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -10767,47 +11601,19 @@ impl Cli { } } - pub async fn execute_ip_pool_update(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.ip_pool_update(); - if let Some(value) = matches.get_one::("description") { - request = request.body_map(|body| body.description(value.clone())) - } - - if let Some(value) = matches.get_one::("name") { - request = request.body_map(|body| body.name(value.clone())) - } - - if let Some(value) = matches.get_one::("pool") { - request = request.pool(value.clone()); - } - + pub async fn execute_ip_pool_service_range_remove( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.ip_pool_service_range_remove(); if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } - self.config.execute_ip_pool_update(matches, &mut request)?; - let result = request.send().await; - match result { - Ok(r) => { - self.config.success_item(&r); - Ok(()) - } - Err(r) => { - self.config.error(&r); - Err(anyhow::Error::new(r)) - } - } - } - - pub async fn execute_ip_pool_delete(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.ip_pool_delete(); - if let Some(value) = matches.get_one::("pool") { - request = request.pool(value.clone()); - } - - self.config.execute_ip_pool_delete(matches, &mut request)?; + self.config + .execute_ip_pool_service_range_remove(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -10821,22 +11627,75 @@ impl Cli { } } - pub async fn execute_ip_pool_range_list( + pub async fn execute_system_metric(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { + let mut request = self.client.system_metric(); + if let Some(value) = matches.get_one::>("end-time") { + request = request.end_time(value.clone()); + } + + if let Some(value) = matches.get_one::("limit") { + request = request.limit(value.clone()); + } + + if let Some(value) = matches.get_one::("metric-name") { + request = request.metric_name(value.clone()); + } + + if let Some(value) = matches.get_one::("order") { + request = request.order(value.clone()); + } + + if let Some(value) = matches.get_one::("silo") { + request = request.silo(value.clone()); + } + + if let Some(value) = matches.get_one::>("start-time") + { + request = request.start_time(value.clone()); + } + + self.config.execute_system_metric(matches, &mut request)?; + self.config.list_start::(); + let mut stream = futures::StreamExt::take( + request.stream(), + matches + .get_one::("limit") + .map_or(usize::MAX, |x| x.get() as usize), + ); + loop { + match futures::TryStreamExt::try_next(&mut stream).await { + Err(r) => { + self.config.list_end_error(&r); + return Err(anyhow::Error::new(r)); + } + Ok(None) => { + self.config + .list_end_success::(); + return Ok(()); + } + Ok(Some(value)) => { + self.config.list_item(&value); + } + } + } + } + + pub async fn execute_networking_address_lot_list( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.ip_pool_range_list(); + let mut request = self.client.networking_address_lot_list(); if let Some(value) = matches.get_one::("limit") { request = request.limit(value.clone()); } - if let Some(value) = matches.get_one::("pool") { - request = request.pool(value.clone()); + if let Some(value) = matches.get_one::("sort-by") { + request = request.sort_by(value.clone()); } self.config - .execute_ip_pool_range_list(matches, &mut request)?; - self.config.list_start::(); + .execute_networking_address_lot_list(matches, &mut request)?; + self.config.list_start::(); let mut stream = futures::StreamExt::take( request.stream(), matches @@ -10851,7 +11710,7 @@ impl Cli { } Ok(None) => { self.config - .list_end_success::(); + .list_end_success::(); return Ok(()); } Ok(Some(value)) => { @@ -10861,23 +11720,31 @@ impl Cli { } } - pub async fn execute_ip_pool_range_add( + pub async fn execute_networking_address_lot_create( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.ip_pool_range_add(); - if let Some(value) = matches.get_one::("pool") { - request = request.pool(value.clone()); + let mut request = self.client.networking_address_lot_create(); + if let Some(value) = matches.get_one::("description") { + request = request.body_map(|body| body.description(value.clone())) + } + + if let Some(value) = matches.get_one::("kind") { + request = request.body_map(|body| body.kind(value.clone())) + } + + if let Some(value) = matches.get_one::("name") { + request = request.body_map(|body| body.name(value.clone())) } if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } self.config - .execute_ip_pool_range_add(matches, &mut request)?; + .execute_networking_address_lot_create(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -10891,23 +11758,17 @@ impl Cli { } } - pub async fn execute_ip_pool_range_remove( + pub async fn execute_networking_address_lot_delete( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.ip_pool_range_remove(); - if let Some(value) = matches.get_one::("pool") { - request = request.pool(value.clone()); - } - - if let Some(value) = matches.get_one::("json-body") { - let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); - request = request.body(body_value); + let mut request = self.client.networking_address_lot_delete(); + if let Some(value) = matches.get_one::("address-lot") { + request = request.address_lot(value.clone()); } self.config - .execute_ip_pool_range_remove(matches, &mut request)?; + .execute_networking_address_lot_delete(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -10921,17 +11782,17 @@ impl Cli { } } - pub async fn execute_ip_pool_silo_list( + pub async fn execute_networking_address_lot_block_list( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.ip_pool_silo_list(); - if let Some(value) = matches.get_one::("limit") { - request = request.limit(value.clone()); + let mut request = self.client.networking_address_lot_block_list(); + if let Some(value) = matches.get_one::("address-lot") { + request = request.address_lot(value.clone()); } - if let Some(value) = matches.get_one::("pool") { - request = request.pool(value.clone()); + if let Some(value) = matches.get_one::("limit") { + request = request.limit(value.clone()); } if let Some(value) = matches.get_one::("sort-by") { @@ -10939,8 +11800,9 @@ impl Cli { } self.config - .execute_ip_pool_silo_list(matches, &mut request)?; - self.config.list_start::(); + .execute_networking_address_lot_block_list(matches, &mut request)?; + self.config + .list_start::(); let mut stream = futures::StreamExt::take( request.stream(), matches @@ -10955,7 +11817,7 @@ impl Cli { } Ok(None) => { self.config - .list_end_success::(); + .list_end_success::(); return Ok(()); } Ok(Some(value)) => { @@ -10965,31 +11827,32 @@ impl Cli { } } - pub async fn execute_ip_pool_silo_link( + pub async fn execute_networking_address_lot_block_add( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.ip_pool_silo_link(); - if let Some(value) = matches.get_one::("is-default") { - request = request.body_map(|body| body.is_default(value.clone())) + let mut request = self.client.networking_address_lot_block_add(); + if let Some(value) = matches.get_one::("address-lot") { + request = request.address_lot(value.clone()); } - if let Some(value) = matches.get_one::("pool") { - request = request.pool(value.clone()); + if let Some(value) = matches.get_one::("first-address") { + request = request.body_map(|body| body.first_address(value.clone())) } - if let Some(value) = matches.get_one::("silo") { - request = request.body_map(|body| body.silo(value.clone())) + if let Some(value) = matches.get_one::("last-address") { + request = request.body_map(|body| body.last_address(value.clone())) } if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); + let body_value = + serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } self.config - .execute_ip_pool_silo_link(matches, &mut request)?; + .execute_networking_address_lot_block_add(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -11003,35 +11866,36 @@ impl Cli { } } - pub async fn execute_ip_pool_silo_update( + pub async fn execute_networking_address_lot_block_remove( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.ip_pool_silo_update(); - if let Some(value) = matches.get_one::("is-default") { - request = request.body_map(|body| body.is_default(value.clone())) + let mut request = self.client.networking_address_lot_block_remove(); + if let Some(value) = matches.get_one::("address-lot") { + request = request.address_lot(value.clone()); } - if let Some(value) = matches.get_one::("pool") { - request = request.pool(value.clone()); + if let Some(value) = matches.get_one::("first-address") { + request = request.body_map(|body| body.first_address(value.clone())) } - if let Some(value) = matches.get_one::("silo") { - request = request.silo(value.clone()); + if let Some(value) = matches.get_one::("last-address") { + request = request.body_map(|body| body.last_address(value.clone())) } if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); + let body_value = + serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } self.config - .execute_ip_pool_silo_update(matches, &mut request)?; + .execute_networking_address_lot_block_remove(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_item(&r); + self.config.success_no_item(&r); Ok(()) } Err(r) => { @@ -11041,25 +11905,17 @@ impl Cli { } } - pub async fn execute_ip_pool_silo_unlink( + pub async fn execute_networking_allow_list_view( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.ip_pool_silo_unlink(); - if let Some(value) = matches.get_one::("pool") { - request = request.pool(value.clone()); - } - - if let Some(value) = matches.get_one::("silo") { - request = request.silo(value.clone()); - } - + let mut request = self.client.networking_allow_list_view(); self.config - .execute_ip_pool_silo_unlink(matches, &mut request)?; + .execute_networking_allow_list_view(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_no_item(&r); + self.config.success_item(&r); Ok(()) } Err(r) => { @@ -11069,17 +11925,19 @@ impl Cli { } } - pub async fn execute_ip_pool_utilization_view( + pub async fn execute_networking_allow_list_update( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.ip_pool_utilization_view(); - if let Some(value) = matches.get_one::("pool") { - request = request.pool(value.clone()); + let mut request = self.client.networking_allow_list_update(); + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); } self.config - .execute_ip_pool_utilization_view(matches, &mut request)?; + .execute_networking_allow_list_update(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -11093,17 +11951,31 @@ impl Cli { } } - pub async fn execute_ip_pool_service_view( + pub async fn execute_networking_bfd_disable( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.ip_pool_service_view(); + let mut request = self.client.networking_bfd_disable(); + if let Some(value) = matches.get_one::("remote") { + request = request.body_map(|body| body.remote(value.clone())) + } + + if let Some(value) = matches.get_one::("switch") { + request = request.body_map(|body| body.switch(value.clone())) + } + + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); + } + self.config - .execute_ip_pool_service_view(matches, &mut request)?; + .execute_networking_bfd_disable(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_item(&r); + self.config.success_no_item(&r); Ok(()) } Err(r) => { @@ -11113,59 +11985,47 @@ impl Cli { } } - pub async fn execute_ip_pool_service_range_list( + pub async fn execute_networking_bfd_enable( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.ip_pool_service_range_list(); - if let Some(value) = matches.get_one::("limit") { - request = request.limit(value.clone()); + let mut request = self.client.networking_bfd_enable(); + if let Some(value) = matches.get_one::("detection-threshold") { + request = request.body_map(|body| body.detection_threshold(value.clone())) } - self.config - .execute_ip_pool_service_range_list(matches, &mut request)?; - self.config.list_start::(); - let mut stream = futures::StreamExt::take( - request.stream(), - matches - .get_one::("limit") - .map_or(usize::MAX, |x| x.get() as usize), - ); - loop { - match futures::TryStreamExt::try_next(&mut stream).await { - Err(r) => { - self.config.list_end_error(&r); - return Err(anyhow::Error::new(r)); - } - Ok(None) => { - self.config - .list_end_success::(); - return Ok(()); - } - Ok(Some(value)) => { - self.config.list_item(&value); - } - } + if let Some(value) = matches.get_one::("local") { + request = request.body_map(|body| body.local(value.clone())) + } + + if let Some(value) = matches.get_one::("mode") { + request = request.body_map(|body| body.mode(value.clone())) + } + + if let Some(value) = matches.get_one::("remote") { + request = request.body_map(|body| body.remote(value.clone())) + } + + if let Some(value) = matches.get_one::("required-rx") { + request = request.body_map(|body| body.required_rx(value.clone())) + } + + if let Some(value) = matches.get_one::("switch") { + request = request.body_map(|body| body.switch(value.clone())) } - } - pub async fn execute_ip_pool_service_range_add( - &self, - matches: &clap::ArgMatches, - ) -> anyhow::Result<()> { - let mut request = self.client.ip_pool_service_range_add(); if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } self.config - .execute_ip_pool_service_range_add(matches, &mut request)?; + .execute_networking_bfd_enable(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_item(&r); + self.config.success_no_item(&r); Ok(()) } Err(r) => { @@ -11175,23 +12035,17 @@ impl Cli { } } - pub async fn execute_ip_pool_service_range_remove( + pub async fn execute_networking_bfd_status( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.ip_pool_service_range_remove(); - if let Some(value) = matches.get_one::("json-body") { - let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); - request = request.body(body_value); - } - + let mut request = self.client.networking_bfd_status(); self.config - .execute_ip_pool_service_range_remove(matches, &mut request)?; + .execute_networking_bfd_status(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_no_item(&r); + self.config.success_item(&r); Ok(()) } Err(r) => { @@ -11201,75 +12055,26 @@ impl Cli { } } - pub async fn execute_system_metric(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { - let mut request = self.client.system_metric(); - if let Some(value) = matches.get_one::>("end-time") { - request = request.end_time(value.clone()); - } - - if let Some(value) = matches.get_one::("limit") { - request = request.limit(value.clone()); - } - - if let Some(value) = matches.get_one::("metric-name") { - request = request.metric_name(value.clone()); - } - - if let Some(value) = matches.get_one::("order") { - request = request.order(value.clone()); - } - - if let Some(value) = matches.get_one::("silo") { - request = request.silo(value.clone()); - } - - if let Some(value) = matches.get_one::>("start-time") - { - request = request.start_time(value.clone()); - } - - self.config.execute_system_metric(matches, &mut request)?; - self.config.list_start::(); - let mut stream = futures::StreamExt::take( - request.stream(), - matches - .get_one::("limit") - .map_or(usize::MAX, |x| x.get() as usize), - ); - loop { - match futures::TryStreamExt::try_next(&mut stream).await { - Err(r) => { - self.config.list_end_error(&r); - return Err(anyhow::Error::new(r)); - } - Ok(None) => { - self.config - .list_end_success::(); - return Ok(()); - } - Ok(Some(value)) => { - self.config.list_item(&value); - } - } - } - } - - pub async fn execute_networking_address_lot_list( + pub async fn execute_networking_bgp_config_list( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_address_lot_list(); + let mut request = self.client.networking_bgp_config_list(); if let Some(value) = matches.get_one::("limit") { request = request.limit(value.clone()); } + if let Some(value) = matches.get_one::("name-or-id") { + request = request.name_or_id(value.clone()); + } + if let Some(value) = matches.get_one::("sort-by") { request = request.sort_by(value.clone()); } self.config - .execute_networking_address_lot_list(matches, &mut request)?; - self.config.list_start::(); + .execute_networking_bgp_config_list(matches, &mut request)?; + self.config.list_start::(); let mut stream = futures::StreamExt::take( request.stream(), matches @@ -11284,7 +12089,7 @@ impl Cli { } Ok(None) => { self.config - .list_end_success::(); + .list_end_success::(); return Ok(()); } Ok(Some(value)) => { @@ -11294,31 +12099,39 @@ impl Cli { } } - pub async fn execute_networking_address_lot_create( + pub async fn execute_networking_bgp_config_create( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_address_lot_create(); - if let Some(value) = matches.get_one::("description") { - request = request.body_map(|body| body.description(value.clone())) + let mut request = self.client.networking_bgp_config_create(); + if let Some(value) = matches.get_one::("asn") { + request = request.body_map(|body| body.asn(value.clone())) } - if let Some(value) = matches.get_one::("kind") { - request = request.body_map(|body| body.kind(value.clone())) + if let Some(value) = matches.get_one::("bgp-announce-set-id") { + request = request.body_map(|body| body.bgp_announce_set_id(value.clone())) + } + + if let Some(value) = matches.get_one::("description") { + request = request.body_map(|body| body.description(value.clone())) } if let Some(value) = matches.get_one::("name") { request = request.body_map(|body| body.name(value.clone())) } + if let Some(value) = matches.get_one::("vrf") { + request = request.body_map(|body| body.vrf(value.clone())) + } + if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } self.config - .execute_networking_address_lot_create(matches, &mut request)?; + .execute_networking_bgp_config_create(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -11332,17 +12145,17 @@ impl Cli { } } - pub async fn execute_networking_address_lot_delete( + pub async fn execute_networking_bgp_config_delete( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_address_lot_delete(); - if let Some(value) = matches.get_one::("address-lot") { - request = request.address_lot(value.clone()); + let mut request = self.client.networking_bgp_config_delete(); + if let Some(value) = matches.get_one::("name-or-id") { + request = request.name_or_id(value.clone()); } self.config - .execute_networking_address_lot_delete(matches, &mut request)?; + .execute_networking_bgp_config_delete(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -11356,77 +12169,64 @@ impl Cli { } } - pub async fn execute_networking_address_lot_block_list( + pub async fn execute_networking_bgp_announce_set_list( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_address_lot_block_list(); - if let Some(value) = matches.get_one::("address-lot") { - request = request.address_lot(value.clone()); - } - + let mut request = self.client.networking_bgp_announce_set_list(); if let Some(value) = matches.get_one::("limit") { request = request.limit(value.clone()); } - if let Some(value) = matches.get_one::("sort-by") { + if let Some(value) = matches.get_one::("name-or-id") { + request = request.name_or_id(value.clone()); + } + + if let Some(value) = matches.get_one::("page-token") { + request = request.page_token(value.clone()); + } + + if let Some(value) = matches.get_one::("sort-by") { request = request.sort_by(value.clone()); } self.config - .execute_networking_address_lot_block_list(matches, &mut request)?; - self.config - .list_start::(); - let mut stream = futures::StreamExt::take( - request.stream(), - matches - .get_one::("limit") - .map_or(usize::MAX, |x| x.get() as usize), - ); - loop { - match futures::TryStreamExt::try_next(&mut stream).await { - Err(r) => { - self.config.list_end_error(&r); - return Err(anyhow::Error::new(r)); - } - Ok(None) => { - self.config - .list_end_success::(); - return Ok(()); - } - Ok(Some(value)) => { - self.config.list_item(&value); - } + .execute_networking_bgp_announce_set_list(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) } } } - pub async fn execute_networking_address_lot_block_add( + pub async fn execute_networking_bgp_announce_set_update( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_address_lot_block_add(); - if let Some(value) = matches.get_one::("address-lot") { - request = request.address_lot(value.clone()); - } - - if let Some(value) = matches.get_one::("first-address") { - request = request.body_map(|body| body.first_address(value.clone())) + let mut request = self.client.networking_bgp_announce_set_update(); + if let Some(value) = matches.get_one::("description") { + request = request.body_map(|body| body.description(value.clone())) } - if let Some(value) = matches.get_one::("last-address") { - request = request.body_map(|body| body.last_address(value.clone())) + if let Some(value) = matches.get_one::("name") { + request = request.body_map(|body| body.name(value.clone())) } if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); let body_value = - serde_json::from_str::(&body_txt).unwrap(); + serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } self.config - .execute_networking_address_lot_block_add(matches, &mut request)?; + .execute_networking_bgp_announce_set_update(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -11440,32 +12240,17 @@ impl Cli { } } - pub async fn execute_networking_address_lot_block_remove( + pub async fn execute_networking_bgp_announce_set_delete( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_address_lot_block_remove(); - if let Some(value) = matches.get_one::("address-lot") { - request = request.address_lot(value.clone()); - } - - if let Some(value) = matches.get_one::("first-address") { - request = request.body_map(|body| body.first_address(value.clone())) - } - - if let Some(value) = matches.get_one::("last-address") { - request = request.body_map(|body| body.last_address(value.clone())) - } - - if let Some(value) = matches.get_one::("json-body") { - let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = - serde_json::from_str::(&body_txt).unwrap(); - request = request.body(body_value); + let mut request = self.client.networking_bgp_announce_set_delete(); + if let Some(value) = matches.get_one::("name-or-id") { + request = request.name_or_id(value.clone()); } self.config - .execute_networking_address_lot_block_remove(matches, &mut request)?; + .execute_networking_bgp_announce_set_delete(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -11479,13 +12264,17 @@ impl Cli { } } - pub async fn execute_networking_allow_list_view( + pub async fn execute_networking_bgp_announcement_list( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_allow_list_view(); + let mut request = self.client.networking_bgp_announcement_list(); + if let Some(value) = matches.get_one::("name-or-id") { + request = request.name_or_id(value.clone()); + } + self.config - .execute_networking_allow_list_view(matches, &mut request)?; + .execute_networking_bgp_announcement_list(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -11495,23 +12284,17 @@ impl Cli { Err(r) => { self.config.error(&r); Err(anyhow::Error::new(r)) - } - } - } - - pub async fn execute_networking_allow_list_update( - &self, - matches: &clap::ArgMatches, - ) -> anyhow::Result<()> { - let mut request = self.client.networking_allow_list_update(); - if let Some(value) = matches.get_one::("json-body") { - let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); - request = request.body(body_value); + } } + } + pub async fn execute_networking_bgp_exported( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self.client.networking_bgp_exported(); self.config - .execute_networking_allow_list_update(matches, &mut request)?; + .execute_networking_bgp_exported(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -11525,31 +12308,21 @@ impl Cli { } } - pub async fn execute_networking_bfd_disable( + pub async fn execute_networking_bgp_message_history( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_bfd_disable(); - if let Some(value) = matches.get_one::("remote") { - request = request.body_map(|body| body.remote(value.clone())) - } - - if let Some(value) = matches.get_one::("switch") { - request = request.body_map(|body| body.switch(value.clone())) - } - - if let Some(value) = matches.get_one::("json-body") { - let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); - request = request.body(body_value); + let mut request = self.client.networking_bgp_message_history(); + if let Some(value) = matches.get_one::("asn") { + request = request.asn(value.clone()); } self.config - .execute_networking_bfd_disable(matches, &mut request)?; + .execute_networking_bgp_message_history(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_no_item(&r); + self.config.success_item(&r); Ok(()) } Err(r) => { @@ -11559,47 +12332,21 @@ impl Cli { } } - pub async fn execute_networking_bfd_enable( + pub async fn execute_networking_bgp_imported_routes_ipv4( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_bfd_enable(); - if let Some(value) = matches.get_one::("detection-threshold") { - request = request.body_map(|body| body.detection_threshold(value.clone())) - } - - if let Some(value) = matches.get_one::("local") { - request = request.body_map(|body| body.local(value.clone())) - } - - if let Some(value) = matches.get_one::("mode") { - request = request.body_map(|body| body.mode(value.clone())) - } - - if let Some(value) = matches.get_one::("remote") { - request = request.body_map(|body| body.remote(value.clone())) - } - - if let Some(value) = matches.get_one::("required-rx") { - request = request.body_map(|body| body.required_rx(value.clone())) - } - - if let Some(value) = matches.get_one::("switch") { - request = request.body_map(|body| body.switch(value.clone())) - } - - if let Some(value) = matches.get_one::("json-body") { - let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); - request = request.body(body_value); + let mut request = self.client.networking_bgp_imported_routes_ipv4(); + if let Some(value) = matches.get_one::("asn") { + request = request.asn(value.clone()); } self.config - .execute_networking_bfd_enable(matches, &mut request)?; + .execute_networking_bgp_imported_routes_ipv4(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_no_item(&r); + self.config.success_item(&r); Ok(()) } Err(r) => { @@ -11609,13 +12356,13 @@ impl Cli { } } - pub async fn execute_networking_bfd_status( + pub async fn execute_networking_bgp_status( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_bfd_status(); + let mut request = self.client.networking_bgp_status(); self.config - .execute_networking_bfd_status(matches, &mut request)?; + .execute_networking_bgp_status(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -11629,26 +12376,23 @@ impl Cli { } } - pub async fn execute_networking_bgp_config_list( + pub async fn execute_networking_loopback_address_list( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_bgp_config_list(); + let mut request = self.client.networking_loopback_address_list(); if let Some(value) = matches.get_one::("limit") { request = request.limit(value.clone()); } - if let Some(value) = matches.get_one::("name-or-id") { - request = request.name_or_id(value.clone()); - } - - if let Some(value) = matches.get_one::("sort-by") { + if let Some(value) = matches.get_one::("sort-by") { request = request.sort_by(value.clone()); } self.config - .execute_networking_bgp_config_list(matches, &mut request)?; - self.config.list_start::(); + .execute_networking_loopback_address_list(matches, &mut request)?; + self.config + .list_start::(); let mut stream = futures::StreamExt::take( request.stream(), matches @@ -11663,7 +12407,7 @@ impl Cli { } Ok(None) => { self.config - .list_end_success::(); + .list_end_success::(); return Ok(()); } Ok(Some(value)) => { @@ -11673,39 +12417,44 @@ impl Cli { } } - pub async fn execute_networking_bgp_config_create( + pub async fn execute_networking_loopback_address_create( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_bgp_config_create(); - if let Some(value) = matches.get_one::("asn") { - request = request.body_map(|body| body.asn(value.clone())) + let mut request = self.client.networking_loopback_address_create(); + if let Some(value) = matches.get_one::("address") { + request = request.body_map(|body| body.address(value.clone())) } - if let Some(value) = matches.get_one::("bgp-announce-set-id") { - request = request.body_map(|body| body.bgp_announce_set_id(value.clone())) + if let Some(value) = matches.get_one::("address-lot") { + request = request.body_map(|body| body.address_lot(value.clone())) } - if let Some(value) = matches.get_one::("description") { - request = request.body_map(|body| body.description(value.clone())) + if let Some(value) = matches.get_one::("anycast") { + request = request.body_map(|body| body.anycast(value.clone())) } - if let Some(value) = matches.get_one::("name") { - request = request.body_map(|body| body.name(value.clone())) + if let Some(value) = matches.get_one::("mask") { + request = request.body_map(|body| body.mask(value.clone())) } - if let Some(value) = matches.get_one::("vrf") { - request = request.body_map(|body| body.vrf(value.clone())) + if let Some(value) = matches.get_one::("rack-id") { + request = request.body_map(|body| body.rack_id(value.clone())) + } + + if let Some(value) = matches.get_one::("switch-location") { + request = request.body_map(|body| body.switch_location(value.clone())) } if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); + let body_value = + serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } self.config - .execute_networking_bgp_config_create(matches, &mut request)?; + .execute_networking_loopback_address_create(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -11719,57 +12468,33 @@ impl Cli { } } - pub async fn execute_networking_bgp_config_delete( - &self, - matches: &clap::ArgMatches, - ) -> anyhow::Result<()> { - let mut request = self.client.networking_bgp_config_delete(); - if let Some(value) = matches.get_one::("name-or-id") { - request = request.name_or_id(value.clone()); - } - - self.config - .execute_networking_bgp_config_delete(matches, &mut request)?; - let result = request.send().await; - match result { - Ok(r) => { - self.config.success_no_item(&r); - Ok(()) - } - Err(r) => { - self.config.error(&r); - Err(anyhow::Error::new(r)) - } - } - } - - pub async fn execute_networking_bgp_announce_set_list( + pub async fn execute_networking_loopback_address_delete( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_bgp_announce_set_list(); - if let Some(value) = matches.get_one::("limit") { - request = request.limit(value.clone()); + let mut request = self.client.networking_loopback_address_delete(); + if let Some(value) = matches.get_one::("address") { + request = request.address(value.clone()); } - if let Some(value) = matches.get_one::("name-or-id") { - request = request.name_or_id(value.clone()); + if let Some(value) = matches.get_one::("rack-id") { + request = request.rack_id(value.clone()); } - if let Some(value) = matches.get_one::("page-token") { - request = request.page_token(value.clone()); + if let Some(value) = matches.get_one::("subnet-mask") { + request = request.subnet_mask(value.clone()); } - if let Some(value) = matches.get_one::("sort-by") { - request = request.sort_by(value.clone()); + if let Some(value) = matches.get_one::("switch-location") { + request = request.switch_location(value.clone()); } self.config - .execute_networking_bgp_announce_set_list(matches, &mut request)?; + .execute_networking_loopback_address_delete(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_item(&r); + self.config.success_no_item(&r); Ok(()) } Err(r) => { @@ -11779,76 +12504,73 @@ impl Cli { } } - pub async fn execute_networking_bgp_announce_set_update( + pub async fn execute_networking_switch_port_configuration_list( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_bgp_announce_set_update(); - if let Some(value) = matches.get_one::("description") { - request = request.body_map(|body| body.description(value.clone())) + let mut request = self.client.networking_switch_port_configuration_list(); + if let Some(value) = matches.get_one::("configuration") { + request = request.configuration(value.clone()); } - if let Some(value) = matches.get_one::("name") { - request = request.body_map(|body| body.name(value.clone())) + if let Some(value) = matches.get_one::("limit") { + request = request.limit(value.clone()); } - if let Some(value) = matches.get_one::("json-body") { - let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = - serde_json::from_str::(&body_txt).unwrap(); - request = request.body(body_value); + if let Some(value) = matches.get_one::("sort-by") { + request = request.sort_by(value.clone()); } self.config - .execute_networking_bgp_announce_set_update(matches, &mut request)?; - let result = request.send().await; - match result { - Ok(r) => { - self.config.success_item(&r); - Ok(()) - } - Err(r) => { - self.config.error(&r); - Err(anyhow::Error::new(r)) + .execute_networking_switch_port_configuration_list(matches, &mut request)?; + self.config + .list_start::(); + let mut stream = futures::StreamExt::take( + request.stream(), + matches + .get_one::("limit") + .map_or(usize::MAX, |x| x.get() as usize), + ); + loop { + match futures::TryStreamExt::try_next(&mut stream).await { + Err(r) => { + self.config.list_end_error(&r); + return Err(anyhow::Error::new(r)); + } + Ok(None) => { + self.config + .list_end_success::(); + return Ok(()); + } + Ok(Some(value)) => { + self.config.list_item(&value); + } } } } - pub async fn execute_networking_bgp_announce_set_delete( + pub async fn execute_networking_switch_port_configuration_create( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_bgp_announce_set_delete(); - if let Some(value) = matches.get_one::("name-or-id") { - request = request.name_or_id(value.clone()); - } - - self.config - .execute_networking_bgp_announce_set_delete(matches, &mut request)?; - let result = request.send().await; - match result { - Ok(r) => { - self.config.success_no_item(&r); - Ok(()) - } - Err(r) => { - self.config.error(&r); - Err(anyhow::Error::new(r)) - } + let mut request = self.client.networking_switch_port_configuration_create(); + if let Some(value) = matches.get_one::("description") { + request = request.body_map(|body| body.description(value.clone())) } - } - pub async fn execute_networking_bgp_announcement_list( - &self, - matches: &clap::ArgMatches, - ) -> anyhow::Result<()> { - let mut request = self.client.networking_bgp_announcement_list(); - if let Some(value) = matches.get_one::("name-or-id") { - request = request.name_or_id(value.clone()); + if let Some(value) = matches.get_one::("name") { + request = request.body_map(|body| body.name(value.clone())) + } + + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = + serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); } self.config - .execute_networking_bgp_announcement_list(matches, &mut request)?; + .execute_networking_switch_port_configuration_create(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -11862,17 +12584,21 @@ impl Cli { } } - pub async fn execute_networking_bgp_exported( + pub async fn execute_networking_switch_port_configuration_delete( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_bgp_exported(); + let mut request = self.client.networking_switch_port_configuration_delete(); + if let Some(value) = matches.get_one::("configuration") { + request = request.configuration(value.clone()); + } + self.config - .execute_networking_bgp_exported(matches, &mut request)?; + .execute_networking_switch_port_configuration_delete(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_item(&r); + self.config.success_no_item(&r); Ok(()) } Err(r) => { @@ -11882,17 +12608,17 @@ impl Cli { } } - pub async fn execute_networking_bgp_message_history( + pub async fn execute_networking_switch_port_configuration_view( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_bgp_message_history(); - if let Some(value) = matches.get_one::("asn") { - request = request.asn(value.clone()); + let mut request = self.client.networking_switch_port_configuration_view(); + if let Some(value) = matches.get_one::("configuration") { + request = request.configuration(value.clone()); } self.config - .execute_networking_bgp_message_history(matches, &mut request)?; + .execute_networking_switch_port_configuration_view(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -11906,17 +12632,19 @@ impl Cli { } } - pub async fn execute_networking_bgp_imported_routes_ipv4( + pub async fn execute_networking_switch_port_configuration_address_list( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_bgp_imported_routes_ipv4(); - if let Some(value) = matches.get_one::("asn") { - request = request.asn(value.clone()); + let mut request = self + .client + .networking_switch_port_configuration_address_list(); + if let Some(value) = matches.get_one::("configuration") { + request = request.configuration(value.clone()); } self.config - .execute_networking_bgp_imported_routes_ipv4(matches, &mut request)?; + .execute_networking_switch_port_configuration_address_list(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -11930,13 +12658,41 @@ impl Cli { } } - pub async fn execute_networking_bgp_status( + pub async fn execute_networking_switch_port_configuration_address_add( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_bgp_status(); + let mut request = self + .client + .networking_switch_port_configuration_address_add(); + if let Some(value) = matches.get_one::("address") { + request = request.body_map(|body| body.address(value.clone())) + } + + if let Some(value) = matches.get_one::("address-lot") { + request = request.body_map(|body| body.address_lot(value.clone())) + } + + if let Some(value) = matches.get_one::("configuration") { + request = request.configuration(value.clone()); + } + + if let Some(value) = matches.get_one::("interface") { + request = request.body_map(|body| body.interface(value.clone())) + } + + if let Some(value) = matches.get_one::("vlan-id") { + request = request.body_map(|body| body.vlan_id(value.clone())) + } + + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); + } + self.config - .execute_networking_bgp_status(matches, &mut request)?; + .execute_networking_switch_port_configuration_address_add(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -11950,53 +12706,14 @@ impl Cli { } } - pub async fn execute_networking_loopback_address_list( - &self, - matches: &clap::ArgMatches, - ) -> anyhow::Result<()> { - let mut request = self.client.networking_loopback_address_list(); - if let Some(value) = matches.get_one::("limit") { - request = request.limit(value.clone()); - } - - if let Some(value) = matches.get_one::("sort-by") { - request = request.sort_by(value.clone()); - } - - self.config - .execute_networking_loopback_address_list(matches, &mut request)?; - self.config - .list_start::(); - let mut stream = futures::StreamExt::take( - request.stream(), - matches - .get_one::("limit") - .map_or(usize::MAX, |x| x.get() as usize), - ); - loop { - match futures::TryStreamExt::try_next(&mut stream).await { - Err(r) => { - self.config.list_end_error(&r); - return Err(anyhow::Error::new(r)); - } - Ok(None) => { - self.config - .list_end_success::(); - return Ok(()); - } - Ok(Some(value)) => { - self.config.list_item(&value); - } - } - } - } - - pub async fn execute_networking_loopback_address_create( + pub async fn execute_networking_switch_port_configuration_address_remove( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_loopback_address_create(); - if let Some(value) = matches.get_one::("address") { + let mut request = self + .client + .networking_switch_port_configuration_address_remove(); + if let Some(value) = matches.get_one::("address") { request = request.body_map(|body| body.address(value.clone())) } @@ -12004,35 +12721,30 @@ impl Cli { request = request.body_map(|body| body.address_lot(value.clone())) } - if let Some(value) = matches.get_one::("anycast") { - request = request.body_map(|body| body.anycast(value.clone())) - } - - if let Some(value) = matches.get_one::("mask") { - request = request.body_map(|body| body.mask(value.clone())) + if let Some(value) = matches.get_one::("configuration") { + request = request.configuration(value.clone()); } - if let Some(value) = matches.get_one::("rack-id") { - request = request.body_map(|body| body.rack_id(value.clone())) + if let Some(value) = matches.get_one::("interface") { + request = request.body_map(|body| body.interface(value.clone())) } - if let Some(value) = matches.get_one::("switch-location") { - request = request.body_map(|body| body.switch_location(value.clone())) + if let Some(value) = matches.get_one::("vlan-id") { + request = request.body_map(|body| body.vlan_id(value.clone())) } if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = - serde_json::from_str::(&body_txt).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } self.config - .execute_networking_loopback_address_create(matches, &mut request)?; + .execute_networking_switch_port_configuration_address_remove(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_item(&r); + self.config.success_no_item(&r); Ok(()) } Err(r) => { @@ -12042,33 +12754,23 @@ impl Cli { } } - pub async fn execute_networking_loopback_address_delete( + pub async fn execute_networking_switch_port_configuration_bgp_peer_list( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_loopback_address_delete(); - if let Some(value) = matches.get_one::("address") { - request = request.address(value.clone()); - } - - if let Some(value) = matches.get_one::("rack-id") { - request = request.rack_id(value.clone()); - } - - if let Some(value) = matches.get_one::("subnet-mask") { - request = request.subnet_mask(value.clone()); - } - - if let Some(value) = matches.get_one::("switch-location") { - request = request.switch_location(value.clone()); + let mut request = self + .client + .networking_switch_port_configuration_bgp_peer_list(); + if let Some(value) = matches.get_one::("configuration") { + request = request.configuration(value.clone()); } self.config - .execute_networking_loopback_address_delete(matches, &mut request)?; + .execute_networking_switch_port_configuration_bgp_peer_list(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_no_item(&r); + self.config.success_item(&r); Ok(()) } Err(r) => { @@ -12078,73 +12780,93 @@ impl Cli { } } - pub async fn execute_networking_switch_port_configuration_list( + pub async fn execute_networking_switch_port_configuration_bgp_peer_add( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_switch_port_configuration_list(); + let mut request = self + .client + .networking_switch_port_configuration_bgp_peer_add(); + if let Some(value) = matches.get_one::("addr") { + request = request.body_map(|body| body.addr(value.clone())) + } + + if let Some(value) = matches.get_one::("allow-export-list-active") { + request = request.body_map(|body| body.allow_export_list_active(value.clone())) + } + + if let Some(value) = matches.get_one::("allow-import-list-active") { + request = request.body_map(|body| body.allow_import_list_active(value.clone())) + } + + if let Some(value) = matches.get_one::("bgp-config") { + request = request.body_map(|body| body.bgp_config(value.clone())) + } + if let Some(value) = matches.get_one::("configuration") { request = request.configuration(value.clone()); } - if let Some(value) = matches.get_one::("limit") { - request = request.limit(value.clone()); + if let Some(value) = matches.get_one::("connect-retry") { + request = request.body_map(|body| body.connect_retry(value.clone())) } - if let Some(value) = matches.get_one::("sort-by") { - request = request.sort_by(value.clone()); + if let Some(value) = matches.get_one::("delay-open") { + request = request.body_map(|body| body.delay_open(value.clone())) } - self.config - .execute_networking_switch_port_configuration_list(matches, &mut request)?; - self.config - .list_start::(); - let mut stream = futures::StreamExt::take( - request.stream(), - matches - .get_one::("limit") - .map_or(usize::MAX, |x| x.get() as usize), - ); - loop { - match futures::TryStreamExt::try_next(&mut stream).await { - Err(r) => { - self.config.list_end_error(&r); - return Err(anyhow::Error::new(r)); - } - Ok(None) => { - self.config - .list_end_success::(); - return Ok(()); - } - Ok(Some(value)) => { - self.config.list_item(&value); - } - } + if let Some(value) = matches.get_one::("enforce-first-as") { + request = request.body_map(|body| body.enforce_first_as(value.clone())) + } + + if let Some(value) = matches.get_one::("hold-time") { + request = request.body_map(|body| body.hold_time(value.clone())) + } + + if let Some(value) = matches.get_one::("idle-hold-time") { + request = request.body_map(|body| body.idle_hold_time(value.clone())) + } + + if let Some(value) = matches.get_one::("interface-name") { + request = request.body_map(|body| body.interface_name(value.clone())) + } + + if let Some(value) = matches.get_one::("keepalive") { + request = request.body_map(|body| body.keepalive(value.clone())) + } + + if let Some(value) = matches.get_one::("local-pref") { + request = request.body_map(|body| body.local_pref(value.clone())) + } + + if let Some(value) = matches.get_one::("md5-auth-key") { + request = request.body_map(|body| body.md5_auth_key(value.clone())) + } + + if let Some(value) = matches.get_one::("min-ttl") { + request = request.body_map(|body| body.min_ttl(value.clone())) } - } - pub async fn execute_networking_switch_port_configuration_create( - &self, - matches: &clap::ArgMatches, - ) -> anyhow::Result<()> { - let mut request = self.client.networking_switch_port_configuration_create(); - if let Some(value) = matches.get_one::("description") { - request = request.body_map(|body| body.description(value.clone())) + if let Some(value) = matches.get_one::("multi-exit-discriminator") { + request = request.body_map(|body| body.multi_exit_discriminator(value.clone())) } - if let Some(value) = matches.get_one::("name") { - request = request.body_map(|body| body.name(value.clone())) + if let Some(value) = matches.get_one::("remote-asn") { + request = request.body_map(|body| body.remote_asn(value.clone())) + } + + if let Some(value) = matches.get_one::("vlan-id") { + request = request.body_map(|body| body.vlan_id(value.clone())) } if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = - serde_json::from_str::(&body_txt).unwrap(); + let body_value = serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } self.config - .execute_networking_switch_port_configuration_create(matches, &mut request)?; + .execute_networking_switch_port_configuration_bgp_peer_add(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { @@ -12158,21 +12880,30 @@ impl Cli { } } - pub async fn execute_networking_switch_port_configuration_delete( + pub async fn execute_networking_switch_port_configuration_bgp_peer_allow_export_list( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_switch_port_configuration_delete(); + let mut request = self + .client + .networking_switch_port_configuration_bgp_peer_allow_export_list(); if let Some(value) = matches.get_one::("configuration") { request = request.configuration(value.clone()); } + if let Some(value) = matches.get_one::("peer-address") { + request = request.peer_address(value.clone()); + } + self.config - .execute_networking_switch_port_configuration_delete(matches, &mut request)?; + .execute_networking_switch_port_configuration_bgp_peer_allow_export_list( + matches, + &mut request, + )?; let result = request.send().await; match result { Ok(r) => { - self.config.success_no_item(&r); + self.config.success_item(&r); Ok(()) } Err(r) => { @@ -12182,17 +12913,41 @@ impl Cli { } } - pub async fn execute_networking_switch_port_configuration_view( + pub async fn execute_networking_switch_port_configuration_bgp_peer_allow_export_add( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_switch_port_configuration_view(); + let mut request = self + .client + .networking_switch_port_configuration_bgp_peer_allow_export_add(); if let Some(value) = matches.get_one::("configuration") { request = request.configuration(value.clone()); } + if let Some(value) = matches.get_one::("interface") { + request = request.body_map(|body| body.interface(value.clone())) + } + + if let Some(value) = matches.get_one::("peer-address") { + request = request.body_map(|body| body.peer_address(value.clone())) + } + + if let Some(value) = matches.get_one::("prefix") { + request = request.body_map(|body| body.prefix(value.clone())) + } + + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = + serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); + } + self.config - .execute_networking_switch_port_configuration_view(matches, &mut request)?; + .execute_networking_switch_port_configuration_bgp_peer_allow_export_add( + matches, + &mut request, + )?; let result = request.send().await; match result { Ok(r) => { @@ -12206,23 +12961,45 @@ impl Cli { } } - pub async fn execute_networking_switch_port_configuration_address_list( + pub async fn execute_networking_switch_port_configuration_bgp_peer_allow_export_remove( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { let mut request = self .client - .networking_switch_port_configuration_address_list(); + .networking_switch_port_configuration_bgp_peer_allow_export_remove(); if let Some(value) = matches.get_one::("configuration") { request = request.configuration(value.clone()); } + if let Some(value) = matches.get_one::("interface") { + request = request.body_map(|body| body.interface(value.clone())) + } + + if let Some(value) = matches.get_one::("peer-address") { + request = request.body_map(|body| body.peer_address(value.clone())) + } + + if let Some(value) = matches.get_one::("prefix") { + request = request.body_map(|body| body.prefix(value.clone())) + } + + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = + serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); + } + self.config - .execute_networking_switch_port_configuration_address_list(matches, &mut request)?; + .execute_networking_switch_port_configuration_bgp_peer_allow_export_remove( + matches, + &mut request, + )?; let result = request.send().await; match result { Ok(r) => { - self.config.success_item(&r); + self.config.success_no_item(&r); Ok(()) } Err(r) => { @@ -12232,21 +13009,46 @@ impl Cli { } } - pub async fn execute_networking_switch_port_configuration_address_add( + pub async fn execute_networking_switch_port_configuration_bgp_peer_allow_import_list( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { let mut request = self .client - .networking_switch_port_configuration_address_add(); - if let Some(value) = matches.get_one::("address") { - request = request.body_map(|body| body.address(value.clone())) + .networking_switch_port_configuration_bgp_peer_allow_import_list(); + if let Some(value) = matches.get_one::("configuration") { + request = request.configuration(value.clone()); } - if let Some(value) = matches.get_one::("address-lot") { - request = request.body_map(|body| body.address_lot(value.clone())) + if let Some(value) = matches.get_one::("peer-address") { + request = request.peer_address(value.clone()); + } + + self.config + .execute_networking_switch_port_configuration_bgp_peer_allow_import_list( + matches, + &mut request, + )?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) + } } + } + pub async fn execute_networking_switch_port_configuration_bgp_peer_allow_import_add( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self + .client + .networking_switch_port_configuration_bgp_peer_allow_import_add(); if let Some(value) = matches.get_one::("configuration") { request = request.configuration(value.clone()); } @@ -12255,18 +13057,26 @@ impl Cli { request = request.body_map(|body| body.interface(value.clone())) } - if let Some(value) = matches.get_one::("vlan-id") { - request = request.body_map(|body| body.vlan_id(value.clone())) + if let Some(value) = matches.get_one::("peer-address") { + request = request.body_map(|body| body.peer_address(value.clone())) + } + + if let Some(value) = matches.get_one::("prefix") { + request = request.body_map(|body| body.prefix(value.clone())) } if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); + let body_value = + serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } self.config - .execute_networking_switch_port_configuration_address_add(matches, &mut request)?; + .execute_networking_switch_port_configuration_bgp_peer_allow_import_add( + matches, + &mut request, + )?; let result = request.send().await; match result { Ok(r) => { @@ -12280,21 +13090,13 @@ impl Cli { } } - pub async fn execute_networking_switch_port_configuration_address_remove( + pub async fn execute_networking_switch_port_configuration_bgp_peer_allow_import_remove( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { let mut request = self .client - .networking_switch_port_configuration_address_remove(); - if let Some(value) = matches.get_one::("address") { - request = request.body_map(|body| body.address(value.clone())) - } - - if let Some(value) = matches.get_one::("address-lot") { - request = request.body_map(|body| body.address_lot(value.clone())) - } - + .networking_switch_port_configuration_bgp_peer_allow_import_remove(); if let Some(value) = matches.get_one::("configuration") { request = request.configuration(value.clone()); } @@ -12303,18 +13105,26 @@ impl Cli { request = request.body_map(|body| body.interface(value.clone())) } - if let Some(value) = matches.get_one::("vlan-id") { - request = request.body_map(|body| body.vlan_id(value.clone())) + if let Some(value) = matches.get_one::("peer-address") { + request = request.body_map(|body| body.peer_address(value.clone())) + } + + if let Some(value) = matches.get_one::("prefix") { + request = request.body_map(|body| body.prefix(value.clone())) } if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); + let body_value = + serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } self.config - .execute_networking_switch_port_configuration_address_remove(matches, &mut request)?; + .execute_networking_switch_port_configuration_bgp_peer_allow_import_remove( + matches, + &mut request, + )?; let result = request.send().await; match result { Ok(r) => { @@ -12328,19 +13138,26 @@ impl Cli { } } - pub async fn execute_networking_switch_port_configuration_bgp_peer_list( + pub async fn execute_networking_switch_port_configuration_bgp_peer_community_list( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { let mut request = self .client - .networking_switch_port_configuration_bgp_peer_list(); + .networking_switch_port_configuration_bgp_peer_community_list(); if let Some(value) = matches.get_one::("configuration") { request = request.configuration(value.clone()); } + if let Some(value) = matches.get_one::("peer-address") { + request = request.peer_address(value.clone()); + } + self.config - .execute_networking_switch_port_configuration_bgp_peer_list(matches, &mut request)?; + .execute_networking_switch_port_configuration_bgp_peer_community_list( + matches, + &mut request, + )?; let result = request.send().await; match result { Ok(r) => { @@ -12354,89 +13171,93 @@ impl Cli { } } - pub async fn execute_networking_switch_port_configuration_bgp_peer_add( + pub async fn execute_networking_switch_port_configuration_bgp_peer_community_add( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { let mut request = self .client - .networking_switch_port_configuration_bgp_peer_add(); - if let Some(value) = matches.get_one::("addr") { - request = request.body_map(|body| body.addr(value.clone())) - } - - if let Some(value) = matches.get_one::("bgp-config") { - request = request.body_map(|body| body.bgp_config(value.clone())) + .networking_switch_port_configuration_bgp_peer_community_add(); + if let Some(value) = matches.get_one::("community") { + request = request.body_map(|body| body.community(value.clone())) } if let Some(value) = matches.get_one::("configuration") { request = request.configuration(value.clone()); } - if let Some(value) = matches.get_one::("connect-retry") { - request = request.body_map(|body| body.connect_retry(value.clone())) - } - - if let Some(value) = matches.get_one::("delay-open") { - request = request.body_map(|body| body.delay_open(value.clone())) - } - - if let Some(value) = matches.get_one::("enforce-first-as") { - request = request.body_map(|body| body.enforce_first_as(value.clone())) - } - - if let Some(value) = matches.get_one::("hold-time") { - request = request.body_map(|body| body.hold_time(value.clone())) - } - - if let Some(value) = matches.get_one::("idle-hold-time") { - request = request.body_map(|body| body.idle_hold_time(value.clone())) - } - - if let Some(value) = matches.get_one::("interface-name") { - request = request.body_map(|body| body.interface_name(value.clone())) + if let Some(value) = matches.get_one::("interface") { + request = request.body_map(|body| body.interface(value.clone())) } - if let Some(value) = matches.get_one::("keepalive") { - request = request.body_map(|body| body.keepalive(value.clone())) + if let Some(value) = matches.get_one::("peer-address") { + request = request.body_map(|body| body.peer_address(value.clone())) } - if let Some(value) = matches.get_one::("local-pref") { - request = request.body_map(|body| body.local_pref(value.clone())) + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = + serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); } - if let Some(value) = matches.get_one::("md5-auth-key") { - request = request.body_map(|body| body.md5_auth_key(value.clone())) + self.config + .execute_networking_switch_port_configuration_bgp_peer_community_add( + matches, + &mut request, + )?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) + } } + } - if let Some(value) = matches.get_one::("min-ttl") { - request = request.body_map(|body| body.min_ttl(value.clone())) + pub async fn execute_networking_switch_port_configuration_bgp_peer_community_remove( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self + .client + .networking_switch_port_configuration_bgp_peer_community_remove(); + if let Some(value) = matches.get_one::("community") { + request = request.body_map(|body| body.community(value.clone())) } - if let Some(value) = matches.get_one::("multi-exit-discriminator") { - request = request.body_map(|body| body.multi_exit_discriminator(value.clone())) + if let Some(value) = matches.get_one::("configuration") { + request = request.configuration(value.clone()); } - if let Some(value) = matches.get_one::("remote-asn") { - request = request.body_map(|body| body.remote_asn(value.clone())) + if let Some(value) = matches.get_one::("interface") { + request = request.body_map(|body| body.interface(value.clone())) } - if let Some(value) = matches.get_one::("vlan-id") { - request = request.body_map(|body| body.vlan_id(value.clone())) + if let Some(value) = matches.get_one::("peer-address") { + request = request.body_map(|body| body.peer_address(value.clone())) } if let Some(value) = matches.get_one::("json-body") { let body_txt = std::fs::read_to_string(value).unwrap(); - let body_value = serde_json::from_str::(&body_txt).unwrap(); + let body_value = + serde_json::from_str::(&body_txt).unwrap(); request = request.body(body_value); } self.config - .execute_networking_switch_port_configuration_bgp_peer_add(matches, &mut request)?; + .execute_networking_switch_port_configuration_bgp_peer_community_remove( + matches, + &mut request, + )?; let result = request.send().await; match result { Ok(r) => { - self.config.success_item(&r); + self.config.success_no_item(&r); Ok(()) } Err(r) => { @@ -15728,6 +16549,78 @@ pub trait CliConfig { Ok(()) } + fn execute_networking_switch_port_configuration_bgp_peer_allow_export_list( + &self, + matches: &clap::ArgMatches, + request: &mut builder::NetworkingSwitchPortConfigurationBgpPeerAllowExportList, + ) -> anyhow::Result<()> { + Ok(()) + } + + fn execute_networking_switch_port_configuration_bgp_peer_allow_export_add( + &self, + matches: &clap::ArgMatches, + request: &mut builder::NetworkingSwitchPortConfigurationBgpPeerAllowExportAdd, + ) -> anyhow::Result<()> { + Ok(()) + } + + fn execute_networking_switch_port_configuration_bgp_peer_allow_export_remove( + &self, + matches: &clap::ArgMatches, + request: &mut builder::NetworkingSwitchPortConfigurationBgpPeerAllowExportRemove, + ) -> anyhow::Result<()> { + Ok(()) + } + + fn execute_networking_switch_port_configuration_bgp_peer_allow_import_list( + &self, + matches: &clap::ArgMatches, + request: &mut builder::NetworkingSwitchPortConfigurationBgpPeerAllowImportList, + ) -> anyhow::Result<()> { + Ok(()) + } + + fn execute_networking_switch_port_configuration_bgp_peer_allow_import_add( + &self, + matches: &clap::ArgMatches, + request: &mut builder::NetworkingSwitchPortConfigurationBgpPeerAllowImportAdd, + ) -> anyhow::Result<()> { + Ok(()) + } + + fn execute_networking_switch_port_configuration_bgp_peer_allow_import_remove( + &self, + matches: &clap::ArgMatches, + request: &mut builder::NetworkingSwitchPortConfigurationBgpPeerAllowImportRemove, + ) -> anyhow::Result<()> { + Ok(()) + } + + fn execute_networking_switch_port_configuration_bgp_peer_community_list( + &self, + matches: &clap::ArgMatches, + request: &mut builder::NetworkingSwitchPortConfigurationBgpPeerCommunityList, + ) -> anyhow::Result<()> { + Ok(()) + } + + fn execute_networking_switch_port_configuration_bgp_peer_community_add( + &self, + matches: &clap::ArgMatches, + request: &mut builder::NetworkingSwitchPortConfigurationBgpPeerCommunityAdd, + ) -> anyhow::Result<()> { + Ok(()) + } + + fn execute_networking_switch_port_configuration_bgp_peer_community_remove( + &self, + matches: &clap::ArgMatches, + request: &mut builder::NetworkingSwitchPortConfigurationBgpPeerCommunityRemove, + ) -> anyhow::Result<()> { + Ok(()) + } + fn execute_networking_switch_port_configuration_bgp_peer_remove( &self, matches: &clap::ArgMatches, @@ -16344,6 +17237,15 @@ pub enum CliCommand { NetworkingSwitchPortConfigurationAddressRemove, NetworkingSwitchPortConfigurationBgpPeerList, NetworkingSwitchPortConfigurationBgpPeerAdd, + NetworkingSwitchPortConfigurationBgpPeerAllowExportList, + NetworkingSwitchPortConfigurationBgpPeerAllowExportAdd, + NetworkingSwitchPortConfigurationBgpPeerAllowExportRemove, + NetworkingSwitchPortConfigurationBgpPeerAllowImportList, + NetworkingSwitchPortConfigurationBgpPeerAllowImportAdd, + NetworkingSwitchPortConfigurationBgpPeerAllowImportRemove, + NetworkingSwitchPortConfigurationBgpPeerCommunityList, + NetworkingSwitchPortConfigurationBgpPeerCommunityAdd, + NetworkingSwitchPortConfigurationBgpPeerCommunityRemove, NetworkingSwitchPortConfigurationBgpPeerRemove, NetworkingSwitchPortConfigurationGeometryView, NetworkingSwitchPortConfigurationGeometrySet, @@ -16563,6 +17465,15 @@ impl CliCommand { CliCommand::NetworkingSwitchPortConfigurationAddressRemove, CliCommand::NetworkingSwitchPortConfigurationBgpPeerList, CliCommand::NetworkingSwitchPortConfigurationBgpPeerAdd, + CliCommand::NetworkingSwitchPortConfigurationBgpPeerAllowExportList, + CliCommand::NetworkingSwitchPortConfigurationBgpPeerAllowExportAdd, + CliCommand::NetworkingSwitchPortConfigurationBgpPeerAllowExportRemove, + CliCommand::NetworkingSwitchPortConfigurationBgpPeerAllowImportList, + CliCommand::NetworkingSwitchPortConfigurationBgpPeerAllowImportAdd, + CliCommand::NetworkingSwitchPortConfigurationBgpPeerAllowImportRemove, + CliCommand::NetworkingSwitchPortConfigurationBgpPeerCommunityList, + CliCommand::NetworkingSwitchPortConfigurationBgpPeerCommunityAdd, + CliCommand::NetworkingSwitchPortConfigurationBgpPeerCommunityRemove, CliCommand::NetworkingSwitchPortConfigurationBgpPeerRemove, CliCommand::NetworkingSwitchPortConfigurationGeometryView, CliCommand::NetworkingSwitchPortConfigurationGeometrySet, diff --git a/cli/tests/data/json-body-required.txt b/cli/tests/data/json-body-required.txt index 8b8950cc..d2141c45 100644 --- a/cli/tests/data/json-body-required.txt +++ b/cli/tests/data/json-body-required.txt @@ -10,6 +10,5 @@ oxide vpc router route create oxide vpc router route update oxide disk create oxide system policy update -oxide system networking address-lot create -oxide system networking switch-port-settings create +oxide system networking switch-port configuration create oxide system networking bgp announce-set update \ No newline at end of file diff --git a/cli/tests/test_net.rs b/cli/tests/test_net.rs index caaceac2..992111e9 100644 --- a/cli/tests/test_net.rs +++ b/cli/tests/test_net.rs @@ -9,8 +9,8 @@ use chrono::prelude::*; use httpmock::MockServer; use oxide::types::{ AddressLot, AddressLotBlock, AddressLotBlockResultsPage, AddressLotKind, AddressLotResultsPage, - BgpConfig, BgpConfigResultsPage, BgpPeer, ImportExportPolicy, LinkFec, LinkSpeed, NameOrId, - SwitchPort, SwitchPortAddressConfig, SwitchPortConfig, SwitchPortGeometry2, + BgpConfig, BgpConfigResultsPage, BgpPeerCombined, ImportExportPolicy, LinkFec, LinkSpeed, + NameOrId, SwitchPort, SwitchPortAddressConfig, SwitchPortConfig, SwitchPortGeometry2, SwitchPortLinkConfig, SwitchPortResultsPage, SwitchPortRouteConfig, SwitchPortSettings, SwitchPortSettingsView, }; @@ -119,7 +119,7 @@ fn test_port_config() { }, ], bgp_peers: vec![ - BgpPeer { + BgpPeerCombined { interface_name: String::from("phy0"), addr: "169.254.10.1".parse().unwrap(), bgp_config: NameOrId::Id(bgp_configs.items[0].id), @@ -139,7 +139,7 @@ fn test_port_config() { remote_asn: None, vlan_id: None, }, - BgpPeer { + BgpPeerCombined { interface_name: String::from("phy0"), addr: "169.254.30.1".parse().unwrap(), bgp_config: NameOrId::Id(bgp_configs.items[0].id), @@ -167,7 +167,7 @@ fn test_port_config() { autoneg: false, fec: LinkFec::None, link_name: String::from("phy0"), - lldp_link_config_id: None, + lldp_link_config_id: Uuid::new_v4(), mtu: 1500, port_settings_id: switch1_qsfp0_settings_id, speed: LinkSpeed::Speed100G, @@ -211,7 +211,7 @@ fn test_port_config() { }, ], bgp_peers: vec![ - BgpPeer { + BgpPeerCombined { interface_name: String::from("phy0"), addr: "169.254.20.1".parse().unwrap(), bgp_config: NameOrId::Id(bgp_configs.items[0].id), @@ -231,7 +231,7 @@ fn test_port_config() { remote_asn: None, vlan_id: None, }, - BgpPeer { + BgpPeerCombined { interface_name: String::from("phy0"), addr: "169.254.40.1".parse().unwrap(), bgp_config: NameOrId::Id(bgp_configs.items[0].id), @@ -259,7 +259,7 @@ fn test_port_config() { autoneg: false, fec: LinkFec::None, link_name: String::from("phy0"), - lldp_link_config_id: None, + lldp_link_config_id: Uuid::new_v4(), mtu: 1500, port_settings_id: switch1_qsfp0_settings_id, speed: LinkSpeed::Speed100G, diff --git a/oxide.json b/oxide.json index 38f70e87..19d205ec 100644 --- a/oxide.json +++ b/oxide.json @@ -7489,6 +7489,429 @@ } } }, + "/v1/system/networking/switch-port-configuration/{configuration}/bgp-peer/allow-export": { + "get": { + "tags": [ + "system/networking" + ], + "summary": "List prefixes allowed to be exported by a given bgp peer", + "operationId": "networking_switch_port_configuration_bgp_peer_allow_export_list", + "parameters": [ + { + "in": "path", + "name": "configuration", + "description": "A name or id to use when selecting a switch port configuration.", + "required": true, + "schema": { + "$ref": "#/components/schemas/NameOrId" + } + }, + { + "in": "query", + "name": "peer_address", + "description": "An address identifying a configured bgp peer.", + "required": true, + "schema": { + "type": "string", + "format": "ip" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "title": "Array_of_BgpAllowedPrefix", + "type": "array", + "items": { + "$ref": "#/components/schemas/BgpAllowedPrefix" + } + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/v1/system/networking/switch-port-configuration/{configuration}/bgp-peer/allow-export/add": { + "post": { + "tags": [ + "system/networking" + ], + "summary": "Add prefix to bgp peer allowed export list", + "operationId": "networking_switch_port_configuration_bgp_peer_allow_export_add", + "parameters": [ + { + "in": "path", + "name": "configuration", + "description": "A name or id to use when selecting a switch port configuration.", + "required": true, + "schema": { + "$ref": "#/components/schemas/NameOrId" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AllowedPrefixAddRemove" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "successful creation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BgpAllowedPrefix" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/v1/system/networking/switch-port-configuration/{configuration}/bgp-peer/allow-export/remove": { + "post": { + "tags": [ + "system/networking" + ], + "summary": "Remove prefix from bgp peer allowed export list", + "operationId": "networking_switch_port_configuration_bgp_peer_allow_export_remove", + "parameters": [ + { + "in": "path", + "name": "configuration", + "description": "A name or id to use when selecting a switch port configuration.", + "required": true, + "schema": { + "$ref": "#/components/schemas/NameOrId" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AllowedPrefixAddRemove" + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "successful deletion" + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/v1/system/networking/switch-port-configuration/{configuration}/bgp-peer/allow-import": { + "get": { + "tags": [ + "system/networking" + ], + "summary": "List prefixes allowed to be imported by a given bgp peer", + "operationId": "networking_switch_port_configuration_bgp_peer_allow_import_list", + "parameters": [ + { + "in": "path", + "name": "configuration", + "description": "A name or id to use when selecting a switch port configuration.", + "required": true, + "schema": { + "$ref": "#/components/schemas/NameOrId" + } + }, + { + "in": "query", + "name": "peer_address", + "description": "An address identifying a configured bgp peer.", + "required": true, + "schema": { + "type": "string", + "format": "ip" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "title": "Array_of_BgpAllowedPrefix", + "type": "array", + "items": { + "$ref": "#/components/schemas/BgpAllowedPrefix" + } + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/v1/system/networking/switch-port-configuration/{configuration}/bgp-peer/allow-import/add": { + "post": { + "tags": [ + "system/networking" + ], + "summary": "Add prefix to bgp peer allowed import list", + "operationId": "networking_switch_port_configuration_bgp_peer_allow_import_add", + "parameters": [ + { + "in": "path", + "name": "configuration", + "description": "A name or id to use when selecting a switch port configuration.", + "required": true, + "schema": { + "$ref": "#/components/schemas/NameOrId" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AllowedPrefixAddRemove" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "successful creation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BgpAllowedPrefix" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/v1/system/networking/switch-port-configuration/{configuration}/bgp-peer/allow-import/remove": { + "post": { + "tags": [ + "system/networking" + ], + "summary": "Remove prefix from bgp peer allowed import list", + "operationId": "networking_switch_port_configuration_bgp_peer_allow_import_remove", + "parameters": [ + { + "in": "path", + "name": "configuration", + "description": "A name or id to use when selecting a switch port configuration.", + "required": true, + "schema": { + "$ref": "#/components/schemas/NameOrId" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AllowedPrefixAddRemove" + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "successful deletion" + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/v1/system/networking/switch-port-configuration/{configuration}/bgp-peer/community": { + "get": { + "tags": [ + "system/networking" + ], + "summary": "List communities assigned to a bgp peer", + "operationId": "networking_switch_port_configuration_bgp_peer_community_list", + "parameters": [ + { + "in": "path", + "name": "configuration", + "description": "A name or id to use when selecting a switch port configuration.", + "required": true, + "schema": { + "$ref": "#/components/schemas/NameOrId" + } + }, + { + "in": "query", + "name": "peer_address", + "description": "An address identifying a configured bgp peer.", + "required": true, + "schema": { + "type": "string", + "format": "ip" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "title": "Array_of_BgpCommunity", + "type": "array", + "items": { + "$ref": "#/components/schemas/BgpCommunity" + } + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/v1/system/networking/switch-port-configuration/{configuration}/bgp-peer/community/add": { + "post": { + "tags": [ + "system/networking" + ], + "summary": "Add community to bgp peer", + "operationId": "networking_switch_port_configuration_bgp_peer_community_add", + "parameters": [ + { + "in": "path", + "name": "configuration", + "description": "A name or id to use when selecting a switch port configuration.", + "required": true, + "schema": { + "$ref": "#/components/schemas/NameOrId" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BgpCommunityAddRemove" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "successful creation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BgpCommunity" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, + "/v1/system/networking/switch-port-configuration/{configuration}/bgp-peer/community/remove": { + "post": { + "tags": [ + "system/networking" + ], + "summary": "Remove community from bgp peer", + "operationId": "networking_switch_port_configuration_bgp_peer_community_remove", + "parameters": [ + { + "in": "path", + "name": "configuration", + "description": "A name or id to use when selecting a switch port configuration.", + "required": true, + "schema": { + "$ref": "#/components/schemas/NameOrId" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BgpCommunityAddRemove" + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "successful deletion" + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, "/v1/system/networking/switch-port-configuration/{configuration}/bgp-peer/remove": { "post": { "tags": [ @@ -10735,6 +11158,38 @@ "allowed_ips" ] }, + "AllowedPrefixAddRemove": { + "description": "A prefix allowed to be imported or exported by a bgp peer", + "type": "object", + "properties": { + "interface": { + "description": "The interface the peer is configured on", + "allOf": [ + { + "$ref": "#/components/schemas/Name" + } + ] + }, + "peer_address": { + "description": "An address identifying the target bgp peer", + "type": "string", + "format": "ip" + }, + "prefix": { + "description": "The allowed prefix to add or remove", + "allOf": [ + { + "$ref": "#/components/schemas/IpNet" + } + ] + } + }, + "required": [ + "interface", + "peer_address", + "prefix" + ] + }, "AllowedSourceIps": { "description": "Description of source IPs allowed to reach rack services.", "oneOf": [ @@ -10988,6 +11443,43 @@ "switch" ] }, + "BgpAllowedPrefix": { + "description": "A BGP allowed prefix entry", + "type": "object", + "properties": { + "addr": { + "description": "Peer Address", + "allOf": [ + { + "$ref": "#/components/schemas/IpNet" + } + ] + }, + "interface_name": { + "description": "Interface peer is reachable on", + "type": "string" + }, + "port_settings_id": { + "description": "Parent switch port configuration", + "type": "string", + "format": "uuid" + }, + "prefix": { + "description": "Allowed Prefix", + "allOf": [ + { + "$ref": "#/components/schemas/IpNet" + } + ] + } + }, + "required": [ + "addr", + "interface_name", + "port_settings_id", + "prefix" + ] + }, "BgpAnnounceSet": { "description": "Represents a BGP announce set by id. The id can be used with other API calls to view and manage the announce set.", "type": "object", @@ -11107,6 +11599,71 @@ "network" ] }, + "BgpCommunity": { + "description": "A BGP community", + "type": "object", + "properties": { + "addr": { + "description": "Peer Address", + "allOf": [ + { + "$ref": "#/components/schemas/IpNet" + } + ] + }, + "community": { + "description": "Community", + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "interface_name": { + "description": "Interface peer is reachable on", + "type": "string" + }, + "port_settings_id": { + "description": "Parent switch port configuration", + "type": "string", + "format": "uuid" + } + }, + "required": [ + "addr", + "community", + "interface_name", + "port_settings_id" + ] + }, + "BgpCommunityAddRemove": { + "description": "A community to be added to or removed from a bgp peer", + "type": "object", + "properties": { + "community": { + "description": "The community to add or remove", + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "interface": { + "description": "The interface the peer is configured on", + "allOf": [ + { + "$ref": "#/components/schemas/Name" + } + ] + }, + "peer_address": { + "description": "An address identifying the target bgp peer", + "type": "string", + "format": "ip" + } + }, + "required": [ + "community", + "interface", + "peer_address" + ] + }, "BgpConfig": { "description": "A base BGP configuration.", "type": "object", @@ -11276,6 +11833,127 @@ }, "BgpMessageHistory": {}, "BgpPeer": { + "description": "The information required to configure a BGP peer.", + "type": "object", + "properties": { + "addr": { + "description": "The address of th e host to peer with.", + "allOf": [ + { + "$ref": "#/components/schemas/IpNet" + } + ] + }, + "allow_export_list_active": { + "description": "Enable export policies", + "type": "boolean" + }, + "allow_import_list_active": { + "description": "Enable import policies", + "type": "boolean" + }, + "bgp_config": { + "description": "The global BGP configuration used for establishing a session with this peer.", + "allOf": [ + { + "$ref": "#/components/schemas/NameOrId" + } + ] + }, + "connect_retry": { + "description": "How long to to wait between TCP connection retries (seconds).", + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "delay_open": { + "description": "How long to delay sending an open request after establishing a TCP session (seconds).", + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "enforce_first_as": { + "description": "Enforce that the first AS in paths received from this peer is the peer's AS.", + "type": "boolean" + }, + "hold_time": { + "description": "How long to hold peer connections between keepalives (seconds).", + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "idle_hold_time": { + "description": "How long to hold a peer in idle before attempting a new session (seconds).", + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "interface_name": { + "description": "The name of interface to peer on. This is relative to the port configuration this BGP peer configuration is a part of. For example this value could be phy0 to refer to a primary physical interface. Or it could be vlan47 to refer to a VLAN interface.", + "type": "string" + }, + "keepalive": { + "description": "How often to send keepalive requests (seconds).", + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "local_pref": { + "nullable": true, + "description": "Apply a local preference to routes received from this peer.", + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "md5_auth_key": { + "nullable": true, + "description": "Use the given key for TCP-MD5 authentication with the peer.", + "type": "string" + }, + "min_ttl": { + "nullable": true, + "description": "Require messages from a peer have a minimum IP time to live field.", + "type": "integer", + "format": "uint8", + "minimum": 0 + }, + "multi_exit_discriminator": { + "nullable": true, + "description": "Apply the provided multi-exit discriminator (MED) updates sent to the peer.", + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "remote_asn": { + "nullable": true, + "description": "Require that a peer has a specified ASN.", + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "vlan_id": { + "nullable": true, + "description": "Associate a VLAN ID with a peer.", + "type": "integer", + "format": "uint16", + "minimum": 0 + } + }, + "required": [ + "addr", + "allow_export_list_active", + "allow_import_list_active", + "bgp_config", + "connect_retry", + "delay_open", + "enforce_first_as", + "hold_time", + "idle_hold_time", + "interface_name", + "keepalive" + ] + }, + "BgpPeerCombined": { "description": "A BGP peer configuration for an interface. Includes the set of announcements that will be advertised to the peer identified by `addr`. The `bgp_config` parameter is a reference to global BGP parameters. The `interface_name` indicates what interface the peer should be contacted on.", "type": "object", "properties": { @@ -11417,7 +12095,7 @@ "peers": { "type": "array", "items": { - "$ref": "#/components/schemas/BgpPeer" + "$ref": "#/components/schemas/BgpPeerCombined" } } }, @@ -20499,7 +21177,7 @@ "description": "BGP peer settings.", "type": "array", "items": { - "$ref": "#/components/schemas/BgpPeer" + "$ref": "#/components/schemas/BgpPeerCombined" } }, "groups": { diff --git a/sdk-httpmock/src/generated_httpmock.rs b/sdk-httpmock/src/generated_httpmock.rs index a3f8d9aa..ccd6c288 100644 --- a/sdk-httpmock/src/generated_httpmock.rs +++ b/sdk-httpmock/src/generated_httpmock.rs @@ -12151,6 +12151,639 @@ pub mod operations { } } + pub struct NetworkingSwitchPortConfigurationBgpPeerAllowExportListWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationBgpPeerAllowExportListWhen { + pub fn new(inner: httpmock::When) -> Self { + Self( + inner.method(httpmock::Method::GET).path_matches( + regex::Regex::new( + "^/v1/system/networking/switch-port-configuration/[^/]*/bgp-peer/\ + allow-export$", + ) + .unwrap(), + ), + ) + } + + pub fn into_inner(self) -> httpmock::When { + self.0 + } + + pub fn configuration(self, value: &types::NameOrId) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/switch-port-configuration/{}/bgp-peer/allow-export$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + + pub fn peer_address(self, value: &std::net::IpAddr) -> Self { + Self(self.0.query_param("peer_address", value.to_string())) + } + } + + pub struct NetworkingSwitchPortConfigurationBgpPeerAllowExportListThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationBgpPeerAllowExportListThen { + pub fn new(inner: httpmock::Then) -> Self { + Self(inner) + } + + pub fn into_inner(self) -> httpmock::Then { + self.0 + } + + pub fn ok(self, value: &Vec) -> Self { + Self( + self.0 + .status(200u16) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn client_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 4u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn server_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 5u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + } + + pub struct NetworkingSwitchPortConfigurationBgpPeerAllowExportAddWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationBgpPeerAllowExportAddWhen { + pub fn new(inner: httpmock::When) -> Self { + Self( + inner.method(httpmock::Method::POST).path_matches( + regex::Regex::new( + "^/v1/system/networking/switch-port-configuration/[^/]*/bgp-peer/\ + allow-export/add$", + ) + .unwrap(), + ), + ) + } + + pub fn into_inner(self) -> httpmock::When { + self.0 + } + + pub fn configuration(self, value: &types::NameOrId) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/switch-port-configuration/{}/bgp-peer/allow-export/add$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + + pub fn body(self, value: &types::AllowedPrefixAddRemove) -> Self { + Self(self.0.json_body_obj(value)) + } + } + + pub struct NetworkingSwitchPortConfigurationBgpPeerAllowExportAddThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationBgpPeerAllowExportAddThen { + pub fn new(inner: httpmock::Then) -> Self { + Self(inner) + } + + pub fn into_inner(self) -> httpmock::Then { + self.0 + } + + pub fn created(self, value: &types::BgpAllowedPrefix) -> Self { + Self( + self.0 + .status(201u16) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn client_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 4u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn server_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 5u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + } + + pub struct NetworkingSwitchPortConfigurationBgpPeerAllowExportRemoveWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationBgpPeerAllowExportRemoveWhen { + pub fn new(inner: httpmock::When) -> Self { + Self( + inner.method(httpmock::Method::POST).path_matches( + regex::Regex::new( + "^/v1/system/networking/switch-port-configuration/[^/]*/bgp-peer/\ + allow-export/remove$", + ) + .unwrap(), + ), + ) + } + + pub fn into_inner(self) -> httpmock::When { + self.0 + } + + pub fn configuration(self, value: &types::NameOrId) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/switch-port-configuration/{}/bgp-peer/allow-export/remove$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + + pub fn body(self, value: &types::AllowedPrefixAddRemove) -> Self { + Self(self.0.json_body_obj(value)) + } + } + + pub struct NetworkingSwitchPortConfigurationBgpPeerAllowExportRemoveThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationBgpPeerAllowExportRemoveThen { + pub fn new(inner: httpmock::Then) -> Self { + Self(inner) + } + + pub fn into_inner(self) -> httpmock::Then { + self.0 + } + + pub fn no_content(self) -> Self { + Self(self.0.status(204u16)) + } + + pub fn client_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 4u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn server_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 5u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + } + + pub struct NetworkingSwitchPortConfigurationBgpPeerAllowImportListWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationBgpPeerAllowImportListWhen { + pub fn new(inner: httpmock::When) -> Self { + Self( + inner.method(httpmock::Method::GET).path_matches( + regex::Regex::new( + "^/v1/system/networking/switch-port-configuration/[^/]*/bgp-peer/\ + allow-import$", + ) + .unwrap(), + ), + ) + } + + pub fn into_inner(self) -> httpmock::When { + self.0 + } + + pub fn configuration(self, value: &types::NameOrId) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/switch-port-configuration/{}/bgp-peer/allow-import$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + + pub fn peer_address(self, value: &std::net::IpAddr) -> Self { + Self(self.0.query_param("peer_address", value.to_string())) + } + } + + pub struct NetworkingSwitchPortConfigurationBgpPeerAllowImportListThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationBgpPeerAllowImportListThen { + pub fn new(inner: httpmock::Then) -> Self { + Self(inner) + } + + pub fn into_inner(self) -> httpmock::Then { + self.0 + } + + pub fn ok(self, value: &Vec) -> Self { + Self( + self.0 + .status(200u16) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn client_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 4u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn server_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 5u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + } + + pub struct NetworkingSwitchPortConfigurationBgpPeerAllowImportAddWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationBgpPeerAllowImportAddWhen { + pub fn new(inner: httpmock::When) -> Self { + Self( + inner.method(httpmock::Method::POST).path_matches( + regex::Regex::new( + "^/v1/system/networking/switch-port-configuration/[^/]*/bgp-peer/\ + allow-import/add$", + ) + .unwrap(), + ), + ) + } + + pub fn into_inner(self) -> httpmock::When { + self.0 + } + + pub fn configuration(self, value: &types::NameOrId) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/switch-port-configuration/{}/bgp-peer/allow-import/add$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + + pub fn body(self, value: &types::AllowedPrefixAddRemove) -> Self { + Self(self.0.json_body_obj(value)) + } + } + + pub struct NetworkingSwitchPortConfigurationBgpPeerAllowImportAddThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationBgpPeerAllowImportAddThen { + pub fn new(inner: httpmock::Then) -> Self { + Self(inner) + } + + pub fn into_inner(self) -> httpmock::Then { + self.0 + } + + pub fn created(self, value: &types::BgpAllowedPrefix) -> Self { + Self( + self.0 + .status(201u16) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn client_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 4u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn server_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 5u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + } + + pub struct NetworkingSwitchPortConfigurationBgpPeerAllowImportRemoveWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationBgpPeerAllowImportRemoveWhen { + pub fn new(inner: httpmock::When) -> Self { + Self( + inner.method(httpmock::Method::POST).path_matches( + regex::Regex::new( + "^/v1/system/networking/switch-port-configuration/[^/]*/bgp-peer/\ + allow-import/remove$", + ) + .unwrap(), + ), + ) + } + + pub fn into_inner(self) -> httpmock::When { + self.0 + } + + pub fn configuration(self, value: &types::NameOrId) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/switch-port-configuration/{}/bgp-peer/allow-import/remove$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + + pub fn body(self, value: &types::AllowedPrefixAddRemove) -> Self { + Self(self.0.json_body_obj(value)) + } + } + + pub struct NetworkingSwitchPortConfigurationBgpPeerAllowImportRemoveThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationBgpPeerAllowImportRemoveThen { + pub fn new(inner: httpmock::Then) -> Self { + Self(inner) + } + + pub fn into_inner(self) -> httpmock::Then { + self.0 + } + + pub fn no_content(self) -> Self { + Self(self.0.status(204u16)) + } + + pub fn client_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 4u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn server_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 5u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + } + + pub struct NetworkingSwitchPortConfigurationBgpPeerCommunityListWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationBgpPeerCommunityListWhen { + pub fn new(inner: httpmock::When) -> Self { + Self( + inner.method(httpmock::Method::GET).path_matches( + regex::Regex::new( + "^/v1/system/networking/switch-port-configuration/[^/]*/bgp-peer/\ + community$", + ) + .unwrap(), + ), + ) + } + + pub fn into_inner(self) -> httpmock::When { + self.0 + } + + pub fn configuration(self, value: &types::NameOrId) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/switch-port-configuration/{}/bgp-peer/community$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + + pub fn peer_address(self, value: &std::net::IpAddr) -> Self { + Self(self.0.query_param("peer_address", value.to_string())) + } + } + + pub struct NetworkingSwitchPortConfigurationBgpPeerCommunityListThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationBgpPeerCommunityListThen { + pub fn new(inner: httpmock::Then) -> Self { + Self(inner) + } + + pub fn into_inner(self) -> httpmock::Then { + self.0 + } + + pub fn ok(self, value: &Vec) -> Self { + Self( + self.0 + .status(200u16) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn client_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 4u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn server_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 5u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + } + + pub struct NetworkingSwitchPortConfigurationBgpPeerCommunityAddWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationBgpPeerCommunityAddWhen { + pub fn new(inner: httpmock::When) -> Self { + Self( + inner.method(httpmock::Method::POST).path_matches( + regex::Regex::new( + "^/v1/system/networking/switch-port-configuration/[^/]*/bgp-peer/\ + community/add$", + ) + .unwrap(), + ), + ) + } + + pub fn into_inner(self) -> httpmock::When { + self.0 + } + + pub fn configuration(self, value: &types::NameOrId) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/switch-port-configuration/{}/bgp-peer/community/add$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + + pub fn body(self, value: &types::BgpCommunityAddRemove) -> Self { + Self(self.0.json_body_obj(value)) + } + } + + pub struct NetworkingSwitchPortConfigurationBgpPeerCommunityAddThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationBgpPeerCommunityAddThen { + pub fn new(inner: httpmock::Then) -> Self { + Self(inner) + } + + pub fn into_inner(self) -> httpmock::Then { + self.0 + } + + pub fn created(self, value: &types::BgpCommunity) -> Self { + Self( + self.0 + .status(201u16) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn client_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 4u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn server_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 5u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + } + + pub struct NetworkingSwitchPortConfigurationBgpPeerCommunityRemoveWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationBgpPeerCommunityRemoveWhen { + pub fn new(inner: httpmock::When) -> Self { + Self( + inner.method(httpmock::Method::POST).path_matches( + regex::Regex::new( + "^/v1/system/networking/switch-port-configuration/[^/]*/bgp-peer/\ + community/remove$", + ) + .unwrap(), + ), + ) + } + + pub fn into_inner(self) -> httpmock::When { + self.0 + } + + pub fn configuration(self, value: &types::NameOrId) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/switch-port-configuration/{}/bgp-peer/community/remove$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + + pub fn body(self, value: &types::BgpCommunityAddRemove) -> Self { + Self(self.0.json_body_obj(value)) + } + } + + pub struct NetworkingSwitchPortConfigurationBgpPeerCommunityRemoveThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationBgpPeerCommunityRemoveThen { + pub fn new(inner: httpmock::Then) -> Self { + Self(inner) + } + + pub fn into_inner(self) -> httpmock::Then { + self.0 + } + + pub fn no_content(self) -> Self { + Self(self.0.status(204u16)) + } + + pub fn client_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 4u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn server_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 5u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + } + pub struct NetworkingSwitchPortConfigurationBgpPeerRemoveWhen(httpmock::When); impl NetworkingSwitchPortConfigurationBgpPeerRemoveWhen { pub fn new(inner: httpmock::When) -> Self { @@ -17551,6 +18184,87 @@ pub trait MockServerExt { operations::NetworkingSwitchPortConfigurationBgpPeerAddWhen, operations::NetworkingSwitchPortConfigurationBgpPeerAddThen, ); + fn networking_switch_port_configuration_bgp_peer_allow_export_list( + &self, + config_fn: F, + ) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationBgpPeerAllowExportListWhen, + operations::NetworkingSwitchPortConfigurationBgpPeerAllowExportListThen, + ); + fn networking_switch_port_configuration_bgp_peer_allow_export_add( + &self, + config_fn: F, + ) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationBgpPeerAllowExportAddWhen, + operations::NetworkingSwitchPortConfigurationBgpPeerAllowExportAddThen, + ); + fn networking_switch_port_configuration_bgp_peer_allow_export_remove( + &self, + config_fn: F, + ) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationBgpPeerAllowExportRemoveWhen, + operations::NetworkingSwitchPortConfigurationBgpPeerAllowExportRemoveThen, + ); + fn networking_switch_port_configuration_bgp_peer_allow_import_list( + &self, + config_fn: F, + ) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationBgpPeerAllowImportListWhen, + operations::NetworkingSwitchPortConfigurationBgpPeerAllowImportListThen, + ); + fn networking_switch_port_configuration_bgp_peer_allow_import_add( + &self, + config_fn: F, + ) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationBgpPeerAllowImportAddWhen, + operations::NetworkingSwitchPortConfigurationBgpPeerAllowImportAddThen, + ); + fn networking_switch_port_configuration_bgp_peer_allow_import_remove( + &self, + config_fn: F, + ) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationBgpPeerAllowImportRemoveWhen, + operations::NetworkingSwitchPortConfigurationBgpPeerAllowImportRemoveThen, + ); + fn networking_switch_port_configuration_bgp_peer_community_list( + &self, + config_fn: F, + ) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationBgpPeerCommunityListWhen, + operations::NetworkingSwitchPortConfigurationBgpPeerCommunityListThen, + ); + fn networking_switch_port_configuration_bgp_peer_community_add( + &self, + config_fn: F, + ) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationBgpPeerCommunityAddWhen, + operations::NetworkingSwitchPortConfigurationBgpPeerCommunityAddThen, + ); + fn networking_switch_port_configuration_bgp_peer_community_remove( + &self, + config_fn: F, + ) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationBgpPeerCommunityRemoveWhen, + operations::NetworkingSwitchPortConfigurationBgpPeerCommunityRemoveThen, + ); fn networking_switch_port_configuration_bgp_peer_remove( &self, config_fn: F, @@ -19780,6 +20494,176 @@ impl MockServerExt for httpmock::MockServer { }) } + fn networking_switch_port_configuration_bgp_peer_allow_export_list( + &self, + config_fn: F, + ) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationBgpPeerAllowExportListWhen, + operations::NetworkingSwitchPortConfigurationBgpPeerAllowExportListThen, + ), + { + self.mock(|when, then| { + config_fn( + operations::NetworkingSwitchPortConfigurationBgpPeerAllowExportListWhen::new(when), + operations::NetworkingSwitchPortConfigurationBgpPeerAllowExportListThen::new(then), + ) + }) + } + + fn networking_switch_port_configuration_bgp_peer_allow_export_add( + &self, + config_fn: F, + ) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationBgpPeerAllowExportAddWhen, + operations::NetworkingSwitchPortConfigurationBgpPeerAllowExportAddThen, + ), + { + self.mock(|when, then| { + config_fn( + operations::NetworkingSwitchPortConfigurationBgpPeerAllowExportAddWhen::new(when), + operations::NetworkingSwitchPortConfigurationBgpPeerAllowExportAddThen::new(then), + ) + }) + } + + fn networking_switch_port_configuration_bgp_peer_allow_export_remove( + &self, + config_fn: F, + ) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationBgpPeerAllowExportRemoveWhen, + operations::NetworkingSwitchPortConfigurationBgpPeerAllowExportRemoveThen, + ), + { + self.mock(|when, then| { + config_fn( + operations::NetworkingSwitchPortConfigurationBgpPeerAllowExportRemoveWhen::new( + when, + ), + operations::NetworkingSwitchPortConfigurationBgpPeerAllowExportRemoveThen::new( + then, + ), + ) + }) + } + + fn networking_switch_port_configuration_bgp_peer_allow_import_list( + &self, + config_fn: F, + ) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationBgpPeerAllowImportListWhen, + operations::NetworkingSwitchPortConfigurationBgpPeerAllowImportListThen, + ), + { + self.mock(|when, then| { + config_fn( + operations::NetworkingSwitchPortConfigurationBgpPeerAllowImportListWhen::new(when), + operations::NetworkingSwitchPortConfigurationBgpPeerAllowImportListThen::new(then), + ) + }) + } + + fn networking_switch_port_configuration_bgp_peer_allow_import_add( + &self, + config_fn: F, + ) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationBgpPeerAllowImportAddWhen, + operations::NetworkingSwitchPortConfigurationBgpPeerAllowImportAddThen, + ), + { + self.mock(|when, then| { + config_fn( + operations::NetworkingSwitchPortConfigurationBgpPeerAllowImportAddWhen::new(when), + operations::NetworkingSwitchPortConfigurationBgpPeerAllowImportAddThen::new(then), + ) + }) + } + + fn networking_switch_port_configuration_bgp_peer_allow_import_remove( + &self, + config_fn: F, + ) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationBgpPeerAllowImportRemoveWhen, + operations::NetworkingSwitchPortConfigurationBgpPeerAllowImportRemoveThen, + ), + { + self.mock(|when, then| { + config_fn( + operations::NetworkingSwitchPortConfigurationBgpPeerAllowImportRemoveWhen::new( + when, + ), + operations::NetworkingSwitchPortConfigurationBgpPeerAllowImportRemoveThen::new( + then, + ), + ) + }) + } + + fn networking_switch_port_configuration_bgp_peer_community_list( + &self, + config_fn: F, + ) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationBgpPeerCommunityListWhen, + operations::NetworkingSwitchPortConfigurationBgpPeerCommunityListThen, + ), + { + self.mock(|when, then| { + config_fn( + operations::NetworkingSwitchPortConfigurationBgpPeerCommunityListWhen::new(when), + operations::NetworkingSwitchPortConfigurationBgpPeerCommunityListThen::new(then), + ) + }) + } + + fn networking_switch_port_configuration_bgp_peer_community_add( + &self, + config_fn: F, + ) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationBgpPeerCommunityAddWhen, + operations::NetworkingSwitchPortConfigurationBgpPeerCommunityAddThen, + ), + { + self.mock(|when, then| { + config_fn( + operations::NetworkingSwitchPortConfigurationBgpPeerCommunityAddWhen::new(when), + operations::NetworkingSwitchPortConfigurationBgpPeerCommunityAddThen::new(then), + ) + }) + } + + fn networking_switch_port_configuration_bgp_peer_community_remove( + &self, + config_fn: F, + ) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationBgpPeerCommunityRemoveWhen, + operations::NetworkingSwitchPortConfigurationBgpPeerCommunityRemoveThen, + ), + { + self.mock(|when, then| { + config_fn( + operations::NetworkingSwitchPortConfigurationBgpPeerCommunityRemoveWhen::new(when), + operations::NetworkingSwitchPortConfigurationBgpPeerCommunityRemoveThen::new(then), + ) + }) + } + fn networking_switch_port_configuration_bgp_peer_remove( &self, config_fn: F, diff --git a/sdk/src/generated_sdk.rs b/sdk/src/generated_sdk.rs index 4594981e..19ca8b44 100644 --- a/sdk/src/generated_sdk.rs +++ b/sdk/src/generated_sdk.rs @@ -883,6 +883,70 @@ pub mod types { } } + /// A prefix allowed to be imported or exported by a bgp peer + /// + ///
JSON schema + /// + /// ```json + /// { + /// "description": "A prefix allowed to be imported or exported by a bgp + /// peer", + /// "type": "object", + /// "required": [ + /// "interface", + /// "peer_address", + /// "prefix" + /// ], + /// "properties": { + /// "interface": { + /// "description": "The interface the peer is configured on", + /// "allOf": [ + /// { + /// "$ref": "#/components/schemas/Name" + /// } + /// ] + /// }, + /// "peer_address": { + /// "description": "An address identifying the target bgp peer", + /// "type": "string", + /// "format": "ip" + /// }, + /// "prefix": { + /// "description": "The allowed prefix to add or remove", + /// "allOf": [ + /// { + /// "$ref": "#/components/schemas/IpNet" + /// } + /// ] + /// } + /// } + /// } + /// ``` + ///
+ #[derive( + :: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, schemars :: JsonSchema, + )] + pub struct AllowedPrefixAddRemove { + /// The interface the peer is configured on + pub interface: Name, + /// An address identifying the target bgp peer + pub peer_address: std::net::IpAddr, + /// The allowed prefix to add or remove + pub prefix: IpNet, + } + + impl From<&AllowedPrefixAddRemove> for AllowedPrefixAddRemove { + fn from(value: &AllowedPrefixAddRemove) -> Self { + value.clone() + } + } + + impl AllowedPrefixAddRemove { + pub fn builder() -> builder::AllowedPrefixAddRemove { + Default::default() + } + } + /// Description of source IPs allowed to reach rack services. /// ///
JSON schema @@ -1586,224 +1650,40 @@ pub mod types { } } - /// Represents a BGP announce set by id. The id can be used with other API - /// calls to view and manage the announce set. + /// A BGP allowed prefix entry /// ///
JSON schema /// /// ```json /// { - /// "description": "Represents a BGP announce set by id. The id can be used - /// with other API calls to view and manage the announce set.", + /// "description": "A BGP allowed prefix entry", /// "type": "object", /// "required": [ - /// "description", - /// "id", - /// "name", - /// "time_created", - /// "time_modified" + /// "addr", + /// "interface_name", + /// "port_settings_id", + /// "prefix" /// ], /// "properties": { - /// "description": { - /// "description": "human-readable free-form text about a resource", - /// "type": "string" - /// }, - /// "id": { - /// "description": "unique, immutable, system-controlled identifier for - /// each resource", - /// "type": "string", - /// "format": "uuid" - /// }, - /// "name": { - /// "description": "unique, mutable, user-controlled identifier for - /// each resource", + /// "addr": { + /// "description": "Peer Address", /// "allOf": [ /// { - /// "$ref": "#/components/schemas/Name" + /// "$ref": "#/components/schemas/IpNet" /// } /// ] /// }, - /// "time_created": { - /// "description": "timestamp when this resource was created", - /// "type": "string", - /// "format": "date-time" - /// }, - /// "time_modified": { - /// "description": "timestamp when this resource was last modified", - /// "type": "string", - /// "format": "date-time" - /// } - /// } - /// } - /// ``` - ///
- #[derive( - :: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, schemars :: JsonSchema, - )] - pub struct BgpAnnounceSet { - /// human-readable free-form text about a resource - pub description: String, - /// unique, immutable, system-controlled identifier for each resource - pub id: uuid::Uuid, - /// unique, mutable, user-controlled identifier for each resource - pub name: Name, - /// timestamp when this resource was created - pub time_created: chrono::DateTime, - /// timestamp when this resource was last modified - pub time_modified: chrono::DateTime, - } - - impl From<&BgpAnnounceSet> for BgpAnnounceSet { - fn from(value: &BgpAnnounceSet) -> Self { - value.clone() - } - } - - impl BgpAnnounceSet { - pub fn builder() -> builder::BgpAnnounceSet { - Default::default() - } - } - - /// Parameters for creating a named set of BGP announcements. - /// - ///
JSON schema - /// - /// ```json - /// { - /// "description": "Parameters for creating a named set of BGP - /// announcements.", - /// "type": "object", - /// "required": [ - /// "announcement", - /// "description", - /// "name" - /// ], - /// "properties": { - /// "announcement": { - /// "description": "The announcements in this set.", - /// "type": "array", - /// "items": { - /// "$ref": "#/components/schemas/BgpAnnouncementCreate" - /// } - /// }, - /// "description": { + /// "interface_name": { + /// "description": "Interface peer is reachable on", /// "type": "string" /// }, - /// "name": { - /// "$ref": "#/components/schemas/Name" - /// } - /// } - /// } - /// ``` - ///
- #[derive( - :: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, schemars :: JsonSchema, - )] - pub struct BgpAnnounceSetCreate { - /// The announcements in this set. - pub announcement: Vec, - pub description: String, - pub name: Name, - } - - impl From<&BgpAnnounceSetCreate> for BgpAnnounceSetCreate { - fn from(value: &BgpAnnounceSetCreate) -> Self { - value.clone() - } - } - - impl BgpAnnounceSetCreate { - pub fn builder() -> builder::BgpAnnounceSetCreate { - Default::default() - } - } - - /// A BGP announcement tied to an address lot block. - /// - ///
JSON schema - /// - /// ```json - /// { - /// "description": "A BGP announcement tied to an address lot block.", - /// "type": "object", - /// "required": [ - /// "address_lot_block_id", - /// "announce_set_id", - /// "network" - /// ], - /// "properties": { - /// "address_lot_block_id": { - /// "description": "The address block the IP network being announced is - /// drawn from.", - /// "type": "string", - /// "format": "uuid" - /// }, - /// "announce_set_id": { - /// "description": "The id of the set this announcement is a part of.", + /// "port_settings_id": { + /// "description": "Parent switch port configuration", /// "type": "string", /// "format": "uuid" /// }, - /// "network": { - /// "description": "The IP network being announced.", - /// "allOf": [ - /// { - /// "$ref": "#/components/schemas/IpNet" - /// } - /// ] - /// } - /// } - /// } - /// ``` - ///
- #[derive( - :: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, schemars :: JsonSchema, - )] - pub struct BgpAnnouncement { - /// The address block the IP network being announced is drawn from. - pub address_lot_block_id: uuid::Uuid, - /// The id of the set this announcement is a part of. - pub announce_set_id: uuid::Uuid, - /// The IP network being announced. - pub network: IpNet, - } - - impl From<&BgpAnnouncement> for BgpAnnouncement { - fn from(value: &BgpAnnouncement) -> Self { - value.clone() - } - } - - impl BgpAnnouncement { - pub fn builder() -> builder::BgpAnnouncement { - Default::default() - } - } - - /// A BGP announcement tied to a particular address lot block. - /// - ///
JSON schema - /// - /// ```json - /// { - /// "description": "A BGP announcement tied to a particular address lot - /// block.", - /// "type": "object", - /// "required": [ - /// "address_lot_block", - /// "network" - /// ], - /// "properties": { - /// "address_lot_block": { - /// "description": "Address lot this announcement is drawn from.", - /// "allOf": [ - /// { - /// "$ref": "#/components/schemas/NameOrId" - /// } - /// ] - /// }, - /// "network": { - /// "description": "The network being announced.", + /// "prefix": { + /// "description": "Allowed Prefix", /// "allOf": [ /// { /// "$ref": "#/components/schemas/IpNet" @@ -1817,35 +1697,40 @@ pub mod types { #[derive( :: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, schemars :: JsonSchema, )] - pub struct BgpAnnouncementCreate { - /// Address lot this announcement is drawn from. - pub address_lot_block: NameOrId, - /// The network being announced. - pub network: IpNet, + pub struct BgpAllowedPrefix { + /// Peer Address + pub addr: IpNet, + /// Interface peer is reachable on + pub interface_name: String, + /// Parent switch port configuration + pub port_settings_id: uuid::Uuid, + /// Allowed Prefix + pub prefix: IpNet, } - impl From<&BgpAnnouncementCreate> for BgpAnnouncementCreate { - fn from(value: &BgpAnnouncementCreate) -> Self { + impl From<&BgpAllowedPrefix> for BgpAllowedPrefix { + fn from(value: &BgpAllowedPrefix) -> Self { value.clone() } } - impl BgpAnnouncementCreate { - pub fn builder() -> builder::BgpAnnouncementCreate { + impl BgpAllowedPrefix { + pub fn builder() -> builder::BgpAllowedPrefix { Default::default() } } - /// A base BGP configuration. + /// Represents a BGP announce set by id. The id can be used with other API + /// calls to view and manage the announce set. /// ///
JSON schema /// /// ```json /// { - /// "description": "A base BGP configuration.", + /// "description": "Represents a BGP announce set by id. The id can be used + /// with other API calls to view and manage the announce set.", /// "type": "object", /// "required": [ - /// "asn", /// "description", /// "id", /// "name", @@ -1853,13 +1738,391 @@ pub mod types { /// "time_modified" /// ], /// "properties": { - /// "asn": { - /// "description": "The autonomous system number of this BGP - /// configuration.", - /// "type": "integer", - /// "format": "uint32", - /// "minimum": 0.0 - /// }, + /// "description": { + /// "description": "human-readable free-form text about a resource", + /// "type": "string" + /// }, + /// "id": { + /// "description": "unique, immutable, system-controlled identifier for + /// each resource", + /// "type": "string", + /// "format": "uuid" + /// }, + /// "name": { + /// "description": "unique, mutable, user-controlled identifier for + /// each resource", + /// "allOf": [ + /// { + /// "$ref": "#/components/schemas/Name" + /// } + /// ] + /// }, + /// "time_created": { + /// "description": "timestamp when this resource was created", + /// "type": "string", + /// "format": "date-time" + /// }, + /// "time_modified": { + /// "description": "timestamp when this resource was last modified", + /// "type": "string", + /// "format": "date-time" + /// } + /// } + /// } + /// ``` + ///
+ #[derive( + :: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, schemars :: JsonSchema, + )] + pub struct BgpAnnounceSet { + /// human-readable free-form text about a resource + pub description: String, + /// unique, immutable, system-controlled identifier for each resource + pub id: uuid::Uuid, + /// unique, mutable, user-controlled identifier for each resource + pub name: Name, + /// timestamp when this resource was created + pub time_created: chrono::DateTime, + /// timestamp when this resource was last modified + pub time_modified: chrono::DateTime, + } + + impl From<&BgpAnnounceSet> for BgpAnnounceSet { + fn from(value: &BgpAnnounceSet) -> Self { + value.clone() + } + } + + impl BgpAnnounceSet { + pub fn builder() -> builder::BgpAnnounceSet { + Default::default() + } + } + + /// Parameters for creating a named set of BGP announcements. + /// + ///
JSON schema + /// + /// ```json + /// { + /// "description": "Parameters for creating a named set of BGP + /// announcements.", + /// "type": "object", + /// "required": [ + /// "announcement", + /// "description", + /// "name" + /// ], + /// "properties": { + /// "announcement": { + /// "description": "The announcements in this set.", + /// "type": "array", + /// "items": { + /// "$ref": "#/components/schemas/BgpAnnouncementCreate" + /// } + /// }, + /// "description": { + /// "type": "string" + /// }, + /// "name": { + /// "$ref": "#/components/schemas/Name" + /// } + /// } + /// } + /// ``` + ///
+ #[derive( + :: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, schemars :: JsonSchema, + )] + pub struct BgpAnnounceSetCreate { + /// The announcements in this set. + pub announcement: Vec, + pub description: String, + pub name: Name, + } + + impl From<&BgpAnnounceSetCreate> for BgpAnnounceSetCreate { + fn from(value: &BgpAnnounceSetCreate) -> Self { + value.clone() + } + } + + impl BgpAnnounceSetCreate { + pub fn builder() -> builder::BgpAnnounceSetCreate { + Default::default() + } + } + + /// A BGP announcement tied to an address lot block. + /// + ///
JSON schema + /// + /// ```json + /// { + /// "description": "A BGP announcement tied to an address lot block.", + /// "type": "object", + /// "required": [ + /// "address_lot_block_id", + /// "announce_set_id", + /// "network" + /// ], + /// "properties": { + /// "address_lot_block_id": { + /// "description": "The address block the IP network being announced is + /// drawn from.", + /// "type": "string", + /// "format": "uuid" + /// }, + /// "announce_set_id": { + /// "description": "The id of the set this announcement is a part of.", + /// "type": "string", + /// "format": "uuid" + /// }, + /// "network": { + /// "description": "The IP network being announced.", + /// "allOf": [ + /// { + /// "$ref": "#/components/schemas/IpNet" + /// } + /// ] + /// } + /// } + /// } + /// ``` + ///
+ #[derive( + :: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, schemars :: JsonSchema, + )] + pub struct BgpAnnouncement { + /// The address block the IP network being announced is drawn from. + pub address_lot_block_id: uuid::Uuid, + /// The id of the set this announcement is a part of. + pub announce_set_id: uuid::Uuid, + /// The IP network being announced. + pub network: IpNet, + } + + impl From<&BgpAnnouncement> for BgpAnnouncement { + fn from(value: &BgpAnnouncement) -> Self { + value.clone() + } + } + + impl BgpAnnouncement { + pub fn builder() -> builder::BgpAnnouncement { + Default::default() + } + } + + /// A BGP announcement tied to a particular address lot block. + /// + ///
JSON schema + /// + /// ```json + /// { + /// "description": "A BGP announcement tied to a particular address lot + /// block.", + /// "type": "object", + /// "required": [ + /// "address_lot_block", + /// "network" + /// ], + /// "properties": { + /// "address_lot_block": { + /// "description": "Address lot this announcement is drawn from.", + /// "allOf": [ + /// { + /// "$ref": "#/components/schemas/NameOrId" + /// } + /// ] + /// }, + /// "network": { + /// "description": "The network being announced.", + /// "allOf": [ + /// { + /// "$ref": "#/components/schemas/IpNet" + /// } + /// ] + /// } + /// } + /// } + /// ``` + ///
+ #[derive( + :: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, schemars :: JsonSchema, + )] + pub struct BgpAnnouncementCreate { + /// Address lot this announcement is drawn from. + pub address_lot_block: NameOrId, + /// The network being announced. + pub network: IpNet, + } + + impl From<&BgpAnnouncementCreate> for BgpAnnouncementCreate { + fn from(value: &BgpAnnouncementCreate) -> Self { + value.clone() + } + } + + impl BgpAnnouncementCreate { + pub fn builder() -> builder::BgpAnnouncementCreate { + Default::default() + } + } + + /// A BGP community + /// + ///
JSON schema + /// + /// ```json + /// { + /// "description": "A BGP community", + /// "type": "object", + /// "required": [ + /// "addr", + /// "community", + /// "interface_name", + /// "port_settings_id" + /// ], + /// "properties": { + /// "addr": { + /// "description": "Peer Address", + /// "allOf": [ + /// { + /// "$ref": "#/components/schemas/IpNet" + /// } + /// ] + /// }, + /// "community": { + /// "description": "Community", + /// "type": "integer", + /// "format": "uint32", + /// "minimum": 0.0 + /// }, + /// "interface_name": { + /// "description": "Interface peer is reachable on", + /// "type": "string" + /// }, + /// "port_settings_id": { + /// "description": "Parent switch port configuration", + /// "type": "string", + /// "format": "uuid" + /// } + /// } + /// } + /// ``` + ///
+ #[derive( + :: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, schemars :: JsonSchema, + )] + pub struct BgpCommunity { + /// Peer Address + pub addr: IpNet, + /// Community + pub community: u32, + /// Interface peer is reachable on + pub interface_name: String, + /// Parent switch port configuration + pub port_settings_id: uuid::Uuid, + } + + impl From<&BgpCommunity> for BgpCommunity { + fn from(value: &BgpCommunity) -> Self { + value.clone() + } + } + + impl BgpCommunity { + pub fn builder() -> builder::BgpCommunity { + Default::default() + } + } + + /// A community to be added to or removed from a bgp peer + /// + ///
JSON schema + /// + /// ```json + /// { + /// "description": "A community to be added to or removed from a bgp peer", + /// "type": "object", + /// "required": [ + /// "community", + /// "interface", + /// "peer_address" + /// ], + /// "properties": { + /// "community": { + /// "description": "The community to add or remove", + /// "type": "integer", + /// "format": "uint32", + /// "minimum": 0.0 + /// }, + /// "interface": { + /// "description": "The interface the peer is configured on", + /// "allOf": [ + /// { + /// "$ref": "#/components/schemas/Name" + /// } + /// ] + /// }, + /// "peer_address": { + /// "description": "An address identifying the target bgp peer", + /// "type": "string", + /// "format": "ip" + /// } + /// } + /// } + /// ``` + ///
+ #[derive( + :: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, schemars :: JsonSchema, + )] + pub struct BgpCommunityAddRemove { + /// The community to add or remove + pub community: u32, + /// The interface the peer is configured on + pub interface: Name, + /// An address identifying the target bgp peer + pub peer_address: std::net::IpAddr, + } + + impl From<&BgpCommunityAddRemove> for BgpCommunityAddRemove { + fn from(value: &BgpCommunityAddRemove) -> Self { + value.clone() + } + } + + impl BgpCommunityAddRemove { + pub fn builder() -> builder::BgpCommunityAddRemove { + Default::default() + } + } + + /// A base BGP configuration. + /// + ///
JSON schema + /// + /// ```json + /// { + /// "description": "A base BGP configuration.", + /// "type": "object", + /// "required": [ + /// "asn", + /// "description", + /// "id", + /// "name", + /// "time_created", + /// "time_modified" + /// ], + /// "properties": { + /// "asn": { + /// "description": "The autonomous system number of this BGP + /// configuration.", + /// "type": "integer", + /// "format": "uint32", + /// "minimum": 0.0 + /// }, /// "description": { /// "description": "human-readable free-form text about a resource", /// "type": "string" @@ -2219,28 +2482,19 @@ pub mod types { } } - /// A BGP peer configuration for an interface. Includes the set of - /// announcements that will be advertised to the peer identified by `addr`. - /// The `bgp_config` parameter is a reference to global BGP parameters. The - /// `interface_name` indicates what interface the peer should be contacted - /// on. + /// The information required to configure a BGP peer. /// ///
JSON schema /// /// ```json /// { - /// "description": "A BGP peer configuration for an interface. Includes the - /// set of announcements that will be advertised to the peer identified by - /// `addr`. The `bgp_config` parameter is a reference to global BGP - /// parameters. The `interface_name` indicates what interface the peer - /// should be contacted on.", + /// "description": "The information required to configure a BGP peer.", /// "type": "object", /// "required": [ /// "addr", - /// "allowed_export", - /// "allowed_import", + /// "allow_export_list_active", + /// "allow_import_list_active", /// "bgp_config", - /// "communities", /// "connect_retry", /// "delay_open", /// "enforce_first_as", @@ -2251,25 +2505,20 @@ pub mod types { /// ], /// "properties": { /// "addr": { - /// "description": "The address of the host to peer with.", - /// "type": "string", - /// "format": "ip" - /// }, - /// "allowed_export": { - /// "description": "Define export policy for a peer.", + /// "description": "The address of th e host to peer with.", /// "allOf": [ /// { - /// "$ref": "#/components/schemas/ImportExportPolicy" + /// "$ref": "#/components/schemas/IpNet" /// } /// ] /// }, - /// "allowed_import": { - /// "description": "Define import policy for a peer.", - /// "allOf": [ - /// { - /// "$ref": "#/components/schemas/ImportExportPolicy" - /// } - /// ] + /// "allow_export_list_active": { + /// "description": "Enable export policies", + /// "type": "boolean" + /// }, + /// "allow_import_list_active": { + /// "description": "Enable import policies", + /// "type": "boolean" /// }, /// "bgp_config": { /// "description": "The global BGP configuration used for establishing @@ -2280,16 +2529,6 @@ pub mod types { /// } /// ] /// }, - /// "communities": { - /// "description": "Include the provided communities in updates sent to - /// the peer.", - /// "type": "array", - /// "items": { - /// "type": "integer", - /// "format": "uint32", - /// "minimum": 0.0 - /// } - /// }, /// "connect_retry": { /// "description": "How long to to wait between TCP connection retries /// (seconds).", @@ -2400,17 +2639,15 @@ pub mod types { :: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, schemars :: JsonSchema, )] pub struct BgpPeer { - /// The address of the host to peer with. - pub addr: std::net::IpAddr, - /// Define export policy for a peer. - pub allowed_export: ImportExportPolicy, - /// Define import policy for a peer. - pub allowed_import: ImportExportPolicy, + /// The address of th e host to peer with. + pub addr: IpNet, + /// Enable export policies + pub allow_export_list_active: bool, + /// Enable import policies + pub allow_import_list_active: bool, /// The global BGP configuration used for establishing a session with /// this peer. pub bgp_config: NameOrId, - /// Include the provided communities in updates sent to the peer. - pub communities: Vec, /// How long to to wait between TCP connection retries (seconds). pub connect_retry: u32, /// How long to delay sending an open request after establishing a TCP @@ -2464,58 +2701,35 @@ pub mod types { } } - /// BgpPeerConfig - /// - ///
JSON schema - /// - /// ```json - /// { - /// "type": "object", - /// "required": [ - /// "peers" - /// ], - /// "properties": { - /// "peers": { - /// "type": "array", - /// "items": { - /// "$ref": "#/components/schemas/BgpPeer" - /// } - /// } - /// } - /// } - /// ``` - ///
- #[derive( - :: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, schemars :: JsonSchema, - )] - pub struct BgpPeerConfig { - pub peers: Vec, - } - - impl From<&BgpPeerConfig> for BgpPeerConfig { - fn from(value: &BgpPeerConfig) -> Self { - value.clone() - } - } - - impl BgpPeerConfig { - pub fn builder() -> builder::BgpPeerConfig { - Default::default() - } - } - - /// A BGP peer configuration to remove from an interface + /// A BGP peer configuration for an interface. Includes the set of + /// announcements that will be advertised to the peer identified by `addr`. + /// The `bgp_config` parameter is a reference to global BGP parameters. The + /// `interface_name` indicates what interface the peer should be contacted + /// on. /// ///
JSON schema /// /// ```json /// { - /// "description": "A BGP peer configuration to remove from an interface", + /// "description": "A BGP peer configuration for an interface. Includes the + /// set of announcements that will be advertised to the peer identified by + /// `addr`. The `bgp_config` parameter is a reference to global BGP + /// parameters. The `interface_name` indicates what interface the peer + /// should be contacted on.", /// "type": "object", /// "required": [ /// "addr", + /// "allowed_export", + /// "allowed_import", /// "bgp_config", - /// "interface_name" + /// "communities", + /// "connect_retry", + /// "delay_open", + /// "enforce_first_as", + /// "hold_time", + /// "idle_hold_time", + /// "interface_name", + /// "keepalive" /// ], /// "properties": { /// "addr": { @@ -2523,6 +2737,22 @@ pub mod types { /// "type": "string", /// "format": "ip" /// }, + /// "allowed_export": { + /// "description": "Define export policy for a peer.", + /// "allOf": [ + /// { + /// "$ref": "#/components/schemas/ImportExportPolicy" + /// } + /// ] + /// }, + /// "allowed_import": { + /// "description": "Define import policy for a peer.", + /// "allOf": [ + /// { + /// "$ref": "#/components/schemas/ImportExportPolicy" + /// } + /// ] + /// }, /// "bgp_config": { /// "description": "The global BGP configuration used for establishing /// a session with this peer.", @@ -2532,45 +2762,297 @@ pub mod types { /// } /// ] /// }, - /// "interface_name": { - /// "description": "The name of interface to peer on. This is relative - /// to the port configuration this BGP peer configuration is a part of. For - /// example this value could be phy0 to refer to a primary physical - /// interface. Or it could be vlan47 to refer to a VLAN interface.", - /// "type": "string" - /// } - /// } - /// } - /// ``` - ///
- #[derive( - :: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, schemars :: JsonSchema, - )] - pub struct BgpPeerRemove { - /// The address of the host to peer with. - pub addr: std::net::IpAddr, - /// The global BGP configuration used for establishing a session with - /// this peer. - pub bgp_config: NameOrId, - /// The name of interface to peer on. This is relative to the port - /// configuration this BGP peer configuration is a part of. For example - /// this value could be phy0 to refer to a primary physical interface. - /// Or it could be vlan47 to refer to a VLAN interface. - pub interface_name: String, - } - - impl From<&BgpPeerRemove> for BgpPeerRemove { - fn from(value: &BgpPeerRemove) -> Self { - value.clone() - } - } - - impl BgpPeerRemove { - pub fn builder() -> builder::BgpPeerRemove { - Default::default() - } - } - + /// "communities": { + /// "description": "Include the provided communities in updates sent to + /// the peer.", + /// "type": "array", + /// "items": { + /// "type": "integer", + /// "format": "uint32", + /// "minimum": 0.0 + /// } + /// }, + /// "connect_retry": { + /// "description": "How long to to wait between TCP connection retries + /// (seconds).", + /// "type": "integer", + /// "format": "uint32", + /// "minimum": 0.0 + /// }, + /// "delay_open": { + /// "description": "How long to delay sending an open request after + /// establishing a TCP session (seconds).", + /// "type": "integer", + /// "format": "uint32", + /// "minimum": 0.0 + /// }, + /// "enforce_first_as": { + /// "description": "Enforce that the first AS in paths received from + /// this peer is the peer's AS.", + /// "type": "boolean" + /// }, + /// "hold_time": { + /// "description": "How long to hold peer connections between + /// keepalives (seconds).", + /// "type": "integer", + /// "format": "uint32", + /// "minimum": 0.0 + /// }, + /// "idle_hold_time": { + /// "description": "How long to hold a peer in idle before attempting a + /// new session (seconds).", + /// "type": "integer", + /// "format": "uint32", + /// "minimum": 0.0 + /// }, + /// "interface_name": { + /// "description": "The name of interface to peer on. This is relative + /// to the port configuration this BGP peer configuration is a part of. For + /// example this value could be phy0 to refer to a primary physical + /// interface. Or it could be vlan47 to refer to a VLAN interface.", + /// "type": "string" + /// }, + /// "keepalive": { + /// "description": "How often to send keepalive requests (seconds).", + /// "type": "integer", + /// "format": "uint32", + /// "minimum": 0.0 + /// }, + /// "local_pref": { + /// "description": "Apply a local preference to routes received from + /// this peer.", + /// "type": [ + /// "integer", + /// "null" + /// ], + /// "format": "uint32", + /// "minimum": 0.0 + /// }, + /// "md5_auth_key": { + /// "description": "Use the given key for TCP-MD5 authentication with + /// the peer.", + /// "type": [ + /// "string", + /// "null" + /// ] + /// }, + /// "min_ttl": { + /// "description": "Require messages from a peer have a minimum IP time + /// to live field.", + /// "type": [ + /// "integer", + /// "null" + /// ], + /// "format": "uint8", + /// "minimum": 0.0 + /// }, + /// "multi_exit_discriminator": { + /// "description": "Apply the provided multi-exit discriminator (MED) + /// updates sent to the peer.", + /// "type": [ + /// "integer", + /// "null" + /// ], + /// "format": "uint32", + /// "minimum": 0.0 + /// }, + /// "remote_asn": { + /// "description": "Require that a peer has a specified ASN.", + /// "type": [ + /// "integer", + /// "null" + /// ], + /// "format": "uint32", + /// "minimum": 0.0 + /// }, + /// "vlan_id": { + /// "description": "Associate a VLAN ID with a peer.", + /// "type": [ + /// "integer", + /// "null" + /// ], + /// "format": "uint16", + /// "minimum": 0.0 + /// } + /// } + /// } + /// ``` + ///
+ #[derive( + :: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, schemars :: JsonSchema, + )] + pub struct BgpPeerCombined { + /// The address of the host to peer with. + pub addr: std::net::IpAddr, + /// Define export policy for a peer. + pub allowed_export: ImportExportPolicy, + /// Define import policy for a peer. + pub allowed_import: ImportExportPolicy, + /// The global BGP configuration used for establishing a session with + /// this peer. + pub bgp_config: NameOrId, + /// Include the provided communities in updates sent to the peer. + pub communities: Vec, + /// How long to to wait between TCP connection retries (seconds). + pub connect_retry: u32, + /// How long to delay sending an open request after establishing a TCP + /// session (seconds). + pub delay_open: u32, + /// Enforce that the first AS in paths received from this peer is the + /// peer's AS. + pub enforce_first_as: bool, + /// How long to hold peer connections between keepalives (seconds). + pub hold_time: u32, + /// How long to hold a peer in idle before attempting a new session + /// (seconds). + pub idle_hold_time: u32, + /// The name of interface to peer on. This is relative to the port + /// configuration this BGP peer configuration is a part of. For example + /// this value could be phy0 to refer to a primary physical interface. + /// Or it could be vlan47 to refer to a VLAN interface. + pub interface_name: String, + /// How often to send keepalive requests (seconds). + pub keepalive: u32, + /// Apply a local preference to routes received from this peer. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub local_pref: Option, + /// Use the given key for TCP-MD5 authentication with the peer. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub md5_auth_key: Option, + /// Require messages from a peer have a minimum IP time to live field. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub min_ttl: Option, + /// Apply the provided multi-exit discriminator (MED) updates sent to + /// the peer. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub multi_exit_discriminator: Option, + /// Require that a peer has a specified ASN. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub remote_asn: Option, + /// Associate a VLAN ID with a peer. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub vlan_id: Option, + } + + impl From<&BgpPeerCombined> for BgpPeerCombined { + fn from(value: &BgpPeerCombined) -> Self { + value.clone() + } + } + + impl BgpPeerCombined { + pub fn builder() -> builder::BgpPeerCombined { + Default::default() + } + } + + /// BgpPeerConfig + /// + ///
JSON schema + /// + /// ```json + /// { + /// "type": "object", + /// "required": [ + /// "peers" + /// ], + /// "properties": { + /// "peers": { + /// "type": "array", + /// "items": { + /// "$ref": "#/components/schemas/BgpPeerCombined" + /// } + /// } + /// } + /// } + /// ``` + ///
+ #[derive( + :: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, schemars :: JsonSchema, + )] + pub struct BgpPeerConfig { + pub peers: Vec, + } + + impl From<&BgpPeerConfig> for BgpPeerConfig { + fn from(value: &BgpPeerConfig) -> Self { + value.clone() + } + } + + impl BgpPeerConfig { + pub fn builder() -> builder::BgpPeerConfig { + Default::default() + } + } + + /// A BGP peer configuration to remove from an interface + /// + ///
JSON schema + /// + /// ```json + /// { + /// "description": "A BGP peer configuration to remove from an interface", + /// "type": "object", + /// "required": [ + /// "addr", + /// "bgp_config", + /// "interface_name" + /// ], + /// "properties": { + /// "addr": { + /// "description": "The address of the host to peer with.", + /// "type": "string", + /// "format": "ip" + /// }, + /// "bgp_config": { + /// "description": "The global BGP configuration used for establishing + /// a session with this peer.", + /// "allOf": [ + /// { + /// "$ref": "#/components/schemas/NameOrId" + /// } + /// ] + /// }, + /// "interface_name": { + /// "description": "The name of interface to peer on. This is relative + /// to the port configuration this BGP peer configuration is a part of. For + /// example this value could be phy0 to refer to a primary physical + /// interface. Or it could be vlan47 to refer to a VLAN interface.", + /// "type": "string" + /// } + /// } + /// } + /// ``` + ///
+ #[derive( + :: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, schemars :: JsonSchema, + )] + pub struct BgpPeerRemove { + /// The address of the host to peer with. + pub addr: std::net::IpAddr, + /// The global BGP configuration used for establishing a session with + /// this peer. + pub bgp_config: NameOrId, + /// The name of interface to peer on. This is relative to the port + /// configuration this BGP peer configuration is a part of. For example + /// this value could be phy0 to refer to a primary physical interface. + /// Or it could be vlan47 to refer to a VLAN interface. + pub interface_name: String, + } + + impl From<&BgpPeerRemove> for BgpPeerRemove { + fn from(value: &BgpPeerRemove) -> Self { + value.clone() + } + } + + impl BgpPeerRemove { + pub fn builder() -> builder::BgpPeerRemove { + Default::default() + } + } + /// The current state of a BGP peer. /// ///
JSON schema @@ -23394,7 +23876,7 @@ pub mod types { /// "description": "BGP peer settings.", /// "type": "array", /// "items": { - /// "$ref": "#/components/schemas/BgpPeer" + /// "$ref": "#/components/schemas/BgpPeerCombined" /// } /// }, /// "groups": { @@ -23467,7 +23949,7 @@ pub mod types { /// Layer 3 IP address settings. pub addresses: Vec, /// BGP peer settings. - pub bgp_peers: Vec, + pub bgp_peers: Vec, /// Switch port settings included from other switch port settings /// groups. pub groups: Vec, @@ -28280,6 +28762,79 @@ pub mod types { } } + #[derive(Clone, Debug)] + pub struct AllowedPrefixAddRemove { + interface: Result, + peer_address: Result, + prefix: Result, + } + + impl Default for AllowedPrefixAddRemove { + fn default() -> Self { + Self { + interface: Err("no value supplied for interface".to_string()), + peer_address: Err("no value supplied for peer_address".to_string()), + prefix: Err("no value supplied for prefix".to_string()), + } + } + } + + impl AllowedPrefixAddRemove { + pub fn interface(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.interface = value + .try_into() + .map_err(|e| format!("error converting supplied value for interface: {}", e)); + self + } + pub fn peer_address(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.peer_address = value.try_into().map_err(|e| { + format!("error converting supplied value for peer_address: {}", e) + }); + self + } + pub fn prefix(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.prefix = value + .try_into() + .map_err(|e| format!("error converting supplied value for prefix: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::AllowedPrefixAddRemove { + type Error = super::error::ConversionError; + fn try_from( + value: AllowedPrefixAddRemove, + ) -> Result { + Ok(Self { + interface: value.interface?, + peer_address: value.peer_address?, + prefix: value.prefix?, + }) + } + } + + impl From for AllowedPrefixAddRemove { + fn from(value: super::AllowedPrefixAddRemove) -> Self { + Self { + interface: Ok(value.interface), + peer_address: Ok(value.peer_address), + prefix: Ok(value.prefix), + } + } + } + #[derive(Clone, Debug)] pub struct Baseboard { part: Result, @@ -28658,6 +29213,94 @@ pub mod types { } } + #[derive(Clone, Debug)] + pub struct BgpAllowedPrefix { + addr: Result, + interface_name: Result, + port_settings_id: Result, + prefix: Result, + } + + impl Default for BgpAllowedPrefix { + fn default() -> Self { + Self { + addr: Err("no value supplied for addr".to_string()), + interface_name: Err("no value supplied for interface_name".to_string()), + port_settings_id: Err("no value supplied for port_settings_id".to_string()), + prefix: Err("no value supplied for prefix".to_string()), + } + } + } + + impl BgpAllowedPrefix { + pub fn addr(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.addr = value + .try_into() + .map_err(|e| format!("error converting supplied value for addr: {}", e)); + self + } + pub fn interface_name(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.interface_name = value.try_into().map_err(|e| { + format!("error converting supplied value for interface_name: {}", e) + }); + self + } + pub fn port_settings_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.port_settings_id = value.try_into().map_err(|e| { + format!( + "error converting supplied value for port_settings_id: {}", + e + ) + }); + self + } + pub fn prefix(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.prefix = value + .try_into() + .map_err(|e| format!("error converting supplied value for prefix: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::BgpAllowedPrefix { + type Error = super::error::ConversionError; + fn try_from(value: BgpAllowedPrefix) -> Result { + Ok(Self { + addr: value.addr?, + interface_name: value.interface_name?, + port_settings_id: value.port_settings_id?, + prefix: value.prefix?, + }) + } + } + + impl From for BgpAllowedPrefix { + fn from(value: super::BgpAllowedPrefix) -> Self { + Self { + addr: Ok(value.addr), + interface_name: Ok(value.interface_name), + port_settings_id: Ok(value.port_settings_id), + prefix: Ok(value.prefix), + } + } + } + #[derive(Clone, Debug)] pub struct BgpAnnounceSet { description: Result, @@ -28968,6 +29611,167 @@ pub mod types { } } + #[derive(Clone, Debug)] + pub struct BgpCommunity { + addr: Result, + community: Result, + interface_name: Result, + port_settings_id: Result, + } + + impl Default for BgpCommunity { + fn default() -> Self { + Self { + addr: Err("no value supplied for addr".to_string()), + community: Err("no value supplied for community".to_string()), + interface_name: Err("no value supplied for interface_name".to_string()), + port_settings_id: Err("no value supplied for port_settings_id".to_string()), + } + } + } + + impl BgpCommunity { + pub fn addr(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.addr = value + .try_into() + .map_err(|e| format!("error converting supplied value for addr: {}", e)); + self + } + pub fn community(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.community = value + .try_into() + .map_err(|e| format!("error converting supplied value for community: {}", e)); + self + } + pub fn interface_name(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.interface_name = value.try_into().map_err(|e| { + format!("error converting supplied value for interface_name: {}", e) + }); + self + } + pub fn port_settings_id(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.port_settings_id = value.try_into().map_err(|e| { + format!( + "error converting supplied value for port_settings_id: {}", + e + ) + }); + self + } + } + + impl std::convert::TryFrom for super::BgpCommunity { + type Error = super::error::ConversionError; + fn try_from(value: BgpCommunity) -> Result { + Ok(Self { + addr: value.addr?, + community: value.community?, + interface_name: value.interface_name?, + port_settings_id: value.port_settings_id?, + }) + } + } + + impl From for BgpCommunity { + fn from(value: super::BgpCommunity) -> Self { + Self { + addr: Ok(value.addr), + community: Ok(value.community), + interface_name: Ok(value.interface_name), + port_settings_id: Ok(value.port_settings_id), + } + } + } + + #[derive(Clone, Debug)] + pub struct BgpCommunityAddRemove { + community: Result, + interface: Result, + peer_address: Result, + } + + impl Default for BgpCommunityAddRemove { + fn default() -> Self { + Self { + community: Err("no value supplied for community".to_string()), + interface: Err("no value supplied for interface".to_string()), + peer_address: Err("no value supplied for peer_address".to_string()), + } + } + } + + impl BgpCommunityAddRemove { + pub fn community(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.community = value + .try_into() + .map_err(|e| format!("error converting supplied value for community: {}", e)); + self + } + pub fn interface(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.interface = value + .try_into() + .map_err(|e| format!("error converting supplied value for interface: {}", e)); + self + } + pub fn peer_address(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.peer_address = value.try_into().map_err(|e| { + format!("error converting supplied value for peer_address: {}", e) + }); + self + } + } + + impl std::convert::TryFrom for super::BgpCommunityAddRemove { + type Error = super::error::ConversionError; + fn try_from( + value: BgpCommunityAddRemove, + ) -> Result { + Ok(Self { + community: value.community?, + interface: value.interface?, + peer_address: value.peer_address?, + }) + } + } + + impl From for BgpCommunityAddRemove { + fn from(value: super::BgpCommunityAddRemove) -> Self { + Self { + community: Ok(value.community), + interface: Ok(value.interface), + peer_address: Ok(value.peer_address), + } + } + } + #[derive(Clone, Debug)] pub struct BgpConfig { asn: Result, @@ -29390,6 +30194,289 @@ pub mod types { #[derive(Clone, Debug)] pub struct BgpPeer { + addr: Result, + allow_export_list_active: Result, + allow_import_list_active: Result, + bgp_config: Result, + connect_retry: Result, + delay_open: Result, + enforce_first_as: Result, + hold_time: Result, + idle_hold_time: Result, + interface_name: Result, + keepalive: Result, + local_pref: Result, String>, + md5_auth_key: Result, String>, + min_ttl: Result, String>, + multi_exit_discriminator: Result, String>, + remote_asn: Result, String>, + vlan_id: Result, String>, + } + + impl Default for BgpPeer { + fn default() -> Self { + Self { + addr: Err("no value supplied for addr".to_string()), + allow_export_list_active: Err( + "no value supplied for allow_export_list_active".to_string() + ), + allow_import_list_active: Err( + "no value supplied for allow_import_list_active".to_string() + ), + bgp_config: Err("no value supplied for bgp_config".to_string()), + connect_retry: Err("no value supplied for connect_retry".to_string()), + delay_open: Err("no value supplied for delay_open".to_string()), + enforce_first_as: Err("no value supplied for enforce_first_as".to_string()), + hold_time: Err("no value supplied for hold_time".to_string()), + idle_hold_time: Err("no value supplied for idle_hold_time".to_string()), + interface_name: Err("no value supplied for interface_name".to_string()), + keepalive: Err("no value supplied for keepalive".to_string()), + local_pref: Ok(Default::default()), + md5_auth_key: Ok(Default::default()), + min_ttl: Ok(Default::default()), + multi_exit_discriminator: Ok(Default::default()), + remote_asn: Ok(Default::default()), + vlan_id: Ok(Default::default()), + } + } + } + + impl BgpPeer { + pub fn addr(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.addr = value + .try_into() + .map_err(|e| format!("error converting supplied value for addr: {}", e)); + self + } + pub fn allow_export_list_active(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.allow_export_list_active = value.try_into().map_err(|e| { + format!( + "error converting supplied value for allow_export_list_active: {}", + e + ) + }); + self + } + pub fn allow_import_list_active(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.allow_import_list_active = value.try_into().map_err(|e| { + format!( + "error converting supplied value for allow_import_list_active: {}", + e + ) + }); + self + } + pub fn bgp_config(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.bgp_config = value + .try_into() + .map_err(|e| format!("error converting supplied value for bgp_config: {}", e)); + self + } + pub fn connect_retry(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.connect_retry = value.try_into().map_err(|e| { + format!("error converting supplied value for connect_retry: {}", e) + }); + self + } + pub fn delay_open(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.delay_open = value + .try_into() + .map_err(|e| format!("error converting supplied value for delay_open: {}", e)); + self + } + pub fn enforce_first_as(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.enforce_first_as = value.try_into().map_err(|e| { + format!( + "error converting supplied value for enforce_first_as: {}", + e + ) + }); + self + } + pub fn hold_time(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.hold_time = value + .try_into() + .map_err(|e| format!("error converting supplied value for hold_time: {}", e)); + self + } + pub fn idle_hold_time(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.idle_hold_time = value.try_into().map_err(|e| { + format!("error converting supplied value for idle_hold_time: {}", e) + }); + self + } + pub fn interface_name(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.interface_name = value.try_into().map_err(|e| { + format!("error converting supplied value for interface_name: {}", e) + }); + self + } + pub fn keepalive(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.keepalive = value + .try_into() + .map_err(|e| format!("error converting supplied value for keepalive: {}", e)); + self + } + pub fn local_pref(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.local_pref = value + .try_into() + .map_err(|e| format!("error converting supplied value for local_pref: {}", e)); + self + } + pub fn md5_auth_key(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.md5_auth_key = value.try_into().map_err(|e| { + format!("error converting supplied value for md5_auth_key: {}", e) + }); + self + } + pub fn min_ttl(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.min_ttl = value + .try_into() + .map_err(|e| format!("error converting supplied value for min_ttl: {}", e)); + self + } + pub fn multi_exit_discriminator(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.multi_exit_discriminator = value.try_into().map_err(|e| { + format!( + "error converting supplied value for multi_exit_discriminator: {}", + e + ) + }); + self + } + pub fn remote_asn(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.remote_asn = value + .try_into() + .map_err(|e| format!("error converting supplied value for remote_asn: {}", e)); + self + } + pub fn vlan_id(mut self, value: T) -> Self + where + T: std::convert::TryInto>, + T::Error: std::fmt::Display, + { + self.vlan_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for vlan_id: {}", e)); + self + } + } + + impl std::convert::TryFrom for super::BgpPeer { + type Error = super::error::ConversionError; + fn try_from(value: BgpPeer) -> Result { + Ok(Self { + addr: value.addr?, + allow_export_list_active: value.allow_export_list_active?, + allow_import_list_active: value.allow_import_list_active?, + bgp_config: value.bgp_config?, + connect_retry: value.connect_retry?, + delay_open: value.delay_open?, + enforce_first_as: value.enforce_first_as?, + hold_time: value.hold_time?, + idle_hold_time: value.idle_hold_time?, + interface_name: value.interface_name?, + keepalive: value.keepalive?, + local_pref: value.local_pref?, + md5_auth_key: value.md5_auth_key?, + min_ttl: value.min_ttl?, + multi_exit_discriminator: value.multi_exit_discriminator?, + remote_asn: value.remote_asn?, + vlan_id: value.vlan_id?, + }) + } + } + + impl From for BgpPeer { + fn from(value: super::BgpPeer) -> Self { + Self { + addr: Ok(value.addr), + allow_export_list_active: Ok(value.allow_export_list_active), + allow_import_list_active: Ok(value.allow_import_list_active), + bgp_config: Ok(value.bgp_config), + connect_retry: Ok(value.connect_retry), + delay_open: Ok(value.delay_open), + enforce_first_as: Ok(value.enforce_first_as), + hold_time: Ok(value.hold_time), + idle_hold_time: Ok(value.idle_hold_time), + interface_name: Ok(value.interface_name), + keepalive: Ok(value.keepalive), + local_pref: Ok(value.local_pref), + md5_auth_key: Ok(value.md5_auth_key), + min_ttl: Ok(value.min_ttl), + multi_exit_discriminator: Ok(value.multi_exit_discriminator), + remote_asn: Ok(value.remote_asn), + vlan_id: Ok(value.vlan_id), + } + } + } + + #[derive(Clone, Debug)] + pub struct BgpPeerCombined { addr: Result, allowed_export: Result, allowed_import: Result, @@ -29410,7 +30497,7 @@ pub mod types { vlan_id: Result, String>, } - impl Default for BgpPeer { + impl Default for BgpPeerCombined { fn default() -> Self { Self { addr: Err("no value supplied for addr".to_string()), @@ -29435,7 +30522,7 @@ pub mod types { } } - impl BgpPeer { + impl BgpPeerCombined { pub fn addr(mut self, value: T) -> Self where T: std::convert::TryInto, @@ -29624,9 +30711,9 @@ pub mod types { } } - impl std::convert::TryFrom for super::BgpPeer { + impl std::convert::TryFrom for super::BgpPeerCombined { type Error = super::error::ConversionError; - fn try_from(value: BgpPeer) -> Result { + fn try_from(value: BgpPeerCombined) -> Result { Ok(Self { addr: value.addr?, allowed_export: value.allowed_export?, @@ -29650,8 +30737,8 @@ pub mod types { } } - impl From for BgpPeer { - fn from(value: super::BgpPeer) -> Self { + impl From for BgpPeerCombined { + fn from(value: super::BgpPeerCombined) -> Self { Self { addr: Ok(value.addr), allowed_export: Ok(value.allowed_export), @@ -29677,7 +30764,7 @@ pub mod types { #[derive(Clone, Debug)] pub struct BgpPeerConfig { - peers: Result, String>, + peers: Result, String>, } impl Default for BgpPeerConfig { @@ -29691,7 +30778,7 @@ pub mod types { impl BgpPeerConfig { pub fn peers(mut self, value: T) -> Self where - T: std::convert::TryInto>, + T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.peers = value @@ -44358,7 +45445,7 @@ pub mod types { #[derive(Clone, Debug)] pub struct SwitchPortSettingsView { addresses: Result, String>, - bgp_peers: Result, String>, + bgp_peers: Result, String>, groups: Result, String>, interfaces: Result, String>, link_lldp: Result, String>, @@ -44399,7 +45486,7 @@ pub mod types { } pub fn bgp_peers(mut self, value: T) -> Self where - T: std::convert::TryInto>, + T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.bgp_peers = value @@ -50566,6 +51653,186 @@ pub trait ClientSystemNetworkingExt { fn networking_switch_port_configuration_bgp_peer_add( &self, ) -> builder::NetworkingSwitchPortConfigurationBgpPeerAdd; + /// List prefixes allowed to be exported by a given bgp peer + /// + /// Sends a `GET` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// bgp-peer/allow-export` + /// + /// Arguments: + /// - `configuration`: A name or id to use when selecting a switch port + /// configuration. + /// - `peer_address`: An address identifying a configured bgp peer. + /// ```ignore + /// let response = client.networking_switch_port_configuration_bgp_peer_allow_export_list() + /// .configuration(configuration) + /// .peer_address(peer_address) + /// .send() + /// .await; + /// ``` + fn networking_switch_port_configuration_bgp_peer_allow_export_list( + &self, + ) -> builder::NetworkingSwitchPortConfigurationBgpPeerAllowExportList; + /// Add prefix to bgp peer allowed export list + /// + /// Sends a `POST` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// bgp-peer/allow-export/add` + /// + /// Arguments: + /// - `configuration`: A name or id to use when selecting a switch port + /// configuration. + /// - `body` + /// ```ignore + /// let response = client.networking_switch_port_configuration_bgp_peer_allow_export_add() + /// .configuration(configuration) + /// .body(body) + /// .send() + /// .await; + /// ``` + fn networking_switch_port_configuration_bgp_peer_allow_export_add( + &self, + ) -> builder::NetworkingSwitchPortConfigurationBgpPeerAllowExportAdd; + /// Remove prefix from bgp peer allowed export list + /// + /// Sends a `POST` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// bgp-peer/allow-export/remove` + /// + /// Arguments: + /// - `configuration`: A name or id to use when selecting a switch port + /// configuration. + /// - `body` + /// ```ignore + /// let response = client.networking_switch_port_configuration_bgp_peer_allow_export_remove() + /// .configuration(configuration) + /// .body(body) + /// .send() + /// .await; + /// ``` + fn networking_switch_port_configuration_bgp_peer_allow_export_remove( + &self, + ) -> builder::NetworkingSwitchPortConfigurationBgpPeerAllowExportRemove; + /// List prefixes allowed to be imported by a given bgp peer + /// + /// Sends a `GET` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// bgp-peer/allow-import` + /// + /// Arguments: + /// - `configuration`: A name or id to use when selecting a switch port + /// configuration. + /// - `peer_address`: An address identifying a configured bgp peer. + /// ```ignore + /// let response = client.networking_switch_port_configuration_bgp_peer_allow_import_list() + /// .configuration(configuration) + /// .peer_address(peer_address) + /// .send() + /// .await; + /// ``` + fn networking_switch_port_configuration_bgp_peer_allow_import_list( + &self, + ) -> builder::NetworkingSwitchPortConfigurationBgpPeerAllowImportList; + /// Add prefix to bgp peer allowed import list + /// + /// Sends a `POST` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// bgp-peer/allow-import/add` + /// + /// Arguments: + /// - `configuration`: A name or id to use when selecting a switch port + /// configuration. + /// - `body` + /// ```ignore + /// let response = client.networking_switch_port_configuration_bgp_peer_allow_import_add() + /// .configuration(configuration) + /// .body(body) + /// .send() + /// .await; + /// ``` + fn networking_switch_port_configuration_bgp_peer_allow_import_add( + &self, + ) -> builder::NetworkingSwitchPortConfigurationBgpPeerAllowImportAdd; + /// Remove prefix from bgp peer allowed import list + /// + /// Sends a `POST` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// bgp-peer/allow-import/remove` + /// + /// Arguments: + /// - `configuration`: A name or id to use when selecting a switch port + /// configuration. + /// - `body` + /// ```ignore + /// let response = client.networking_switch_port_configuration_bgp_peer_allow_import_remove() + /// .configuration(configuration) + /// .body(body) + /// .send() + /// .await; + /// ``` + fn networking_switch_port_configuration_bgp_peer_allow_import_remove( + &self, + ) -> builder::NetworkingSwitchPortConfigurationBgpPeerAllowImportRemove; + /// List communities assigned to a bgp peer + /// + /// Sends a `GET` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// bgp-peer/community` + /// + /// Arguments: + /// - `configuration`: A name or id to use when selecting a switch port + /// configuration. + /// - `peer_address`: An address identifying a configured bgp peer. + /// ```ignore + /// let response = client.networking_switch_port_configuration_bgp_peer_community_list() + /// .configuration(configuration) + /// .peer_address(peer_address) + /// .send() + /// .await; + /// ``` + fn networking_switch_port_configuration_bgp_peer_community_list( + &self, + ) -> builder::NetworkingSwitchPortConfigurationBgpPeerCommunityList; + /// Add community to bgp peer + /// + /// Sends a `POST` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// bgp-peer/community/add` + /// + /// Arguments: + /// - `configuration`: A name or id to use when selecting a switch port + /// configuration. + /// - `body` + /// ```ignore + /// let response = client.networking_switch_port_configuration_bgp_peer_community_add() + /// .configuration(configuration) + /// .body(body) + /// .send() + /// .await; + /// ``` + fn networking_switch_port_configuration_bgp_peer_community_add( + &self, + ) -> builder::NetworkingSwitchPortConfigurationBgpPeerCommunityAdd; + /// Remove community from bgp peer + /// + /// Sends a `POST` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// bgp-peer/community/remove` + /// + /// Arguments: + /// - `configuration`: A name or id to use when selecting a switch port + /// configuration. + /// - `body` + /// ```ignore + /// let response = client.networking_switch_port_configuration_bgp_peer_community_remove() + /// .configuration(configuration) + /// .body(body) + /// .send() + /// .await; + /// ``` + fn networking_switch_port_configuration_bgp_peer_community_remove( + &self, + ) -> builder::NetworkingSwitchPortConfigurationBgpPeerCommunityRemove; /// Remove bgp peer from an interface configuration /// /// Sends a `POST` request to @@ -50982,6 +52249,60 @@ impl ClientSystemNetworkingExt for Client { builder::NetworkingSwitchPortConfigurationBgpPeerAdd::new(self) } + fn networking_switch_port_configuration_bgp_peer_allow_export_list( + &self, + ) -> builder::NetworkingSwitchPortConfigurationBgpPeerAllowExportList { + builder::NetworkingSwitchPortConfigurationBgpPeerAllowExportList::new(self) + } + + fn networking_switch_port_configuration_bgp_peer_allow_export_add( + &self, + ) -> builder::NetworkingSwitchPortConfigurationBgpPeerAllowExportAdd { + builder::NetworkingSwitchPortConfigurationBgpPeerAllowExportAdd::new(self) + } + + fn networking_switch_port_configuration_bgp_peer_allow_export_remove( + &self, + ) -> builder::NetworkingSwitchPortConfigurationBgpPeerAllowExportRemove { + builder::NetworkingSwitchPortConfigurationBgpPeerAllowExportRemove::new(self) + } + + fn networking_switch_port_configuration_bgp_peer_allow_import_list( + &self, + ) -> builder::NetworkingSwitchPortConfigurationBgpPeerAllowImportList { + builder::NetworkingSwitchPortConfigurationBgpPeerAllowImportList::new(self) + } + + fn networking_switch_port_configuration_bgp_peer_allow_import_add( + &self, + ) -> builder::NetworkingSwitchPortConfigurationBgpPeerAllowImportAdd { + builder::NetworkingSwitchPortConfigurationBgpPeerAllowImportAdd::new(self) + } + + fn networking_switch_port_configuration_bgp_peer_allow_import_remove( + &self, + ) -> builder::NetworkingSwitchPortConfigurationBgpPeerAllowImportRemove { + builder::NetworkingSwitchPortConfigurationBgpPeerAllowImportRemove::new(self) + } + + fn networking_switch_port_configuration_bgp_peer_community_list( + &self, + ) -> builder::NetworkingSwitchPortConfigurationBgpPeerCommunityList { + builder::NetworkingSwitchPortConfigurationBgpPeerCommunityList::new(self) + } + + fn networking_switch_port_configuration_bgp_peer_community_add( + &self, + ) -> builder::NetworkingSwitchPortConfigurationBgpPeerCommunityAdd { + builder::NetworkingSwitchPortConfigurationBgpPeerCommunityAdd::new(self) + } + + fn networking_switch_port_configuration_bgp_peer_community_remove( + &self, + ) -> builder::NetworkingSwitchPortConfigurationBgpPeerCommunityRemove { + builder::NetworkingSwitchPortConfigurationBgpPeerCommunityRemove::new(self) + } + fn networking_switch_port_configuration_bgp_peer_remove( &self, ) -> builder::NetworkingSwitchPortConfigurationBgpPeerRemove { @@ -66938,83 +68259,819 @@ pub mod builder { _ => Err(Error::UnexpectedResponse(response)), } } - - /// Streams `GET` requests to - /// `/v1/system/networking/switch-port-configuration` - pub fn stream( - self, - ) -> impl futures::Stream>> - + Unpin - + 'a { - use futures::StreamExt; - use futures::TryFutureExt; - use futures::TryStreamExt; - let next = Self { - configuration: Ok(None), - page_token: Ok(None), - sort_by: Ok(None), - ..self.clone() - }; - self.send() - .map_ok(move |page| { - let page = page.into_inner(); - let first = futures::stream::iter(page.items).map(Ok); - let rest = futures::stream::try_unfold( - (page.next_page, next), - |(next_page, next)| async { - if next_page.is_none() { - Ok(None) - } else { - Self { - page_token: Ok(next_page), - ..next.clone() - } - .send() - .map_ok(|page| { - let page = page.into_inner(); - Some(( - futures::stream::iter(page.items).map(Ok), - (page.next_page, next), - )) - }) - .await - } - }, - ) - .try_flatten(); - first.chain(rest) - }) - .try_flatten_stream() - .boxed() - } + + /// Streams `GET` requests to + /// `/v1/system/networking/switch-port-configuration` + pub fn stream( + self, + ) -> impl futures::Stream>> + + Unpin + + 'a { + use futures::StreamExt; + use futures::TryFutureExt; + use futures::TryStreamExt; + let next = Self { + configuration: Ok(None), + page_token: Ok(None), + sort_by: Ok(None), + ..self.clone() + }; + self.send() + .map_ok(move |page| { + let page = page.into_inner(); + let first = futures::stream::iter(page.items).map(Ok); + let rest = futures::stream::try_unfold( + (page.next_page, next), + |(next_page, next)| async { + if next_page.is_none() { + Ok(None) + } else { + Self { + page_token: Ok(next_page), + ..next.clone() + } + .send() + .map_ok(|page| { + let page = page.into_inner(); + Some(( + futures::stream::iter(page.items).map(Ok), + (page.next_page, next), + )) + }) + .await + } + }, + ) + .try_flatten(); + first.chain(rest) + }) + .try_flatten_stream() + .boxed() + } + } + + /// Builder for + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_create`] + /// + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_create`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_create + #[derive(Debug, Clone)] + pub struct NetworkingSwitchPortConfigurationCreate<'a> { + client: &'a super::Client, + body: Result, + } + + impl<'a> NetworkingSwitchPortConfigurationCreate<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client: client, + body: Ok(types::builder::SwitchPortSettingsCreate::default()), + } + } + + pub fn body(mut self, value: V) -> Self + where + V: std::convert::TryInto, + >::Error: std::fmt::Display, + { + self.body = value.try_into().map(From::from).map_err(|s| { + format!( + "conversion to `SwitchPortSettingsCreate` for body failed: {}", + s + ) + }); + self + } + + pub fn body_map(mut self, f: F) -> Self + where + F: std::ops::FnOnce( + types::builder::SwitchPortSettingsCreate, + ) -> types::builder::SwitchPortSettingsCreate, + { + self.body = self.body.map(f); + self + } + + /// Sends a `POST` request to + /// `/v1/system/networking/switch-port-configuration` + pub async fn send( + self, + ) -> Result, Error> { + let Self { client, body } = self; + let body = body + .and_then(|v| { + types::SwitchPortSettingsCreate::try_from(v).map_err(|e| e.to_string()) + }) + .map_err(Error::InvalidRequest)?; + let url = format!( + "{}/v1/system/networking/switch-port-configuration", + client.baseurl, + ); + #[allow(unused_mut)] + let mut request = client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + } + + /// Builder for + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_delete`] + /// + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_delete`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_delete + #[derive(Debug, Clone)] + pub struct NetworkingSwitchPortConfigurationDelete<'a> { + client: &'a super::Client, + configuration: Result, String>, + } + + impl<'a> NetworkingSwitchPortConfigurationDelete<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client: client, + configuration: Ok(None), + } + } + + pub fn configuration(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.configuration = value + .try_into() + .map(Some) + .map_err(|_| "conversion to `NameOrId` for configuration failed".to_string()); + self + } + + /// Sends a `DELETE` request to + /// `/v1/system/networking/switch-port-configuration` + pub async fn send(self) -> Result, Error> { + let Self { + client, + configuration, + } = self; + let configuration = configuration.map_err(Error::InvalidRequest)?; + let url = format!( + "{}/v1/system/networking/switch-port-configuration", + client.baseurl, + ); + let mut query = Vec::with_capacity(1usize); + if let Some(v) = &configuration { + query.push(("configuration", v.to_string())); + } + #[allow(unused_mut)] + let mut request = client + .client + .delete(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + .build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + } + + /// Builder for + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_view`] + /// + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_view`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_view + #[derive(Debug, Clone)] + pub struct NetworkingSwitchPortConfigurationView<'a> { + client: &'a super::Client, + configuration: Result, + } + + impl<'a> NetworkingSwitchPortConfigurationView<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client: client, + configuration: Err("configuration was not initialized".to_string()), + } + } + + pub fn configuration(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.configuration = value + .try_into() + .map_err(|_| "conversion to `NameOrId` for configuration failed".to_string()); + self + } + + /// Sends a `GET` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}` + pub async fn send( + self, + ) -> Result, Error> { + let Self { + client, + configuration, + } = self; + let configuration = configuration.map_err(Error::InvalidRequest)?; + let url = format!( + "{}/v1/system/networking/switch-port-configuration/{}", + client.baseurl, + encode_path(&configuration.to_string()), + ); + #[allow(unused_mut)] + let mut request = client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + } + + /// Builder for + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_address_list`] + /// + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_address_list`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_address_list + #[derive(Debug, Clone)] + pub struct NetworkingSwitchPortConfigurationAddressList<'a> { + client: &'a super::Client, + configuration: Result, + } + + impl<'a> NetworkingSwitchPortConfigurationAddressList<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client: client, + configuration: Err("configuration was not initialized".to_string()), + } + } + + pub fn configuration(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.configuration = value + .try_into() + .map_err(|_| "conversion to `NameOrId` for configuration failed".to_string()); + self + } + + /// Sends a `GET` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// address` + pub async fn send( + self, + ) -> Result>, Error> + { + let Self { + client, + configuration, + } = self; + let configuration = configuration.map_err(Error::InvalidRequest)?; + let url = format!( + "{}/v1/system/networking/switch-port-configuration/{}/address", + client.baseurl, + encode_path(&configuration.to_string()), + ); + #[allow(unused_mut)] + let mut request = client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + } + + /// Builder for + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_address_add`] + /// + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_address_add`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_address_add + #[derive(Debug, Clone)] + pub struct NetworkingSwitchPortConfigurationAddressAdd<'a> { + client: &'a super::Client, + configuration: Result, + body: Result, + } + + impl<'a> NetworkingSwitchPortConfigurationAddressAdd<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client: client, + configuration: Err("configuration was not initialized".to_string()), + body: Ok(types::builder::AddressAddRemove::default()), + } + } + + pub fn configuration(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.configuration = value + .try_into() + .map_err(|_| "conversion to `NameOrId` for configuration failed".to_string()); + self + } + + pub fn body(mut self, value: V) -> Self + where + V: std::convert::TryInto, + >::Error: std::fmt::Display, + { + self.body = value + .try_into() + .map(From::from) + .map_err(|s| format!("conversion to `AddressAddRemove` for body failed: {}", s)); + self + } + + pub fn body_map(mut self, f: F) -> Self + where + F: std::ops::FnOnce( + types::builder::AddressAddRemove, + ) -> types::builder::AddressAddRemove, + { + self.body = self.body.map(f); + self + } + + /// Sends a `POST` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// address/add` + pub async fn send( + self, + ) -> Result, Error> { + let Self { + client, + configuration, + body, + } = self; + let configuration = configuration.map_err(Error::InvalidRequest)?; + let body = body + .and_then(|v| types::AddressAddRemove::try_from(v).map_err(|e| e.to_string())) + .map_err(Error::InvalidRequest)?; + let url = format!( + "{}/v1/system/networking/switch-port-configuration/{}/address/add", + client.baseurl, + encode_path(&configuration.to_string()), + ); + #[allow(unused_mut)] + let mut request = client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + } + + /// Builder for + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_address_remove`] + /// + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_address_remove`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_address_remove + #[derive(Debug, Clone)] + pub struct NetworkingSwitchPortConfigurationAddressRemove<'a> { + client: &'a super::Client, + configuration: Result, + body: Result, + } + + impl<'a> NetworkingSwitchPortConfigurationAddressRemove<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client: client, + configuration: Err("configuration was not initialized".to_string()), + body: Ok(types::builder::AddressAddRemove::default()), + } + } + + pub fn configuration(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.configuration = value + .try_into() + .map_err(|_| "conversion to `NameOrId` for configuration failed".to_string()); + self + } + + pub fn body(mut self, value: V) -> Self + where + V: std::convert::TryInto, + >::Error: std::fmt::Display, + { + self.body = value + .try_into() + .map(From::from) + .map_err(|s| format!("conversion to `AddressAddRemove` for body failed: {}", s)); + self + } + + pub fn body_map(mut self, f: F) -> Self + where + F: std::ops::FnOnce( + types::builder::AddressAddRemove, + ) -> types::builder::AddressAddRemove, + { + self.body = self.body.map(f); + self + } + + /// Sends a `POST` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// address/remove` + pub async fn send(self) -> Result, Error> { + let Self { + client, + configuration, + body, + } = self; + let configuration = configuration.map_err(Error::InvalidRequest)?; + let body = body + .and_then(|v| types::AddressAddRemove::try_from(v).map_err(|e| e.to_string())) + .map_err(Error::InvalidRequest)?; + let url = format!( + "{}/v1/system/networking/switch-port-configuration/{}/address/remove", + client.baseurl, + encode_path(&configuration.to_string()), + ); + #[allow(unused_mut)] + let mut request = client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + } + + /// Builder for + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_list`] + /// + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_list`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_list + #[derive(Debug, Clone)] + pub struct NetworkingSwitchPortConfigurationBgpPeerList<'a> { + client: &'a super::Client, + configuration: Result, + } + + impl<'a> NetworkingSwitchPortConfigurationBgpPeerList<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client: client, + configuration: Err("configuration was not initialized".to_string()), + } + } + + pub fn configuration(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.configuration = value + .try_into() + .map_err(|_| "conversion to `NameOrId` for configuration failed".to_string()); + self + } + + /// Sends a `GET` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// bgp-peer` + pub async fn send(self) -> Result>, Error> { + let Self { + client, + configuration, + } = self; + let configuration = configuration.map_err(Error::InvalidRequest)?; + let url = format!( + "{}/v1/system/networking/switch-port-configuration/{}/bgp-peer", + client.baseurl, + encode_path(&configuration.to_string()), + ); + #[allow(unused_mut)] + let mut request = client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + } + + /// Builder for + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_add`] + /// + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_add`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_add + #[derive(Debug, Clone)] + pub struct NetworkingSwitchPortConfigurationBgpPeerAdd<'a> { + client: &'a super::Client, + configuration: Result, + body: Result, + } + + impl<'a> NetworkingSwitchPortConfigurationBgpPeerAdd<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client: client, + configuration: Err("configuration was not initialized".to_string()), + body: Ok(types::builder::BgpPeer::default()), + } + } + + pub fn configuration(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.configuration = value + .try_into() + .map_err(|_| "conversion to `NameOrId` for configuration failed".to_string()); + self + } + + pub fn body(mut self, value: V) -> Self + where + V: std::convert::TryInto, + >::Error: std::fmt::Display, + { + self.body = value + .try_into() + .map(From::from) + .map_err(|s| format!("conversion to `BgpPeer` for body failed: {}", s)); + self + } + + pub fn body_map(mut self, f: F) -> Self + where + F: std::ops::FnOnce(types::builder::BgpPeer) -> types::builder::BgpPeer, + { + self.body = self.body.map(f); + self + } + + /// Sends a `POST` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// bgp-peer/add` + pub async fn send(self) -> Result, Error> { + let Self { + client, + configuration, + body, + } = self; + let configuration = configuration.map_err(Error::InvalidRequest)?; + let body = body + .and_then(|v| types::BgpPeer::try_from(v).map_err(|e| e.to_string())) + .map_err(Error::InvalidRequest)?; + let url = format!( + "{}/v1/system/networking/switch-port-configuration/{}/bgp-peer/add", + client.baseurl, + encode_path(&configuration.to_string()), + ); + #[allow(unused_mut)] + let mut request = client + .client + .post(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 201u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + } + + /// Builder for + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_allow_export_list`] + /// + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_allow_export_list`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_allow_export_list + #[derive(Debug, Clone)] + pub struct NetworkingSwitchPortConfigurationBgpPeerAllowExportList<'a> { + client: &'a super::Client, + configuration: Result, + peer_address: Result, + } + + impl<'a> NetworkingSwitchPortConfigurationBgpPeerAllowExportList<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client: client, + configuration: Err("configuration was not initialized".to_string()), + peer_address: Err("peer_address was not initialized".to_string()), + } + } + + pub fn configuration(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.configuration = value + .try_into() + .map_err(|_| "conversion to `NameOrId` for configuration failed".to_string()); + self + } + + pub fn peer_address(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.peer_address = value.try_into().map_err(|_| { + "conversion to `std :: net :: IpAddr` for peer_address failed".to_string() + }); + self + } + + /// Sends a `GET` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// bgp-peer/allow-export` + pub async fn send( + self, + ) -> Result>, Error> { + let Self { + client, + configuration, + peer_address, + } = self; + let configuration = configuration.map_err(Error::InvalidRequest)?; + let peer_address = peer_address.map_err(Error::InvalidRequest)?; + let url = format!( + "{}/v1/system/networking/switch-port-configuration/{}/bgp-peer/allow-export", + client.baseurl, + encode_path(&configuration.to_string()), + ); + let mut query = Vec::with_capacity(1usize); + query.push(("peer_address", peer_address.to_string())); + #[allow(unused_mut)] + let mut request = client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .query(&query) + .build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } } /// Builder for - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_create`] + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_allow_export_add`] /// - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_create`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_create + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_allow_export_add`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_allow_export_add #[derive(Debug, Clone)] - pub struct NetworkingSwitchPortConfigurationCreate<'a> { + pub struct NetworkingSwitchPortConfigurationBgpPeerAllowExportAdd<'a> { client: &'a super::Client, - body: Result, + configuration: Result, + body: Result, } - impl<'a> NetworkingSwitchPortConfigurationCreate<'a> { + impl<'a> NetworkingSwitchPortConfigurationBgpPeerAllowExportAdd<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, - body: Ok(types::builder::SwitchPortSettingsCreate::default()), + configuration: Err("configuration was not initialized".to_string()), + body: Ok(types::builder::AllowedPrefixAddRemove::default()), } } + pub fn configuration(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.configuration = value + .try_into() + .map_err(|_| "conversion to `NameOrId` for configuration failed".to_string()); + self + } + pub fn body(mut self, value: V) -> Self where - V: std::convert::TryInto, - >::Error: std::fmt::Display, + V: std::convert::TryInto, + >::Error: std::fmt::Display, { self.body = value.try_into().map(From::from).map_err(|s| { format!( - "conversion to `SwitchPortSettingsCreate` for body failed: {}", + "conversion to `AllowedPrefixAddRemove` for body failed: {}", s ) }); @@ -67024,27 +69081,32 @@ pub mod builder { pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce( - types::builder::SwitchPortSettingsCreate, - ) -> types::builder::SwitchPortSettingsCreate, + types::builder::AllowedPrefixAddRemove, + ) -> types::builder::AllowedPrefixAddRemove, { self.body = self.body.map(f); self } /// Sends a `POST` request to - /// `/v1/system/networking/switch-port-configuration` + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// bgp-peer/allow-export/add` pub async fn send( self, - ) -> Result, Error> { - let Self { client, body } = self; + ) -> Result, Error> { + let Self { + client, + configuration, + body, + } = self; + let configuration = configuration.map_err(Error::InvalidRequest)?; let body = body - .and_then(|v| { - types::SwitchPortSettingsCreate::try_from(v).map_err(|e| e.to_string()) - }) + .and_then(|v| types::AllowedPrefixAddRemove::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; let url = format!( - "{}/v1/system/networking/switch-port-configuration", + "{}/v1/system/networking/switch-port-configuration/{}/bgp-peer/allow-export/add", client.baseurl, + encode_path(&configuration.to_string()), ); #[allow(unused_mut)] let mut request = client @@ -67072,20 +69134,22 @@ pub mod builder { } /// Builder for - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_delete`] + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_allow_export_remove`] /// - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_delete`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_delete + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_allow_export_remove`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_allow_export_remove #[derive(Debug, Clone)] - pub struct NetworkingSwitchPortConfigurationDelete<'a> { + pub struct NetworkingSwitchPortConfigurationBgpPeerAllowExportRemove<'a> { client: &'a super::Client, - configuration: Result, String>, + configuration: Result, + body: Result, } - impl<'a> NetworkingSwitchPortConfigurationDelete<'a> { + impl<'a> NetworkingSwitchPortConfigurationBgpPeerAllowExportRemove<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, - configuration: Ok(None), + configuration: Err("configuration was not initialized".to_string()), + body: Ok(types::builder::AllowedPrefixAddRemove::default()), } } @@ -67095,36 +69159,61 @@ pub mod builder { { self.configuration = value .try_into() - .map(Some) .map_err(|_| "conversion to `NameOrId` for configuration failed".to_string()); self } - /// Sends a `DELETE` request to - /// `/v1/system/networking/switch-port-configuration` + pub fn body(mut self, value: V) -> Self + where + V: std::convert::TryInto, + >::Error: std::fmt::Display, + { + self.body = value.try_into().map(From::from).map_err(|s| { + format!( + "conversion to `AllowedPrefixAddRemove` for body failed: {}", + s + ) + }); + self + } + + pub fn body_map(mut self, f: F) -> Self + where + F: std::ops::FnOnce( + types::builder::AllowedPrefixAddRemove, + ) -> types::builder::AllowedPrefixAddRemove, + { + self.body = self.body.map(f); + self + } + + /// Sends a `POST` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// bgp-peer/allow-export/remove` pub async fn send(self) -> Result, Error> { let Self { client, configuration, + body, } = self; let configuration = configuration.map_err(Error::InvalidRequest)?; + let body = body + .and_then(|v| types::AllowedPrefixAddRemove::try_from(v).map_err(|e| e.to_string())) + .map_err(Error::InvalidRequest)?; let url = format!( - "{}/v1/system/networking/switch-port-configuration", + "{}/v1/system/networking/switch-port-configuration/{}/bgp-peer/allow-export/remove", client.baseurl, + encode_path(&configuration.to_string()), ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &configuration { - query.push(("configuration", v.to_string())); - } #[allow(unused_mut)] let mut request = client .client - .delete(url) + .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .query(&query) + .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; @@ -67142,20 +69231,22 @@ pub mod builder { } /// Builder for - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_view`] + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_allow_import_list`] /// - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_view`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_view + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_allow_import_list`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_allow_import_list #[derive(Debug, Clone)] - pub struct NetworkingSwitchPortConfigurationView<'a> { + pub struct NetworkingSwitchPortConfigurationBgpPeerAllowImportList<'a> { client: &'a super::Client, configuration: Result, + peer_address: Result, } - impl<'a> NetworkingSwitchPortConfigurationView<'a> { + impl<'a> NetworkingSwitchPortConfigurationBgpPeerAllowImportList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, configuration: Err("configuration was not initialized".to_string()), + peer_address: Err("peer_address was not initialized".to_string()), } } @@ -67169,21 +69260,36 @@ pub mod builder { self } + pub fn peer_address(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.peer_address = value.try_into().map_err(|_| { + "conversion to `std :: net :: IpAddr` for peer_address failed".to_string() + }); + self + } + /// Sends a `GET` request to - /// `/v1/system/networking/switch-port-configuration/{configuration}` + /// `/v1/system/networking/switch-port-configuration/{configuration}/ + /// bgp-peer/allow-import` pub async fn send( self, - ) -> Result, Error> { + ) -> Result>, Error> { let Self { client, configuration, + peer_address, } = self; let configuration = configuration.map_err(Error::InvalidRequest)?; + let peer_address = peer_address.map_err(Error::InvalidRequest)?; let url = format!( - "{}/v1/system/networking/switch-port-configuration/{}", + "{}/v1/system/networking/switch-port-configuration/{}/bgp-peer/allow-import", client.baseurl, encode_path(&configuration.to_string()), ); + let mut query = Vec::with_capacity(1usize); + query.push(("peer_address", peer_address.to_string())); #[allow(unused_mut)] let mut request = client .client @@ -67192,6 +69298,7 @@ pub mod builder { reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) + .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; @@ -67209,20 +69316,22 @@ pub mod builder { } /// Builder for - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_address_list`] + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_allow_import_add`] /// - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_address_list`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_address_list + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_allow_import_add`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_allow_import_add #[derive(Debug, Clone)] - pub struct NetworkingSwitchPortConfigurationAddressList<'a> { + pub struct NetworkingSwitchPortConfigurationBgpPeerAllowImportAdd<'a> { client: &'a super::Client, configuration: Result, + body: Result, } - impl<'a> NetworkingSwitchPortConfigurationAddressList<'a> { + impl<'a> NetworkingSwitchPortConfigurationBgpPeerAllowImportAdd<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, configuration: Err("configuration was not initialized".to_string()), + body: Ok(types::builder::AllowedPrefixAddRemove::default()), } } @@ -67236,36 +69345,64 @@ pub mod builder { self } - /// Sends a `GET` request to + pub fn body(mut self, value: V) -> Self + where + V: std::convert::TryInto, + >::Error: std::fmt::Display, + { + self.body = value.try_into().map(From::from).map_err(|s| { + format!( + "conversion to `AllowedPrefixAddRemove` for body failed: {}", + s + ) + }); + self + } + + pub fn body_map(mut self, f: F) -> Self + where + F: std::ops::FnOnce( + types::builder::AllowedPrefixAddRemove, + ) -> types::builder::AllowedPrefixAddRemove, + { + self.body = self.body.map(f); + self + } + + /// Sends a `POST` request to /// `/v1/system/networking/switch-port-configuration/{configuration}/ - /// address` + /// bgp-peer/allow-import/add` pub async fn send( self, - ) -> Result>, Error> - { + ) -> Result, Error> { let Self { client, configuration, + body, } = self; let configuration = configuration.map_err(Error::InvalidRequest)?; + let body = body + .and_then(|v| types::AllowedPrefixAddRemove::try_from(v).map_err(|e| e.to_string())) + .map_err(Error::InvalidRequest)?; let url = format!( - "{}/v1/system/networking/switch-port-configuration/{}/address", + "{}/v1/system/networking/switch-port-configuration/{}/bgp-peer/allow-import/add", client.baseurl, encode_path(&configuration.to_string()), ); #[allow(unused_mut)] let mut request = client .client - .get(url) + .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) + .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, + 201u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), @@ -67278,22 +69415,22 @@ pub mod builder { } /// Builder for - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_address_add`] + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_allow_import_remove`] /// - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_address_add`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_address_add + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_allow_import_remove`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_allow_import_remove #[derive(Debug, Clone)] - pub struct NetworkingSwitchPortConfigurationAddressAdd<'a> { + pub struct NetworkingSwitchPortConfigurationBgpPeerAllowImportRemove<'a> { client: &'a super::Client, configuration: Result, - body: Result, + body: Result, } - impl<'a> NetworkingSwitchPortConfigurationAddressAdd<'a> { + impl<'a> NetworkingSwitchPortConfigurationBgpPeerAllowImportRemove<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, configuration: Err("configuration was not initialized".to_string()), - body: Ok(types::builder::AddressAddRemove::default()), + body: Ok(types::builder::AllowedPrefixAddRemove::default()), } } @@ -67309,21 +69446,23 @@ pub mod builder { pub fn body(mut self, value: V) -> Self where - V: std::convert::TryInto, - >::Error: std::fmt::Display, + V: std::convert::TryInto, + >::Error: std::fmt::Display, { - self.body = value - .try_into() - .map(From::from) - .map_err(|s| format!("conversion to `AddressAddRemove` for body failed: {}", s)); + self.body = value.try_into().map(From::from).map_err(|s| { + format!( + "conversion to `AllowedPrefixAddRemove` for body failed: {}", + s + ) + }); self } pub fn body_map(mut self, f: F) -> Self where F: std::ops::FnOnce( - types::builder::AddressAddRemove, - ) -> types::builder::AddressAddRemove, + types::builder::AllowedPrefixAddRemove, + ) -> types::builder::AllowedPrefixAddRemove, { self.body = self.body.map(f); self @@ -67331,10 +69470,8 @@ pub mod builder { /// Sends a `POST` request to /// `/v1/system/networking/switch-port-configuration/{configuration}/ - /// address/add` - pub async fn send( - self, - ) -> Result, Error> { + /// bgp-peer/allow-import/remove` + pub async fn send(self) -> Result, Error> { let Self { client, configuration, @@ -67342,10 +69479,10 @@ pub mod builder { } = self; let configuration = configuration.map_err(Error::InvalidRequest)?; let body = body - .and_then(|v| types::AddressAddRemove::try_from(v).map_err(|e| e.to_string())) + .and_then(|v| types::AllowedPrefixAddRemove::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; let url = format!( - "{}/v1/system/networking/switch-port-configuration/{}/address/add", + "{}/v1/system/networking/switch-port-configuration/{}/bgp-peer/allow-import/remove", client.baseurl, encode_path(&configuration.to_string()), ); @@ -67362,7 +69499,7 @@ pub mod builder { let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, + 204u16 => Ok(ResponseValue::empty(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), @@ -67375,22 +69512,22 @@ pub mod builder { } /// Builder for - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_address_remove`] + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_community_list`] /// - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_address_remove`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_address_remove + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_community_list`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_community_list #[derive(Debug, Clone)] - pub struct NetworkingSwitchPortConfigurationAddressRemove<'a> { + pub struct NetworkingSwitchPortConfigurationBgpPeerCommunityList<'a> { client: &'a super::Client, configuration: Result, - body: Result, + peer_address: Result, } - impl<'a> NetworkingSwitchPortConfigurationAddressRemove<'a> { + impl<'a> NetworkingSwitchPortConfigurationBgpPeerCommunityList<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, configuration: Err("configuration was not initialized".to_string()), - body: Ok(types::builder::AddressAddRemove::default()), + peer_address: Err("peer_address was not initialized".to_string()), } } @@ -67404,60 +69541,50 @@ pub mod builder { self } - pub fn body(mut self, value: V) -> Self - where - V: std::convert::TryInto, - >::Error: std::fmt::Display, - { - self.body = value - .try_into() - .map(From::from) - .map_err(|s| format!("conversion to `AddressAddRemove` for body failed: {}", s)); - self - } - - pub fn body_map(mut self, f: F) -> Self + pub fn peer_address(mut self, value: V) -> Self where - F: std::ops::FnOnce( - types::builder::AddressAddRemove, - ) -> types::builder::AddressAddRemove, + V: std::convert::TryInto, { - self.body = self.body.map(f); + self.peer_address = value.try_into().map_err(|_| { + "conversion to `std :: net :: IpAddr` for peer_address failed".to_string() + }); self } - /// Sends a `POST` request to + /// Sends a `GET` request to /// `/v1/system/networking/switch-port-configuration/{configuration}/ - /// address/remove` - pub async fn send(self) -> Result, Error> { + /// bgp-peer/community` + pub async fn send( + self, + ) -> Result>, Error> { let Self { client, configuration, - body, + peer_address, } = self; let configuration = configuration.map_err(Error::InvalidRequest)?; - let body = body - .and_then(|v| types::AddressAddRemove::try_from(v).map_err(|e| e.to_string())) - .map_err(Error::InvalidRequest)?; + let peer_address = peer_address.map_err(Error::InvalidRequest)?; let url = format!( - "{}/v1/system/networking/switch-port-configuration/{}/address/remove", + "{}/v1/system/networking/switch-port-configuration/{}/bgp-peer/community", client.baseurl, encode_path(&configuration.to_string()), ); + let mut query = Vec::with_capacity(1usize); + query.push(("peer_address", peer_address.to_string())); #[allow(unused_mut)] let mut request = client .client - .post(url) + .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .json(&body) + .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), + 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), @@ -67470,20 +69597,22 @@ pub mod builder { } /// Builder for - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_list`] + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_community_add`] /// - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_list`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_list + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_community_add`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_community_add #[derive(Debug, Clone)] - pub struct NetworkingSwitchPortConfigurationBgpPeerList<'a> { + pub struct NetworkingSwitchPortConfigurationBgpPeerCommunityAdd<'a> { client: &'a super::Client, configuration: Result, + body: Result, } - impl<'a> NetworkingSwitchPortConfigurationBgpPeerList<'a> { + impl<'a> NetworkingSwitchPortConfigurationBgpPeerCommunityAdd<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, configuration: Err("configuration was not initialized".to_string()), + body: Ok(types::builder::BgpCommunityAddRemove::default()), } } @@ -67497,33 +69626,62 @@ pub mod builder { self } - /// Sends a `GET` request to + pub fn body(mut self, value: V) -> Self + where + V: std::convert::TryInto, + >::Error: std::fmt::Display, + { + self.body = value.try_into().map(From::from).map_err(|s| { + format!( + "conversion to `BgpCommunityAddRemove` for body failed: {}", + s + ) + }); + self + } + + pub fn body_map(mut self, f: F) -> Self + where + F: std::ops::FnOnce( + types::builder::BgpCommunityAddRemove, + ) -> types::builder::BgpCommunityAddRemove, + { + self.body = self.body.map(f); + self + } + + /// Sends a `POST` request to /// `/v1/system/networking/switch-port-configuration/{configuration}/ - /// bgp-peer` - pub async fn send(self) -> Result>, Error> { + /// bgp-peer/community/add` + pub async fn send(self) -> Result, Error> { let Self { client, configuration, + body, } = self; let configuration = configuration.map_err(Error::InvalidRequest)?; + let body = body + .and_then(|v| types::BgpCommunityAddRemove::try_from(v).map_err(|e| e.to_string())) + .map_err(Error::InvalidRequest)?; let url = format!( - "{}/v1/system/networking/switch-port-configuration/{}/bgp-peer", + "{}/v1/system/networking/switch-port-configuration/{}/bgp-peer/community/add", client.baseurl, encode_path(&configuration.to_string()), ); #[allow(unused_mut)] let mut request = client .client - .get(url) + .post(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) + .json(&body) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, + 201u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), @@ -67536,22 +69694,22 @@ pub mod builder { } /// Builder for - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_add`] + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_community_remove`] /// - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_add`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_add + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_community_remove`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_bgp_peer_community_remove #[derive(Debug, Clone)] - pub struct NetworkingSwitchPortConfigurationBgpPeerAdd<'a> { + pub struct NetworkingSwitchPortConfigurationBgpPeerCommunityRemove<'a> { client: &'a super::Client, configuration: Result, - body: Result, + body: Result, } - impl<'a> NetworkingSwitchPortConfigurationBgpPeerAdd<'a> { + impl<'a> NetworkingSwitchPortConfigurationBgpPeerCommunityRemove<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, configuration: Err("configuration was not initialized".to_string()), - body: Ok(types::builder::BgpPeer::default()), + body: Ok(types::builder::BgpCommunityAddRemove::default()), } } @@ -67567,19 +69725,23 @@ pub mod builder { pub fn body(mut self, value: V) -> Self where - V: std::convert::TryInto, - >::Error: std::fmt::Display, + V: std::convert::TryInto, + >::Error: std::fmt::Display, { - self.body = value - .try_into() - .map(From::from) - .map_err(|s| format!("conversion to `BgpPeer` for body failed: {}", s)); + self.body = value.try_into().map(From::from).map_err(|s| { + format!( + "conversion to `BgpCommunityAddRemove` for body failed: {}", + s + ) + }); self } pub fn body_map(mut self, f: F) -> Self where - F: std::ops::FnOnce(types::builder::BgpPeer) -> types::builder::BgpPeer, + F: std::ops::FnOnce( + types::builder::BgpCommunityAddRemove, + ) -> types::builder::BgpCommunityAddRemove, { self.body = self.body.map(f); self @@ -67587,8 +69749,8 @@ pub mod builder { /// Sends a `POST` request to /// `/v1/system/networking/switch-port-configuration/{configuration}/ - /// bgp-peer/add` - pub async fn send(self) -> Result, Error> { + /// bgp-peer/community/remove` + pub async fn send(self) -> Result, Error> { let Self { client, configuration, @@ -67596,10 +69758,10 @@ pub mod builder { } = self; let configuration = configuration.map_err(Error::InvalidRequest)?; let body = body - .and_then(|v| types::BgpPeer::try_from(v).map_err(|e| e.to_string())) + .and_then(|v| types::BgpCommunityAddRemove::try_from(v).map_err(|e| e.to_string())) .map_err(Error::InvalidRequest)?; let url = format!( - "{}/v1/system/networking/switch-port-configuration/{}/bgp-peer/add", + "{}/v1/system/networking/switch-port-configuration/{}/bgp-peer/community/remove", client.baseurl, encode_path(&configuration.to_string()), ); @@ -67616,7 +69778,7 @@ pub mod builder { let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, + 204u16 => Ok(ResponseValue::empty(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), From 87a103b156a854136b62881dff954d62d1703f64 Mon Sep 17 00:00:00 2001 From: Levon Tarver Date: Mon, 28 Oct 2024 15:53:21 +0000 Subject: [PATCH 6/8] generate handlers for remaining API endpoints --- cli/src/cli_builder.rs | 18 +- cli/src/generated_cli.rs | 444 ++++++++++++--- oxide.json | 301 +++++++--- sdk-httpmock/src/generated_httpmock.rs | 434 ++++++++++++-- sdk/src/generated_sdk.rs | 749 +++++++++++++++++++------ 5 files changed, 1578 insertions(+), 368 deletions(-) diff --git a/cli/src/cli_builder.rs b/cli/src/cli_builder.rs index 10734ed8..7797d633 100644 --- a/cli/src/cli_builder.rs +++ b/cli/src/cli_builder.rs @@ -465,12 +465,26 @@ fn xxx<'a>(command: CliCommand) -> Option<&'a str> { CliCommand::NetworkingSwitchPortList => Some("system hardware switch-port list"), CliCommand::NetworkingSwitchPortStatus => Some("system hardware switch-port status"), + // TODO: deprecate? + // how do we go about deprecating commands? CliCommand::NetworkingSwitchPortApplySettings => { - Some("system hardware switch-port configuration apply") + Some("system hardware switch-port apply-settings") } CliCommand::NetworkingSwitchPortClearSettings => { - Some("system hardware switch-port configuration remove") + Some("system hardware switch-port clear-settings") } + + // Use these instead + CliCommand::NetworkingSwitchPortActiveConfigurationView => { + Some("system hardware switch-port active-configuration view") + } + CliCommand::NetworkingSwitchPortActiveConfigurationSet => { + Some("system hardware switch-port active-configuration set") + } + CliCommand::NetworkingSwitchPortActiveConfigurationClear => { + Some("system hardware switch-port active-configuration clear") + } + CliCommand::NetworkingSwitchPortConfigurationList => { Some("system networking switch-port configuration list") } diff --git a/cli/src/generated_cli.rs b/cli/src/generated_cli.rs index 58ad42a1..53af6620 100644 --- a/cli/src/generated_cli.rs +++ b/cli/src/generated_cli.rs @@ -122,6 +122,15 @@ impl Cli { CliCommand::PhysicalDiskView => Self::cli_physical_disk_view(), CliCommand::RackList => Self::cli_rack_list(), CliCommand::RackView => Self::cli_rack_view(), + CliCommand::NetworkingSwitchPortActiveConfigurationView => { + Self::cli_networking_switch_port_active_configuration_view() + } + CliCommand::NetworkingSwitchPortActiveConfigurationSet => { + Self::cli_networking_switch_port_active_configuration_set() + } + CliCommand::NetworkingSwitchPortActiveConfigurationClear => { + Self::cli_networking_switch_port_active_configuration_clear() + } CliCommand::SledList => Self::cli_sled_list(), CliCommand::SledAdd => Self::cli_sled_add(), CliCommand::SledView => Self::cli_sled_view(), @@ -216,12 +225,12 @@ impl Cli { CliCommand::NetworkingSwitchPortConfigurationCreate => { Self::cli_networking_switch_port_configuration_create() } - CliCommand::NetworkingSwitchPortConfigurationDelete => { - Self::cli_networking_switch_port_configuration_delete() - } CliCommand::NetworkingSwitchPortConfigurationView => { Self::cli_networking_switch_port_configuration_view() } + CliCommand::NetworkingSwitchPortConfigurationDelete => { + Self::cli_networking_switch_port_configuration_delete() + } CliCommand::NetworkingSwitchPortConfigurationAddressList => { Self::cli_networking_switch_port_configuration_address_list() } @@ -681,7 +690,8 @@ impl Cli { clap::Arg::new("certificate") .long("certificate") .value_parser(clap::value_parser!(types::NameOrId)) - .required(true), + .required(true) + .help("Name or ID of the certificate"), ) .about("Fetch certificate") .long_about("Returns the details of a specific certificate") @@ -693,7 +703,8 @@ impl Cli { clap::Arg::new("certificate") .long("certificate") .value_parser(clap::value_parser!(types::NameOrId)) - .required(true), + .required(true) + .help("Name or ID of the certificate"), ) .about("Delete certificate") .long_about("Permanently delete a certificate. This operation cannot be undone.") @@ -3415,11 +3426,128 @@ impl Cli { .long("rack-id") .value_parser(clap::value_parser!(uuid::Uuid)) .required(true) - .help("The rack's unique ID."), + .help("ID of the rack"), ) .about("Fetch rack") } + pub fn cli_networking_switch_port_active_configuration_view() -> clap::Command { + clap::Command::new("") + .arg( + clap::Arg::new("port") + .long("port") + .value_parser(clap::value_parser!(types::Name)) + .required(true) + .help("A name to use when selecting switch ports."), + ) + .arg( + clap::Arg::new("rack-id") + .long("rack-id") + .value_parser(clap::value_parser!(uuid::Uuid)) + .required(true) + .help("A rack id to use when selecting switch ports."), + ) + .arg( + clap::Arg::new("switch") + .long("switch") + .value_parser(clap::builder::TypedValueParser::map( + clap::builder::PossibleValuesParser::new([ + types::SwitchLocation::Switch0.to_string(), + types::SwitchLocation::Switch1.to_string(), + ]), + |s| types::SwitchLocation::try_from(s).unwrap(), + )) + .required(true) + .help("A switch location to use when selecting switch ports."), + ) + .about("View switch port configuration") + } + + pub fn cli_networking_switch_port_active_configuration_set() -> clap::Command { + clap::Command::new("") + .arg( + clap::Arg::new("port") + .long("port") + .value_parser(clap::value_parser!(types::Name)) + .required(true) + .help("A name to use when selecting switch ports."), + ) + .arg( + clap::Arg::new("port-settings") + .long("port-settings") + .value_parser(clap::value_parser!(types::NameOrId)) + .required_unless_present("json-body") + .help("A name or id to use when applying switch port settings."), + ) + .arg( + clap::Arg::new("rack-id") + .long("rack-id") + .value_parser(clap::value_parser!(uuid::Uuid)) + .required(true) + .help("A rack id to use when selecting switch ports."), + ) + .arg( + clap::Arg::new("switch") + .long("switch") + .value_parser(clap::builder::TypedValueParser::map( + clap::builder::PossibleValuesParser::new([ + types::SwitchLocation::Switch0.to_string(), + types::SwitchLocation::Switch1.to_string(), + ]), + |s| types::SwitchLocation::try_from(s).unwrap(), + )) + .required(true) + .help("A switch location to use when selecting switch ports."), + ) + .arg( + clap::Arg::new("json-body") + .long("json-body") + .value_name("JSON-FILE") + .required(false) + .value_parser(clap::value_parser!(std::path::PathBuf)) + .help("Path to a file that contains the full json body."), + ) + .arg( + clap::Arg::new("json-body-template") + .long("json-body-template") + .action(clap::ArgAction::SetTrue) + .help("XXX"), + ) + .about("Set switch port configuration") + } + + pub fn cli_networking_switch_port_active_configuration_clear() -> clap::Command { + clap::Command::new("") + .arg( + clap::Arg::new("port") + .long("port") + .value_parser(clap::value_parser!(types::Name)) + .required(true) + .help("A name to use when selecting switch ports."), + ) + .arg( + clap::Arg::new("rack-id") + .long("rack-id") + .value_parser(clap::value_parser!(uuid::Uuid)) + .required(true) + .help("A rack id to use when selecting switch ports."), + ) + .arg( + clap::Arg::new("switch") + .long("switch") + .value_parser(clap::builder::TypedValueParser::map( + clap::builder::PossibleValuesParser::new([ + types::SwitchLocation::Switch0.to_string(), + types::SwitchLocation::Switch1.to_string(), + ]), + |s| types::SwitchLocation::try_from(s).unwrap(), + )) + .required(true) + .help("A switch location to use when selecting switch ports."), + ) + .about("Clear switch port configuration") + } + pub fn cli_sled_list() -> clap::Command { clap::Command::new("") .arg( @@ -3653,7 +3781,13 @@ impl Cli { .arg( clap::Arg::new("switch-location") .long("switch-location") - .value_parser(clap::value_parser!(types::Name)) + .value_parser(clap::builder::TypedValueParser::map( + clap::builder::PossibleValuesParser::new([ + types::SwitchLocation::Switch0.to_string(), + types::SwitchLocation::Switch1.to_string(), + ]), + |s| types::SwitchLocation::try_from(s).unwrap(), + )) .required(true) .help("A switch location to use when selecting switch ports."), ) @@ -3693,7 +3827,13 @@ impl Cli { .arg( clap::Arg::new("switch-location") .long("switch-location") - .value_parser(clap::value_parser!(types::Name)) + .value_parser(clap::builder::TypedValueParser::map( + clap::builder::PossibleValuesParser::new([ + types::SwitchLocation::Switch0.to_string(), + types::SwitchLocation::Switch1.to_string(), + ]), + |s| types::SwitchLocation::try_from(s).unwrap(), + )) .required(true) .help("A switch location to use when selecting switch ports."), ) @@ -3719,7 +3859,13 @@ impl Cli { .arg( clap::Arg::new("switch-location") .long("switch-location") - .value_parser(clap::value_parser!(types::Name)) + .value_parser(clap::builder::TypedValueParser::map( + clap::builder::PossibleValuesParser::new([ + types::SwitchLocation::Switch0.to_string(), + types::SwitchLocation::Switch1.to_string(), + ]), + |s| types::SwitchLocation::try_from(s).unwrap(), + )) .required(true) .help("A switch location to use when selecting switch ports."), ) @@ -3845,7 +3991,7 @@ impl Cli { .long("user-id") .value_parser(clap::value_parser!(uuid::Uuid)) .required(true) - .help("The user's internal id"), + .help("The user's internal ID"), ) .about("Delete user") } @@ -3864,7 +4010,7 @@ impl Cli { .long("user-id") .value_parser(clap::value_parser!(uuid::Uuid)) .required(true) - .help("The user's internal id"), + .help("The user's internal ID"), ) .arg( clap::Arg::new("json-body") @@ -4866,8 +5012,8 @@ impl Cli { pub fn cli_networking_bgp_config_delete() -> clap::Command { clap::Command::new("") .arg( - clap::Arg::new("name-or-id") - .long("name-or-id") + clap::Arg::new("bgp-config") + .long("bgp-config") .value_parser(clap::value_parser!(types::NameOrId)) .required(true) .help("A name or id to use when selecting BGP config."), @@ -5195,21 +5341,19 @@ impl Cli { .about("Create switch port settings") } - pub fn cli_networking_switch_port_configuration_delete() -> clap::Command { + pub fn cli_networking_switch_port_configuration_view() -> clap::Command { clap::Command::new("") .arg( clap::Arg::new("configuration") .long("configuration") .value_parser(clap::value_parser!(types::NameOrId)) - .required(false) - .help( - "An optional name or id to use when selecting a switch port configuration.", - ), + .required(true) + .help("A name or id to use when selecting a switch port configuration."), ) - .about("Delete switch port settings") + .about("View a switch port configuration") } - pub fn cli_networking_switch_port_configuration_view() -> clap::Command { + pub fn cli_networking_switch_port_configuration_delete() -> clap::Command { clap::Command::new("") .arg( clap::Arg::new("configuration") @@ -5218,7 +5362,7 @@ impl Cli { .required(true) .help("A name or id to use when selecting a switch port configuration."), ) - .about("Get information about a named set of switch-port-settings") + .about("Delete switch port settings") } pub fn cli_networking_switch_port_configuration_address_list() -> clap::Command { @@ -5240,7 +5384,7 @@ impl Cli { .long("address") .value_parser(clap::value_parser!(types::IpNet)) .required_unless_present("json-body") - .help("The address and prefix length of this address."), + .help("The address and subnet mask"), ) .arg( clap::Arg::new("address-lot") @@ -5294,7 +5438,7 @@ impl Cli { .long("address") .value_parser(clap::value_parser!(types::IpNet)) .required_unless_present("json-body") - .help("The address and prefix length of this address."), + .help("The address and subnet mask"), ) .arg( clap::Arg::new("address-lot") @@ -5360,7 +5504,7 @@ impl Cli { .long("addr") .value_parser(clap::value_parser!(types::IpNet)) .required_unless_present("json-body") - .help("The address of th e host to peer with."), + .help("The address of the host to peer with."), ) .arg( clap::Arg::new("allow-export-list-active") @@ -5433,7 +5577,7 @@ impl Cli { .value_parser(clap::value_parser!(u32)) .required_unless_present("json-body") .help( - "How long to hold a peer in idle before attempting a new session \ + "How long to hold this peer in idle before attempting a new session \ (seconds).", ), ) @@ -5443,7 +5587,7 @@ impl Cli { .value_parser(clap::value_parser!(String)) .required_unless_present("json-body") .help( - "The name of interface to peer on. This is relative to the port \ + "The name of the interface to peer on. This is relative to the port \ configuration this BGP peer configuration is a part of. For example this \ value could be phy0 to refer to a primary physical interface. Or it \ could be vlan47 to refer to a VLAN interface.", @@ -5468,38 +5612,37 @@ impl Cli { .long("md5-auth-key") .value_parser(clap::value_parser!(String)) .required(false) - .help("Use the given key for TCP-MD5 authentication with the peer."), + .help("Use the given key for TCP-MD5 authentication with this peer."), ) .arg( clap::Arg::new("min-ttl") .long("min-ttl") .value_parser(clap::value_parser!(u8)) .required(false) - .help("Require messages from a peer have a minimum IP time to live field."), + .help( + "Require messages from this peer to have a minimum IP time to live field.", + ), ) .arg( clap::Arg::new("multi-exit-discriminator") .long("multi-exit-discriminator") .value_parser(clap::value_parser!(u32)) .required(false) - .help( - "Apply the provided multi-exit discriminator (MED) updates sent to the \ - peer.", - ), + .help("Apply a multi-exit discriminator (MED) in updates sent to this peer."), ) .arg( clap::Arg::new("remote-asn") .long("remote-asn") .value_parser(clap::value_parser!(u32)) .required(false) - .help("Require that a peer has a specified ASN."), + .help("Require that this peer have a specified ASN."), ) .arg( clap::Arg::new("vlan-id") .long("vlan-id") .value_parser(clap::value_parser!(u16)) .required(false) - .help("Associate a VLAN ID with a peer."), + .help("Associate a VLAN ID with this peer."), ) .arg( clap::Arg::new("json-body") @@ -5891,7 +6034,7 @@ impl Cli { .value_parser(clap::value_parser!(String)) .required_unless_present("json-body") .help( - "The name of interface to peer on. This is relative to the port \ + "The name of the interface to peer on. This is relative to the port \ configuration this BGP peer configuration is a part of. For example this \ value could be phy0 to refer to a primary physical interface. Or it \ could be vlan47 to refer to a VLAN interface.", @@ -6150,13 +6293,13 @@ impl Cli { .help("The interface to configure the route on"), ) .arg( - clap::Arg::new("local-pref") - .long("local-pref") - .value_parser(clap::value_parser!(u32)) + clap::Arg::new("rib-priority") + .long("rib-priority") + .value_parser(clap::value_parser!(u8)) .required(false) .help( - "Local preference for route. Higher preference indictes precedence within \ - and across protocols.", + "Local preference for route. Higher preference indicates precedence \ + within and across protocols.", ), ) .arg( @@ -6214,13 +6357,13 @@ impl Cli { .help("The interface to configure the route on"), ) .arg( - clap::Arg::new("local-pref") - .long("local-pref") - .value_parser(clap::value_parser!(u32)) + clap::Arg::new("rib-priority") + .long("rib-priority") + .value_parser(clap::value_parser!(u8)) .required(false) .help( - "Local preference for route. Higher preference indictes precedence within \ - and across protocols.", + "Local preference for route. Higher preference indicates precedence \ + within and across protocols.", ), ) .arg( @@ -6613,7 +6756,7 @@ impl Cli { .long("user-id") .value_parser(clap::value_parser!(uuid::Uuid)) .required(true) - .help("The user's internal id"), + .help("The user's internal ID"), ) .about("Fetch built-in (system) user") } @@ -7892,6 +8035,18 @@ impl Cli { CliCommand::PhysicalDiskView => self.execute_physical_disk_view(matches).await, CliCommand::RackList => self.execute_rack_list(matches).await, CliCommand::RackView => self.execute_rack_view(matches).await, + CliCommand::NetworkingSwitchPortActiveConfigurationView => { + self.execute_networking_switch_port_active_configuration_view(matches) + .await + } + CliCommand::NetworkingSwitchPortActiveConfigurationSet => { + self.execute_networking_switch_port_active_configuration_set(matches) + .await + } + CliCommand::NetworkingSwitchPortActiveConfigurationClear => { + self.execute_networking_switch_port_active_configuration_clear(matches) + .await + } CliCommand::SledList => self.execute_sled_list(matches).await, CliCommand::SledAdd => self.execute_sled_add(matches).await, CliCommand::SledView => self.execute_sled_view(matches).await, @@ -8041,14 +8196,14 @@ impl Cli { self.execute_networking_switch_port_configuration_create(matches) .await } - CliCommand::NetworkingSwitchPortConfigurationDelete => { - self.execute_networking_switch_port_configuration_delete(matches) - .await - } CliCommand::NetworkingSwitchPortConfigurationView => { self.execute_networking_switch_port_configuration_view(matches) .await } + CliCommand::NetworkingSwitchPortConfigurationDelete => { + self.execute_networking_switch_port_configuration_delete(matches) + .await + } CliCommand::NetworkingSwitchPortConfigurationAddressList => { self.execute_networking_switch_port_configuration_address_list(matches) .await @@ -11494,6 +11649,119 @@ impl Cli { } } + pub async fn execute_networking_switch_port_active_configuration_view( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self + .client + .networking_switch_port_active_configuration_view(); + if let Some(value) = matches.get_one::("port") { + request = request.port(value.clone()); + } + + if let Some(value) = matches.get_one::("rack-id") { + request = request.rack_id(value.clone()); + } + + if let Some(value) = matches.get_one::("switch") { + request = request.switch(value.clone()); + } + + self.config + .execute_networking_switch_port_active_configuration_view(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) + } + } + } + + pub async fn execute_networking_switch_port_active_configuration_set( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self + .client + .networking_switch_port_active_configuration_set(); + if let Some(value) = matches.get_one::("port") { + request = request.port(value.clone()); + } + + if let Some(value) = matches.get_one::("port-settings") { + request = request.body_map(|body| body.port_settings(value.clone())) + } + + if let Some(value) = matches.get_one::("rack-id") { + request = request.rack_id(value.clone()); + } + + if let Some(value) = matches.get_one::("switch") { + request = request.switch(value.clone()); + } + + if let Some(value) = matches.get_one::("json-body") { + let body_txt = std::fs::read_to_string(value).unwrap(); + let body_value = + serde_json::from_str::(&body_txt).unwrap(); + request = request.body(body_value); + } + + self.config + .execute_networking_switch_port_active_configuration_set(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_no_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) + } + } + } + + pub async fn execute_networking_switch_port_active_configuration_clear( + &self, + matches: &clap::ArgMatches, + ) -> anyhow::Result<()> { + let mut request = self + .client + .networking_switch_port_active_configuration_clear(); + if let Some(value) = matches.get_one::("port") { + request = request.port(value.clone()); + } + + if let Some(value) = matches.get_one::("rack-id") { + request = request.rack_id(value.clone()); + } + + if let Some(value) = matches.get_one::("switch") { + request = request.switch(value.clone()); + } + + self.config + .execute_networking_switch_port_active_configuration_clear(matches, &mut request)?; + let result = request.send().await; + match result { + Ok(r) => { + self.config.success_no_item(&r); + Ok(()) + } + Err(r) => { + self.config.error(&r); + Err(anyhow::Error::new(r)) + } + } + } + pub async fn execute_sled_list(&self, matches: &clap::ArgMatches) -> anyhow::Result<()> { let mut request = self.client.sled_list(); if let Some(value) = matches.get_one::("limit") { @@ -11800,7 +12068,7 @@ impl Cli { request = request.rack_id(value.clone()); } - if let Some(value) = matches.get_one::("switch-location") { + if let Some(value) = matches.get_one::("switch-location") { request = request.switch_location(value.clone()); } @@ -11839,7 +12107,7 @@ impl Cli { request = request.rack_id(value.clone()); } - if let Some(value) = matches.get_one::("switch-location") { + if let Some(value) = matches.get_one::("switch-location") { request = request.switch_location(value.clone()); } @@ -11871,7 +12139,7 @@ impl Cli { request = request.rack_id(value.clone()); } - if let Some(value) = matches.get_one::("switch-location") { + if let Some(value) = matches.get_one::("switch-location") { request = request.switch_location(value.clone()); } @@ -13215,8 +13483,8 @@ impl Cli { matches: &clap::ArgMatches, ) -> anyhow::Result<()> { let mut request = self.client.networking_bgp_config_delete(); - if let Some(value) = matches.get_one::("name-or-id") { - request = request.name_or_id(value.clone()); + if let Some(value) = matches.get_one::("bgp-config") { + request = request.bgp_config(value.clone()); } self.config @@ -13645,21 +13913,21 @@ impl Cli { } } - pub async fn execute_networking_switch_port_configuration_delete( + pub async fn execute_networking_switch_port_configuration_view( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_switch_port_configuration_delete(); + let mut request = self.client.networking_switch_port_configuration_view(); if let Some(value) = matches.get_one::("configuration") { request = request.configuration(value.clone()); } self.config - .execute_networking_switch_port_configuration_delete(matches, &mut request)?; + .execute_networking_switch_port_configuration_view(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_no_item(&r); + self.config.success_item(&r); Ok(()) } Err(r) => { @@ -13669,21 +13937,21 @@ impl Cli { } } - pub async fn execute_networking_switch_port_configuration_view( + pub async fn execute_networking_switch_port_configuration_delete( &self, matches: &clap::ArgMatches, ) -> anyhow::Result<()> { - let mut request = self.client.networking_switch_port_configuration_view(); + let mut request = self.client.networking_switch_port_configuration_delete(); if let Some(value) = matches.get_one::("configuration") { request = request.configuration(value.clone()); } self.config - .execute_networking_switch_port_configuration_view(matches, &mut request)?; + .execute_networking_switch_port_configuration_delete(matches, &mut request)?; let result = request.send().await; match result { Ok(r) => { - self.config.success_item(&r); + self.config.success_no_item(&r); Ok(()) } Err(r) => { @@ -14621,8 +14889,8 @@ impl Cli { request = request.body_map(|body| body.interface(value.clone())) } - if let Some(value) = matches.get_one::("local-pref") { - request = request.body_map(|body| body.local_pref(value.clone())) + if let Some(value) = matches.get_one::("rib-priority") { + request = request.body_map(|body| body.rib_priority(value.clone())) } if let Some(value) = matches.get_one::("vid") { @@ -14673,8 +14941,8 @@ impl Cli { request = request.body_map(|body| body.interface(value.clone())) } - if let Some(value) = matches.get_one::("local-pref") { - request = request.body_map(|body| body.local_pref(value.clone())) + if let Some(value) = matches.get_one::("rib-priority") { + request = request.body_map(|body| body.rib_priority(value.clone())) } if let Some(value) = matches.get_one::("vid") { @@ -17130,6 +17398,30 @@ pub trait CliConfig { Ok(()) } + fn execute_networking_switch_port_active_configuration_view( + &self, + matches: &clap::ArgMatches, + request: &mut builder::NetworkingSwitchPortActiveConfigurationView, + ) -> anyhow::Result<()> { + Ok(()) + } + + fn execute_networking_switch_port_active_configuration_set( + &self, + matches: &clap::ArgMatches, + request: &mut builder::NetworkingSwitchPortActiveConfigurationSet, + ) -> anyhow::Result<()> { + Ok(()) + } + + fn execute_networking_switch_port_active_configuration_clear( + &self, + matches: &clap::ArgMatches, + request: &mut builder::NetworkingSwitchPortActiveConfigurationClear, + ) -> anyhow::Result<()> { + Ok(()) + } + fn execute_sled_list( &self, matches: &clap::ArgMatches, @@ -17642,18 +17934,18 @@ pub trait CliConfig { Ok(()) } - fn execute_networking_switch_port_configuration_delete( + fn execute_networking_switch_port_configuration_view( &self, matches: &clap::ArgMatches, - request: &mut builder::NetworkingSwitchPortConfigurationDelete, + request: &mut builder::NetworkingSwitchPortConfigurationView, ) -> anyhow::Result<()> { Ok(()) } - fn execute_networking_switch_port_configuration_view( + fn execute_networking_switch_port_configuration_delete( &self, matches: &clap::ArgMatches, - request: &mut builder::NetworkingSwitchPortConfigurationView, + request: &mut builder::NetworkingSwitchPortConfigurationDelete, ) -> anyhow::Result<()> { Ok(()) } @@ -18326,6 +18618,9 @@ pub enum CliCommand { PhysicalDiskView, RackList, RackView, + NetworkingSwitchPortActiveConfigurationView, + NetworkingSwitchPortActiveConfigurationSet, + NetworkingSwitchPortActiveConfigurationClear, SledList, SledAdd, SledView, @@ -18390,8 +18685,8 @@ pub enum CliCommand { NetworkingLoopbackAddressDelete, NetworkingSwitchPortConfigurationList, NetworkingSwitchPortConfigurationCreate, - NetworkingSwitchPortConfigurationDelete, NetworkingSwitchPortConfigurationView, + NetworkingSwitchPortConfigurationDelete, NetworkingSwitchPortConfigurationAddressList, NetworkingSwitchPortConfigurationAddressAdd, NetworkingSwitchPortConfigurationAddressRemove, @@ -18565,6 +18860,9 @@ impl CliCommand { CliCommand::PhysicalDiskView, CliCommand::RackList, CliCommand::RackView, + CliCommand::NetworkingSwitchPortActiveConfigurationView, + CliCommand::NetworkingSwitchPortActiveConfigurationSet, + CliCommand::NetworkingSwitchPortActiveConfigurationClear, CliCommand::SledList, CliCommand::SledAdd, CliCommand::SledView, @@ -18629,8 +18927,8 @@ impl CliCommand { CliCommand::NetworkingLoopbackAddressDelete, CliCommand::NetworkingSwitchPortConfigurationList, CliCommand::NetworkingSwitchPortConfigurationCreate, - CliCommand::NetworkingSwitchPortConfigurationDelete, CliCommand::NetworkingSwitchPortConfigurationView, + CliCommand::NetworkingSwitchPortConfigurationDelete, CliCommand::NetworkingSwitchPortConfigurationAddressList, CliCommand::NetworkingSwitchPortConfigurationAddressAdd, CliCommand::NetworkingSwitchPortConfigurationAddressRemove, diff --git a/oxide.json b/oxide.json index b76adbb5..dcf838f2 100644 --- a/oxide.json +++ b/oxide.json @@ -468,6 +468,7 @@ { "in": "path", "name": "certificate", + "description": "Name or ID of the certificate", "required": true, "schema": { "$ref": "#/components/schemas/NameOrId" @@ -504,6 +505,7 @@ { "in": "path", "name": "certificate", + "description": "Name or ID of the certificate", "required": true, "schema": { "$ref": "#/components/schemas/NameOrId" @@ -4879,7 +4881,7 @@ { "in": "path", "name": "rack_id", - "description": "The rack's unique ID.", + "description": "ID of the rack", "required": true, "schema": { "type": "string", @@ -4907,6 +4909,169 @@ } } }, + "/v1/system/hardware/racks/{rack_id}/switch/{switch}/switch-port/{port}/configuration": { + "get": { + "tags": [ + "system/hardware" + ], + "summary": "View switch port configuration", + "operationId": "networking_switch_port_active_configuration_view", + "parameters": [ + { + "in": "path", + "name": "port", + "description": "A name to use when selecting switch ports.", + "required": true, + "schema": { + "$ref": "#/components/schemas/Name" + } + }, + { + "in": "path", + "name": "rack_id", + "description": "A rack id to use when selecting switch ports.", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + }, + { + "in": "path", + "name": "switch", + "description": "A switch location to use when selecting switch ports.", + "required": true, + "schema": { + "$ref": "#/components/schemas/SwitchLocation" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SwitchPortSettings" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + }, + "put": { + "tags": [ + "system/hardware" + ], + "summary": "Set switch port configuration", + "operationId": "networking_switch_port_active_configuration_set", + "parameters": [ + { + "in": "path", + "name": "port", + "description": "A name to use when selecting switch ports.", + "required": true, + "schema": { + "$ref": "#/components/schemas/Name" + } + }, + { + "in": "path", + "name": "rack_id", + "description": "A rack id to use when selecting switch ports.", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + }, + { + "in": "path", + "name": "switch", + "description": "A switch location to use when selecting switch ports.", + "required": true, + "schema": { + "$ref": "#/components/schemas/SwitchLocation" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SwitchPortApplySettings" + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "resource updated" + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + }, + "delete": { + "tags": [ + "system/hardware" + ], + "summary": "Clear switch port configuration", + "operationId": "networking_switch_port_active_configuration_clear", + "parameters": [ + { + "in": "path", + "name": "port", + "description": "A name to use when selecting switch ports.", + "required": true, + "schema": { + "$ref": "#/components/schemas/Name" + } + }, + { + "in": "path", + "name": "rack_id", + "description": "A rack id to use when selecting switch ports.", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + }, + { + "in": "path", + "name": "switch", + "description": "A switch location to use when selecting switch ports.", + "required": true, + "schema": { + "$ref": "#/components/schemas/SwitchLocation" + } + } + ], + "responses": { + "204": { + "description": "successful deletion" + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, "/v1/system/hardware/sleds": { "get": { "tags": [ @@ -5381,7 +5546,7 @@ "description": "A switch location to use when selecting switch ports.", "required": true, "schema": { - "$ref": "#/components/schemas/Name" + "$ref": "#/components/schemas/SwitchLocation" } } ], @@ -5405,7 +5570,8 @@ "5XX": { "$ref": "#/components/responses/Error" } - } + }, + "deprecated": true }, "delete": { "tags": [ @@ -5439,7 +5605,7 @@ "description": "A switch location to use when selecting switch ports.", "required": true, "schema": { - "$ref": "#/components/schemas/Name" + "$ref": "#/components/schemas/SwitchLocation" } } ], @@ -5453,7 +5619,8 @@ "5XX": { "$ref": "#/components/responses/Error" } - } + }, + "deprecated": true } }, "/v1/system/hardware/switch-port/{port}/status": { @@ -5489,7 +5656,7 @@ "description": "A switch location to use when selecting switch ports.", "required": true, "schema": { - "$ref": "#/components/schemas/Name" + "$ref": "#/components/schemas/SwitchLocation" } } ], @@ -5740,7 +5907,7 @@ { "in": "path", "name": "user_id", - "description": "The user's internal id", + "description": "The user's internal ID", "required": true, "schema": { "type": "string", @@ -5782,7 +5949,7 @@ { "in": "path", "name": "user_id", - "description": "The user's internal id", + "description": "The user's internal ID", "required": true, "schema": { "type": "string", @@ -7295,7 +7462,9 @@ "$ref": "#/components/responses/Error" } } - }, + } + }, + "/v1/system/networking/bgp/{bgp_config}": { "delete": { "tags": [ "system/networking" @@ -7304,8 +7473,8 @@ "operationId": "networking_bgp_config_delete", "parameters": [ { - "in": "query", - "name": "name_or_id", + "in": "path", + "name": "bgp_config", "description": "A name or id to use when selecting BGP config.", "required": true, "schema": { @@ -7406,8 +7575,8 @@ "required": true }, "responses": { - "201": { - "description": "successful creation", + "200": { + "description": "successful operation", "content": { "application/json": { "schema": { @@ -7896,26 +8065,36 @@ "$ref": "#/components/responses/Error" } } - }, - "delete": { + } + }, + "/v1/system/networking/switch-port-configuration/{configuration}": { + "get": { "tags": [ "system/networking" ], - "summary": "Delete switch port settings", - "operationId": "networking_switch_port_configuration_delete", + "summary": "View a switch port configuration", + "operationId": "networking_switch_port_configuration_view", "parameters": [ { - "in": "query", + "in": "path", "name": "configuration", - "description": "An optional name or id to use when selecting a switch port configuration.", + "description": "A name or id to use when selecting a switch port configuration.", + "required": true, "schema": { "$ref": "#/components/schemas/NameOrId" } } ], "responses": { - "204": { - "description": "successful deletion" + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SwitchPortSettingsView" + } + } + } }, "4XX": { "$ref": "#/components/responses/Error" @@ -7924,15 +8103,13 @@ "$ref": "#/components/responses/Error" } } - } - }, - "/v1/system/networking/switch-port-configuration/{configuration}": { - "get": { + }, + "delete": { "tags": [ "system/networking" ], - "summary": "Get information about a named set of switch-port-settings", - "operationId": "networking_switch_port_configuration_view", + "summary": "Delete switch port settings", + "operationId": "networking_switch_port_configuration_delete", "parameters": [ { "in": "path", @@ -7945,15 +8122,8 @@ } ], "responses": { - "200": { - "description": "successful operation", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SwitchPortSettingsView" - } - } - } + "204": { + "description": "successful deletion" }, "4XX": { "$ref": "#/components/responses/Error" @@ -9730,7 +9900,7 @@ { "in": "path", "name": "user_id", - "description": "The user's internal id", + "description": "The user's internal ID", "required": true, "schema": { "type": "string", @@ -11508,7 +11678,7 @@ "type": "object", "properties": { "address": { - "description": "The address and prefix length of this address.", + "description": "The address and subnet mask", "allOf": [ { "$ref": "#/components/schemas/IpNet" @@ -11537,11 +11707,11 @@ ] }, "AddressAddRemove": { - "description": "An address to be added or removed from an interface", + "description": "An address to be added to or removed from an interface", "type": "object", "properties": { "address": { - "description": "The address and prefix length of this address.", + "description": "The address and subnet mask", "allOf": [ { "$ref": "#/components/schemas/IpNet" @@ -12533,7 +12703,7 @@ "type": "object", "properties": { "addr": { - "description": "The address of th e host to peer with.", + "description": "The address of the host to peer with.", "allOf": [ { "$ref": "#/components/schemas/IpNet" @@ -12579,13 +12749,13 @@ "minimum": 0 }, "idle_hold_time": { - "description": "How long to hold a peer in idle before attempting a new session (seconds).", + "description": "How long to hold this peer in idle before attempting a new session (seconds).", "type": "integer", "format": "uint32", "minimum": 0 }, "interface_name": { - "description": "The name of interface to peer on. This is relative to the port configuration this BGP peer configuration is a part of. For example this value could be phy0 to refer to a primary physical interface. Or it could be vlan47 to refer to a VLAN interface.", + "description": "The name of the interface to peer on. This is relative to the port configuration this BGP peer configuration is a part of. For example this value could be phy0 to refer to a primary physical interface. Or it could be vlan47 to refer to a VLAN interface.", "type": "string" }, "keepalive": { @@ -12603,33 +12773,33 @@ }, "md5_auth_key": { "nullable": true, - "description": "Use the given key for TCP-MD5 authentication with the peer.", + "description": "Use the given key for TCP-MD5 authentication with this peer.", "type": "string" }, "min_ttl": { "nullable": true, - "description": "Require messages from a peer have a minimum IP time to live field.", + "description": "Require messages from this peer to have a minimum IP time to live field.", "type": "integer", "format": "uint8", "minimum": 0 }, "multi_exit_discriminator": { "nullable": true, - "description": "Apply the provided multi-exit discriminator (MED) updates sent to the peer.", + "description": "Apply a multi-exit discriminator (MED) in updates sent to this peer.", "type": "integer", "format": "uint32", "minimum": 0 }, "remote_asn": { "nullable": true, - "description": "Require that a peer has a specified ASN.", + "description": "Require that this peer have a specified ASN.", "type": "integer", "format": "uint32", "minimum": 0 }, "vlan_id": { "nullable": true, - "description": "Associate a VLAN ID with a peer.", + "description": "Associate a VLAN ID with this peer.", "type": "integer", "format": "uint16", "minimum": 0 @@ -12659,7 +12829,7 @@ "format": "ip" }, "allowed_export": { - "description": "Define export policy for a peer.", + "description": "Define export policy for this peer.", "allOf": [ { "$ref": "#/components/schemas/ImportExportPolicy" @@ -12667,7 +12837,7 @@ ] }, "allowed_import": { - "description": "Define import policy for a peer.", + "description": "Define import policy for this peer.", "allOf": [ { "$ref": "#/components/schemas/ImportExportPolicy" @@ -12683,7 +12853,7 @@ ] }, "communities": { - "description": "Include the provided communities in updates sent to the peer.", + "description": "Include the provided communities in updates sent to this peer.", "type": "array", "items": { "type": "integer", @@ -12720,7 +12890,7 @@ "minimum": 0 }, "interface_name": { - "description": "The name of interface to peer on. This is relative to the port configuration this BGP peer configuration is a part of. For example this value could be phy0 to refer to a primary physical interface. Or it could be vlan47 to refer to a VLAN interface.", + "description": "The name of the interface to peer on. This is relative to the port configuration this BGP peer configuration is a part of. For example this value could be phy0 to refer to a primary physical interface. Or it could be vlan47 to refer to a VLAN interface.", "type": "string" }, "keepalive": { @@ -12738,33 +12908,33 @@ }, "md5_auth_key": { "nullable": true, - "description": "Use the given key for TCP-MD5 authentication with the peer.", + "description": "Use the given key for TCP-MD5 authentication with this peer.", "type": "string" }, "min_ttl": { "nullable": true, - "description": "Require messages from a peer have a minimum IP time to live field.", + "description": "Require messages from this peer have a minimum IP time to live field.", "type": "integer", "format": "uint8", "minimum": 0 }, "multi_exit_discriminator": { "nullable": true, - "description": "Apply the provided multi-exit discriminator (MED) updates sent to the peer.", + "description": "Apply a multi-exit discriminator (MED) in updates sent to this peer.", "type": "integer", "format": "uint32", "minimum": 0 }, "remote_asn": { "nullable": true, - "description": "Require that a peer has a specified ASN.", + "description": "Require that this peer has a specified ASN.", "type": "integer", "format": "uint32", "minimum": 0 }, "vlan_id": { "nullable": true, - "description": "Associate a VLAN ID with a peer.", + "description": "Associate a VLAN ID with this peer.", "type": "integer", "format": "uint16", "minimum": 0 @@ -12817,7 +12987,7 @@ ] }, "interface_name": { - "description": "The name of interface to peer on. This is relative to the port configuration this BGP peer configuration is a part of. For example this value could be phy0 to refer to a primary physical interface. Or it could be vlan47 to refer to a VLAN interface.", + "description": "The name of the interface to peer on. This is relative to the port configuration this BGP peer configuration is a part of. For example this value could be phy0 to refer to a primary physical interface. Or it could be vlan47 to refer to a VLAN interface.", "type": "string" } }, @@ -19954,7 +20124,7 @@ }, "rib_priority": { "nullable": true, - "description": "Local preference for route. Higher preference indictes precedence within and across protocols.", + "description": "Local preference for route. Higher preference indicates precedence within and across protocols.", "type": "integer", "format": "uint8", "minimum": 0 @@ -19973,7 +20143,7 @@ ] }, "RouteAddRemove": { - "description": "A route to a destination network through a gateway address to add or remove to an interface.", + "description": "A network route to to add to or remove from an interface.", "type": "object", "properties": { "dst": { @@ -19997,11 +20167,11 @@ } ] }, - "local_pref": { + "rib_priority": { "nullable": true, - "description": "Local preference for route. Higher preference indictes precedence within and across protocols.", + "description": "Local preference for route. Higher preference indicates precedence within and across protocols.", "type": "integer", - "format": "uint32", + "format": "uint8", "minimum": 0 }, "vid": { @@ -21984,6 +22154,7 @@ "type": "string" }, "lldp_link_config_id": { + "nullable": true, "description": "The link-layer discovery protocol service configuration id for this link.", "type": "string", "format": "uuid" @@ -22012,7 +22183,6 @@ "autoneg", "fec", "link_name", - "lldp_link_config_id", "mtu", "port_settings_id", "speed" @@ -22583,7 +22753,8 @@ "nanoseconds", "volts", "amps", - "degrees_celcius" + "watts", + "degrees_celsius" ] }, { diff --git a/sdk-httpmock/src/generated_httpmock.rs b/sdk-httpmock/src/generated_httpmock.rs index 4f49213b..04f04d95 100644 --- a/sdk-httpmock/src/generated_httpmock.rs +++ b/sdk-httpmock/src/generated_httpmock.rs @@ -8109,6 +8109,258 @@ pub mod operations { } } + pub struct NetworkingSwitchPortActiveConfigurationViewWhen(httpmock::When); + impl NetworkingSwitchPortActiveConfigurationViewWhen { + pub fn new(inner: httpmock::When) -> Self { + Self( + inner.method(httpmock::Method::GET).path_matches( + regex::Regex::new( + "^/v1/system/hardware/racks/[^/]*/switch/[^/]*/switch-port/[^/]*/\ + configuration$", + ) + .unwrap(), + ), + ) + } + + pub fn into_inner(self) -> httpmock::When { + self.0 + } + + pub fn rack_id(self, value: &uuid::Uuid) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/hardware/racks/{}/switch/.*/switch-port/.*/configuration$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + + pub fn switch(self, value: types::SwitchLocation) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/hardware/racks/.*/switch/{}/switch-port/.*/configuration$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + + pub fn port(self, value: &types::Name) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/hardware/racks/.*/switch/.*/switch-port/{}/configuration$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + } + + pub struct NetworkingSwitchPortActiveConfigurationViewThen(httpmock::Then); + impl NetworkingSwitchPortActiveConfigurationViewThen { + pub fn new(inner: httpmock::Then) -> Self { + Self(inner) + } + + pub fn into_inner(self) -> httpmock::Then { + self.0 + } + + pub fn ok(self, value: &types::SwitchPortSettings) -> Self { + Self( + self.0 + .status(200u16) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn client_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 4u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn server_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 5u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + } + + pub struct NetworkingSwitchPortActiveConfigurationSetWhen(httpmock::When); + impl NetworkingSwitchPortActiveConfigurationSetWhen { + pub fn new(inner: httpmock::When) -> Self { + Self( + inner.method(httpmock::Method::PUT).path_matches( + regex::Regex::new( + "^/v1/system/hardware/racks/[^/]*/switch/[^/]*/switch-port/[^/]*/\ + configuration$", + ) + .unwrap(), + ), + ) + } + + pub fn into_inner(self) -> httpmock::When { + self.0 + } + + pub fn rack_id(self, value: &uuid::Uuid) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/hardware/racks/{}/switch/.*/switch-port/.*/configuration$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + + pub fn switch(self, value: types::SwitchLocation) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/hardware/racks/.*/switch/{}/switch-port/.*/configuration$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + + pub fn port(self, value: &types::Name) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/hardware/racks/.*/switch/.*/switch-port/{}/configuration$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + + pub fn body(self, value: &types::SwitchPortApplySettings) -> Self { + Self(self.0.json_body_obj(value)) + } + } + + pub struct NetworkingSwitchPortActiveConfigurationSetThen(httpmock::Then); + impl NetworkingSwitchPortActiveConfigurationSetThen { + pub fn new(inner: httpmock::Then) -> Self { + Self(inner) + } + + pub fn into_inner(self) -> httpmock::Then { + self.0 + } + + pub fn no_content(self) -> Self { + Self(self.0.status(204u16)) + } + + pub fn client_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 4u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn server_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 5u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + } + + pub struct NetworkingSwitchPortActiveConfigurationClearWhen(httpmock::When); + impl NetworkingSwitchPortActiveConfigurationClearWhen { + pub fn new(inner: httpmock::When) -> Self { + Self( + inner.method(httpmock::Method::DELETE).path_matches( + regex::Regex::new( + "^/v1/system/hardware/racks/[^/]*/switch/[^/]*/switch-port/[^/]*/\ + configuration$", + ) + .unwrap(), + ), + ) + } + + pub fn into_inner(self) -> httpmock::When { + self.0 + } + + pub fn rack_id(self, value: &uuid::Uuid) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/hardware/racks/{}/switch/.*/switch-port/.*/configuration$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + + pub fn switch(self, value: types::SwitchLocation) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/hardware/racks/.*/switch/{}/switch-port/.*/configuration$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + + pub fn port(self, value: &types::Name) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/hardware/racks/.*/switch/.*/switch-port/{}/configuration$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) + } + } + + pub struct NetworkingSwitchPortActiveConfigurationClearThen(httpmock::Then); + impl NetworkingSwitchPortActiveConfigurationClearThen { + pub fn new(inner: httpmock::Then) -> Self { + Self(inner) + } + + pub fn into_inner(self) -> httpmock::Then { + self.0 + } + + pub fn no_content(self) -> Self { + Self(self.0.status(204u16)) + } + + pub fn client_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 4u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + + pub fn server_error(self, status: u16, value: &types::Error) -> Self { + assert_eq!(status / 100u16, 5u16); + Self( + self.0 + .status(status) + .header("content-type", "application/json") + .json_body_obj(value), + ) + } + } + pub struct SledListWhen(httpmock::When); impl SledListWhen { pub fn new(inner: httpmock::When) -> Self { @@ -8850,7 +9102,7 @@ pub mod operations { Self(self.0.query_param("rack_id", value.to_string())) } - pub fn switch_location(self, value: &types::Name) -> Self { + pub fn switch_location(self, value: types::SwitchLocation) -> Self { Self(self.0.query_param("switch_location", value.to_string())) } @@ -8919,7 +9171,7 @@ pub mod operations { Self(self.0.query_param("rack_id", value.to_string())) } - pub fn switch_location(self, value: &types::Name) -> Self { + pub fn switch_location(self, value: types::SwitchLocation) -> Self { Self(self.0.query_param("switch_location", value.to_string())) } } @@ -8984,7 +9236,7 @@ pub mod operations { Self(self.0.query_param("rack_id", value.to_string())) } - pub fn switch_location(self, value: &types::Name) -> Self { + pub fn switch_location(self, value: types::SwitchLocation) -> Self { Self(self.0.query_param("switch_location", value.to_string())) } } @@ -11900,7 +12152,7 @@ pub mod operations { Self( inner .method(httpmock::Method::DELETE) - .path_matches(regex::Regex::new("^/v1/system/networking/bgp$").unwrap()), + .path_matches(regex::Regex::new("^/v1/system/networking/bgp/[^/]*$").unwrap()), ) } @@ -11908,8 +12160,13 @@ pub mod operations { self.0 } - pub fn name_or_id(self, value: &types::NameOrId) -> Self { - Self(self.0.query_param("name_or_id", value.to_string())) + pub fn bgp_config(self, value: &types::NameOrId) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/bgp/{}$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) } } @@ -12076,10 +12333,10 @@ pub mod operations { self.0 } - pub fn created(self, value: &types::BgpAnnounceSet) -> Self { + pub fn ok(self, value: &types::BgpAnnounceSet) -> Self { Self( self.0 - .status(201u16) + .status(200u16) .header("content-type", "application/json") .json_body_obj(value), ) @@ -12875,37 +13132,33 @@ pub mod operations { } } - pub struct NetworkingSwitchPortConfigurationDeleteWhen(httpmock::When); - impl NetworkingSwitchPortConfigurationDeleteWhen { + pub struct NetworkingSwitchPortConfigurationViewWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationViewWhen { pub fn new(inner: httpmock::When) -> Self { - Self(inner.method(httpmock::Method::DELETE).path_matches( - regex::Regex::new("^/v1/system/networking/switch-port-configuration$").unwrap(), - )) + Self( + inner.method(httpmock::Method::GET).path_matches( + regex::Regex::new("^/v1/system/networking/switch-port-configuration/[^/]*$") + .unwrap(), + ), + ) } pub fn into_inner(self) -> httpmock::When { self.0 } - pub fn configuration<'a, T>(self, value: T) -> Self - where - T: Into>, - { - if let Some(value) = value.into() { - Self(self.0.query_param("configuration", value.to_string())) - } else { - Self(self.0.matches(|req| { - req.query_params - .as_ref() - .and_then(|qs| qs.iter().find(|(key, _)| key == "configuration")) - .is_none() - })) - } + pub fn configuration(self, value: &types::NameOrId) -> Self { + let re = regex::Regex::new(&format!( + "^/v1/system/networking/switch-port-configuration/{}$", + value.to_string() + )) + .unwrap(); + Self(self.0.path_matches(re)) } } - pub struct NetworkingSwitchPortConfigurationDeleteThen(httpmock::Then); - impl NetworkingSwitchPortConfigurationDeleteThen { + pub struct NetworkingSwitchPortConfigurationViewThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationViewThen { pub fn new(inner: httpmock::Then) -> Self { Self(inner) } @@ -12914,8 +13167,13 @@ pub mod operations { self.0 } - pub fn no_content(self) -> Self { - Self(self.0.status(204u16)) + pub fn ok(self, value: &types::SwitchPortSettingsView) -> Self { + Self( + self.0 + .status(200u16) + .header("content-type", "application/json") + .json_body_obj(value), + ) } pub fn client_error(self, status: u16, value: &types::Error) -> Self { @@ -12939,11 +13197,11 @@ pub mod operations { } } - pub struct NetworkingSwitchPortConfigurationViewWhen(httpmock::When); - impl NetworkingSwitchPortConfigurationViewWhen { + pub struct NetworkingSwitchPortConfigurationDeleteWhen(httpmock::When); + impl NetworkingSwitchPortConfigurationDeleteWhen { pub fn new(inner: httpmock::When) -> Self { Self( - inner.method(httpmock::Method::GET).path_matches( + inner.method(httpmock::Method::DELETE).path_matches( regex::Regex::new("^/v1/system/networking/switch-port-configuration/[^/]*$") .unwrap(), ), @@ -12964,8 +13222,8 @@ pub mod operations { } } - pub struct NetworkingSwitchPortConfigurationViewThen(httpmock::Then); - impl NetworkingSwitchPortConfigurationViewThen { + pub struct NetworkingSwitchPortConfigurationDeleteThen(httpmock::Then); + impl NetworkingSwitchPortConfigurationDeleteThen { pub fn new(inner: httpmock::Then) -> Self { Self(inner) } @@ -12974,13 +13232,8 @@ pub mod operations { self.0 } - pub fn ok(self, value: &types::SwitchPortSettingsView) -> Self { - Self( - self.0 - .status(200u16) - .header("content-type", "application/json") - .json_body_obj(value), - ) + pub fn no_content(self) -> Self { + Self(self.0.status(204u16)) } pub fn client_error(self, status: u16, value: &types::Error) -> Self { @@ -19109,6 +19362,24 @@ pub trait MockServerExt { fn rack_view(&self, config_fn: F) -> httpmock::Mock where F: FnOnce(operations::RackViewWhen, operations::RackViewThen); + fn networking_switch_port_active_configuration_view(&self, config_fn: F) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortActiveConfigurationViewWhen, + operations::NetworkingSwitchPortActiveConfigurationViewThen, + ); + fn networking_switch_port_active_configuration_set(&self, config_fn: F) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortActiveConfigurationSetWhen, + operations::NetworkingSwitchPortActiveConfigurationSetThen, + ); + fn networking_switch_port_active_configuration_clear(&self, config_fn: F) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortActiveConfigurationClearWhen, + operations::NetworkingSwitchPortActiveConfigurationClearThen, + ); fn sled_list(&self, config_fn: F) -> httpmock::Mock where F: FnOnce(operations::SledListWhen, operations::SledListThen); @@ -19385,18 +19656,18 @@ pub trait MockServerExt { operations::NetworkingSwitchPortConfigurationCreateWhen, operations::NetworkingSwitchPortConfigurationCreateThen, ); - fn networking_switch_port_configuration_delete(&self, config_fn: F) -> httpmock::Mock - where - F: FnOnce( - operations::NetworkingSwitchPortConfigurationDeleteWhen, - operations::NetworkingSwitchPortConfigurationDeleteThen, - ); fn networking_switch_port_configuration_view(&self, config_fn: F) -> httpmock::Mock where F: FnOnce( operations::NetworkingSwitchPortConfigurationViewWhen, operations::NetworkingSwitchPortConfigurationViewThen, ); + fn networking_switch_port_configuration_delete(&self, config_fn: F) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortConfigurationDeleteWhen, + operations::NetworkingSwitchPortConfigurationDeleteThen, + ); fn networking_switch_port_configuration_address_list(&self, config_fn: F) -> httpmock::Mock where F: FnOnce( @@ -20933,6 +21204,51 @@ impl MockServerExt for httpmock::MockServer { }) } + fn networking_switch_port_active_configuration_view(&self, config_fn: F) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortActiveConfigurationViewWhen, + operations::NetworkingSwitchPortActiveConfigurationViewThen, + ), + { + self.mock(|when, then| { + config_fn( + operations::NetworkingSwitchPortActiveConfigurationViewWhen::new(when), + operations::NetworkingSwitchPortActiveConfigurationViewThen::new(then), + ) + }) + } + + fn networking_switch_port_active_configuration_set(&self, config_fn: F) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortActiveConfigurationSetWhen, + operations::NetworkingSwitchPortActiveConfigurationSetThen, + ), + { + self.mock(|when, then| { + config_fn( + operations::NetworkingSwitchPortActiveConfigurationSetWhen::new(when), + operations::NetworkingSwitchPortActiveConfigurationSetThen::new(then), + ) + }) + } + + fn networking_switch_port_active_configuration_clear(&self, config_fn: F) -> httpmock::Mock + where + F: FnOnce( + operations::NetworkingSwitchPortActiveConfigurationClearWhen, + operations::NetworkingSwitchPortActiveConfigurationClearThen, + ), + { + self.mock(|when, then| { + config_fn( + operations::NetworkingSwitchPortActiveConfigurationClearWhen::new(when), + operations::NetworkingSwitchPortActiveConfigurationClearThen::new(then), + ) + }) + } + fn sled_list(&self, config_fn: F) -> httpmock::Mock where F: FnOnce(operations::SledListWhen, operations::SledListThen), @@ -21785,32 +22101,32 @@ impl MockServerExt for httpmock::MockServer { }) } - fn networking_switch_port_configuration_delete(&self, config_fn: F) -> httpmock::Mock + fn networking_switch_port_configuration_view(&self, config_fn: F) -> httpmock::Mock where F: FnOnce( - operations::NetworkingSwitchPortConfigurationDeleteWhen, - operations::NetworkingSwitchPortConfigurationDeleteThen, + operations::NetworkingSwitchPortConfigurationViewWhen, + operations::NetworkingSwitchPortConfigurationViewThen, ), { self.mock(|when, then| { config_fn( - operations::NetworkingSwitchPortConfigurationDeleteWhen::new(when), - operations::NetworkingSwitchPortConfigurationDeleteThen::new(then), + operations::NetworkingSwitchPortConfigurationViewWhen::new(when), + operations::NetworkingSwitchPortConfigurationViewThen::new(then), ) }) } - fn networking_switch_port_configuration_view(&self, config_fn: F) -> httpmock::Mock + fn networking_switch_port_configuration_delete(&self, config_fn: F) -> httpmock::Mock where F: FnOnce( - operations::NetworkingSwitchPortConfigurationViewWhen, - operations::NetworkingSwitchPortConfigurationViewThen, + operations::NetworkingSwitchPortConfigurationDeleteWhen, + operations::NetworkingSwitchPortConfigurationDeleteThen, ), { self.mock(|when, then| { config_fn( - operations::NetworkingSwitchPortConfigurationViewWhen::new(when), - operations::NetworkingSwitchPortConfigurationViewThen::new(then), + operations::NetworkingSwitchPortConfigurationDeleteWhen::new(when), + operations::NetworkingSwitchPortConfigurationDeleteThen::new(then), ) }) } diff --git a/sdk/src/generated_sdk.rs b/sdk/src/generated_sdk.rs index 99821aba..5d671a7f 100644 --- a/sdk/src/generated_sdk.rs +++ b/sdk/src/generated_sdk.rs @@ -53,7 +53,7 @@ pub mod types { /// ], /// "properties": { /// "address": { - /// "description": "The address and prefix length of this address.", + /// "description": "The address and subnet mask", /// "allOf": [ /// { /// "$ref": "#/components/schemas/IpNet" @@ -85,7 +85,7 @@ pub mod types { :: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, schemars :: JsonSchema, )] pub struct Address { - /// The address and prefix length of this address. + /// The address and subnet mask pub address: IpNet, /// The address lot this address is drawn from. pub address_lot: NameOrId, @@ -106,13 +106,14 @@ pub mod types { } } - /// An address to be added or removed from an interface + /// An address to be added to or removed from an interface /// ///
JSON schema /// /// ```json /// { - /// "description": "An address to be added or removed from an interface", + /// "description": "An address to be added to or removed from an + /// interface", /// "type": "object", /// "required": [ /// "address", @@ -121,7 +122,7 @@ pub mod types { /// ], /// "properties": { /// "address": { - /// "description": "The address and prefix length of this address.", + /// "description": "The address and subnet mask", /// "allOf": [ /// { /// "$ref": "#/components/schemas/IpNet" @@ -161,7 +162,7 @@ pub mod types { :: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, schemars :: JsonSchema, )] pub struct AddressAddRemove { - /// The address and prefix length of this address. + /// The address and subnet mask pub address: IpNet, /// The address lot this address is drawn from. pub address_lot: NameOrId, @@ -2505,7 +2506,7 @@ pub mod types { /// ], /// "properties": { /// "addr": { - /// "description": "The address of th e host to peer with.", + /// "description": "The address of the host to peer with.", /// "allOf": [ /// { /// "$ref": "#/components/schemas/IpNet" @@ -2556,16 +2557,16 @@ pub mod types { /// "minimum": 0.0 /// }, /// "idle_hold_time": { - /// "description": "How long to hold a peer in idle before attempting a - /// new session (seconds).", + /// "description": "How long to hold this peer in idle before + /// attempting a new session (seconds).", /// "type": "integer", /// "format": "uint32", /// "minimum": 0.0 /// }, /// "interface_name": { - /// "description": "The name of interface to peer on. This is relative - /// to the port configuration this BGP peer configuration is a part of. For - /// example this value could be phy0 to refer to a primary physical + /// "description": "The name of the interface to peer on. This is + /// relative to the port configuration this BGP peer configuration is a part + /// of. For example this value could be phy0 to refer to a primary physical /// interface. Or it could be vlan47 to refer to a VLAN interface.", /// "type": "string" /// }, @@ -2587,15 +2588,15 @@ pub mod types { /// }, /// "md5_auth_key": { /// "description": "Use the given key for TCP-MD5 authentication with - /// the peer.", + /// this peer.", /// "type": [ /// "string", /// "null" /// ] /// }, /// "min_ttl": { - /// "description": "Require messages from a peer have a minimum IP time - /// to live field.", + /// "description": "Require messages from this peer to have a minimum + /// IP time to live field.", /// "type": [ /// "integer", /// "null" @@ -2604,8 +2605,8 @@ pub mod types { /// "minimum": 0.0 /// }, /// "multi_exit_discriminator": { - /// "description": "Apply the provided multi-exit discriminator (MED) - /// updates sent to the peer.", + /// "description": "Apply a multi-exit discriminator (MED) in updates + /// sent to this peer.", /// "type": [ /// "integer", /// "null" @@ -2614,7 +2615,7 @@ pub mod types { /// "minimum": 0.0 /// }, /// "remote_asn": { - /// "description": "Require that a peer has a specified ASN.", + /// "description": "Require that this peer have a specified ASN.", /// "type": [ /// "integer", /// "null" @@ -2623,7 +2624,7 @@ pub mod types { /// "minimum": 0.0 /// }, /// "vlan_id": { - /// "description": "Associate a VLAN ID with a peer.", + /// "description": "Associate a VLAN ID with this peer.", /// "type": [ /// "integer", /// "null" @@ -2639,7 +2640,7 @@ pub mod types { :: serde :: Deserialize, :: serde :: Serialize, Clone, Debug, schemars :: JsonSchema, )] pub struct BgpPeer { - /// The address of th e host to peer with. + /// The address of the host to peer with. pub addr: IpNet, /// Enable export policies pub allow_export_list_active: bool, @@ -2658,10 +2659,10 @@ pub mod types { pub enforce_first_as: bool, /// How long to hold peer connections between keepalives (seconds). pub hold_time: u32, - /// How long to hold a peer in idle before attempting a new session + /// How long to hold this peer in idle before attempting a new session /// (seconds). pub idle_hold_time: u32, - /// The name of interface to peer on. This is relative to the port + /// The name of the interface to peer on. This is relative to the port /// configuration this BGP peer configuration is a part of. For example /// this value could be phy0 to refer to a primary physical interface. /// Or it could be vlan47 to refer to a VLAN interface. @@ -2671,20 +2672,20 @@ pub mod types { /// Apply a local preference to routes received from this peer. #[serde(default, skip_serializing_if = "Option::is_none")] pub local_pref: Option, - /// Use the given key for TCP-MD5 authentication with the peer. + /// Use the given key for TCP-MD5 authentication with this peer. #[serde(default, skip_serializing_if = "Option::is_none")] pub md5_auth_key: Option, - /// Require messages from a peer have a minimum IP time to live field. + /// Require messages from this peer to have a minimum IP time to live + /// field. #[serde(default, skip_serializing_if = "Option::is_none")] pub min_ttl: Option, - /// Apply the provided multi-exit discriminator (MED) updates sent to - /// the peer. + /// Apply a multi-exit discriminator (MED) in updates sent to this peer. #[serde(default, skip_serializing_if = "Option::is_none")] pub multi_exit_discriminator: Option, - /// Require that a peer has a specified ASN. + /// Require that this peer have a specified ASN. #[serde(default, skip_serializing_if = "Option::is_none")] pub remote_asn: Option, - /// Associate a VLAN ID with a peer. + /// Associate a VLAN ID with this peer. #[serde(default, skip_serializing_if = "Option::is_none")] pub vlan_id: Option, } @@ -2738,7 +2739,7 @@ pub mod types { /// "format": "ip" /// }, /// "allowed_export": { - /// "description": "Define export policy for a peer.", + /// "description": "Define export policy for this peer.", /// "allOf": [ /// { /// "$ref": "#/components/schemas/ImportExportPolicy" @@ -2746,7 +2747,7 @@ pub mod types { /// ] /// }, /// "allowed_import": { - /// "description": "Define import policy for a peer.", + /// "description": "Define import policy for this peer.", /// "allOf": [ /// { /// "$ref": "#/components/schemas/ImportExportPolicy" @@ -2764,7 +2765,7 @@ pub mod types { /// }, /// "communities": { /// "description": "Include the provided communities in updates sent to - /// the peer.", + /// this peer.", /// "type": "array", /// "items": { /// "type": "integer", @@ -2806,9 +2807,9 @@ pub mod types { /// "minimum": 0.0 /// }, /// "interface_name": { - /// "description": "The name of interface to peer on. This is relative - /// to the port configuration this BGP peer configuration is a part of. For - /// example this value could be phy0 to refer to a primary physical + /// "description": "The name of the interface to peer on. This is + /// relative to the port configuration this BGP peer configuration is a part + /// of. For example this value could be phy0 to refer to a primary physical /// interface. Or it could be vlan47 to refer to a VLAN interface.", /// "type": "string" /// }, @@ -2830,15 +2831,15 @@ pub mod types { /// }, /// "md5_auth_key": { /// "description": "Use the given key for TCP-MD5 authentication with - /// the peer.", + /// this peer.", /// "type": [ /// "string", /// "null" /// ] /// }, /// "min_ttl": { - /// "description": "Require messages from a peer have a minimum IP time - /// to live field.", + /// "description": "Require messages from this peer have a minimum IP + /// time to live field.", /// "type": [ /// "integer", /// "null" @@ -2847,8 +2848,8 @@ pub mod types { /// "minimum": 0.0 /// }, /// "multi_exit_discriminator": { - /// "description": "Apply the provided multi-exit discriminator (MED) - /// updates sent to the peer.", + /// "description": "Apply a multi-exit discriminator (MED) in updates + /// sent to this peer.", /// "type": [ /// "integer", /// "null" @@ -2857,7 +2858,7 @@ pub mod types { /// "minimum": 0.0 /// }, /// "remote_asn": { - /// "description": "Require that a peer has a specified ASN.", + /// "description": "Require that this peer has a specified ASN.", /// "type": [ /// "integer", /// "null" @@ -2866,7 +2867,7 @@ pub mod types { /// "minimum": 0.0 /// }, /// "vlan_id": { - /// "description": "Associate a VLAN ID with a peer.", + /// "description": "Associate a VLAN ID with this peer.", /// "type": [ /// "integer", /// "null" @@ -2884,14 +2885,14 @@ pub mod types { pub struct BgpPeerCombined { /// The address of the host to peer with. pub addr: std::net::IpAddr, - /// Define export policy for a peer. + /// Define export policy for this peer. pub allowed_export: ImportExportPolicy, - /// Define import policy for a peer. + /// Define import policy for this peer. pub allowed_import: ImportExportPolicy, /// The global BGP configuration used for establishing a session with /// this peer. pub bgp_config: NameOrId, - /// Include the provided communities in updates sent to the peer. + /// Include the provided communities in updates sent to this peer. pub communities: Vec, /// How long to to wait between TCP connection retries (seconds). pub connect_retry: u32, @@ -2906,7 +2907,7 @@ pub mod types { /// How long to hold a peer in idle before attempting a new session /// (seconds). pub idle_hold_time: u32, - /// The name of interface to peer on. This is relative to the port + /// The name of the interface to peer on. This is relative to the port /// configuration this BGP peer configuration is a part of. For example /// this value could be phy0 to refer to a primary physical interface. /// Or it could be vlan47 to refer to a VLAN interface. @@ -2916,20 +2917,20 @@ pub mod types { /// Apply a local preference to routes received from this peer. #[serde(default, skip_serializing_if = "Option::is_none")] pub local_pref: Option, - /// Use the given key for TCP-MD5 authentication with the peer. + /// Use the given key for TCP-MD5 authentication with this peer. #[serde(default, skip_serializing_if = "Option::is_none")] pub md5_auth_key: Option, - /// Require messages from a peer have a minimum IP time to live field. + /// Require messages from this peer have a minimum IP time to live + /// field. #[serde(default, skip_serializing_if = "Option::is_none")] pub min_ttl: Option, - /// Apply the provided multi-exit discriminator (MED) updates sent to - /// the peer. + /// Apply a multi-exit discriminator (MED) in updates sent to this peer. #[serde(default, skip_serializing_if = "Option::is_none")] pub multi_exit_discriminator: Option, - /// Require that a peer has a specified ASN. + /// Require that this peer has a specified ASN. #[serde(default, skip_serializing_if = "Option::is_none")] pub remote_asn: Option, - /// Associate a VLAN ID with a peer. + /// Associate a VLAN ID with this peer. #[serde(default, skip_serializing_if = "Option::is_none")] pub vlan_id: Option, } @@ -3015,9 +3016,9 @@ pub mod types { /// ] /// }, /// "interface_name": { - /// "description": "The name of interface to peer on. This is relative - /// to the port configuration this BGP peer configuration is a part of. For - /// example this value could be phy0 to refer to a primary physical + /// "description": "The name of the interface to peer on. This is + /// relative to the port configuration this BGP peer configuration is a part + /// of. For example this value could be phy0 to refer to a primary physical /// interface. Or it could be vlan47 to refer to a VLAN interface.", /// "type": "string" /// } @@ -3034,7 +3035,7 @@ pub mod types { /// The global BGP configuration used for establishing a session with /// this peer. pub bgp_config: NameOrId, - /// The name of interface to peer on. This is relative to the port + /// The name of the interface to peer on. This is relative to the port /// configuration this BGP peer configuration is a part of. For example /// this value could be phy0 to refer to a primary physical interface. /// Or it could be vlan47 to refer to a VLAN interface. @@ -19394,7 +19395,7 @@ pub mod types { /// }, /// "rib_priority": { /// "description": "Local preference for route. Higher preference - /// indictes precedence within and across protocols.", + /// indicates precedence within and across protocols.", /// "type": [ /// "integer", /// "null" @@ -19423,7 +19424,7 @@ pub mod types { pub dst: IpNet, /// The route gateway. pub gw: std::net::IpAddr, - /// Local preference for route. Higher preference indictes precedence + /// Local preference for route. Higher preference indicates precedence /// within and across protocols. #[serde(default, skip_serializing_if = "Option::is_none")] pub rib_priority: Option, @@ -19444,15 +19445,14 @@ pub mod types { } } - /// A route to a destination network through a gateway address to add or - /// remove to an interface. + /// A network route to to add to or remove from an interface. /// ///
JSON schema /// /// ```json /// { - /// "description": "A route to a destination network through a gateway - /// address to add or remove to an interface.", + /// "description": "A network route to to add to or remove from an + /// interface.", /// "type": "object", /// "required": [ /// "dst", @@ -19481,14 +19481,14 @@ pub mod types { /// } /// ] /// }, - /// "local_pref": { + /// "rib_priority": { /// "description": "Local preference for route. Higher preference - /// indictes precedence within and across protocols.", + /// indicates precedence within and across protocols.", /// "type": [ /// "integer", /// "null" /// ], - /// "format": "uint32", + /// "format": "uint8", /// "minimum": 0.0 /// }, /// "vid": { @@ -19514,10 +19514,10 @@ pub mod types { pub gw: std::net::IpAddr, /// The interface to configure the route on pub interface: Name, - /// Local preference for route. Higher preference indictes precedence + /// Local preference for route. Higher preference indicates precedence /// within and across protocols. #[serde(default, skip_serializing_if = "Option::is_none")] - pub local_pref: Option, + pub rib_priority: Option, /// VLAN id the gateway is reachable over. #[serde(default, skip_serializing_if = "Option::is_none")] pub vid: Option, @@ -24201,7 +24201,6 @@ pub mod types { /// "autoneg", /// "fec", /// "link_name", - /// "lldp_link_config_id", /// "mtu", /// "port_settings_id", /// "speed" @@ -24227,7 +24226,10 @@ pub mod types { /// "lldp_link_config_id": { /// "description": "The link-layer discovery protocol service /// configuration id for this link.", - /// "type": "string", + /// "type": [ + /// "string", + /// "null" + /// ], /// "format": "uuid" /// }, /// "mtu": { @@ -24266,7 +24268,8 @@ pub mod types { pub link_name: String, /// The link-layer discovery protocol service configuration id for this /// link. - pub lldp_link_config_id: uuid::Uuid, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub lldp_link_config_id: Option, /// The maximum transmission unit for this link. pub mtu: u16, /// The port settings this link configuration belongs to. @@ -25680,7 +25683,8 @@ pub mod types { /// "nanoseconds", /// "volts", /// "amps", - /// "degrees_celcius" + /// "watts", + /// "degrees_celsius" /// ] /// }, /// { @@ -25728,8 +25732,10 @@ pub mod types { Volts, #[serde(rename = "amps")] Amps, - #[serde(rename = "degrees_celcius")] - DegreesCelcius, + #[serde(rename = "watts")] + Watts, + #[serde(rename = "degrees_celsius")] + DegreesCelsius, /// No meaningful units, e.g. a dimensionless quanity. #[serde(rename = "none")] None, @@ -25771,7 +25777,8 @@ pub mod types { "nanoseconds" => Ok(Self::Nanoseconds), "volts" => Ok(Self::Volts), "amps" => Ok(Self::Amps), - "degrees_celcius" => Ok(Self::DegreesCelcius), + "watts" => Ok(Self::Watts), + "degrees_celsius" => Ok(Self::DegreesCelsius), "none" => Ok(Self::None), "rpm" => Ok(Self::Rpm), _ => Err("invalid value".into()), @@ -42775,7 +42782,7 @@ pub mod types { dst: Result, gw: Result, interface: Result, - local_pref: Result, String>, + rib_priority: Result, String>, vid: Result, String>, } @@ -42785,7 +42792,7 @@ pub mod types { dst: Err("no value supplied for dst".to_string()), gw: Err("no value supplied for gw".to_string()), interface: Err("no value supplied for interface".to_string()), - local_pref: Ok(Default::default()), + rib_priority: Ok(Default::default()), vid: Ok(Default::default()), } } @@ -42822,14 +42829,14 @@ pub mod types { .map_err(|e| format!("error converting supplied value for interface: {}", e)); self } - pub fn local_pref(mut self, value: T) -> Self + pub fn rib_priority(mut self, value: T) -> Self where - T: std::convert::TryInto>, + T: std::convert::TryInto>, T::Error: std::fmt::Display, { - self.local_pref = value - .try_into() - .map_err(|e| format!("error converting supplied value for local_pref: {}", e)); + self.rib_priority = value.try_into().map_err(|e| { + format!("error converting supplied value for rib_priority: {}", e) + }); self } pub fn vid(mut self, value: T) -> Self @@ -42851,7 +42858,7 @@ pub mod types { dst: value.dst?, gw: value.gw?, interface: value.interface?, - local_pref: value.local_pref?, + rib_priority: value.rib_priority?, vid: value.vid?, }) } @@ -42863,7 +42870,7 @@ pub mod types { dst: Ok(value.dst), gw: Ok(value.gw), interface: Ok(value.interface), - local_pref: Ok(value.local_pref), + rib_priority: Ok(value.rib_priority), vid: Ok(value.vid), } } @@ -46597,7 +46604,7 @@ pub mod types { autoneg: Result, fec: Result, link_name: Result, - lldp_link_config_id: Result, + lldp_link_config_id: Result, String>, mtu: Result, port_settings_id: Result, speed: Result, @@ -46609,9 +46616,7 @@ pub mod types { autoneg: Err("no value supplied for autoneg".to_string()), fec: Err("no value supplied for fec".to_string()), link_name: Err("no value supplied for link_name".to_string()), - lldp_link_config_id: Err( - "no value supplied for lldp_link_config_id".to_string() - ), + lldp_link_config_id: Ok(Default::default()), mtu: Err("no value supplied for mtu".to_string()), port_settings_id: Err("no value supplied for port_settings_id".to_string()), speed: Err("no value supplied for speed".to_string()), @@ -46652,7 +46657,7 @@ pub mod types { } pub fn lldp_link_config_id(mut self, value: T) -> Self where - T: std::convert::TryInto, + T: std::convert::TryInto>, T::Error: std::fmt::Display, { self.lldp_link_config_id = value.try_into().map_err(|e| { @@ -52106,6 +52111,8 @@ pub trait ClientSilosExt { /// /// Sends a `GET` request to `/v1/certificates/{certificate}` /// + /// Arguments: + /// - `certificate`: Name or ID of the certificate /// ```ignore /// let response = client.certificate_view() /// .certificate(certificate) @@ -52119,6 +52126,8 @@ pub trait ClientSilosExt { /// /// Sends a `DELETE` request to `/v1/certificates/{certificate}` /// + /// Arguments: + /// - `certificate`: Name or ID of the certificate /// ```ignore /// let response = client.certificate_delete() /// .certificate(certificate) @@ -52399,7 +52408,7 @@ pub trait ClientSystemHardwareExt { /// Sends a `GET` request to `/v1/system/hardware/racks/{rack_id}` /// /// Arguments: - /// - `rack_id`: The rack's unique ID. + /// - `rack_id`: ID of the rack /// ```ignore /// let response = client.rack_view() /// .rack_id(rack_id) @@ -52407,6 +52416,71 @@ pub trait ClientSystemHardwareExt { /// .await; /// ``` fn rack_view(&self) -> builder::RackView; + /// View switch port configuration + /// + /// Sends a `GET` request to + /// `/v1/system/hardware/racks/{rack_id}/switch/{switch}/switch-port/{port}/ + /// configuration` + /// + /// Arguments: + /// - `rack_id`: A rack id to use when selecting switch ports. + /// - `switch`: A switch location to use when selecting switch ports. + /// - `port`: A name to use when selecting switch ports. + /// ```ignore + /// let response = client.networking_switch_port_active_configuration_view() + /// .rack_id(rack_id) + /// .switch(switch) + /// .port(port) + /// .send() + /// .await; + /// ``` + fn networking_switch_port_active_configuration_view( + &self, + ) -> builder::NetworkingSwitchPortActiveConfigurationView; + /// Set switch port configuration + /// + /// Sends a `PUT` request to + /// `/v1/system/hardware/racks/{rack_id}/switch/{switch}/switch-port/{port}/ + /// configuration` + /// + /// Arguments: + /// - `rack_id`: A rack id to use when selecting switch ports. + /// - `switch`: A switch location to use when selecting switch ports. + /// - `port`: A name to use when selecting switch ports. + /// - `body` + /// ```ignore + /// let response = client.networking_switch_port_active_configuration_set() + /// .rack_id(rack_id) + /// .switch(switch) + /// .port(port) + /// .body(body) + /// .send() + /// .await; + /// ``` + fn networking_switch_port_active_configuration_set( + &self, + ) -> builder::NetworkingSwitchPortActiveConfigurationSet; + /// Clear switch port configuration + /// + /// Sends a `DELETE` request to + /// `/v1/system/hardware/racks/{rack_id}/switch/{switch}/switch-port/{port}/ + /// configuration` + /// + /// Arguments: + /// - `rack_id`: A rack id to use when selecting switch ports. + /// - `switch`: A switch location to use when selecting switch ports. + /// - `port`: A name to use when selecting switch ports. + /// ```ignore + /// let response = client.networking_switch_port_active_configuration_clear() + /// .rack_id(rack_id) + /// .switch(switch) + /// .port(port) + /// .send() + /// .await; + /// ``` + fn networking_switch_port_active_configuration_clear( + &self, + ) -> builder::NetworkingSwitchPortActiveConfigurationClear; /// List sleds /// /// Sends a `GET` request to `/v1/system/hardware/sleds` @@ -52650,6 +52724,24 @@ impl ClientSystemHardwareExt for Client { builder::RackView::new(self) } + fn networking_switch_port_active_configuration_view( + &self, + ) -> builder::NetworkingSwitchPortActiveConfigurationView { + builder::NetworkingSwitchPortActiveConfigurationView::new(self) + } + + fn networking_switch_port_active_configuration_set( + &self, + ) -> builder::NetworkingSwitchPortActiveConfigurationSet { + builder::NetworkingSwitchPortActiveConfigurationSet::new(self) + } + + fn networking_switch_port_active_configuration_clear( + &self, + ) -> builder::NetworkingSwitchPortActiveConfigurationClear { + builder::NetworkingSwitchPortActiveConfigurationClear::new(self) + } + fn sled_list(&self) -> builder::SledList { builder::SledList::new(self) } @@ -53261,13 +53353,13 @@ pub trait ClientSystemNetworkingExt { fn networking_bgp_config_create(&self) -> builder::NetworkingBgpConfigCreate; /// Delete BGP configuration /// - /// Sends a `DELETE` request to `/v1/system/networking/bgp` + /// Sends a `DELETE` request to `/v1/system/networking/bgp/{bgp_config}` /// /// Arguments: - /// - `name_or_id`: A name or id to use when selecting BGP config. + /// - `bgp_config`: A name or id to use when selecting BGP config. /// ```ignore /// let response = client.networking_bgp_config_delete() - /// .name_or_id(name_or_id) + /// .bgp_config(bgp_config) /// .send() /// .await; /// ``` @@ -53469,40 +53561,40 @@ pub trait ClientSystemNetworkingExt { fn networking_switch_port_configuration_create( &self, ) -> builder::NetworkingSwitchPortConfigurationCreate; - /// Delete switch port settings + /// View a switch port configuration /// - /// Sends a `DELETE` request to - /// `/v1/system/networking/switch-port-configuration` + /// Sends a `GET` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}` /// /// Arguments: - /// - `configuration`: An optional name or id to use when selecting a switch - /// port configuration. + /// - `configuration`: A name or id to use when selecting a switch port + /// configuration. /// ```ignore - /// let response = client.networking_switch_port_configuration_delete() + /// let response = client.networking_switch_port_configuration_view() /// .configuration(configuration) /// .send() /// .await; /// ``` - fn networking_switch_port_configuration_delete( + fn networking_switch_port_configuration_view( &self, - ) -> builder::NetworkingSwitchPortConfigurationDelete; - /// Get information about a named set of switch-port-settings + ) -> builder::NetworkingSwitchPortConfigurationView; + /// Delete switch port settings /// - /// Sends a `GET` request to + /// Sends a `DELETE` request to /// `/v1/system/networking/switch-port-configuration/{configuration}` /// /// Arguments: /// - `configuration`: A name or id to use when selecting a switch port /// configuration. /// ```ignore - /// let response = client.networking_switch_port_configuration_view() + /// let response = client.networking_switch_port_configuration_delete() /// .configuration(configuration) /// .send() /// .await; /// ``` - fn networking_switch_port_configuration_view( + fn networking_switch_port_configuration_delete( &self, - ) -> builder::NetworkingSwitchPortConfigurationView; + ) -> builder::NetworkingSwitchPortConfigurationDelete; /// List addresses assigned to a provided interface configuration /// /// Sends a `GET` request to @@ -54085,18 +54177,18 @@ impl ClientSystemNetworkingExt for Client { builder::NetworkingSwitchPortConfigurationCreate::new(self) } - fn networking_switch_port_configuration_delete( - &self, - ) -> builder::NetworkingSwitchPortConfigurationDelete { - builder::NetworkingSwitchPortConfigurationDelete::new(self) - } - fn networking_switch_port_configuration_view( &self, ) -> builder::NetworkingSwitchPortConfigurationView { builder::NetworkingSwitchPortConfigurationView::new(self) } + fn networking_switch_port_configuration_delete( + &self, + ) -> builder::NetworkingSwitchPortConfigurationDelete { + builder::NetworkingSwitchPortConfigurationDelete::new(self) + } + fn networking_switch_port_configuration_address_list( &self, ) -> builder::NetworkingSwitchPortConfigurationAddressList { @@ -54289,7 +54381,7 @@ pub trait ClientSystemSilosExt { /// `/v1/system/identity-providers/local/users/{user_id}` /// /// Arguments: - /// - `user_id`: The user's internal id + /// - `user_id`: The user's internal ID /// - `silo`: Name or ID of the silo /// ```ignore /// let response = client.local_idp_user_delete() @@ -54308,7 +54400,7 @@ pub trait ClientSystemSilosExt { /// `/v1/system/identity-providers/local/users/{user_id}/set-password` /// /// Arguments: - /// - `user_id`: The user's internal id + /// - `user_id`: The user's internal ID /// - `silo`: Name or ID of the silo /// - `body` /// ```ignore @@ -54536,7 +54628,7 @@ pub trait ClientSystemSilosExt { /// Sends a `GET` request to `/v1/system/users/{user_id}` /// /// Arguments: - /// - `user_id`: The user's internal id + /// - `user_id`: The user's internal ID /// - `silo`: Name or ID of the silo /// ```ignore /// let response = client.silo_user_view() @@ -65862,6 +65954,329 @@ pub mod builder { } } + /// Builder for + /// [`ClientSystemHardwareExt::networking_switch_port_active_configuration_view`] + /// + /// [`ClientSystemHardwareExt::networking_switch_port_active_configuration_view`]: super::ClientSystemHardwareExt::networking_switch_port_active_configuration_view + #[derive(Debug, Clone)] + pub struct NetworkingSwitchPortActiveConfigurationView<'a> { + client: &'a super::Client, + rack_id: Result, + switch: Result, + port: Result, + } + + impl<'a> NetworkingSwitchPortActiveConfigurationView<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client: client, + rack_id: Err("rack_id was not initialized".to_string()), + switch: Err("switch was not initialized".to_string()), + port: Err("port was not initialized".to_string()), + } + } + + pub fn rack_id(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.rack_id = value + .try_into() + .map_err(|_| "conversion to `uuid :: Uuid` for rack_id failed".to_string()); + self + } + + pub fn switch(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.switch = value + .try_into() + .map_err(|_| "conversion to `SwitchLocation` for switch failed".to_string()); + self + } + + pub fn port(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.port = value + .try_into() + .map_err(|_| "conversion to `Name` for port failed".to_string()); + self + } + + /// Sends a `GET` request to + /// `/v1/system/hardware/racks/{rack_id}/switch/{switch}/switch-port/ + /// {port}/configuration` + pub async fn send( + self, + ) -> Result, Error> { + let Self { + client, + rack_id, + switch, + port, + } = self; + let rack_id = rack_id.map_err(Error::InvalidRequest)?; + let switch = switch.map_err(Error::InvalidRequest)?; + let port = port.map_err(Error::InvalidRequest)?; + let url = format!( + "{}/v1/system/hardware/racks/{}/switch/{}/switch-port/{}/configuration", + client.baseurl, + encode_path(&rack_id.to_string()), + encode_path(&switch.to_string()), + encode_path(&port.to_string()), + ); + #[allow(unused_mut)] + let mut request = client + .client + .get(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 200u16 => ResponseValue::from_response(response).await, + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + } + + /// Builder for + /// [`ClientSystemHardwareExt::networking_switch_port_active_configuration_set`] + /// + /// [`ClientSystemHardwareExt::networking_switch_port_active_configuration_set`]: super::ClientSystemHardwareExt::networking_switch_port_active_configuration_set + #[derive(Debug, Clone)] + pub struct NetworkingSwitchPortActiveConfigurationSet<'a> { + client: &'a super::Client, + rack_id: Result, + switch: Result, + port: Result, + body: Result, + } + + impl<'a> NetworkingSwitchPortActiveConfigurationSet<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client: client, + rack_id: Err("rack_id was not initialized".to_string()), + switch: Err("switch was not initialized".to_string()), + port: Err("port was not initialized".to_string()), + body: Ok(types::builder::SwitchPortApplySettings::default()), + } + } + + pub fn rack_id(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.rack_id = value + .try_into() + .map_err(|_| "conversion to `uuid :: Uuid` for rack_id failed".to_string()); + self + } + + pub fn switch(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.switch = value + .try_into() + .map_err(|_| "conversion to `SwitchLocation` for switch failed".to_string()); + self + } + + pub fn port(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.port = value + .try_into() + .map_err(|_| "conversion to `Name` for port failed".to_string()); + self + } + + pub fn body(mut self, value: V) -> Self + where + V: std::convert::TryInto, + >::Error: std::fmt::Display, + { + self.body = value.try_into().map(From::from).map_err(|s| { + format!( + "conversion to `SwitchPortApplySettings` for body failed: {}", + s + ) + }); + self + } + + pub fn body_map(mut self, f: F) -> Self + where + F: std::ops::FnOnce( + types::builder::SwitchPortApplySettings, + ) -> types::builder::SwitchPortApplySettings, + { + self.body = self.body.map(f); + self + } + + /// Sends a `PUT` request to + /// `/v1/system/hardware/racks/{rack_id}/switch/{switch}/switch-port/ + /// {port}/configuration` + pub async fn send(self) -> Result, Error> { + let Self { + client, + rack_id, + switch, + port, + body, + } = self; + let rack_id = rack_id.map_err(Error::InvalidRequest)?; + let switch = switch.map_err(Error::InvalidRequest)?; + let port = port.map_err(Error::InvalidRequest)?; + let body = body + .and_then(|v| { + types::SwitchPortApplySettings::try_from(v).map_err(|e| e.to_string()) + }) + .map_err(Error::InvalidRequest)?; + let url = format!( + "{}/v1/system/hardware/racks/{}/switch/{}/switch-port/{}/configuration", + client.baseurl, + encode_path(&rack_id.to_string()), + encode_path(&switch.to_string()), + encode_path(&port.to_string()), + ); + #[allow(unused_mut)] + let mut request = client + .client + .put(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .json(&body) + .build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + } + + /// Builder for + /// [`ClientSystemHardwareExt::networking_switch_port_active_configuration_clear`] + /// + /// [`ClientSystemHardwareExt::networking_switch_port_active_configuration_clear`]: super::ClientSystemHardwareExt::networking_switch_port_active_configuration_clear + #[derive(Debug, Clone)] + pub struct NetworkingSwitchPortActiveConfigurationClear<'a> { + client: &'a super::Client, + rack_id: Result, + switch: Result, + port: Result, + } + + impl<'a> NetworkingSwitchPortActiveConfigurationClear<'a> { + pub fn new(client: &'a super::Client) -> Self { + Self { + client: client, + rack_id: Err("rack_id was not initialized".to_string()), + switch: Err("switch was not initialized".to_string()), + port: Err("port was not initialized".to_string()), + } + } + + pub fn rack_id(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.rack_id = value + .try_into() + .map_err(|_| "conversion to `uuid :: Uuid` for rack_id failed".to_string()); + self + } + + pub fn switch(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.switch = value + .try_into() + .map_err(|_| "conversion to `SwitchLocation` for switch failed".to_string()); + self + } + + pub fn port(mut self, value: V) -> Self + where + V: std::convert::TryInto, + { + self.port = value + .try_into() + .map_err(|_| "conversion to `Name` for port failed".to_string()); + self + } + + /// Sends a `DELETE` request to + /// `/v1/system/hardware/racks/{rack_id}/switch/{switch}/switch-port/ + /// {port}/configuration` + pub async fn send(self) -> Result, Error> { + let Self { + client, + rack_id, + switch, + port, + } = self; + let rack_id = rack_id.map_err(Error::InvalidRequest)?; + let switch = switch.map_err(Error::InvalidRequest)?; + let port = port.map_err(Error::InvalidRequest)?; + let url = format!( + "{}/v1/system/hardware/racks/{}/switch/{}/switch-port/{}/configuration", + client.baseurl, + encode_path(&rack_id.to_string()), + encode_path(&switch.to_string()), + encode_path(&port.to_string()), + ); + #[allow(unused_mut)] + let mut request = client + .client + .delete(url) + .header( + reqwest::header::ACCEPT, + reqwest::header::HeaderValue::from_static("application/json"), + ) + .build()?; + let result = client.client.execute(request).await; + let response = result?; + match response.status().as_u16() { + 204u16 => Ok(ResponseValue::empty(response)), + 400u16..=499u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + 500u16..=599u16 => Err(Error::ErrorResponse( + ResponseValue::from_response(response).await?, + )), + _ => Err(Error::UnexpectedResponse(response)), + } + } + } + /// Builder for [`ClientSystemHardwareExt::sled_list`] /// /// [`ClientSystemHardwareExt::sled_list`]: super::ClientSystemHardwareExt::sled_list @@ -66884,7 +67299,7 @@ pub mod builder { client: &'a super::Client, port: Result, rack_id: Result, - switch_location: Result, + switch_location: Result, body: Result, } @@ -66921,11 +67336,11 @@ pub mod builder { pub fn switch_location(mut self, value: V) -> Self where - V: std::convert::TryInto, + V: std::convert::TryInto, { - self.switch_location = value - .try_into() - .map_err(|_| "conversion to `Name` for switch_location failed".to_string()); + self.switch_location = value.try_into().map_err(|_| { + "conversion to `SwitchLocation` for switch_location failed".to_string() + }); self } @@ -67014,7 +67429,7 @@ pub mod builder { client: &'a super::Client, port: Result, rack_id: Result, - switch_location: Result, + switch_location: Result, } impl<'a> NetworkingSwitchPortClearSettings<'a> { @@ -67049,11 +67464,11 @@ pub mod builder { pub fn switch_location(mut self, value: V) -> Self where - V: std::convert::TryInto, + V: std::convert::TryInto, { - self.switch_location = value - .try_into() - .map_err(|_| "conversion to `Name` for switch_location failed".to_string()); + self.switch_location = value.try_into().map_err(|_| { + "conversion to `SwitchLocation` for switch_location failed".to_string() + }); self } @@ -67110,7 +67525,7 @@ pub mod builder { client: &'a super::Client, port: Result, rack_id: Result, - switch_location: Result, + switch_location: Result, } impl<'a> NetworkingSwitchPortStatus<'a> { @@ -67145,11 +67560,11 @@ pub mod builder { pub fn switch_location(mut self, value: V) -> Self where - V: std::convert::TryInto, + V: std::convert::TryInto, { - self.switch_location = value - .try_into() - .map_err(|_| "conversion to `Name` for switch_location failed".to_string()); + self.switch_location = value.try_into().map_err(|_| { + "conversion to `SwitchLocation` for switch_location failed".to_string() + }); self } @@ -70919,34 +71334,36 @@ pub mod builder { #[derive(Debug, Clone)] pub struct NetworkingBgpConfigDelete<'a> { client: &'a super::Client, - name_or_id: Result, + bgp_config: Result, } impl<'a> NetworkingBgpConfigDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, - name_or_id: Err("name_or_id was not initialized".to_string()), + bgp_config: Err("bgp_config was not initialized".to_string()), } } - pub fn name_or_id(mut self, value: V) -> Self + pub fn bgp_config(mut self, value: V) -> Self where V: std::convert::TryInto, { - self.name_or_id = value + self.bgp_config = value .try_into() - .map_err(|_| "conversion to `NameOrId` for name_or_id failed".to_string()); + .map_err(|_| "conversion to `NameOrId` for bgp_config failed".to_string()); self } - /// Sends a `DELETE` request to `/v1/system/networking/bgp` + /// Sends a `DELETE` request to `/v1/system/networking/bgp/{bgp_config}` pub async fn send(self) -> Result, Error> { - let Self { client, name_or_id } = self; - let name_or_id = name_or_id.map_err(Error::InvalidRequest)?; - let url = format!("{}/v1/system/networking/bgp", client.baseurl,); - let mut query = Vec::with_capacity(1usize); - query.push(("name_or_id", name_or_id.to_string())); + let Self { client, bgp_config } = self; + let bgp_config = bgp_config.map_err(Error::InvalidRequest)?; + let url = format!( + "{}/v1/system/networking/bgp/{}", + client.baseurl, + encode_path(&bgp_config.to_string()), + ); #[allow(unused_mut)] let mut request = client .client @@ -70955,7 +71372,6 @@ pub mod builder { reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; @@ -71139,7 +71555,7 @@ pub mod builder { let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, + 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), @@ -72088,20 +72504,20 @@ pub mod builder { } /// Builder for - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_delete`] + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_view`] /// - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_delete`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_delete + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_view`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_view #[derive(Debug, Clone)] - pub struct NetworkingSwitchPortConfigurationDelete<'a> { + pub struct NetworkingSwitchPortConfigurationView<'a> { client: &'a super::Client, - configuration: Result, String>, + configuration: Result, } - impl<'a> NetworkingSwitchPortConfigurationDelete<'a> { + impl<'a> NetworkingSwitchPortConfigurationView<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, - configuration: Ok(None), + configuration: Err("configuration was not initialized".to_string()), } } @@ -72111,41 +72527,38 @@ pub mod builder { { self.configuration = value .try_into() - .map(Some) .map_err(|_| "conversion to `NameOrId` for configuration failed".to_string()); self } - /// Sends a `DELETE` request to - /// `/v1/system/networking/switch-port-configuration` - pub async fn send(self) -> Result, Error> { + /// Sends a `GET` request to + /// `/v1/system/networking/switch-port-configuration/{configuration}` + pub async fn send( + self, + ) -> Result, Error> { let Self { client, configuration, } = self; let configuration = configuration.map_err(Error::InvalidRequest)?; let url = format!( - "{}/v1/system/networking/switch-port-configuration", + "{}/v1/system/networking/switch-port-configuration/{}", client.baseurl, + encode_path(&configuration.to_string()), ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &configuration { - query.push(("configuration", v.to_string())); - } #[allow(unused_mut)] let mut request = client .client - .delete(url) + .get(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), ) - .query(&query) .build()?; let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { - 204u16 => Ok(ResponseValue::empty(response)), + 200u16 => ResponseValue::from_response(response).await, 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), @@ -72158,16 +72571,16 @@ pub mod builder { } /// Builder for - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_view`] + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_delete`] /// - /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_view`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_view + /// [`ClientSystemNetworkingExt::networking_switch_port_configuration_delete`]: super::ClientSystemNetworkingExt::networking_switch_port_configuration_delete #[derive(Debug, Clone)] - pub struct NetworkingSwitchPortConfigurationView<'a> { + pub struct NetworkingSwitchPortConfigurationDelete<'a> { client: &'a super::Client, configuration: Result, } - impl<'a> NetworkingSwitchPortConfigurationView<'a> { + impl<'a> NetworkingSwitchPortConfigurationDelete<'a> { pub fn new(client: &'a super::Client) -> Self { Self { client: client, @@ -72185,11 +72598,9 @@ pub mod builder { self } - /// Sends a `GET` request to + /// Sends a `DELETE` request to /// `/v1/system/networking/switch-port-configuration/{configuration}` - pub async fn send( - self, - ) -> Result, Error> { + pub async fn send(self) -> Result, Error> { let Self { client, configuration, @@ -72203,7 +72614,7 @@ pub mod builder { #[allow(unused_mut)] let mut request = client .client - .get(url) + .delete(url) .header( reqwest::header::ACCEPT, reqwest::header::HeaderValue::from_static("application/json"), @@ -72212,7 +72623,7 @@ pub mod builder { let result = client.client.execute(request).await; let response = result?; match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, + 204u16 => Ok(ResponseValue::empty(response)), 400u16..=499u16 => Err(Error::ErrorResponse( ResponseValue::from_response(response).await?, )), From d4f15be59571ba5dc0e153923a0da00b0b5a6145 Mon Sep 17 00:00:00 2001 From: Levon Tarver Date: Mon, 28 Oct 2024 21:40:13 +0000 Subject: [PATCH 7/8] fix test --- cli/tests/test_net.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/tests/test_net.rs b/cli/tests/test_net.rs index acbadfee..55896111 100644 --- a/cli/tests/test_net.rs +++ b/cli/tests/test_net.rs @@ -167,7 +167,7 @@ fn test_port_config() { autoneg: false, fec: LinkFec::None, link_name: String::from("phy0"), - lldp_link_config_id: Uuid::new_v4(), + lldp_link_config_id: Some(Uuid::new_v4()), mtu: 1500, port_settings_id: switch1_qsfp0_settings_id, speed: LinkSpeed::Speed100G, @@ -259,7 +259,7 @@ fn test_port_config() { autoneg: false, fec: LinkFec::None, link_name: String::from("phy0"), - lldp_link_config_id: Uuid::new_v4(), + lldp_link_config_id: Some(Uuid::new_v4()), mtu: 1500, port_settings_id: switch1_qsfp0_settings_id, speed: LinkSpeed::Speed100G, From 668ff4728a75410432eac37746c6a56b36d5f58b Mon Sep 17 00:00:00 2001 From: Levon Tarver Date: Mon, 28 Oct 2024 22:26:54 +0000 Subject: [PATCH 8/8] regen --- cli/docs/cli.json | 177 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 142 insertions(+), 35 deletions(-) diff --git a/cli/docs/cli.json b/cli/docs/cli.json index 9a3ff345..69b7be9f 100644 --- a/cli/docs/cli.json +++ b/cli/docs/cli.json @@ -217,7 +217,8 @@ "long_about": "Permanently delete a certificate. This operation cannot be undone.", "args": [ { - "long": "certificate" + "long": "certificate", + "help": "Name or ID of the certificate" }, { "long": "profile", @@ -256,7 +257,8 @@ "long_about": "Returns the details of a specific certificate", "args": [ { - "long": "certificate" + "long": "certificate", + "help": "Name or ID of the certificate" }, { "long": "profile", @@ -3433,7 +3435,7 @@ }, { "long": "user-id", - "help": "The user's internal id" + "help": "The user's internal ID" } ] }, @@ -3461,7 +3463,7 @@ }, { "long": "user-id", - "help": "The user's internal id" + "help": "The user's internal ID" } ] } @@ -3809,7 +3811,7 @@ }, { "long": "user-id", - "help": "The user's internal id" + "help": "The user's internal ID" } ] } @@ -4104,7 +4106,7 @@ }, { "long": "rack-id", - "help": "The rack's unique ID." + "help": "ID of the rack" } ] } @@ -4338,7 +4340,7 @@ ], "subcommands": [ { - "name": "configuration", + "name": "active-configuration", "args": [ { "long": "profile", @@ -4348,8 +4350,35 @@ ], "subcommands": [ { - "name": "apply", - "about": "Apply switch port settings", + "name": "clear", + "about": "Clear switch port configuration", + "args": [ + { + "long": "port", + "help": "A name to use when selecting switch ports." + }, + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + }, + { + "long": "rack-id", + "help": "A rack id to use when selecting switch ports." + }, + { + "long": "switch", + "values": [ + "switch0", + "switch1" + ], + "help": "A switch location to use when selecting switch ports." + } + ] + }, + { + "name": "set", + "about": "Set switch port configuration", "args": [ { "long": "json-body", @@ -4377,14 +4406,18 @@ "help": "A rack id to use when selecting switch ports." }, { - "long": "switch-location", + "long": "switch", + "values": [ + "switch0", + "switch1" + ], "help": "A switch location to use when selecting switch ports." } ] }, { - "name": "remove", - "about": "Clear switch port settings", + "name": "view", + "about": "View switch port configuration", "args": [ { "long": "port", @@ -4400,13 +4433,83 @@ "help": "A rack id to use when selecting switch ports." }, { - "long": "switch-location", + "long": "switch", + "values": [ + "switch0", + "switch1" + ], "help": "A switch location to use when selecting switch ports." } ] } ] }, + { + "name": "apply-settings", + "about": "Apply switch port settings", + "args": [ + { + "long": "json-body", + "help": "Path to a file that contains the full json body." + }, + { + "long": "json-body-template", + "help": "XXX" + }, + { + "long": "port", + "help": "A name to use when selecting switch ports." + }, + { + "long": "port-settings", + "help": "A name or id to use when applying switch port settings." + }, + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + }, + { + "long": "rack-id", + "help": "A rack id to use when selecting switch ports." + }, + { + "long": "switch-location", + "values": [ + "switch0", + "switch1" + ], + "help": "A switch location to use when selecting switch ports." + } + ] + }, + { + "name": "clear-settings", + "about": "Clear switch port settings", + "args": [ + { + "long": "port", + "help": "A name to use when selecting switch ports." + }, + { + "long": "profile", + "help": "Configuration profile to use for commands", + "global": true + }, + { + "long": "rack-id", + "help": "A rack id to use when selecting switch ports." + }, + { + "long": "switch-location", + "values": [ + "switch0", + "switch1" + ], + "help": "A switch location to use when selecting switch ports." + } + ] + }, { "name": "list", "about": "List switch ports", @@ -4462,6 +4565,10 @@ }, { "long": "switch-location", + "values": [ + "switch0", + "switch1" + ], "help": "A switch location to use when selecting switch ports." } ] @@ -5223,7 +5330,7 @@ "about": "Delete BGP configuration", "args": [ { - "long": "name-or-id", + "long": "bgp-config", "help": "A name or id to use when selecting BGP config." }, { @@ -6202,7 +6309,7 @@ "args": [ { "long": "address", - "help": "The address and prefix length of this address." + "help": "The address and subnet mask" }, { "long": "address-lot", @@ -6256,7 +6363,7 @@ "args": [ { "long": "address", - "help": "The address and prefix length of this address." + "help": "The address and subnet mask" }, { "long": "address-lot", @@ -6317,7 +6424,7 @@ "args": [ { "long": "addr", - "help": "The address of th e host to peer with." + "help": "The address of the host to peer with." }, { "long": "allow-export-list-active", @@ -6365,11 +6472,11 @@ }, { "long": "idle-hold-time", - "help": "How long to hold a peer in idle before attempting a new session (seconds)." + "help": "How long to hold this peer in idle before attempting a new session (seconds)." }, { "long": "interface-name", - "help": "The name of interface to peer on. This is relative to the port configuration this BGP peer configuration is a part of. For example this value could be phy0 to refer to a primary physical interface. Or it could be vlan47 to refer to a VLAN interface." + "help": "The name of the interface to peer on. This is relative to the port configuration this BGP peer configuration is a part of. For example this value could be phy0 to refer to a primary physical interface. Or it could be vlan47 to refer to a VLAN interface." }, { "long": "json-body", @@ -6389,15 +6496,15 @@ }, { "long": "md5-auth-key", - "help": "Use the given key for TCP-MD5 authentication with the peer." + "help": "Use the given key for TCP-MD5 authentication with this peer." }, { "long": "min-ttl", - "help": "Require messages from a peer have a minimum IP time to live field." + "help": "Require messages from this peer to have a minimum IP time to live field." }, { "long": "multi-exit-discriminator", - "help": "Apply the provided multi-exit discriminator (MED) updates sent to the peer." + "help": "Apply a multi-exit discriminator (MED) in updates sent to this peer." }, { "long": "profile", @@ -6406,11 +6513,11 @@ }, { "long": "remote-asn", - "help": "Require that a peer has a specified ASN." + "help": "Require that this peer have a specified ASN." }, { "long": "vlan-id", - "help": "Associate a VLAN ID with a peer." + "help": "Associate a VLAN ID with this peer." } ] }, @@ -6762,7 +6869,7 @@ }, { "long": "interface-name", - "help": "The name of interface to peer on. This is relative to the port configuration this BGP peer configuration is a part of. For example this value could be phy0 to refer to a primary physical interface. Or it could be vlan47 to refer to a VLAN interface." + "help": "The name of the interface to peer on. This is relative to the port configuration this BGP peer configuration is a part of. For example this value could be phy0 to refer to a primary physical interface. Or it could be vlan47 to refer to a VLAN interface." }, { "long": "json-body", @@ -6814,7 +6921,7 @@ "args": [ { "long": "configuration", - "help": "An optional name or id to use when selecting a switch port configuration." + "help": "A name or id to use when selecting a switch port configuration." }, { "long": "profile", @@ -7079,15 +7186,15 @@ "long": "json-body-template", "help": "XXX" }, - { - "long": "local-pref", - "help": "Local preference for route. Higher preference indictes precedence within and across protocols." - }, { "long": "profile", "help": "Configuration profile to use for commands", "global": true }, + { + "long": "rib-priority", + "help": "Local preference for route. Higher preference indicates precedence within and across protocols." + }, { "long": "vid", "help": "VLAN id the gateway is reachable over." @@ -7137,15 +7244,15 @@ "long": "json-body-template", "help": "XXX" }, - { - "long": "local-pref", - "help": "Local preference for route. Higher preference indictes precedence within and across protocols." - }, { "long": "profile", "help": "Configuration profile to use for commands", "global": true }, + { + "long": "rib-priority", + "help": "Local preference for route. Higher preference indicates precedence within and across protocols." + }, { "long": "vid", "help": "VLAN id the gateway is reachable over." @@ -7156,7 +7263,7 @@ }, { "name": "view", - "about": "Get information about a named set of switch-port-settings", + "about": "View a switch port configuration", "args": [ { "long": "configuration",