-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
473 additions
and
557 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# coding=utf-8 | ||
# -------------------------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for license information. | ||
# -------------------------------------------------------------------------------------------- | ||
|
||
from azext_iot.common._azure import parse_iot_hub_connection_string | ||
|
||
|
||
# TODO: Align with vNext for IoT Hub | ||
class IotHubTarget: | ||
def __init__(self, decomposed: dict): | ||
# Revisit | ||
decomposed_lower = dict((k.lower(), v) for k, v in decomposed.items()) | ||
|
||
self.cs = decomposed_lower.get("cs") | ||
self.policy = decomposed_lower.get("sharedaccesskeyname") | ||
self.shared_access_key = decomposed_lower.get("sharedaccesskey") | ||
self.entity = decomposed_lower.get("hostname") | ||
|
||
@classmethod | ||
def from_connection_string(cls, cstring): | ||
decomposed = parse_iot_hub_connection_string(cs=cstring) | ||
decomposed["cs"] = cstring | ||
return cls(decomposed) | ||
|
||
def as_dict(self): | ||
return { | ||
"cs": self.cs, | ||
"policy": self.policy, | ||
"primarykey": self.shared_access_key, | ||
"entity": self.entity, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.