diff --git a/src/azure-cli/azure/cli/command_modules/search/_help.py b/src/azure-cli/azure/cli/command_modules/search/_help.py index 973f6b5e128..d40d5bb2d84 100644 --- a/src/azure-cli/azure/cli/command_modules/search/_help.py +++ b/src/azure-cli/azure/cli/command_modules/search/_help.py @@ -42,6 +42,11 @@ short-summary: Manage Azure Search shared private link resources. """ +helps['search shared-private-link-resource wait'] = """ +type: command +short-summary: Wait for async shared private link resource operations. +""" + helps['search service create'] = """ type: command short-summary: Creates a Search service in the given resource group. @@ -54,3 +59,8 @@ type: command short-summary: Update partition and replica of the given search service. """ + +helps['search service wait'] = """ +type: command +short-summary: Wait for async service operations. +""" diff --git a/src/azure-cli/azure/cli/command_modules/search/commands.py b/src/azure-cli/azure/cli/command_modules/search/commands.py index 7930d9ca7bb..ad9bdf49b9e 100644 --- a/src/azure-cli/azure/cli/command_modules/search/commands.py +++ b/src/azure-cli/azure/cli/command_modules/search/commands.py @@ -46,8 +46,9 @@ def load_command_table(self, _): g.command('list', 'list_by_resource_group') g.show_command('show', 'get') g.command('delete', 'delete', confirmation=True) - g.generic_update_command('update', custom_func_name='update_search_service', setter_name='begin_create_or_update', setter_arg_name='service') - g.custom_command('create', 'create_search_service') + g.generic_update_command('update', supports_no_wait=True, custom_func_name='update_search_service', setter_name='begin_create_or_update', setter_arg_name='service') + g.custom_command('create', 'create_search_service', supports_no_wait=True) + g.wait_command('wait') with self.command_group('search private-endpoint-connection', search_private_endpoint_connections_sdk) as g: g.command('list', 'list_by_service') @@ -62,8 +63,9 @@ def load_command_table(self, _): g.command('list', 'list_by_service') g.show_command('show', 'get') g.command('delete', 'begin_delete', confirmation=True) - g.custom_command('create', 'create_shared_private_link_resource') - g.custom_command('update', 'update_shared_private_link_resource') + g.custom_command('create', 'create_shared_private_link_resource', supports_no_wait=True) + g.custom_command('update', 'update_shared_private_link_resource', supports_no_wait=True) + g.wait_command('wait') with self.command_group('search admin-key', search_admin_keys_sdk) as g: g.show_command('show', 'get') diff --git a/src/azure-cli/azure/cli/command_modules/search/custom.py b/src/azure-cli/azure/cli/command_modules/search/custom.py index b8c6d413476..6faeb12c1e9 100644 --- a/src/azure-cli/azure/cli/command_modules/search/custom.py +++ b/src/azure-cli/azure/cli/command_modules/search/custom.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- from knack.log import get_logger +from azure.cli.core.util import sdk_no_wait logger = get_logger(__name__) @@ -16,7 +17,8 @@ def _get_resource_group_location(cli_ctx, resource_group_name): def create_search_service(cmd, resource_group_name, search_service_name, sku, location=None, partition_count=0, - replica_count=0, public_network_access="enabled", ip_rules=None, identity_type=None): + replica_count=0, public_network_access="enabled", ip_rules=None, identity_type=None, + no_wait=False): """ Creates a Search service in the given resource group. @@ -29,7 +31,7 @@ def create_search_service(cmd, resource_group_name, search_service_name, sku, lo :param public_network_access: Public accessibility to the search service; allowed values are "enabled" or "disabled". :param ip_rules: Public IP(v4) addresses or CIDR ranges to the search service, seperated by comma or semicolon; - These IP rules are applicable only when public_network_access is "enabled". + these IP rules are applicable only when --public-network-access is "enabled". :param identity_type: The identity type; possible values include: "None", "SystemAssigned". """ from azure.mgmt.search.models import SearchService, Sku, NetworkRuleSet, IpRule, Identity @@ -63,7 +65,7 @@ def create_search_service(cmd, resource_group_name, search_service_name, sku, lo _identity = Identity(type=identity_type) _search.identity = _identity - return _client.begin_create_or_update(resource_group_name, search_service_name, _search) + return sdk_no_wait(no_wait, _client.begin_create_or_update, resource_group_name, search_service_name, _search) def update_search_service(instance, partition_count=0, replica_count=0, public_network_access=None, @@ -76,7 +78,7 @@ def update_search_service(instance, partition_count=0, replica_count=0, public_n :param public_network_access: Public accessibility to the search service; allowed values are "enabled" or "disabled". :param ip_rules: Public IP(v4) addresses or CIDR ranges to the search service, seperated by comma(',') or - semicolon(';'); If spaces (ex - ' '), ',' or ';' is provided, any existing IP rule will be + semicolon(';'); If spaces (' '), ',' or ';' is provided, any existing IP rule will be nullified and no public IP rule is applied. These IP rules are applicable only when public_network_access is "enabled". :param identity_type: The identity type; possible values include: "None", "SystemAssigned". @@ -117,8 +119,8 @@ def update_private_endpoint_connection(cmd, resource_group_name, search_service_ :param resource_group_name: Name of resource group. :param search_service_name: Name of the search service. - :param private_endpoint_connection_name: Name of the private endpoint connection resource. - Ex - {the name of the private endpoint resource}.{guid}. + :param private_endpoint_connection_name: Name of the private endpoint connection resource; + for example: {the name of the private endpoint resource}.{guid}. :param private_link_service_connection_status: The updated status of the private endpoint connection resource. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". :param private_link_service_connection_description: Custom description when updating @@ -150,7 +152,8 @@ def update_private_endpoint_connection(cmd, resource_group_name, search_service_ def create_shared_private_link_resource(cmd, resource_group_name, search_service_name, shared_private_link_resource_name, shared_private_link_resource_id, shared_private_link_resource_group_id, - shared_private_link_resource_request_message="Please approve"): + shared_private_link_resource_request_message="Please approve", + no_wait=False): """ Create shared privatelink resources in a Search service in the given resource group. @@ -158,9 +161,9 @@ def create_shared_private_link_resource(cmd, resource_group_name, search_service :param search_service_name: Name of the search service. :param shared_private_link_resource_name: Name of the shared private link resource. :param shared_private_link_resource_id: Fully qualified resource ID for the resource. - Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/ + for example: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/ {resourceProviderNamespace}/{resourceType}/{resourceName}. - :param shared_private_link_resource_group_id: The group id of the resource. Ex, blob, sql or vault. + :param shared_private_link_resource_group_id: The group id of the resource; for example: blob, sql or vault. :param shared_private_link_resource_request_message: Custom request message when creating or updating the shared privatelink resources. """ @@ -176,24 +179,25 @@ def create_shared_private_link_resource(cmd, resource_group_name, search_service request_message=shared_private_link_resource_request_message ) - return _client.begin_create_or_update(resource_group_name, search_service_name, shared_private_link_resource_name, - _shared_private_link_resource) + return sdk_no_wait(no_wait, _client.begin_create_or_update, resource_group_name, + search_service_name, shared_private_link_resource_name, _shared_private_link_resource) def update_shared_private_link_resource(cmd, resource_group_name, search_service_name, shared_private_link_resource_name, shared_private_link_resource_id, shared_private_link_resource_group_id, - shared_private_link_resource_request_message): + shared_private_link_resource_request_message, + no_wait=False): """ Update shared privatelink resources in a Search service in the given resource group. :param resource_group_name: Name of resource group. :param search_service_name: Name of the search service. :param shared_private_link_resource_name: Name of the shared private link resource. - :param shared_private_link_resource_id: Fully qualified resource ID for the resource. - Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/ + :param shared_private_link_resource_id: Fully qualified resource ID for the resource; + for example: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/ {resourceProviderNamespace}/{resourceType}/{resourceName}. - :param shared_private_link_resource_group_id: The group id of the resource. Ex, blob, sql or vault. + :param shared_private_link_resource_group_id: The group id of the resource; for example: blob, sql or vault. :param shared_private_link_resource_request_message: Custom request message when creating or updating the shared privatelink resources. """ @@ -209,5 +213,5 @@ def update_shared_private_link_resource(cmd, resource_group_name, search_service request_message=shared_private_link_resource_request_message ) - return _client.begin_create_or_update(resource_group_name, search_service_name, shared_private_link_resource_name, - _shared_private_link_resource) + return sdk_no_wait(no_wait, _client.begin_create_or_update, resource_group_name, + search_service_name, shared_private_link_resource_name, _shared_private_link_resource)