-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[IoT] Add private link and private end point paramaters to IoT Central CLI #22273
Conversation
IoT |
Hello, I am trying to include private endpoint connection and private link service into the iot central app cli and am following the PR #12383 as a template. Is this the correct direction to go? I noticed the document https://github.com/Azure/azure-cli/blob/dev/doc/private_endpoint_connection_command_guideline.md which was revised after that linked PR shows another way to include the desired service. Are the steps taken in the storage PR deprecated? |
with self.command_group('iot central app private-endpoint-connection', private_endpoint_sdk, | ||
is_preview=True, | ||
resource_type=ResourceType.MGMT_IOTCENTRAL, min_api='2021-11-01-preview') as g: # removed param: custom_command_type=private_endpoint_custom_type, | ||
from ._validators import validate_private_endpoint_connection_id | ||
g.command('delete', 'delete', confirmation=True, validator=validate_private_endpoint_connection_id) | ||
g.show_command('show', 'get', validator=validate_private_endpoint_connection_id) | ||
g.custom_command('approve', 'approve_private_endpoint_connection', | ||
validator=validate_private_endpoint_connection_id) | ||
g.custom_command('reject', 'reject_private_endpoint_connection', | ||
validator=validate_private_endpoint_connection_id) | ||
|
||
with self.command_group('iot central app private-link-resource', private_link_resource_sdk, | ||
resource_type=ResourceType.MGMT_IOTCENTRAL) as g: | ||
from azure.cli.core.commands.transform import gen_dict_to_list_transform | ||
g.command('list', 'list_private_link_resources', is_preview=True, min_api='2021-11-01-preview', | ||
transform=gen_dict_to_list_transform(key="value")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At present, this code has the following errors, resulting in iot central app private-endpoint-connection
and iot central app private-link-resource
can not being loaded normally:
-
The python SDK package
azure-mgmt-iotcentral
corresponding toResourceType.MGMT_IOTCENTRAL
does not support multiple api-version folders, so please remove the declaration ofmin_api='2021-11-01-preview'
and the declaration ofResourceType.MGMT_IOTCENTRAL: '2018-09-01'
in the_shared.py
file -
There is no method
list_private_link_resources()
in_private_links_operations.py
, but only methodlist()
code link
As for |
@hmmorales, IMO, you could follow PR #12383 as a template. And there is no need to modify the network module, usually it's just to make the development easier within network module (reference: #19908). |
@hmmorales This problem seems to be caused by you modifying the default output format. Our tests parse the result value of the commands in JSON format. If the default output format is modified to other formats(such as |
I am receiving this response when I run the command and after running the test script again I receive the same error response printed earlier |
@hmmorales Could you confirm that the return result of |
@zhoxing-ms I included a small print statement in azure-cli-testsdk/azure/cli/testsdk/base.py to print what is causing the error |
@hmmorales I guess there may be a problem with the output format of the command itself. Could you execute the command separately in the dev environment and then show me the output of this command? |
@zhoxing-ms I wanted to provide some additional information with the problem I am seeing. I found that within the funtion The print statements when the first create command is tested: The print statements when the update command is tested The line |
@hmmorales This problem should be caused by the breaking change of the SDK package In the SDK version But in the SDK version As for Python SDK related issue, you can ask @msyyc for help |
@hmmorales Could you please address those comments? |
@hmmorales Please refer to submitting-pull-requests to modify the PR description to add the specific information of new commands and parameters. such as |
Disregard, the 'Reverting merge' part of the last commit. I just had to pull in the most recent edits to dev. Additionally after I address the remaining PR comments I may need some more time for my team to verify the --help message text before the PR can be merged |
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
@hmmorales May I ask when can we merge this PR? |
@@ -1351,7 +1351,7 @@ def iot_central_app_list(client, resource_group_name=None): | |||
|
|||
|
|||
def iot_central_app_update(client, app_name, parameters, resource_group_name): | |||
return client.apps.begin_update(resource_group_name, app_name, parameters) | |||
return client.apps.begin_create_or_update(resource_group_name, app_name, parameters) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason for switching this over to the CreateOrUpdate API?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The get_long_running_output here in the updated iotcentral api doesn't return a deserialized json which caused decoding issues as mentioned earlier. The get_long_running_output here in begin_create_or_update does return a deserialzied json thus why I went with it. I suspect this is a bug in the new api.
"Type must be Microsoft.IoTCentral/iotApps") | ||
elif connection_id: | ||
id_list = connection_id.split('/') | ||
if id_list[id_list.index('providers') + 1].lower() != 'microsoft.iotcentral': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there not some helper methods that parse the resourceId for us?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not that I can find..
I am having a few other devs on my team review the PR, I will send a follow up when it is ready to merge |
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
@hmmorales Could you please address those conflicts and CI issues? Please note that if you do not address them in time by tomorrow, this PR will not catch up with the release of this sprint, and we will have to postpone it to the release of next sprint (07-05) |
As for the CI issue, the |
f67f147
to
fde5920
Compare
@zhoxing-ms It looks like all checks passed, PR should be good to merge 😄 |
Description
Changing the existing IoT Central app to use private endpoint connection and private link network features
Testing Guide
azdev test test_iot_central_commands --live --discover
azdev style iot
azdev linter iot
..
History Notes
[IoT]
az iot central app private-link-resource list
: Add a new command to support listing private link resources[IoT]
az iot central app private-endpoint-connection show
: Add a new command to support showing details of a private endpoint connection of the IoT Central app[IoT]
az iot central app private-endpoint-connection approve
: Add a new command to support approving a private endpoint connection for the IoT Central app[IoT]
az iot central app private-endpoint-connection reject
: Add a new command to support rejecting a private endpoint connection for the IoT Central app[IoT]
az iot central app private-endpoint-connection delete
: Add a new command to support deleting a private endpoint connection for the IoT Central appThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.