forked from Azure/azure-cli-extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconnectivity_utils.py
More file actions
29 lines (24 loc) · 1.12 KB
/
connectivity_utils.py
File metadata and controls
29 lines (24 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
import json
import base64
from knack import log
logger = log.get_logger(__name__)
def format_relay_info_string(relay_info):
relay_info_string = json.dumps(
{
"relay": {
"namespaceName": relay_info['namespaceName'],
"namespaceNameSuffix": relay_info['namespaceNameSuffix'],
"hybridConnectionName": relay_info['hybridConnectionName'],
"accessKey": relay_info['accessKey'],
"expiresOn": relay_info['expiresOn'],
"serviceConfigurationToken": relay_info['serviceConfigurationToken']
}
})
result_bytes = relay_info_string.encode("ascii")
enc = base64.b64encode(result_bytes)
base64_result_string = enc.decode("ascii")
return base64_result_string