Skip to content

Commit

Permalink
Update Geolocation changelog for the release (Azure#38359)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lakicar95 authored Nov 8, 2024
1 parent dad2f74 commit c6d4b95
Show file tree
Hide file tree
Showing 37 changed files with 454 additions and 578 deletions.
2 changes: 1 addition & 1 deletion sdk/maps/azure-maps-geolocation/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Release History

## 1.0.0b2 (2024-05-15)
## 1.0.0b2 (2024-11-06)

### Other Changes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@
from ._version import VERSION
from ._geolocation_client import MapsGeolocationClient

__all__ = [
'MapsGeolocationClient'
]
__all__ = ["MapsGeolocationClient"]
__version__ = VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,24 @@
from ._generated import GeolocationClient as _GeolocationClient
from ._version import API_VERSION


# To check the credential is either AzureKeyCredential or TokenCredential
def _authentication_policy(credential):
authentication_policy = None
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if isinstance(credential, AzureKeyCredential):
authentication_policy = AzureKeyCredentialPolicy(
name="subscription-key", credential=credential
)
authentication_policy = AzureKeyCredentialPolicy(name="subscription-key", credential=credential)
elif credential is not None and not hasattr(credential, "get_token"):
raise TypeError(
"Unsupported credential: {}. Use an instance of AzureKeyCredential "
"or a token credential from azure.identity".format(type(credential))
)
return authentication_policy


class MapsGeolocationClientBase:
def __init__(
self,
credential: Union[AzureKeyCredential, TokenCredential],
**kwargs: Any
) -> None:
def __init__(self, credential: Union[AzureKeyCredential, TokenCredential], **kwargs: Any) -> None:
self._maps_client = _GeolocationClient(
credential=credential, # type: ignore
api_version=kwargs.pop("api_version", API_VERSION),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
__all__ = ['GeolocationClient']

__all__ = ["GeolocationClient"]
__all__.extend([p for p in _patch_all if p not in __all__])

_patch_sdk()
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential


class GeolocationClient: # pylint: disable=client-accepts-api-version-keyword
"""Azure Maps Geolocation REST APIs.
Expand Down Expand Up @@ -55,16 +56,9 @@ def __init__(
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.geolocation = GeolocationOperations(
self._client, self._config, self._serialize, self._deserialize
)

self.geolocation = GeolocationOperations(self._client, self._config, self._serialize, self._deserialize)

def send_request(
self,
request: HttpRequest,
**kwargs: Any
) -> HttpResponse:
def send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,38 +36,34 @@ class GeolocationClientConfiguration(Configuration): # pylint: disable=too-many
:paramtype api_version: str
"""

def __init__(
self,
credential: "TokenCredential",
client_id: Optional[str] = None,
**kwargs: Any
) -> None:
def __init__(self, credential: "TokenCredential", client_id: Optional[str] = None, **kwargs: Any) -> None:
super(GeolocationClientConfiguration, self).__init__(**kwargs)
api_version = kwargs.pop('api_version', "1.0") # type: str
api_version = kwargs.pop("api_version", "1.0") # type: str

if credential is None:
raise ValueError("Parameter 'credential' must not be None.")

self.credential = credential
self.client_id = client_id
self.api_version = api_version
self.credential_scopes = kwargs.pop('credential_scopes', ['https://atlas.microsoft.com/.default'])
kwargs.setdefault('sdk_moniker', 'maps-geolocation/{}'.format(VERSION))
self.credential_scopes = kwargs.pop("credential_scopes", ["https://atlas.microsoft.com/.default"])
kwargs.setdefault("sdk_moniker", "maps-geolocation/{}".format(VERSION))
self._configure(**kwargs)

def _configure(
self,
**kwargs # type: Any
self, **kwargs # type: Any
):
# type: (...) -> None
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
self.authentication_policy = policies.BearerTokenCredentialPolicy(
self.credential, *self.credential_scopes, **kwargs
)
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

__all__: List[str] = [] # Add all objects you want publicly available to users at this package level


def patch_sdk():
"""Do not remove from this file.
Expand Down
Loading

0 comments on commit c6d4b95

Please sign in to comment.