2626from typing import Any , TYPE_CHECKING , Union
2727
2828from ._utils import get_http_request_kwargs
29- from ._common ._constants import SchemaFormat
29+ from ._common ._constants import SchemaFormat , DEFAULT_VERSION
3030from ._common ._schema import Schema , SchemaProperties
3131from ._common ._response_handlers import (
3232 _parse_response_schema ,
@@ -48,6 +48,8 @@ class SchemaRegistryClient(object):
4848 For example: my-namespace.servicebus.windows.net.
4949 :param credential: To authenticate managing the entities of the SchemaRegistry namespace.
5050 :type credential: ~azure.core.credentials.TokenCredential
51+ :keyword str api_version: The Schema Registry service API version to use for requests.
52+ Default value and only accepted value currently is "2021-10".
5153
5254 .. admonition:: Example:
5355
@@ -62,8 +64,12 @@ class SchemaRegistryClient(object):
6264
6365 def __init__ (self , fully_qualified_namespace , credential , ** kwargs ):
6466 # type: (str, TokenCredential, Any) -> None
67+ api_version = kwargs .pop ("api_version" , DEFAULT_VERSION )
6568 self ._generated_client = AzureSchemaRegistry (
66- credential = credential , endpoint = fully_qualified_namespace , ** kwargs
69+ credential = credential ,
70+ endpoint = fully_qualified_namespace ,
71+ api_version = api_version ,
72+ ** kwargs
6773 )
6874
6975 def __enter__ (self ):
@@ -83,7 +89,12 @@ def close(self):
8389 self ._generated_client .close ()
8490
8591 def register_schema (
86- self , group_name , name , schema_definition , format , ** kwargs # pylint:disable=redefined-builtin
92+ self ,
93+ group_name ,
94+ schema_name ,
95+ schema_definition ,
96+ format ,
97+ ** kwargs # pylint:disable=redefined-builtin
8798 ):
8899 # type: (str, str, str, Union[str, SchemaFormat], Any) -> SchemaProperties
89100 """
@@ -92,7 +103,7 @@ def register_schema(
92103 schema is created at latest version + 1.
93104
94105 :param str group_name: Schema group under which schema should be registered.
95- :param str name : Name of schema being registered.
106+ :param str schema_name : Name of schema being registered.
96107 :param str schema_definition: String representation of the schema being registered.
97108 :param format: Format for the schema being registered.
98109 For now Avro is the only supported schema format by the service.
@@ -118,7 +129,7 @@ def register_schema(
118129 http_request_kwargs = get_http_request_kwargs (kwargs )
119130 request = schema_rest .build_register_request (
120131 group_name = group_name ,
121- schema_name = name ,
132+ schema_name = schema_name ,
122133 content = schema_definition ,
123134 serialization_type = format ,
124135 content_type = kwargs .pop ("content_type" , "application/json" ),
@@ -129,13 +140,13 @@ def register_schema(
129140 response .raise_for_status ()
130141 return _parse_response_schema_properties (response )
131142
132- def get_schema (self , id , ** kwargs ): # pylint:disable=redefined-builtin
143+ def get_schema (self , schema_id , ** kwargs ):
133144 # type: (str, Any) -> Schema
134145 """
135146 Gets a registered schema by its unique ID.
136147 Azure Schema Registry guarantees that ID is unique within a namespace.
137148
138- :param str id : References specific schema in registry namespace.
149+ :param str schema_id : References specific schema in registry namespace.
139150 :rtype: ~azure.schemaregistry.Schema
140151 :raises: :class:`~azure.core.exceptions.HttpResponseError`
141152
@@ -150,21 +161,28 @@ def get_schema(self, id, **kwargs): # pylint:disable=redefined-builtin
150161
151162 """
152163 http_request_kwargs = get_http_request_kwargs (kwargs )
153- request = schema_rest .build_get_by_id_request (schema_id = id , ** http_request_kwargs )
164+ request = schema_rest .build_get_by_id_request (
165+ schema_id = schema_id , ** http_request_kwargs
166+ )
154167 response = self ._generated_client .send_request (request , ** kwargs )
155168 response .raise_for_status ()
156169 return _parse_response_schema (response )
157170
158171 def get_schema_properties (
159- self , group_name , name , schema_definition , format , ** kwargs # pylint:disable=redefined-builtin
172+ self ,
173+ group_name ,
174+ schema_name ,
175+ schema_definition ,
176+ format ,
177+ ** kwargs # pylint:disable=redefined-builtin
160178 ):
161179 # type: (str, str, str, Union[str, SchemaFormat], Any) -> SchemaProperties
162180 """
163181 Gets the schema properties corresponding to an existing schema within the specified schema group,
164182 as matched by schema definition comparison.
165183
166184 :param str group_name: Schema group under which schema should be registered.
167- :param str name : Name of schema being registered.
185+ :param str schema_name : Name of schema being registered.
168186 :param str schema_definition: String representation of the schema being registered.
169187 :param format: Format for the schema being registered.
170188 :type format: Union[str, SchemaFormat]
@@ -189,7 +207,7 @@ def get_schema_properties(
189207 http_request_kwargs = get_http_request_kwargs (kwargs )
190208 request = schema_rest .build_query_id_by_content_request (
191209 group_name = group_name ,
192- schema_name = name ,
210+ schema_name = schema_name ,
193211 content = schema_definition ,
194212 serialization_type = format ,
195213 content_type = kwargs .pop ("content_type" , "application/json" ),
0 commit comments