pub fn from_private_key<S, T, U>(
        http_client: Arc<dyn HttpClient>,
        iot_hub_name: S,
        key_name: T,
        private_key: U,
        expires_in_seconds: i64,
    ) -> azure_core::Result<Self>
    where
        S: Into<String>,
        T: AsRef<str>,
        U: AsRef<str>,
    {
        let iot_hub_name_str = iot_hub_name.into();

        let sas_token = Self::generate_sas_token(
            iot_hub_name_str.as_str(),
            key_name.as_ref(),
            private_key.as_ref(),
            expires_in_seconds,
        )?;

        Ok(Self {
            http_client,
            iot_hub_name: iot_hub_name_str,
            sas_token,
        })
    }
/// Create a new IoTHubService struct based on a given IoT Hub name and a private key
///
/// The private key should preferably be of a user / group that has the rights to make service requests.
/// ```
/// use std::sync::Arc;
/// use azure_core::HttpClient;
/// use azure_iot_hub::service::ServiceClient;
///
/// let http_client = azure_core::new_http_client();
///
/// let iot_hub_name = "iot-hub";
/// let key_name = "iot_hubowner";
/// let private_key = "YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg==";
///
/// let result = ServiceClient::from_private_key(http_client, iot_hub_name, key_name, private_key, 3600);
/// assert!(result.is_ok());
/// ```
Create a new IoTHubService struct based on a given IoT Hub name and a private key
The private key should preferably be of a user / group that has the rights to make service requests.






Create a new IoTHubService struct based on a given IoT Hub name and a private key The private key should preferably be of a user / group that has the rights to make service requests .
pub fn from_private_key<S, T, U>(
        http_client: Arc<dyn HttpClient>,
        iot_hub_name: S,
        key_name: T,
        private_key: U,
        expires_in_seconds: i64,
    ) -> azure_core::Result<Self>
    where
        S: Into<String>,
        T: AsRef<str>,
        U: AsRef<str>,
    {
        let iot_hub_name_str = iot_hub_name.into();
        let sas_token = Self::generate_sas_token(
            iot_hub_name_str.as_str(),
            key_name.as_ref(),
            private_key.as_ref(),
            expires_in_seconds,
        )?;
        Ok(Self {
            http_client,
            iot_hub_name: iot_hub_name_str,
            sas_token,
        })
    }
pub fn from_private_key < S , T , U > ( http_client : Arc < dyn HttpClient > , iot_hub_name : S , key_name : T , private_key : U , expires_in_seconds : i64 , ) -> azure_core :: Result < Self > where S : Into < String > , T : AsRef < str > , U : AsRef < str > , { let iot_hub_name_str = iot_hub_name . into ( ) ; let sas_token = Self :: generate_sas_token ( iot_hub_name_str . as_str ( ) , key_name . as_ref ( ) , private_key . as_ref ( ) , expires_in_seconds , ) ? ; Ok ( Self { http_client , iot_hub_name : iot_hub_name_str , sas_token , } ) }
Create a new IoTHubService struct based on a given IoT Hub name and a private key
The private key should preferably be of a user / group that has the rights to make service requests.
Create a new IoTHubService struct based on a given IoT Hub name and a private key The private key should preferably be of a user / group that has the rights to make service requests .
http_client
Arc<dyn HttpClient>
iot_hub_name
S
key_name
T
private_key
U
expires_in_seconds
i64