Skip to content

Commit 56e4363

Browse files
Revert "Subscriptions API Hosting Support for Sentinel Hub"
1 parent cef0d98 commit 56e4363

File tree

5 files changed

+8
-112
lines changed

5 files changed

+8
-112
lines changed

planet/cli/subscriptions.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ async def list_subscription_results_cmd(ctx,
249249
help='Source JSON. Can be a string, filename, or - for stdin.')
250250
@click.option(
251251
'--delivery',
252+
required=True,
252253
type=types.JSON(),
253254
help=("Delivery configuration, including credentials for a cloud "
254255
"storage provider, to enable cloud delivery of data. Can be a "
@@ -261,10 +262,6 @@ async def list_subscription_results_cmd(ctx,
261262
'--tools',
262263
type=types.JSON(),
263264
help='Toolchain JSON. Can be a string, filename, or - for stdin.')
264-
@click.option(
265-
'--hosting',
266-
type=types.JSON(),
267-
help='Hosting JSON. Can be a string, a filename, or - for stdin.')
268265
@click.option(
269266
'--clip-to-source',
270267
is_flag=True,
@@ -276,7 +273,6 @@ def request(name,
276273
delivery,
277274
notifications,
278275
tools,
279-
hosting,
280276
clip_to_source,
281277
pretty):
282278
"""Generate a subscriptions request.
@@ -291,7 +287,6 @@ def request(name,
291287
delivery,
292288
notifications=notifications,
293289
tools=tools,
294-
hosting=hosting,
295290
clip_to_source=clip_to_source)
296291
echo_json(res, pretty)
297292

planet/subscription_request.py

Lines changed: 6 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,9 @@
4949

5050
def build_request(name: str,
5151
source: Mapping,
52-
delivery: Optional[Mapping] = None,
52+
delivery: Mapping,
5353
notifications: Optional[Mapping] = None,
5454
tools: Optional[List[Mapping]] = None,
55-
hosting: Optional[Mapping] = None,
5655
clip_to_source: Optional[bool] = False) -> dict:
5756
"""Construct a Subscriptions API request.
5857
@@ -66,7 +65,6 @@ def build_request(name: str,
6665
notifications: Specify notifications via email/webhook.
6766
tools: Tools to apply to the products. The order of operation
6867
is determined by the service.
69-
hosting: A hosting destination e.g. Sentinel Hub.
7068
clip_to_source: whether to clip to the source geometry or not
7169
(the default). If True a clip configuration will be added to
7270
the list of requested tools unless an existing clip tool
@@ -108,20 +106,17 @@ def build_request(name: str,
108106
109107
delivery = amazon_s3(ACCESS_KEY_ID, SECRET_ACCESS_KEY, "test", "us-east-1")
110108
111-
hosting = sentinel_hub("2716077c-191e-4e47-9e3f-01c9c429f88d")
112-
113109
subscription_request = build_request(
114-
"test_subscription", source=source, delivery=delivery, hosting=hosting
110+
"test_subscription", source=source, delivery=delivery
115111
)
116112
```
117113
"""
118-
# Because source is a Mapping we must make copies for
114+
# Because source and delivery are Mappings we must make copies for
119115
# the function's return value. dict() shallow copies a Mapping
120116
# and returns a new dict.
121-
details = {"name": name, "source": dict(source)}
122-
123-
if delivery:
124-
details['delivery'] = dict(delivery)
117+
details = {
118+
"name": name, "source": dict(source), "delivery": dict(delivery)
119+
}
125120

126121
if notifications:
127122
details['notifications'] = dict(notifications)
@@ -150,9 +145,6 @@ def build_request(name: str,
150145

151146
details['tools'] = tool_list
152147

153-
if hosting:
154-
details['hosting'] = dict(hosting)
155-
156148
return details
157149

158150

@@ -743,24 +735,3 @@ def cloud_filter_tool(
743735
}
744736

745737
return _tool("cloud_filter", result)
746-
747-
748-
def _hosting(type: str, parameters: dict) -> dict:
749-
return {"type": type, "parameters": parameters}
750-
751-
752-
def sentinel_hub(collection_id: Optional[str]) -> dict:
753-
"""Specify a Sentinel Hub hosting destination.
754-
755-
Requires the user to have a Sentinel Hub account linked with their Planet
756-
account. Subscriptions API will create a new collection to deliver data to
757-
if collection_id is omitted from the request.
758-
759-
Parameters:
760-
collection_id: Sentinel Hub collection
761-
"""
762-
763-
parameters = {}
764-
if collection_id:
765-
parameters['collection_id'] = collection_id
766-
return _hosting("sentinel_hub", parameters)

tests/integration/test_subscriptions_api.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -204,18 +204,6 @@ async def test_create_subscription_success():
204204
assert sub['name'] == 'test'
205205

206206

207-
@pytest.mark.anyio
208-
@create_mock
209-
async def test_create_subscription_with_hosting_success():
210-
"""Subscription is created, description has the expected items."""
211-
async with Session() as session:
212-
client = SubscriptionsClient(session, base_url=TEST_URL)
213-
sub = await client.create_subscription({
214-
'name': 'test', 'source': 'test', 'hosting': 'yes, please'
215-
})
216-
assert sub['name'] == 'test'
217-
218-
219207
@pytest.mark.anyio
220208
@failing_api_mock
221209
async def test_cancel_subscription_failure():

tests/integration/test_subscriptions_cli.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,11 @@ def test_subscriptions_create_failure(invoke):
9595
# It must be updated when we begin to test against a more strict
9696
# imitation of the Planet Subscriptions API.
9797
GOOD_SUB_REQUEST = {'name': 'lol', 'delivery': True, 'source': 'wut'}
98-
GOOD_SUB_REQUEST_WITH_HOSTING = {
99-
'name': 'lol', 'source': 'wut', 'hosting': True
100-
}
10198

10299

103100
@pytest.mark.parametrize('cmd_arg, runner_input',
104101
[('-', json.dumps(GOOD_SUB_REQUEST)),
105-
(json.dumps(GOOD_SUB_REQUEST), None),
106-
('-', json.dumps(GOOD_SUB_REQUEST_WITH_HOSTING)),
107-
(json.dumps(GOOD_SUB_REQUEST_WITH_HOSTING), None)])
102+
(json.dumps(GOOD_SUB_REQUEST), None)])
108103
@create_mock
109104
def test_subscriptions_create_success(invoke, cmd_arg, runner_input):
110105
"""Subscriptions creation succeeds with a valid subscription request."""

tests/unit/test_subscription_request.py

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -119,59 +119,6 @@ def test_build_request_clip_to_source_failure(geom_geojson):
119119
)
120120

121121

122-
def test_build_request_host_sentinel_hub_with_collection(geom_geojson):
123-
source = {
124-
"type": "catalog",
125-
"parameters": {
126-
"geometry": geom_geojson,
127-
"start_time": "2021-03-01T00:00:00Z",
128-
"end_time": "2023-11-01T00:00:00Z",
129-
"rrule": "FREQ=MONTHLY;BYMONTH=3,4,5,6,7,8,9,10",
130-
"item_types": ["PSScene"],
131-
"asset_types": ["ortho_analytic_4b"]
132-
}
133-
}
134-
135-
hosting = {"type": "sentinel-hub"}
136-
137-
res = subscription_request.build_request('test',
138-
source=source,
139-
hosting=hosting)
140-
141-
expected = {"name": "test", "source": source, "hosting": hosting}
142-
143-
assert res == expected
144-
145-
146-
def test_build_request_host_sentinel_hub_no_collection(geom_geojson):
147-
source = {
148-
"type": "catalog",
149-
"parameters": {
150-
"geometry": geom_geojson,
151-
"start_time": "2021-03-01T00:00:00Z",
152-
"end_time": "2023-11-01T00:00:00Z",
153-
"rrule": "FREQ=MONTHLY;BYMONTH=3,4,5,6,7,8,9,10",
154-
"item_types": ["PSScene"],
155-
"asset_types": ["ortho_analytic_4b"]
156-
}
157-
}
158-
159-
hosting = {
160-
"type": "sentinel-hub",
161-
"parameters": {
162-
"collection_id": "4c9af036-4274-4a97-bf0d-eb2a7853330d"
163-
}
164-
}
165-
166-
res = subscription_request.build_request('test',
167-
source=source,
168-
hosting=hosting)
169-
170-
expected = {"name": "test", "source": source, "hosting": hosting}
171-
172-
assert res == expected
173-
174-
175122
def test_catalog_source_success(geom_geojson):
176123
res = subscription_request.catalog_source(
177124
item_types=["PSScene"],

0 commit comments

Comments
 (0)