Skip to content

[Network] support generic commands for private link scenario#13225

Merged
mmyyrroonn merged 17 commits intoAzure:devfrom
mmyyrroonn:general-private-link
May 11, 2020
Merged

[Network] support generic commands for private link scenario#13225
mmyyrroonn merged 17 commits intoAzure:devfrom
mmyyrroonn:general-private-link

Conversation

@mmyyrroonn
Copy link
Contributor

Description

Testing Guide

History Notes

[Component Name 1] BREAKING CHANGE: az command a: Make some customer-facing breaking change.
[Component Name 2] az command b: Add some customer-facing feature.


This checklist is used to make sure that common guidelines for a pull request are followed.

@yonzhan
Copy link
Collaborator

yonzhan commented Apr 28, 2020

add to S169

@mmyyrroonn mmyyrroonn force-pushed the general-private-link branch from a4296df to a4cc8de Compare May 8, 2020 03:24
@mmyyrroonn
Copy link
Contributor Author

/azp run Azure.azure-cli

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Comment on lines +69 to +78
while query_counts:
time.sleep(RETRY_INTERVAL)
query_counts -= 1
private_endpoint_connection = self.show_private_endpoint_connection(cmd,
resource_group_name,
service_name,
private_endpoint_connection_name)
if private_endpoint_connection['properties'].get('provisioningState'):
if private_endpoint_connection['properties']['provisioningState'] == "Succeeded":
return private_endpoint_connection
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can extract this part and put it into core, so that az rest can also benefit from it by using az rest --wait-async.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the show method is specific to each get rest call. wait command requires user's input to identify the resource. So I think it's not suitable to have a generic way.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made a demo:

def send_raw_request_wait(*args, timeout=3600, expected_status_code=None,
                          body_query=None, expected_body_query_result=None, **kwargs):
    RETRY_MAX = 20
    RETRY_INTERVAL = 10
    query_counts = RETRY_MAX
    import time
    import jmespath
    # src/azure-cli-core/azure/cli/core/commands/arm.py:676
    while query_counts:
        time.sleep(RETRY_INTERVAL)
        query_counts -= 1
        response = send_raw_request(*args, **kwargs)
        if body_query and jmespath.search(body_query, response) != expected_body_query_result:
            continue
        if expected_status_code:
            raise NotImplementedError()
    raise Exception("Max retry count reached.")

But we can consider it later. No hurry.

@mmyyrroonn mmyyrroonn merged commit 0caf144 into Azure:dev May 11, 2020
@mmyyrroonn mmyyrroonn deleted the general-private-link branch May 11, 2020 03:26
- name: Approve a private endpoint connection for a storage account.
text: az network private-endpoint-connection approve -g MyResourceGroup -n MyPrivateEndpoint --service-name MySA --type Microsoft.Storage/storageAccounts --description "Approved"
- name: Approve a private endpoint connection for a keyvault.
text: az network private-endpoint-connection approve -g MyResourceGroup -n MyPrivateEndpoint --service-name MyKV --type Microsoft.Keyvault/vaults --description "Approved"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

service-name is confusing, would it more clear resource-name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make senses. Will change in another PR within this release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants