Skip to content
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/azure-cli/azure/cli/command_modules/search/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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')
Expand Down
38 changes: 21 additions & 17 deletions src/azure-cli/azure/cli/command_modules/search/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

Expand All @@ -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.

Expand All @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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".
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -150,17 +152,18 @@ 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.

: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/
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.
"""
Expand All @@ -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.
"""
Expand All @@ -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)