Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
07313e9
WIP
May 16, 2025
e411aba
WIP2
May 22, 2025
98263dc
WIP#
May 22, 2025
12d9cb0
WIP
May 16, 2025
9493f36
WIP2
May 22, 2025
abf2bb8
WIP#
May 22, 2025
4517865
Add secret replacer to scrub secrets in test recordings.
May 29, 2025
c550b2b
Merge branch 'feature-search-rp-2025-05-ga-cli' of https://github.com…
May 29, 2025
dbaab8b
Add secret replacer for query key tests.
May 29, 2025
41f9e7f
Merge branch 'Azure:dev' into feature-search-rp-2025-05-ga-cli
Draconicida Aug 5, 2025
f87215c
Merge branch 'Azure:dev' into feature-search-rp-2025-05-ga-cli
Draconicida Aug 22, 2025
c18d193
Add test recordings and fixes for test failures.
Sep 12, 2025
4fa5dd8
WIP
May 16, 2025
87ec3b5
WIP2
May 22, 2025
3b9b4e0
WIP#
May 22, 2025
3030728
Add secret replacer to scrub secrets in test recordings.
May 29, 2025
f084811
WIP2
May 22, 2025
ab10a7f
WIP#
May 22, 2025
1f85db3
Add secret replacer for query key tests.
May 29, 2025
d35f0a5
Add test recordings and fixes for test failures.
Sep 12, 2025
29df959
Merge branch 'feature-search-rp-2025-05-ga-cli' of https://github.com…
Sep 12, 2025
866eb83
Provide shortened command option.
Sep 12, 2025
c7011b8
Add help info for commands.
Sep 12, 2025
ad15d8b
Add examples to help info.
Sep 12, 2025
4491540
Fix help error.
Sep 12, 2025
2620573
Fix help examples.
Sep 12, 2025
f52fc1a
More help examples fixes
Sep 12, 2025
d591ba0
More help examples format fix
Sep 12, 2025
8bab5e6
Add missing_command_example exclusion for search service shared-priva…
Sep 12, 2025
d9c03bb
Add missing_command_example exclusion test
Sep 12, 2025
76a3731
Add missing_command_example exclusions
Sep 12, 2025
dcc2988
Style check fixes.
Sep 12, 2025
ac4c01d
Fix line too long style check issues.
Sep 12, 2025
ffb79ff
Avoid unnecessary breaking change.
Sep 15, 2025
a2468cd
Create separate lint exclusion file under search.
Sep 17, 2025
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
81 changes: 81 additions & 0 deletions src/azure-cli/azure/cli/command_modules/search/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,84 @@
type: command
short-summary: Wait for async service operations.
"""

helps['search service query-key create'] = """
type: command
short-summary: Creates a query key for a given Azure Search service.
examples:
- name: Create a query key for a Search service.
text: >
az search service query-key create --resource-group MyResourceGroup --search-service-name MySearchService -n MyQueryKey
"""

helps['search service admin-key regenerate'] = """
type: command
short-summary: Regenerate an admin key for a given Azure Search service.
examples:
- name: Regenerate the primary admin key for a Search service.
text: >
az search service admin-key regenerate --resource-group MyResourceGroup --search-service-name MySearchService --key-kind primary
- name: Regenerate the secondary admin key for a Search service.
text: >
az search service admin-key regenerate --resource-group MyResourceGroup --search-service-name MySearchService --key-kind secondary
"""

helps['search service check-name-availability'] = """
type: command
short-summary: Check the availability of a given Azure Search service name.
examples:
- name: Check if a Search service name is available.
text: >
az search service check-name-availability --name MySearchService --type searchServices
"""

helps['search service upgrade'] = """
type: command
short-summary: Upgrade a given Azure Search service.
examples:
- name: Upgrade a Search service.
text: >
az search service upgrade --resource-group MyResourceGroup --search-service-name MySearchService
"""

helps['search service network-security-perimeter-configuration reconcile'] = """
type: command
short-summary: Reconcile network security perimeter configuration for a given Azure Search service.
examples:
- name: Reconcile network security perimeter configuration and specify a perimeter name.
text: >
az search service network-security-perimeter-configuration reconcile --resource-group MyResourceGroup --search-service-name MySearchService --nsp-config-name MyPerimeter
"""

helps['search service shared-private-link-resource create'] = """
type: command
short-summary: Create a shared private link resource for a given Azure Search service.
examples:
- name: Create a shared private link resource for a Search service.
text: >
az search service shared-private-link-resource create --resource-group MyResourceGroup --search-service-name MySearchService --name MySharedPrivateLinkResource --group-id MyGroupId --resource-id /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/{provider}/{resourceType}/{resourceName}
- name: Create a shared private link resource and specify a request message.
text: >
az search service shared-private-link-resource create --resource-group MyResourceGroup --search-service-name MySearchService --name MySharedPrivateLinkResource --group-id MyGroupId --resource-id /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/{provider}/{resourceType}/{resourceName} --request-message "Please approve this connection."
"""

helps['search service shared-private-link-resource update'] = """
type: command
short-summary: Update a shared private link resource for a given Azure Search service.
examples:
- name: Update the request message for a shared private link resource.
text: >
az search service shared-private-link-resource update --resource-group MyResourceGroup --search-service-name MySearchService --name MySharedPrivateLinkResource --request-message "Updated request message."
- name: Approve a shared private link resource connection.
text: >
az search service shared-private-link-resource update --resource-group MyResourceGroup --search-service-name MySearchService --name MySharedPrivateLinkResource --status Approved
"""

helps['search service private-endpoint-connection update'] = """
type: command
short-summary: Update a private endpoint connection for a given Azure Search service.
examples:
- name: Approve a private endpoint connection.
text: >
az search service private-endpoint-connection update --resource-group MyResourceGroup --search-service-name MySearchService --name MyPrivateEndpointConnection
"""
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"search",
)
class __CMDGroup(AAZCommandGroup):
"""Manage Azure Search services, admin keys and query keys
"""Manage Search
"""
pass

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"search service",
)
class __CMDGroup(AAZCommandGroup):
"""Manage Azure Search services
"""Manage Service
"""
pass

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@
# flake8: noqa

from .__cmd_group import *
from ._check_name_availability import *
from ._create import *
from ._delete import *
from ._list import *
from ._show import *
from ._update import *
from ._upgrade import *
from ._wait import *
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from azure.cli.core.aaz import *


@register_command(
"search service check-name-availability",
)
class CheckNameAvailability(AAZCommand):
"""Checks whether or not the given search service name is available for use. Search service names must be globally unique since they are part of the service URI (https://`<name>`.search.windows.net).
"""

_aaz_info = {
"version": "2025-05-01",
"resources": [
["mgmt-plane", "/subscriptions/{}/providers/microsoft.search/checknameavailability", "2025-05-01"],
]
}

def _handler(self, command_args):
super()._handler(command_args)
self._execute_operations()
return self._output()

_args_schema = None

@classmethod
def _build_arguments_schema(cls, *args, **kwargs):
if cls._args_schema is not None:
return cls._args_schema
cls._args_schema = super()._build_arguments_schema(*args, **kwargs)

# define Arg Group ""

# define Arg Group "CheckNameAvailabilityInput"

_args_schema = cls._args_schema
_args_schema.name = AAZStrArg(
options=["--name"],
arg_group="CheckNameAvailabilityInput",
help="The search service name to validate. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length.",
required=True,
)
_args_schema.type = AAZStrArg(
options=["--type"],
arg_group="CheckNameAvailabilityInput",
help="The type of the resource whose name is to be validated. This value must always be 'searchServices'.",
required=True,
enum={"searchServices": "searchServices"},
)
return cls._args_schema

def _execute_operations(self):
self.pre_operations()
self.ServicesCheckNameAvailability(ctx=self.ctx)()
self.post_operations()

@register_callback
def pre_operations(self):
pass

@register_callback
def post_operations(self):
pass

def _output(self, *args, **kwargs):
result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True)
return result

class ServicesCheckNameAvailability(AAZHttpOperation):
CLIENT_TYPE = "MgmtClient"

def __call__(self, *args, **kwargs):
request = self.make_request()
session = self.client.send_request(request=request, stream=False, **kwargs)
if session.http_response.status_code in [200]:
return self.on_200(session)

return self.on_error(session.http_response)

@property
def url(self):
return self.client.format_url(
"/subscriptions/{subscriptionId}/providers/Microsoft.Search/checkNameAvailability",
**self.url_parameters
)

@property
def method(self):
return "POST"

@property
def error_format(self):
return "ODataV4Format"

@property
def url_parameters(self):
parameters = {
**self.serialize_url_param(
"subscriptionId", self.ctx.subscription_id,
required=True,
),
}
return parameters

@property
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2025-05-01",
required=True,
),
}
return parameters

@property
def header_parameters(self):
parameters = {
**self.serialize_header_param(
"Content-Type", "application/json",
),
**self.serialize_header_param(
"Accept", "application/json",
),
}
return parameters

@property
def content(self):
_content_value, _builder = self.new_content_builder(
self.ctx.args,
typ=AAZObjectType,
typ_kwargs={"flags": {"required": True, "client_flatten": True}}
)
_builder.set_prop("name", AAZStrType, ".name", typ_kwargs={"flags": {"required": True}})
_builder.set_prop("type", AAZStrType, ".type", typ_kwargs={"flags": {"required": True}})

return self.serialize_content(_content_value)

def on_200(self, session):
data = self.deserialize_http_content(session)
self.ctx.set_var(
"instance",
data,
schema_builder=self._build_schema_on_200
)

_schema_on_200 = None

@classmethod
def _build_schema_on_200(cls):
if cls._schema_on_200 is not None:
return cls._schema_on_200

cls._schema_on_200 = AAZObjectType()

_schema_on_200 = cls._schema_on_200
_schema_on_200.message = AAZStrType(
flags={"read_only": True},
)
_schema_on_200.name_available = AAZBoolType(
serialized_name="nameAvailable",
flags={"read_only": True},
)
_schema_on_200.reason = AAZStrType(
flags={"read_only": True},
)

return cls._schema_on_200


class _CheckNameAvailabilityHelper:
"""Helper class for CheckNameAvailability"""


__all__ = ["CheckNameAvailability"]
Loading
Loading