diff --git a/sdk/planetarycomputer/azure-planetarycomputer/CHANGELOG.md b/sdk/planetarycomputer/azure-planetarycomputer/CHANGELOG.md index 5f02193934d7..4f60234107db 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/CHANGELOG.md +++ b/sdk/planetarycomputer/azure-planetarycomputer/CHANGELOG.md @@ -1,9 +1,13 @@ # Release History -## 1.0.0b1 (2025-12-01) +## 1.0.0b1 (Unreleased) -- Initial version +### Features Added -### Other Changes +- Added models `AssetStatisticsResponse`, `BandStatisticsMap`, `ClassMapLegendResponse`, `QueryableDefinitionsResponse`, `TilerAssetGeoJson`, `TilerInfoMapResponse`. +- `get_collection_queryables`, `list_queryables` now return `QueryableDefinitionsResponse`. +- `get_class_map_legend` now returns `ClassMapLegendResponse`. -- Introduce azure-planetarycomputer. +### Breaking Changes + +- Renamed `StacOperations.list_collections` to `StacOperations.get_collections`. diff --git a/sdk/planetarycomputer/azure-planetarycomputer/CONTRIBUTING.md b/sdk/planetarycomputer/azure-planetarycomputer/CONTRIBUTING.md index 5549f13cf487..f1b011296d16 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/CONTRIBUTING.md +++ b/sdk/planetarycomputer/azure-planetarycomputer/CONTRIBUTING.md @@ -77,12 +77,24 @@ The code generator already produces a file-level suppression on line 1 of each ` | `from collections.abc import MutableMapping` | `# pylint: disable=import-error` | Not resolvable in the pylint virtualenv | | `return super().__new__(cls)` (in `Model.__new__`) | `# pylint: disable=no-value-for-parameter` | False positive - pylint cannot resolve the MRO for `__new__` | -> **Important:** After adding pylint suppressions, run `tox -e black` first - Black may reformat single-line imports into multi-line, which moves your `# pylint: disable` comments. If Black reformats the `_deserialize_xml` import into multiple lines, the `# pylint: disable=unused-import` comment must be on the `from ... import (` line, **not** on the closing `)` or the individual name line. +> **Critical: Run Black _before_ adding pylint suppressions.** Black reformats imports (turning single-line into multi-line), which changes where `# pylint: disable` comments must go. If you add suppressions first and then run Black, the comments may end up on the wrong line. The correct order is: (1) run `tox -e black`, (2) restore tests/samples, (3) add pylint suppressions. -### Sample Updates +> **Emitter version variability:** The emitter may add different inline suppressions to different functions. For example, `build_data_get_mosaics_tile_json_request` gets the full `too-many-locals,too-many-branches,too-many-statements`, while `build_data_get_mosaics_tile_request` only gets `too-many-locals`. Always check the pylint output to see if additional suppressions are needed beyond what the emitter provides. + +### Sphinx Docstring Fixes + +The code generator sometimes produces RST formatting bugs in docstrings (e.g., code block terminators merged with following text, incorrect bullet continuation indentation). These must be fixed in **both** sync and async `_operations.py`. Run `tox -e sphinx` after each regeneration — Sphinx treats warnings as errors, so any formatting issues will cause a build failure. + +### Sample and Test Updates If the TypeSpec renames or removes API operations, the hand-written samples under `samples/` and `samples/async/` must be updated to match. MyPy and Pyright (which also check samples) will catch these as type errors. +**Test updates require special care:** + +- **Do NOT rename test methods** even if the SDK method they test was renamed. Test method names determine recording file paths. Renaming a test method breaks the recording lookup — only change the API call *inside* the test body. +- **Update type assertions** if an API's return type changes (e.g., from `dict` to a typed model). The test assertions must match the new return type. +- **Run tests in playback mode** (`pytest tests/ -v`) after all fixes to verify all tests pass. + --- ## Local Validation @@ -269,15 +281,21 @@ Each file has a sync and async variant (e.g., `test_00_stac_collection.py` and ` After running `npx tsp-client update`: -- [ ] Restore `tests/` and `samples/` - `git checkout -- tests/ samples/` +- [ ] Delete `generated_samples/` and `generated_tests/` +- [ ] Restore `tests/` and `samples/` — `git checkout -- tests/ samples/` +- [ ] Run `tox -e black` — formatting (MUST be done before adding pylint suppressions) +- [ ] Restore `tests/` and `samples/` again if Black modified them - [ ] Add inline `# pylint: disable=import-error` to `MutableMapping` imports (3 files) - [ ] Add `# pylint: disable=unused-import` on the `from ... import (` line for `_deserialize_xml` (2 files) -- [ ] Add `# pylint: disable=too-many-locals,too-many-branches,too-many-statements` inline on `build_data_get_mosaics_tile_request` (sync `_operations.py` only) +- [ ] Add `# pylint: disable=too-many-locals,too-many-branches,too-many-statements` inline on `build_data_get_mosaics_tile_*` functions (check emitter output — may need to add missing suppressions) - [ ] Add inline `# pylint: disable=no-value-for-parameter` to `Model.__new__` in `model_base.py` -- [ ] Run `tox -e black` - formatting (may reformat imports; re-check pylint comment placement) -- [ ] Restore `tests/` and `samples/` again if Black modified them -- [ ] Run `tox -e pylint` - linting (should score 10.00/10) -- [ ] Run `tox -e sphinx` - documentation -- [ ] Run `tox -e mypy` and `tox -e pyright` - type checking (will catch renamed/removed APIs in samples) +- [ ] Fix any Sphinx docstring issues (both sync and async `_operations.py`) — check `tox -e sphinx` output +- [ ] Run `tox -e pylint` — linting (should score 10.00/10) +- [ ] Run `tox -e sphinx` — documentation (should build with 0 warnings) +- [ ] Run `tox -e mypy` and `tox -e pyright` — type checking (will catch renamed/removed APIs in samples) - [ ] Update samples if any operations were renamed or removed +- [ ] Update tests: fix API calls (not method names!), update `isinstance` checks for changed return types +- [ ] Run `pytest tests/ -v` in playback mode — should be 202 passed +- [ ] Run `tox -e apistub` — API stub generation +- [ ] Re-record tests if HTTP request/response data changed (see Testing section) - [ ] Update `CHANGELOG.md` with a release date if preparing a release \ No newline at end of file diff --git a/sdk/planetarycomputer/azure-planetarycomputer/apiview-properties.json b/sdk/planetarycomputer/azure-planetarycomputer/apiview-properties.json index 078a9e1cef38..e7d73c6b5fb4 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/apiview-properties.json +++ b/sdk/planetarycomputer/azure-planetarycomputer/apiview-properties.json @@ -2,7 +2,10 @@ "CrossLanguagePackageId": "Microsoft.PlanetaryComputer", "CrossLanguageDefinitionId": { "azure.planetarycomputer.models.AssetMetadata": "Microsoft.PlanetaryComputer.AssetMetadata", + "azure.planetarycomputer.models.AssetStatisticsResponse": "Microsoft.PlanetaryComputer.AssetStatisticsResponse", "azure.planetarycomputer.models.BandStatistics": "Microsoft.PlanetaryComputer.BandStatistics", + "azure.planetarycomputer.models.BandStatisticsMap": "Microsoft.PlanetaryComputer.BandStatisticsMap", + "azure.planetarycomputer.models.ClassMapLegendResponse": "ClassMapLegendResponse", "azure.planetarycomputer.models.DefaultLocation": "Microsoft.PlanetaryComputer.DefaultLocation", "azure.planetarycomputer.models.ErrorInfo": "Microsoft.PlanetaryComputer.ErrorInfo", "azure.planetarycomputer.models.Feature": "Feature", @@ -27,6 +30,7 @@ "azure.planetarycomputer.models.PartitionType": "Microsoft.PlanetaryComputer.PartitionType", "azure.planetarycomputer.models.Point": "Point", "azure.planetarycomputer.models.Polygon": "Polygon", + "azure.planetarycomputer.models.QueryableDefinitionsResponse": "Microsoft.PlanetaryComputer.QueryableDefinitionsResponse", "azure.planetarycomputer.models.RenderOption": "Microsoft.PlanetaryComputer.RenderOption", "azure.planetarycomputer.models.RenderOptionCondition": "Microsoft.PlanetaryComputer.RenderOptionCondition", "azure.planetarycomputer.models.RenderOptionLegend": "Microsoft.PlanetaryComputer.RenderOptionLegend", @@ -66,9 +70,11 @@ "azure.planetarycomputer.models.TileMatrix": "TileMatrix", "azure.planetarycomputer.models.TileMatrixSet": "TileMatrixSet", "azure.planetarycomputer.models.TileMatrixSetBoundingBox": "TileMatrixSetBoundingBox", + "azure.planetarycomputer.models.TilerAssetGeoJson": "Microsoft.PlanetaryComputer.TilerAssetGeoJson", "azure.planetarycomputer.models.TilerCoreModelsResponsesPoint": "Microsoft.PlanetaryComputer.TilerCoreModelsResponsesPoint", "azure.planetarycomputer.models.TilerInfo": "Microsoft.PlanetaryComputer.TilerInfo", "azure.planetarycomputer.models.TilerInfoGeoJsonFeature": "Microsoft.PlanetaryComputer.TilerInfoGeoJsonFeature", + "azure.planetarycomputer.models.TilerInfoMapResponse": "Microsoft.PlanetaryComputer.TilerInfoMapResponse", "azure.planetarycomputer.models.TilerMosaicSearchRegistrationResponse": "Microsoft.PlanetaryComputer.TilerMosaicSearchRegistrationResponse", "azure.planetarycomputer.models.TilerStacItemStatistics": "Microsoft.PlanetaryComputer.TilerStacItemStatistics", "azure.planetarycomputer.models.TilerStacSearchDefinition": "Microsoft.PlanetaryComputer.TilerStacSearchDefinition", @@ -162,8 +168,8 @@ "azure.planetarycomputer.aio.operations.StacOperations.begin_delete_collection": "Customizations.Stac.deleteCollection", "azure.planetarycomputer.operations.StacOperations.get_collection": "Customizations.Stac.getCollection", "azure.planetarycomputer.aio.operations.StacOperations.get_collection": "Customizations.Stac.getCollection", - "azure.planetarycomputer.operations.StacOperations.list_collections": "Customizations.Stac.listCollections", - "azure.planetarycomputer.aio.operations.StacOperations.list_collections": "Customizations.Stac.listCollections", + "azure.planetarycomputer.operations.StacOperations.get_collections": "Customizations.Stac.getCollections", + "azure.planetarycomputer.aio.operations.StacOperations.get_collections": "Customizations.Stac.getCollections", "azure.planetarycomputer.operations.StacOperations.get_partition_type": "Customizations.Stac.getPartitionType", "azure.planetarycomputer.aio.operations.StacOperations.get_partition_type": "Customizations.Stac.getPartitionType", "azure.planetarycomputer.operations.StacOperations.replace_partition_type": "Customizations.Stac.replacePartitionType", diff --git a/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/_types.py b/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/_types.py index 5a70a723103f..a45d10748e70 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/_types.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/_types.py @@ -9,4 +9,3 @@ from typing import Union BandMetadataElement = Union[str, dict[str, str]] -IntervalLegendsElement = Union[list[int], dict[str, str]] diff --git a/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/aio/operations/_operations.py b/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/aio/operations/_operations.py index 5e7ec8863f14..54bc3f1903ec 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/aio/operations/_operations.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -9,7 +9,7 @@ from collections.abc import MutableMapping # pylint: disable=import-error from io import IOBase import json -from typing import Any, AsyncIterator, Callable, IO, Optional, TYPE_CHECKING, TypeVar, Union, cast, overload +from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core import AsyncPipelineClient @@ -33,12 +33,7 @@ from azure.core.utils import case_insensitive_dict from ... import models as _models -from ..._utils.model_base import ( # pylint: disable=unused-import - Model as _Model, - SdkJSONEncoder, - _deserialize, - _deserialize_xml, -) +from ..._utils.model_base import Model as _Model, SdkJSONEncoder, _deserialize, _deserialize_xml # pylint: disable=unused-import from ..._utils.serialization import Deserializer, Serializer from ..._utils.utils import prepare_multipart_form_data from ...operations._operations import ( @@ -112,6 +107,7 @@ build_stac_get_collection_queryables_request, build_stac_get_collection_request, build_stac_get_collection_thumbnail_request, + build_stac_get_collections_request, build_stac_get_conformance_class_request, build_stac_get_item_collection_request, build_stac_get_item_request, @@ -120,7 +116,6 @@ build_stac_get_partition_type_request, build_stac_get_render_option_request, build_stac_get_tile_settings_request, - build_stac_list_collections_request, build_stac_list_mosaics_request, build_stac_list_queryables_request, build_stac_list_render_options_request, @@ -135,8 +130,6 @@ ) from .._configuration import PlanetaryComputerProClientConfiguration -if TYPE_CHECKING: - from ... import _types JSON = MutableMapping[str, Any] T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] @@ -3082,7 +3075,7 @@ async def get_collection( return deserialized # type: ignore @distributed_trace_async - async def list_collections( + async def get_collections( self, *, sign: Optional[Union[str, _models.StacAssetUrlSigningMode]] = None, @@ -3115,7 +3108,7 @@ async def list_collections( cls: ClsType[_models.StacCatalogCollections] = kwargs.pop("cls", None) - _request = build_stac_list_collections_request( + _request = build_stac_get_collections_request( sign=sign, duration_in_minutes=duration_in_minutes, api_version=self._config.api_version, @@ -5545,13 +5538,14 @@ async def delete_queryable(self, collection_id: str, queryable_name: str, **kwar return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async - async def list_queryables(self, **kwargs: Any) -> dict[str, Any]: + async def list_queryables(self, **kwargs: Any) -> _models.QueryableDefinitionsResponse: """Queryables. List all queryables in the GeoCatalog instance. - :return: dict mapping str to any - :rtype: dict[str, any] + :return: QueryableDefinitionsResponse. The QueryableDefinitionsResponse is compatible with + MutableMapping + :rtype: ~azure.planetarycomputer.models.QueryableDefinitionsResponse :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -5565,7 +5559,7 @@ async def list_queryables(self, **kwargs: Any) -> dict[str, Any]: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[dict[str, Any]] = kwargs.pop("cls", None) + cls: ClsType[_models.QueryableDefinitionsResponse] = kwargs.pop("cls", None) _request = build_stac_list_queryables_request( api_version=self._config.api_version, @@ -5596,7 +5590,7 @@ async def list_queryables(self, **kwargs: Any) -> dict[str, Any]: if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(dict[str, Any], response.json()) + deserialized = _deserialize(_models.QueryableDefinitionsResponse, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5604,15 +5598,18 @@ async def list_queryables(self, **kwargs: Any) -> dict[str, Any]: return deserialized # type: ignore @distributed_trace_async - async def get_collection_queryables(self, collection_id: str, **kwargs: Any) -> dict[str, Any]: + async def get_collection_queryables( + self, collection_id: str, **kwargs: Any + ) -> _models.QueryableDefinitionsResponse: """Collection Queryables. List all queryables in a given collection. :param collection_id: Collection ID. Required. :type collection_id: str - :return: dict mapping str to any - :rtype: dict[str, any] + :return: QueryableDefinitionsResponse. The QueryableDefinitionsResponse is compatible with + MutableMapping + :rtype: ~azure.planetarycomputer.models.QueryableDefinitionsResponse :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -5626,7 +5623,7 @@ async def get_collection_queryables(self, collection_id: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[dict[str, Any]] = kwargs.pop("cls", None) + cls: ClsType[_models.QueryableDefinitionsResponse] = kwargs.pop("cls", None) _request = build_stac_get_collection_queryables_request( collection_id=collection_id, @@ -5658,7 +5655,7 @@ async def get_collection_queryables(self, collection_id: str, **kwargs: Any) -> if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(dict[str, Any], response.json()) + deserialized = _deserialize(_models.QueryableDefinitionsResponse, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5667,7 +5664,13 @@ async def get_collection_queryables(self, collection_id: str, **kwargs: Any) -> @overload async def search( - self, body: _models.StacSearchParameters, *, content_type: str = "application/json", **kwargs: Any + self, + body: _models.StacSearchParameters, + *, + sign: Optional[Union[str, _models.StacAssetUrlSigningMode]] = None, + duration_in_minutes: Optional[int] = None, + content_type: str = "application/json", + **kwargs: Any ) -> _models.StacItemCollection: """Search. @@ -5675,6 +5678,11 @@ async def search( :param body: Request body. Required. :type body: ~azure.planetarycomputer.models.StacSearchParameters + :keyword sign: Whether to sign asset URLs in the response. Known values are: "true" and + "false". Default value is None. + :paramtype sign: str or ~azure.planetarycomputer.models.StacAssetUrlSigningMode + :keyword duration_in_minutes: URL signature duration in minutes. Default value is None. + :paramtype duration_in_minutes: int :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -5685,7 +5693,13 @@ async def search( @overload async def search( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + self, + body: JSON, + *, + sign: Optional[Union[str, _models.StacAssetUrlSigningMode]] = None, + duration_in_minutes: Optional[int] = None, + content_type: str = "application/json", + **kwargs: Any ) -> _models.StacItemCollection: """Search. @@ -5693,6 +5707,11 @@ async def search( :param body: Request body. Required. :type body: JSON + :keyword sign: Whether to sign asset URLs in the response. Known values are: "true" and + "false". Default value is None. + :paramtype sign: str or ~azure.planetarycomputer.models.StacAssetUrlSigningMode + :keyword duration_in_minutes: URL signature duration in minutes. Default value is None. + :paramtype duration_in_minutes: int :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -5703,7 +5722,13 @@ async def search( @overload async def search( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + self, + body: IO[bytes], + *, + sign: Optional[Union[str, _models.StacAssetUrlSigningMode]] = None, + duration_in_minutes: Optional[int] = None, + content_type: str = "application/json", + **kwargs: Any ) -> _models.StacItemCollection: """Search. @@ -5711,6 +5736,11 @@ async def search( :param body: Request body. Required. :type body: IO[bytes] + :keyword sign: Whether to sign asset URLs in the response. Known values are: "true" and + "false". Default value is None. + :paramtype sign: str or ~azure.planetarycomputer.models.StacAssetUrlSigningMode + :keyword duration_in_minutes: URL signature duration in minutes. Default value is None. + :paramtype duration_in_minutes: int :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -5721,7 +5751,12 @@ async def search( @distributed_trace_async async def search( - self, body: Union[_models.StacSearchParameters, JSON, IO[bytes]], **kwargs: Any + self, + body: Union[_models.StacSearchParameters, JSON, IO[bytes]], + *, + sign: Optional[Union[str, _models.StacAssetUrlSigningMode]] = None, + duration_in_minutes: Optional[int] = None, + **kwargs: Any ) -> _models.StacItemCollection: """Search. @@ -5730,6 +5765,11 @@ async def search( :param body: Request body. Is one of the following types: StacSearchParameters, JSON, IO[bytes] Required. :type body: ~azure.planetarycomputer.models.StacSearchParameters or JSON or IO[bytes] + :keyword sign: Whether to sign asset URLs in the response. Known values are: "true" and + "false". Default value is None. + :paramtype sign: str or ~azure.planetarycomputer.models.StacAssetUrlSigningMode + :keyword duration_in_minutes: URL signature duration in minutes. Default value is None. + :paramtype duration_in_minutes: int :return: StacItemCollection. The StacItemCollection is compatible with MutableMapping :rtype: ~azure.planetarycomputer.models.StacItemCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -5756,6 +5796,8 @@ async def search( _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_stac_search_request( + sign=sign, + duration_in_minutes=duration_in_minutes, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -5954,7 +5996,7 @@ async def get_asset_statistics( # pylint: disable=too-many-locals histogram_bins: Optional[str] = None, histogram_range: Optional[str] = None, **kwargs: Any - ) -> dict[str, dict[str, _models.BandStatistics]]: + ) -> _models.AssetStatisticsResponse: """Asset Statistics. Per Asset statistics. @@ -6013,8 +6055,8 @@ async def get_asset_statistics( # pylint: disable=too-many-locals `_. Default value is None. :paramtype histogram_range: str - :return: dict mapping str to dict mapping str to BandStatistics - :rtype: dict[str, dict[str, ~azure.planetarycomputer.models.BandStatistics]] + :return: AssetStatisticsResponse. The AssetStatisticsResponse is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.AssetStatisticsResponse :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -6028,7 +6070,7 @@ async def get_asset_statistics( # pylint: disable=too-many-locals _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[dict[str, dict[str, _models.BandStatistics]]] = kwargs.pop("cls", None) + cls: ClsType[_models.AssetStatisticsResponse] = kwargs.pop("cls", None) _request = build_data_get_asset_statistics_request( collection_id=collection_id, @@ -6074,7 +6116,7 @@ async def get_asset_statistics( # pylint: disable=too-many-locals if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(dict[str, dict[str, _models.BandStatistics]], response.json()) + deserialized = _deserialize(_models.AssetStatisticsResponse, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7879,7 +7921,7 @@ async def get_info_geo_json( @distributed_trace_async async def get_item_asset_details( self, collection_id: str, item_id: str, *, assets: Optional[List[str]] = None, **kwargs: Any - ) -> dict[str, _models.TilerInfo]: + ) -> _models.TilerInfoMapResponse: """Info. Return dataset's basic info. @@ -7890,8 +7932,8 @@ async def get_item_asset_details( :type item_id: str :keyword assets: Asset's names. Default value is None. :paramtype assets: list[str] - :return: dict mapping str to TilerInfo - :rtype: dict[str, ~azure.planetarycomputer.models.TilerInfo] + :return: TilerInfoMapResponse. The TilerInfoMapResponse is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TilerInfoMapResponse :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -7905,7 +7947,7 @@ async def get_item_asset_details( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[dict[str, _models.TilerInfo]] = kwargs.pop("cls", None) + cls: ClsType[_models.TilerInfoMapResponse] = kwargs.pop("cls", None) _request = build_data_get_item_asset_details_request( collection_id=collection_id, @@ -7939,7 +7981,7 @@ async def get_item_asset_details( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(dict[str, _models.TilerInfo], response.json()) + deserialized = _deserialize(_models.TilerInfoMapResponse, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9812,7 +9854,7 @@ async def get_wmts_capabilities( # pylint: disable=too-many-locals @distributed_trace_async async def get_class_map_legend( self, classmap_name: str, *, trim_start: Optional[int] = None, trim_end: Optional[int] = None, **kwargs: Any - ) -> dict[str, Any]: + ) -> _models.ClassMapLegendResponse: """Get ClassMap Legend. Generate values and color swatches mapping for a given classmap. @@ -9823,8 +9865,8 @@ async def get_class_map_legend( :paramtype trim_start: int :keyword trim_end: Number of items to trim from the end of the cmap. Default value is None. :paramtype trim_end: int - :return: dict mapping str to any - :rtype: dict[str, any] + :return: ClassMapLegendResponse. The ClassMapLegendResponse is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.ClassMapLegendResponse :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -9838,7 +9880,7 @@ async def get_class_map_legend( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[dict[str, Any]] = kwargs.pop("cls", None) + cls: ClsType[_models.ClassMapLegendResponse] = kwargs.pop("cls", None) _request = build_data_get_class_map_legend_request( classmap_name=classmap_name, @@ -9872,7 +9914,7 @@ async def get_class_map_legend( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(dict[str, Any], response.json()) + deserialized = _deserialize(_models.ClassMapLegendResponse, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9882,19 +9924,48 @@ async def get_class_map_legend( @distributed_trace_async async def get_interval_legend( self, classmap_name: str, *, trim_start: Optional[int] = None, trim_end: Optional[int] = None, **kwargs: Any - ) -> List[List["_types.IntervalLegendsElement"]]: + ) -> List[List[List[int]]]: """Get Interval Legend. Generate values and color swatches mapping for a given interval classmap. + Returns a color map for intervals, where each interval is defined by: + + * A numeric range `[min, max]` representing the interval boundaries. + * An RGBA color `[red, green, blue, alpha]` associated with the interval. + + The response is a 2D array of interval definitions, where each element is a pair: + + * The first element is an array of two numbers `[min, max]` defining the interval. + * The second element is an array of four numbers `[red, green, blue, alpha]` defining the RGBA + color. + + Example: + + .. code-block:: json + + [ + [ + [-2, 0], [0, 0, 0, 0] + ], + [ + [1, 32], [255, 255, 178, 255] + ] + ] + + This example defines two intervals: + + * The interval `[-2, 0]` is mapped to the color `[0, 0, 0, 0]` (transparent black). + * The interval `[1, 32]` is mapped to the color `[255, 255, 178, 255]` (opaque yellow). + :param classmap_name: classmap name. Required. :type classmap_name: str :keyword trim_start: Number of items to trim from the start of the cmap. Default value is None. :paramtype trim_start: int :keyword trim_end: Number of items to trim from the end of the cmap. Default value is None. :paramtype trim_end: int - :return: list of list of list of int or dict mapping str to str - :rtype: list[list[list[int] or dict[str, str]]] + :return: list of list of list of int + :rtype: list[list[list[int]]] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -9908,7 +9979,7 @@ async def get_interval_legend( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[List["_types.IntervalLegendsElement"]]] = kwargs.pop("cls", None) + cls: ClsType[List[List[List[int]]]] = kwargs.pop("cls", None) _request = build_data_get_interval_legend_request( classmap_name=classmap_name, @@ -9945,7 +10016,7 @@ async def get_interval_legend( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(List[List["_types.IntervalLegendsElement"]], response.json()) + deserialized = _deserialize(List[List[List[int]]], response.json()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -10161,7 +10232,7 @@ async def get_mosaics_assets_for_tile( exit_when_full: Optional[bool] = None, skip_covered: Optional[bool] = None, **kwargs: Any - ) -> List[Any]: + ) -> List[_models.TilerAssetGeoJson]: """Assets For Tile Tilematrixsetid As Path. Return a list of assets which overlap a given tile. @@ -10197,8 +10268,8 @@ async def get_mosaics_assets_for_tile( (defaults to True in PgSTAC). Default value is None. :paramtype skip_covered: bool - :return: list of any - :rtype: list[any] + :return: list of TilerAssetGeoJson + :rtype: list[~azure.planetarycomputer.models.TilerAssetGeoJson] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -10212,7 +10283,7 @@ async def get_mosaics_assets_for_tile( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[Any]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.TilerAssetGeoJson]] = kwargs.pop("cls", None) _request = build_data_get_mosaics_assets_for_tile_request( search_id=search_id, @@ -10254,7 +10325,7 @@ async def get_mosaics_assets_for_tile( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(List[Any], response.json()) + deserialized = _deserialize(List[_models.TilerAssetGeoJson], response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11212,7 +11283,7 @@ async def get_sign( """sign an HREF in the format of a URL and returns a SharedAccessSignatureSignedHrefResponse. Signs a HREF (a link URL) by appending a `SAS Token - `_. + `_. If the HREF is not a Azure Blob Storage HREF, then pass back the HREF unsigned. :keyword href: Href. Required. @@ -11282,7 +11353,7 @@ async def get_token( """generate a SAS Token for the given Azure Blob storage account and container. Generate a `SAS Token - `_ + `_ for the given storage account and container. The storage account and container must be associated with a Planetary Computer dataset indexed by the STAC API. @@ -11351,7 +11422,7 @@ async def revoke_token(self, *, duration_in_minutes: Optional[int] = None, **kwa """Revoke SAS token for the managed storage account of this GeoCatalog. Revoke a `SAS Token - `_ + `_ for managed storage account of this GeoCatalog. :keyword duration_in_minutes: Duration. Default value is None. diff --git a/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/models/__init__.py b/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/models/__init__.py index ce47f21509a7..54cc3911b1f2 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/models/__init__.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/models/__init__.py @@ -15,7 +15,10 @@ from ._models import ( # type: ignore AssetMetadata, + AssetStatisticsResponse, BandStatistics, + BandStatisticsMap, + ClassMapLegendResponse, DefaultLocation, ErrorInfo, Feature, @@ -40,6 +43,7 @@ PartitionType, Point, Polygon, + QueryableDefinitionsResponse, RenderOption, RenderOptionCondition, RenderOptionLegend, @@ -80,9 +84,11 @@ TileMatrixSet, TileMatrixSetBoundingBox, TileSettings, + TilerAssetGeoJson, TilerCoreModelsResponsesPoint, TilerInfo, TilerInfoGeoJsonFeature, + TilerInfoMapResponse, TilerMosaicSearchRegistrationResponse, TilerStacItemStatistics, TilerStacSearchDefinition, @@ -123,7 +129,10 @@ __all__ = [ "AssetMetadata", + "AssetStatisticsResponse", "BandStatistics", + "BandStatisticsMap", + "ClassMapLegendResponse", "DefaultLocation", "ErrorInfo", "Feature", @@ -148,6 +157,7 @@ "PartitionType", "Point", "Polygon", + "QueryableDefinitionsResponse", "RenderOption", "RenderOptionCondition", "RenderOptionLegend", @@ -188,9 +198,11 @@ "TileMatrixSet", "TileMatrixSetBoundingBox", "TileSettings", + "TilerAssetGeoJson", "TilerCoreModelsResponsesPoint", "TilerInfo", "TilerInfoGeoJsonFeature", + "TilerInfoMapResponse", "TilerMosaicSearchRegistrationResponse", "TilerStacItemStatistics", "TilerStacSearchDefinition", diff --git a/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/models/_models.py b/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/models/_models.py index 15d522fef94e..840671abaf7d 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/models/_models.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/models/_models.py @@ -69,6 +69,10 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class AssetStatisticsResponse(_Model): + """Return dataset's statistics.""" + + class BandStatistics(_Model): """Statistical information about a data band. @@ -172,6 +176,14 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class BandStatisticsMap(_Model): + """Map of band names to their statistics.""" + + +class ClassMapLegendResponse(_Model): + """ClassMap legend response model.""" + + class DefaultLocation(_Model): """Defines a default geographic location for map visualization. @@ -664,7 +676,7 @@ class IngestionSource(_Model): """ __mapping__: dict[str, _Model] = {} - id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + id: str = rest_field(visibility=["read", "update"]) """Ingestion source id. Required.""" created: Optional[datetime.datetime] = rest_field(visibility=["read"], format="rfc3339") """Created time in UTC format.""" @@ -742,19 +754,19 @@ class LineString(Geometry, discriminator="LineString"): :ivar type: The type of the linestring. Required. Represents a LineString geometry. :vartype type: str or ~azure.planetarycomputer.models.LINE_STRING :ivar coordinates: The coordinates of the linestring. Required. - :vartype coordinates: list[float] + :vartype coordinates: list[list[float]] """ type: Literal[GeometryType.LINE_STRING] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore """The type of the linestring. Required. Represents a LineString geometry.""" - coordinates: list[float] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + coordinates: list[list[float]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The coordinates of the linestring. Required.""" @overload def __init__( self, *, - coordinates: list[float], + coordinates: list[list[float]], bounding_box: Optional[list[float]] = None, ) -> None: ... @@ -945,19 +957,19 @@ class MultiLineString(Geometry, discriminator="MultiLineString"): :ivar type: The type of the multilinestring. Required. Represents a MultiLineString geometry. :vartype type: str or ~azure.planetarycomputer.models.MULTI_LINE_STRING :ivar coordinates: The coordinates of the multilinestring. Required. - :vartype coordinates: list[list[float]] + :vartype coordinates: list[list[list[float]]] """ type: Literal[GeometryType.MULTI_LINE_STRING] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore """The type of the multilinestring. Required. Represents a MultiLineString geometry.""" - coordinates: list[list[float]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + coordinates: list[list[list[float]]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The coordinates of the multilinestring. Required.""" @overload def __init__( self, *, - coordinates: list[list[float]], + coordinates: list[list[list[float]]], bounding_box: Optional[list[float]] = None, ) -> None: ... @@ -981,19 +993,19 @@ class MultiPoint(Geometry, discriminator="MultiPoint"): :ivar type: The type of the multipoint. Required. Represents a MultiPoint geometry. :vartype type: str or ~azure.planetarycomputer.models.MULTI_POINT :ivar coordinates: The coordinates of the multipoint. Required. - :vartype coordinates: list[float] + :vartype coordinates: list[list[float]] """ type: Literal[GeometryType.MULTI_POINT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore """The type of the multipoint. Required. Represents a MultiPoint geometry.""" - coordinates: list[float] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + coordinates: list[list[float]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The coordinates of the multipoint. Required.""" @overload def __init__( self, *, - coordinates: list[float], + coordinates: list[list[float]], bounding_box: Optional[list[float]] = None, ) -> None: ... @@ -1015,12 +1027,12 @@ class MultiPolygon(Geometry, discriminator="MultiPolygon"): :ivar bounding_box: Optional bounding box of the geometry. :vartype bounding_box: list[float] :ivar coordinates: The coordinates of the multipolygon. Required. - :vartype coordinates: list[list[list[float]]] + :vartype coordinates: list[list[list[list[float]]]] :ivar type: The type of the multipolygon. Required. Represents a MultiPolygon geometry. :vartype type: str or ~azure.planetarycomputer.models.MULTI_POLYGON """ - coordinates: list[list[list[float]]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + coordinates: list[list[list[list[float]]]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The coordinates of the multipolygon. Required.""" type: Literal[GeometryType.MULTI_POLYGON] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore """The type of the multipolygon. Required. Represents a MultiPolygon geometry.""" @@ -1029,7 +1041,7 @@ class MultiPolygon(Geometry, discriminator="MultiPolygon"): def __init__( self, *, - coordinates: list[list[list[float]]], + coordinates: list[list[list[list[float]]]], bounding_box: Optional[list[float]] = None, ) -> None: ... @@ -1227,20 +1239,20 @@ class Point(Geometry, discriminator="Point"): Point geometry. :vartype type: str or ~azure.planetarycomputer.models.POINT :ivar coordinates: The coordinates of the point as [longitude, latitude]. Required. - :vartype coordinates: str + :vartype coordinates: list[float] """ type: Literal[GeometryType.POINT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore """The geometry type, always \"Point\" for Point geometries. Required. Represents a Point geometry.""" - coordinates: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + coordinates: list[float] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The coordinates of the point as [longitude, latitude]. Required.""" @overload def __init__( self, *, - coordinates: str, + coordinates: list[float], bounding_box: Optional[list[float]] = None, ) -> None: ... @@ -1292,6 +1304,10 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = GeometryType.POLYGON # type: ignore +class QueryableDefinitionsResponse(_Model): + """Queryable definitions response.""" + + class RenderOption(_Model): """Defines visualization parameters for rendering data on a map. @@ -1894,9 +1910,9 @@ class StacCollection(_Model): Represents a STAC collection. :ivar created_on: MSFT Created. - :vartype created_on: str + :vartype created_on: ~datetime.datetime :ivar updated_on: MSFT Updated. - :vartype updated_on: str + :vartype updated_on: ~datetime.datetime :ivar short_description: MSFT Short Description. :vartype short_description: str :ivar stac_extensions: URLs to STAC extensions implemented by this STAC resource. @@ -1935,12 +1951,12 @@ class StacCollection(_Model): :vartype summaries: dict[str, any] """ - created_on: Optional[str] = rest_field( - name="msft:_created", visibility=["read", "create", "update", "delete", "query"] + created_on: Optional[datetime.datetime] = rest_field( + name="msft:_created", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" ) """MSFT Created.""" - updated_on: Optional[str] = rest_field( - name="msft:_updated", visibility=["read", "create", "update", "delete", "query"] + updated_on: Optional[datetime.datetime] = rest_field( + name="msft:_updated", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" ) """MSFT Updated.""" short_description: Optional[str] = rest_field( @@ -1997,8 +2013,8 @@ def __init__( links: list["_models.StacLink"], license: str, extent: "_models.StacExtensionExtent", - created_on: Optional[str] = None, - updated_on: Optional[str] = None, + created_on: Optional[datetime.datetime] = None, + updated_on: Optional[datetime.datetime] = None, short_description: Optional[str] = None, stac_extensions: Optional[list[str]] = None, stac_version: Optional[str] = None, @@ -2231,9 +2247,9 @@ class StacItemOrStacItemCollection(_Model): :ivar links: Links to related resources and endpoints. :vartype links: list[~azure.planetarycomputer.models.StacLink] :ivar created_on: MSFT Created. - :vartype created_on: str + :vartype created_on: ~datetime.datetime :ivar updated_on: MSFT Updated. - :vartype updated_on: str + :vartype updated_on: ~datetime.datetime :ivar short_description: MSFT Short Description. :vartype short_description: str :ivar stac_extensions: URLs to STAC extensions implemented by this STAC resource. @@ -2248,12 +2264,12 @@ class StacItemOrStacItemCollection(_Model): """Stac Version.""" links: Optional[list["_models.StacLink"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Links to related resources and endpoints.""" - created_on: Optional[str] = rest_field( - name="msft:_created", visibility=["read", "create", "update", "delete", "query"] + created_on: Optional[datetime.datetime] = rest_field( + name="msft:_created", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" ) """MSFT Created.""" - updated_on: Optional[str] = rest_field( - name="msft:_updated", visibility=["read", "create", "update", "delete", "query"] + updated_on: Optional[datetime.datetime] = rest_field( + name="msft:_updated", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" ) """MSFT Updated.""" short_description: Optional[str] = rest_field( @@ -2270,8 +2286,8 @@ def __init__( type: str, stac_version: Optional[str] = None, links: Optional[list["_models.StacLink"]] = None, - created_on: Optional[str] = None, - updated_on: Optional[str] = None, + created_on: Optional[datetime.datetime] = None, + updated_on: Optional[datetime.datetime] = None, short_description: Optional[str] = None, stac_extensions: Optional[list[str]] = None, ) -> None: ... @@ -2295,9 +2311,9 @@ class StacItem(StacItemOrStacItemCollection, discriminator="Feature"): :ivar links: Links to related resources and endpoints. :vartype links: list[~azure.planetarycomputer.models.StacLink] :ivar created_on: MSFT Created. - :vartype created_on: str + :vartype created_on: ~datetime.datetime :ivar updated_on: MSFT Updated. - :vartype updated_on: str + :vartype updated_on: ~datetime.datetime :ivar short_description: MSFT Short Description. :vartype short_description: str :ivar stac_extensions: URLs to STAC extensions implemented by this STAC resource. @@ -2317,7 +2333,7 @@ class StacItem(StacItemOrStacItemCollection, discriminator="Feature"): :ivar assets: Assets. Required. :vartype assets: dict[str, ~azure.planetarycomputer.models.StacAsset] :ivar timestamp: MSFT Timestamp. - :vartype timestamp: str + :vartype timestamp: ~datetime.datetime :ivar e_tag: MSFT ETag. :vartype e_tag: str """ @@ -2336,7 +2352,9 @@ class StacItem(StacItemOrStacItemCollection, discriminator="Feature"): """Attributes associated with the feature. Required.""" assets: dict[str, "_models.StacAsset"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Assets. Required.""" - timestamp: Optional[str] = rest_field(name="_msft:ts", visibility=["read", "create", "update", "delete", "query"]) + timestamp: Optional[datetime.datetime] = rest_field( + name="_msft:ts", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) """MSFT Timestamp.""" e_tag: Optional[str] = rest_field(name="_msft:etag", visibility=["read", "create", "update", "delete", "query"]) """MSFT ETag.""" @@ -2352,12 +2370,12 @@ def __init__( assets: dict[str, "_models.StacAsset"], stac_version: Optional[str] = None, links: Optional[list["_models.StacLink"]] = None, - created_on: Optional[str] = None, - updated_on: Optional[str] = None, + created_on: Optional[datetime.datetime] = None, + updated_on: Optional[datetime.datetime] = None, short_description: Optional[str] = None, stac_extensions: Optional[list[str]] = None, collection: Optional[str] = None, - timestamp: Optional[str] = None, + timestamp: Optional[datetime.datetime] = None, e_tag: Optional[str] = None, ) -> None: ... @@ -2511,9 +2529,9 @@ class StacItemCollection(StacItemOrStacItemCollection, discriminator="FeatureCol :ivar links: Links to related resources and endpoints. :vartype links: list[~azure.planetarycomputer.models.StacLink] :ivar created_on: MSFT Created. - :vartype created_on: str + :vartype created_on: ~datetime.datetime :ivar updated_on: MSFT Updated. - :vartype updated_on: str + :vartype updated_on: ~datetime.datetime :ivar short_description: MSFT Short Description. :vartype short_description: str :ivar stac_extensions: URLs to STAC extensions implemented by this STAC resource. @@ -2548,8 +2566,8 @@ def __init__( features: list["_models.StacItem"], stac_version: Optional[str] = None, links: Optional[list["_models.StacLink"]] = None, - created_on: Optional[str] = None, - updated_on: Optional[str] = None, + created_on: Optional[datetime.datetime] = None, + updated_on: Optional[datetime.datetime] = None, short_description: Optional[str] = None, stac_extensions: Optional[list[str]] = None, bounding_box: Optional[list[float]] = None, @@ -2789,9 +2807,9 @@ class StacLandingPage(_Model): Represents the STAC API landing page with links to available resources. :ivar created_on: MSFT Created. - :vartype created_on: str + :vartype created_on: ~datetime.datetime :ivar updated_on: MSFT Updated. - :vartype updated_on: str + :vartype updated_on: ~datetime.datetime :ivar short_description: MSFT Short Description. :vartype short_description: str :ivar stac_extensions: URLs to STAC extensions implemented by this STAC resource. @@ -2812,12 +2830,12 @@ class StacLandingPage(_Model): :vartype type: str """ - created_on: Optional[str] = rest_field( - name="msft:_created", visibility=["read", "create", "update", "delete", "query"] + created_on: Optional[datetime.datetime] = rest_field( + name="msft:_created", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" ) """MSFT Created.""" - updated_on: Optional[str] = rest_field( - name="msft:_updated", visibility=["read", "create", "update", "delete", "query"] + updated_on: Optional[datetime.datetime] = rest_field( + name="msft:_updated", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" ) """MSFT Updated.""" short_description: Optional[str] = rest_field( @@ -2849,8 +2867,8 @@ def __init__( description: str, conforms_to: list[str], links: list["_models.StacLink"], - created_on: Optional[str] = None, - updated_on: Optional[str] = None, + created_on: Optional[datetime.datetime] = None, + updated_on: Optional[datetime.datetime] = None, short_description: Optional[str] = None, stac_extensions: Optional[list[str]] = None, title: Optional[str] = None, @@ -3171,10 +3189,6 @@ class StacSearchParameters(_Model): Overrides datetime validation from the base request model. :vartype conformance_class: dict[str, any] - :ivar sign: Whether to sign asset URLs in the response. Known values are: "true" and "false". - :vartype sign: str or ~azure.planetarycomputer.models.StacAssetUrlSigningMode - :ivar duration_in_minutes: URL signature duration in minutes. - :vartype duration_in_minutes: int :ivar query: STAC Query See the `STAC Query Extension `_. @@ -3220,14 +3234,6 @@ class StacSearchParameters(_Model): """Conf Overrides datetime validation from the base request model.""" - sign: Optional[Union[str, "_models.StacAssetUrlSigningMode"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Whether to sign asset URLs in the response. Known values are: \"true\" and \"false\".""" - duration_in_minutes: Optional[int] = rest_field( - name="duration", visibility=["read", "create", "update", "delete", "query"] - ) - """URL signature duration in minutes.""" query: Optional[dict[str, Any]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """STAC Query @@ -3271,8 +3277,6 @@ def __init__( date_time: Optional[str] = None, limit: Optional[int] = None, conformance_class: Optional[dict[str, Any]] = None, - sign: Optional[Union[str, "_models.StacAssetUrlSigningMode"]] = None, - duration_in_minutes: Optional[int] = None, query: Optional[dict[str, Any]] = None, sort_by: Optional[list["_models.StacSortExtension"]] = None, fields: Optional[list["_models.SearchOptionsFields"]] = None, @@ -3696,6 +3700,49 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class TilerAssetGeoJson(_Model): + """Represents GeoJSON with feature with an asset property. + + :ivar id: Unique identifier for the feature. Required. + :vartype id: str + :ivar collection: ID of the STAC collection this item belongs to. + :vartype collection: str + :ivar bounding_box: Bounding box coordinates for the feature. Required. + :vartype bounding_box: list[float] + :ivar assets: Assets. Required. + :vartype assets: dict[str, ~azure.planetarycomputer.models.StacAsset] + """ + + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Unique identifier for the feature. Required.""" + collection: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """ID of the STAC collection this item belongs to.""" + bounding_box: list[float] = rest_field(name="bbox", visibility=["read", "create", "update", "delete", "query"]) + """Bounding box coordinates for the feature. Required.""" + assets: dict[str, "_models.StacAsset"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Assets. Required.""" + + @overload + def __init__( + self, + *, + id: str, # pylint: disable=redefined-builtin + bounding_box: list[float], + assets: dict[str, "_models.StacAsset"], + collection: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class TilerCoreModelsResponsesPoint(_Model): """Response model for point query operations providing values at a specific location. @@ -3903,6 +3950,10 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class TilerInfoMapResponse(_Model): + """Return dataset's basic info.""" + + class TilerMosaicSearchRegistrationResponse(_Model): """Response from a successful mosaic registration with search ID and related links. diff --git a/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/operations/_operations.py b/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/operations/_operations.py index 2c1ce139f44b..682ae83d26a2 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/operations/_operations.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/azure/planetarycomputer/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -9,7 +9,7 @@ from collections.abc import MutableMapping # pylint: disable=import-error from io import IOBase import json -from typing import Any, Callable, IO, Iterator, Optional, TYPE_CHECKING, TypeVar, Union, cast, overload +from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core import PipelineClient @@ -33,17 +33,11 @@ from .. import models as _models from .._configuration import PlanetaryComputerProClientConfiguration -from .._utils.model_base import ( # pylint: disable=unused-import - Model as _Model, - SdkJSONEncoder, - _deserialize, - _deserialize_xml, -) +from .._utils.model_base import Model as _Model, SdkJSONEncoder, _deserialize, _deserialize_xml # pylint: disable=unused-import + # pylint: disable=unused-import from .._utils.serialization import Deserializer, Serializer from .._utils.utils import prepare_multipart_form_data -if TYPE_CHECKING: - from .. import _types JSON = MutableMapping[str, Any] T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] @@ -833,7 +827,7 @@ def build_stac_get_collection_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_stac_list_collections_request( +def build_stac_get_collections_request( *, sign: Optional[Union[str, _models.StacAssetUrlSigningMode]] = None, duration_in_minutes: Optional[int] = None, @@ -1441,7 +1435,12 @@ def build_stac_get_collection_queryables_request( # pylint: disable=name-too-lo return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_stac_search_request(**kwargs: Any) -> HttpRequest: +def build_stac_search_request( + *, + sign: Optional[Union[str, _models.StacAssetUrlSigningMode]] = None, + duration_in_minutes: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1454,6 +1453,10 @@ def build_stac_search_request(**kwargs: Any) -> HttpRequest: # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if sign is not None: + _params["sign"] = _SERIALIZER.query("sign", sign, "str") + if duration_in_minutes is not None: + _params["duration"] = _SERIALIZER.query("duration_in_minutes", duration_in_minutes, "int") # Construct headers if content_type is not None: @@ -6316,7 +6319,7 @@ def get_collection( return deserialized # type: ignore @distributed_trace - def list_collections( + def get_collections( self, *, sign: Optional[Union[str, _models.StacAssetUrlSigningMode]] = None, @@ -6349,7 +6352,7 @@ def list_collections( cls: ClsType[_models.StacCatalogCollections] = kwargs.pop("cls", None) - _request = build_stac_list_collections_request( + _request = build_stac_get_collections_request( sign=sign, duration_in_minutes=duration_in_minutes, api_version=self._config.api_version, @@ -8779,13 +8782,14 @@ def delete_queryable( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore @distributed_trace - def list_queryables(self, **kwargs: Any) -> dict[str, Any]: + def list_queryables(self, **kwargs: Any) -> _models.QueryableDefinitionsResponse: """Queryables. List all queryables in the GeoCatalog instance. - :return: dict mapping str to any - :rtype: dict[str, any] + :return: QueryableDefinitionsResponse. The QueryableDefinitionsResponse is compatible with + MutableMapping + :rtype: ~azure.planetarycomputer.models.QueryableDefinitionsResponse :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -8799,7 +8803,7 @@ def list_queryables(self, **kwargs: Any) -> dict[str, Any]: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[dict[str, Any]] = kwargs.pop("cls", None) + cls: ClsType[_models.QueryableDefinitionsResponse] = kwargs.pop("cls", None) _request = build_stac_list_queryables_request( api_version=self._config.api_version, @@ -8830,7 +8834,7 @@ def list_queryables(self, **kwargs: Any) -> dict[str, Any]: if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(dict[str, Any], response.json()) + deserialized = _deserialize(_models.QueryableDefinitionsResponse, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8838,15 +8842,16 @@ def list_queryables(self, **kwargs: Any) -> dict[str, Any]: return deserialized # type: ignore @distributed_trace - def get_collection_queryables(self, collection_id: str, **kwargs: Any) -> dict[str, Any]: + def get_collection_queryables(self, collection_id: str, **kwargs: Any) -> _models.QueryableDefinitionsResponse: """Collection Queryables. List all queryables in a given collection. :param collection_id: Collection ID. Required. :type collection_id: str - :return: dict mapping str to any - :rtype: dict[str, any] + :return: QueryableDefinitionsResponse. The QueryableDefinitionsResponse is compatible with + MutableMapping + :rtype: ~azure.planetarycomputer.models.QueryableDefinitionsResponse :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -8860,7 +8865,7 @@ def get_collection_queryables(self, collection_id: str, **kwargs: Any) -> dict[s _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[dict[str, Any]] = kwargs.pop("cls", None) + cls: ClsType[_models.QueryableDefinitionsResponse] = kwargs.pop("cls", None) _request = build_stac_get_collection_queryables_request( collection_id=collection_id, @@ -8892,7 +8897,7 @@ def get_collection_queryables(self, collection_id: str, **kwargs: Any) -> dict[s if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(dict[str, Any], response.json()) + deserialized = _deserialize(_models.QueryableDefinitionsResponse, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8901,7 +8906,13 @@ def get_collection_queryables(self, collection_id: str, **kwargs: Any) -> dict[s @overload def search( - self, body: _models.StacSearchParameters, *, content_type: str = "application/json", **kwargs: Any + self, + body: _models.StacSearchParameters, + *, + sign: Optional[Union[str, _models.StacAssetUrlSigningMode]] = None, + duration_in_minutes: Optional[int] = None, + content_type: str = "application/json", + **kwargs: Any ) -> _models.StacItemCollection: """Search. @@ -8909,6 +8920,11 @@ def search( :param body: Request body. Required. :type body: ~azure.planetarycomputer.models.StacSearchParameters + :keyword sign: Whether to sign asset URLs in the response. Known values are: "true" and + "false". Default value is None. + :paramtype sign: str or ~azure.planetarycomputer.models.StacAssetUrlSigningMode + :keyword duration_in_minutes: URL signature duration in minutes. Default value is None. + :paramtype duration_in_minutes: int :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -8919,7 +8935,13 @@ def search( @overload def search( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + self, + body: JSON, + *, + sign: Optional[Union[str, _models.StacAssetUrlSigningMode]] = None, + duration_in_minutes: Optional[int] = None, + content_type: str = "application/json", + **kwargs: Any ) -> _models.StacItemCollection: """Search. @@ -8927,6 +8949,11 @@ def search( :param body: Request body. Required. :type body: JSON + :keyword sign: Whether to sign asset URLs in the response. Known values are: "true" and + "false". Default value is None. + :paramtype sign: str or ~azure.planetarycomputer.models.StacAssetUrlSigningMode + :keyword duration_in_minutes: URL signature duration in minutes. Default value is None. + :paramtype duration_in_minutes: int :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -8937,7 +8964,13 @@ def search( @overload def search( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + self, + body: IO[bytes], + *, + sign: Optional[Union[str, _models.StacAssetUrlSigningMode]] = None, + duration_in_minutes: Optional[int] = None, + content_type: str = "application/json", + **kwargs: Any ) -> _models.StacItemCollection: """Search. @@ -8945,6 +8978,11 @@ def search( :param body: Request body. Required. :type body: IO[bytes] + :keyword sign: Whether to sign asset URLs in the response. Known values are: "true" and + "false". Default value is None. + :paramtype sign: str or ~azure.planetarycomputer.models.StacAssetUrlSigningMode + :keyword duration_in_minutes: URL signature duration in minutes. Default value is None. + :paramtype duration_in_minutes: int :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -8955,7 +8993,12 @@ def search( @distributed_trace def search( - self, body: Union[_models.StacSearchParameters, JSON, IO[bytes]], **kwargs: Any + self, + body: Union[_models.StacSearchParameters, JSON, IO[bytes]], + *, + sign: Optional[Union[str, _models.StacAssetUrlSigningMode]] = None, + duration_in_minutes: Optional[int] = None, + **kwargs: Any ) -> _models.StacItemCollection: """Search. @@ -8964,6 +9007,11 @@ def search( :param body: Request body. Is one of the following types: StacSearchParameters, JSON, IO[bytes] Required. :type body: ~azure.planetarycomputer.models.StacSearchParameters or JSON or IO[bytes] + :keyword sign: Whether to sign asset URLs in the response. Known values are: "true" and + "false". Default value is None. + :paramtype sign: str or ~azure.planetarycomputer.models.StacAssetUrlSigningMode + :keyword duration_in_minutes: URL signature duration in minutes. Default value is None. + :paramtype duration_in_minutes: int :return: StacItemCollection. The StacItemCollection is compatible with MutableMapping :rtype: ~azure.planetarycomputer.models.StacItemCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -8990,6 +9038,8 @@ def search( _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore _request = build_stac_search_request( + sign=sign, + duration_in_minutes=duration_in_minutes, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -9188,7 +9238,7 @@ def get_asset_statistics( # pylint: disable=too-many-locals histogram_bins: Optional[str] = None, histogram_range: Optional[str] = None, **kwargs: Any - ) -> dict[str, dict[str, _models.BandStatistics]]: + ) -> _models.AssetStatisticsResponse: """Asset Statistics. Per Asset statistics. @@ -9247,8 +9297,8 @@ def get_asset_statistics( # pylint: disable=too-many-locals `_. Default value is None. :paramtype histogram_range: str - :return: dict mapping str to dict mapping str to BandStatistics - :rtype: dict[str, dict[str, ~azure.planetarycomputer.models.BandStatistics]] + :return: AssetStatisticsResponse. The AssetStatisticsResponse is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.AssetStatisticsResponse :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -9262,7 +9312,7 @@ def get_asset_statistics( # pylint: disable=too-many-locals _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[dict[str, dict[str, _models.BandStatistics]]] = kwargs.pop("cls", None) + cls: ClsType[_models.AssetStatisticsResponse] = kwargs.pop("cls", None) _request = build_data_get_asset_statistics_request( collection_id=collection_id, @@ -9308,7 +9358,7 @@ def get_asset_statistics( # pylint: disable=too-many-locals if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(dict[str, dict[str, _models.BandStatistics]], response.json()) + deserialized = _deserialize(_models.AssetStatisticsResponse, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11113,7 +11163,7 @@ def get_info_geo_json( @distributed_trace def get_item_asset_details( self, collection_id: str, item_id: str, *, assets: Optional[List[str]] = None, **kwargs: Any - ) -> dict[str, _models.TilerInfo]: + ) -> _models.TilerInfoMapResponse: """Info. Return dataset's basic info. @@ -11124,8 +11174,8 @@ def get_item_asset_details( :type item_id: str :keyword assets: Asset's names. Default value is None. :paramtype assets: list[str] - :return: dict mapping str to TilerInfo - :rtype: dict[str, ~azure.planetarycomputer.models.TilerInfo] + :return: TilerInfoMapResponse. The TilerInfoMapResponse is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.TilerInfoMapResponse :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -11139,7 +11189,7 @@ def get_item_asset_details( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[dict[str, _models.TilerInfo]] = kwargs.pop("cls", None) + cls: ClsType[_models.TilerInfoMapResponse] = kwargs.pop("cls", None) _request = build_data_get_item_asset_details_request( collection_id=collection_id, @@ -11173,7 +11223,7 @@ def get_item_asset_details( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(dict[str, _models.TilerInfo], response.json()) + deserialized = _deserialize(_models.TilerInfoMapResponse, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13046,7 +13096,7 @@ def get_wmts_capabilities( # pylint: disable=too-many-locals @distributed_trace def get_class_map_legend( self, classmap_name: str, *, trim_start: Optional[int] = None, trim_end: Optional[int] = None, **kwargs: Any - ) -> dict[str, Any]: + ) -> _models.ClassMapLegendResponse: """Get ClassMap Legend. Generate values and color swatches mapping for a given classmap. @@ -13057,8 +13107,8 @@ def get_class_map_legend( :paramtype trim_start: int :keyword trim_end: Number of items to trim from the end of the cmap. Default value is None. :paramtype trim_end: int - :return: dict mapping str to any - :rtype: dict[str, any] + :return: ClassMapLegendResponse. The ClassMapLegendResponse is compatible with MutableMapping + :rtype: ~azure.planetarycomputer.models.ClassMapLegendResponse :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -13072,7 +13122,7 @@ def get_class_map_legend( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[dict[str, Any]] = kwargs.pop("cls", None) + cls: ClsType[_models.ClassMapLegendResponse] = kwargs.pop("cls", None) _request = build_data_get_class_map_legend_request( classmap_name=classmap_name, @@ -13106,7 +13156,7 @@ def get_class_map_legend( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(dict[str, Any], response.json()) + deserialized = _deserialize(_models.ClassMapLegendResponse, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13116,19 +13166,48 @@ def get_class_map_legend( @distributed_trace def get_interval_legend( self, classmap_name: str, *, trim_start: Optional[int] = None, trim_end: Optional[int] = None, **kwargs: Any - ) -> List[List["_types.IntervalLegendsElement"]]: + ) -> List[List[List[int]]]: """Get Interval Legend. Generate values and color swatches mapping for a given interval classmap. + Returns a color map for intervals, where each interval is defined by: + + * A numeric range `[min, max]` representing the interval boundaries. + * An RGBA color `[red, green, blue, alpha]` associated with the interval. + + The response is a 2D array of interval definitions, where each element is a pair: + + * The first element is an array of two numbers `[min, max]` defining the interval. + * The second element is an array of four numbers `[red, green, blue, alpha]` defining the RGBA + color. + + Example: + + .. code-block:: json + + [ + [ + [-2, 0], [0, 0, 0, 0] + ], + [ + [1, 32], [255, 255, 178, 255] + ] + ] + + This example defines two intervals: + + * The interval `[-2, 0]` is mapped to the color `[0, 0, 0, 0]` (transparent black). + * The interval `[1, 32]` is mapped to the color `[255, 255, 178, 255]` (opaque yellow). + :param classmap_name: classmap name. Required. :type classmap_name: str :keyword trim_start: Number of items to trim from the start of the cmap. Default value is None. :paramtype trim_start: int :keyword trim_end: Number of items to trim from the end of the cmap. Default value is None. :paramtype trim_end: int - :return: list of list of list of int or dict mapping str to str - :rtype: list[list[list[int] or dict[str, str]]] + :return: list of list of list of int + :rtype: list[list[list[int]]] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -13142,7 +13221,7 @@ def get_interval_legend( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[List["_types.IntervalLegendsElement"]]] = kwargs.pop("cls", None) + cls: ClsType[List[List[List[int]]]] = kwargs.pop("cls", None) _request = build_data_get_interval_legend_request( classmap_name=classmap_name, @@ -13179,7 +13258,7 @@ def get_interval_legend( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(List[List["_types.IntervalLegendsElement"]], response.json()) + deserialized = _deserialize(List[List[List[int]]], response.json()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -13395,7 +13474,7 @@ def get_mosaics_assets_for_tile( exit_when_full: Optional[bool] = None, skip_covered: Optional[bool] = None, **kwargs: Any - ) -> List[Any]: + ) -> List[_models.TilerAssetGeoJson]: """Assets For Tile Tilematrixsetid As Path. Return a list of assets which overlap a given tile. @@ -13431,8 +13510,8 @@ def get_mosaics_assets_for_tile( (defaults to True in PgSTAC). Default value is None. :paramtype skip_covered: bool - :return: list of any - :rtype: list[any] + :return: list of TilerAssetGeoJson + :rtype: list[~azure.planetarycomputer.models.TilerAssetGeoJson] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -13446,7 +13525,7 @@ def get_mosaics_assets_for_tile( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[Any]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.TilerAssetGeoJson]] = kwargs.pop("cls", None) _request = build_data_get_mosaics_assets_for_tile_request( search_id=search_id, @@ -13488,7 +13567,7 @@ def get_mosaics_assets_for_tile( if _stream: deserialized = response.iter_bytes() else: - deserialized = _deserialize(List[Any], response.json()) + deserialized = _deserialize(List[_models.TilerAssetGeoJson], response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14446,7 +14525,7 @@ def get_sign( """sign an HREF in the format of a URL and returns a SharedAccessSignatureSignedHrefResponse. Signs a HREF (a link URL) by appending a `SAS Token - `_. + `_. If the HREF is not a Azure Blob Storage HREF, then pass back the HREF unsigned. :keyword href: Href. Required. @@ -14516,7 +14595,7 @@ def get_token( """generate a SAS Token for the given Azure Blob storage account and container. Generate a `SAS Token - `_ + `_ for the given storage account and container. The storage account and container must be associated with a Planetary Computer dataset indexed by the STAC API. @@ -14587,7 +14666,7 @@ def revoke_token( # pylint: disable=inconsistent-return-statements """Revoke SAS token for the managed storage account of this GeoCatalog. Revoke a `SAS Token - `_ + `_ for managed storage account of this GeoCatalog. :keyword duration_in_minutes: Duration. Default value is None. diff --git a/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_00_stac_collection_async.py b/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_00_stac_collection_async.py index ec709abe7591..38fa9538ece3 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_00_stac_collection_async.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_00_stac_collection_async.py @@ -59,7 +59,7 @@ async def create_collection(client: PlanetaryComputerProClient, collection_id): """Create a new STAC collection with item assets.""" # Check if collection already exists logging.info(f"Checking if collection '{collection_id}' exists...") - get_all_collections_response = await client.stac.list_collections() + get_all_collections_response = await client.stac.get_collections() if any(c.id == collection_id for c in get_all_collections_response["collections"]): logging.info(f"Collection '{collection_id}' already exists, deleting it...") @@ -483,7 +483,7 @@ async def main(): await credential.get_token("https://geocatalog.spatio.azure.com/.default") # List all collections - await client.stac.list_collections() + await client.stac.get_collections() # Create and configure collection await create_collection(client, collection_id) diff --git a/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_02_stac_specification_async.py b/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_02_stac_specification_async.py index cdedb31c9e4d..808223554c38 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_02_stac_specification_async.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/samples/async/planetary_computer_02_stac_specification_async.py @@ -64,7 +64,7 @@ async def get_landing_page(client: "PlanetaryComputerProClient"): async def search_collections(client: "PlanetaryComputerProClient"): """Search and list STAC collections.""" - collections = await client.stac.list_collections() + collections = await client.stac.get_collections() # Show first few collections for collection in collections.collections[:3]: diff --git a/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_00_stac_collection.py b/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_00_stac_collection.py index 8527faa915ad..30214826b636 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_00_stac_collection.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_00_stac_collection.py @@ -58,7 +58,7 @@ def create_collection(client: PlanetaryComputerProClient, collection_id): """Create a new STAC collection with item assets.""" # Check if collection already exists logging.info(f"Checking if collection '{collection_id}' exists...") - get_all_collections_response = client.stac.list_collections() + get_all_collections_response = client.stac.get_collections() if any(c.id == collection_id for c in get_all_collections_response["collections"]): logging.info(f"Collection '{collection_id}' already exists, deleting it...") @@ -470,7 +470,7 @@ def main(): credential.get_token("https://geocatalog.spatio.azure.com/.default") # List all collections - client.stac.list_collections() + client.stac.get_collections() # Create and configure collection create_collection(client, collection_id) diff --git a/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_02_stac_specification.py b/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_02_stac_specification.py index dd3e668ba766..a0cfb9f890f5 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_02_stac_specification.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/samples/planetary_computer_02_stac_specification.py @@ -63,7 +63,7 @@ def get_landing_page(client: PlanetaryComputerProClient): def search_collections(client: PlanetaryComputerProClient): """Search and list STAC collections.""" - collections = client.stac.list_collections() + collections = client.stac.get_collections() # Show first few collections for collection in collections.collections[:3]: diff --git a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_00_stac_collection.py b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_00_stac_collection.py index 5dabf06f0e96..a3f89ed363e5 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_00_stac_collection.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_00_stac_collection.py @@ -8,6 +8,7 @@ Unit tests for STAC Collection operations. """ +from collections.abc import MutableMapping import logging import time import datetime @@ -55,8 +56,8 @@ def test_01_list_collections(self, planetarycomputer_endpoint): client = self.create_client(endpoint=planetarycomputer_endpoint) - test_logger.info("Calling: list_collections()") - response = client.stac.list_collections() + test_logger.info("Calling: get_collections()") + response = client.stac.get_collections() test_logger.info(f"Response type: {type(response)}") @@ -376,13 +377,11 @@ def test_08_get_collection_queryables( test_logger.info(f"Response type: {type(response)}") test_logger.info( - f"Response keys: {list(response.keys()) if isinstance(response, dict) else 'N/A'}" + f"Response keys: {list(response.keys()) if isinstance(response, MutableMapping) else 'N/A'}" ) # Validate response structure - assert isinstance( - response, dict - ), f"Response should be a dict, got {type(response)}" + assert isinstance(response, MutableMapping), f"Response should be a dict, got {type(response)}" assert "properties" in response, "Response should have 'properties' key" properties = response["properties"] @@ -417,13 +416,11 @@ def test_09_list_queryables(self, planetarycomputer_endpoint): test_logger.info(f"Response type: {type(response)}") test_logger.info( - f"Response keys: {list(response.keys()) if isinstance(response, dict) else 'N/A'}" + f"Response keys: {list(response.keys()) if isinstance(response, MutableMapping) else 'N/A'}" ) # Validate response structure - assert isinstance( - response, dict - ), f"Response should be a dict, got {type(response)}" + assert isinstance(response, MutableMapping), f"Response should be a dict, got {type(response)}" assert "properties" in response, "Response should have 'properties' key" properties = response["properties"] @@ -1193,7 +1190,7 @@ def test_20_create_queryables( # Verify our queryable was created queryable_names = [ - q.get("name") if isinstance(q, dict) else q.name for q in response + q.get("name") if isinstance(q, MutableMapping) else q.name for q in response ] assert ( "test:property" in queryable_names diff --git a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_00_stac_collection_async.py b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_00_stac_collection_async.py index 09e079f25823..77011a186057 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_00_stac_collection_async.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_00_stac_collection_async.py @@ -8,6 +8,7 @@ Unit tests for STAC Collection operations. """ +from collections.abc import MutableMapping import logging import time import datetime @@ -57,8 +58,8 @@ async def test_01_list_collections(self, planetarycomputer_endpoint): client = self.create_client(endpoint=planetarycomputer_endpoint) - test_logger.info("Calling: list_collections()") - response = await client.stac.list_collections() + test_logger.info("Calling: get_collections()") + response = await client.stac.get_collections() test_logger.info(f"Response type: {type(response)}") @@ -392,13 +393,11 @@ async def test_08_get_collection_queryables( test_logger.info(f"Response type: {type(response)}") test_logger.info( - f"Response keys: {list(response.keys()) if isinstance(response, dict) else 'N/A'}" + f"Response keys: {list(response.keys()) if isinstance(response, MutableMapping) else 'N/A'}" ) # Validate response structure - assert isinstance( - response, dict - ), f"Response should be a dict, got {type(response)}" + assert isinstance(response, MutableMapping), f"Response should be a dict, got {type(response)}" assert "properties" in response, "Response should have 'properties' key" properties = response["properties"] @@ -435,13 +434,11 @@ async def test_09_list_queryables(self, planetarycomputer_endpoint): test_logger.info(f"Response type: {type(response)}") test_logger.info( - f"Response keys: {list(response.keys()) if isinstance(response, dict) else 'N/A'}" + f"Response keys: {list(response.keys()) if isinstance(response, MutableMapping) else 'N/A'}" ) # Validate response structure - assert isinstance( - response, dict - ), f"Response should be a dict, got {type(response)}" + assert isinstance(response, MutableMapping), f"Response should be a dict, got {type(response)}" assert "properties" in response, "Response should have 'properties' key" properties = response["properties"] @@ -1239,7 +1236,7 @@ async def test_20_create_queryables( # Verify our queryable was created queryable_names = [ - q.get("name") if isinstance(q, dict) else q.name for q in response + q.get("name") if isinstance(q, MutableMapping) else q.name for q in response ] assert ( "test:property" in queryable_names diff --git a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_02_stac_specification.py b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_02_stac_specification.py index f99dcd2fea31..7b521f0c5470 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_02_stac_specification.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_02_stac_specification.py @@ -110,7 +110,7 @@ def test_03_list_collections(self, planetarycomputer_endpoint, planetarycomputer assert collection_id is not None client = self.create_client(endpoint=planetarycomputer_endpoint) - collections = client.stac.list_collections() + collections = client.stac.get_collections() # Validate collections response assert collections is not None, "Collections should not be None" diff --git a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_02_stac_specification_async.py b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_02_stac_specification_async.py index bf926582b20d..d962d1912e81 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_02_stac_specification_async.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_02_stac_specification_async.py @@ -112,7 +112,7 @@ async def test_03_list_collections(self, planetarycomputer_endpoint, planetaryco assert collection_id is not None client = self.create_client(endpoint=planetarycomputer_endpoint) - collections = await client.stac.list_collections() + collections = await client.stac.get_collections() # Validate collections response assert collections is not None, "Collections should not be None" diff --git a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_06_map_legends.py b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_06_map_legends.py index 2c026e772912..f658b36aafac 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_06_map_legends.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_06_map_legends.py @@ -6,6 +6,7 @@ """ Unit tests for Map Legend operations. """ +from collections.abc import MutableMapping import io import logging from pathlib import Path @@ -63,9 +64,7 @@ def test_01_get_class_map_legend(self, planetarycomputer_endpoint): test_logger.info(f"Response: {response}") # Assert response is a dictionary - assert isinstance( - response, dict - ), f"Response should be a dict, got {type(response)}" + assert isinstance(response, MutableMapping), f"Response should be a dict, got {type(response)}" assert len(response) > 0, "Response should not be empty" # Assert MTBS Severity classes are present (0-6) @@ -350,7 +349,7 @@ def test_05_class_map_legend_structure(self, planetarycomputer_endpoint): test_logger.info(f"Response: {response}") # Assert response is a dictionary - assert isinstance(response, dict), "Response should be a dict" + assert isinstance(response, MutableMapping), "Response should be a dict" # Validate all keys are string class values for key in response.keys(): diff --git a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_06_map_legends_async.py b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_06_map_legends_async.py index 6c1fb603e0c8..4a6738ba7256 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_06_map_legends_async.py +++ b/sdk/planetarycomputer/azure-planetarycomputer/tests/test_planetary_computer_06_map_legends_async.py @@ -6,6 +6,7 @@ """ Unit tests for Map Legend operations. """ +from collections.abc import MutableMapping import io import logging from pathlib import Path @@ -65,9 +66,7 @@ async def test_01_get_class_map_legend(self, planetarycomputer_endpoint): test_logger.info(f"Response: {response}") # Assert response is a dictionary - assert isinstance( - response, dict - ), f"Response should be a dict, got {type(response)}" + assert isinstance(response, MutableMapping), f"Response should be a dict, got {type(response)}" assert len(response) > 0, "Response should not be empty" # Assert MTBS Severity classes are present (0-6) @@ -362,7 +361,7 @@ async def test_05_class_map_legend_structure(self, planetarycomputer_endpoint): test_logger.info(f"Response: {response}") # Assert response is a dictionary - assert isinstance(response, dict), "Response should be a dict" + assert isinstance(response, MutableMapping), "Response should be a dict" # Validate all keys are string class values for key in response.keys(): diff --git a/sdk/planetarycomputer/azure-planetarycomputer/tsp-location.yaml b/sdk/planetarycomputer/azure-planetarycomputer/tsp-location.yaml index c5f04addf72b..7e7c127a4dfd 100644 --- a/sdk/planetarycomputer/azure-planetarycomputer/tsp-location.yaml +++ b/sdk/planetarycomputer/azure-planetarycomputer/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/orbital/Microsoft.PlanetaryComputer -commit: 19973dbec9712fd97de1268ef14566bc7b50a629 +commit: f6aac155e9a422cf0251498788e5726c3b615bf3 repo: Azure/azure-rest-api-specs additionalDirectories: