@@ -35,14 +35,18 @@ async def _patch_destination(ctx, destination_id, data, pretty):
3535 except Exception as e :
3636 raise ClickException (f"Failed to patch destination: { e } " )
3737
38+
3839async def _list_destinations (ctx , archived , is_owner , can_write , pretty ):
3940 async with destinations_client (ctx ) as cl :
4041 try :
41- response = await cl .list_destinations (archived , is_owner , can_write )
42+ response = await cl .list_destinations (archived ,
43+ is_owner ,
44+ can_write )
4245 echo_json (response , pretty )
4346 except Exception as e :
4447 raise ClickException (f"Failed to list destinations: { e } " )
4548
49+
4650async def _get_destination (ctx , destination_id , pretty ):
4751 async with destinations_client (ctx ) as cl :
4852 try :
@@ -51,6 +55,7 @@ async def _get_destination(ctx, destination_id, pretty):
5155 except Exception as e :
5256 raise ClickException (f"Failed to get destination: { e } " )
5357
58+
5459async def _create_destination (ctx , data , pretty ):
5560 async with destinations_client (ctx ) as cl :
5661 try :
@@ -64,18 +69,19 @@ async def _create_destination(ctx, data, pretty):
6469@click .option (
6570 '--archived/--is-not-archived' ,
6671 default = None ,
67- help = 'Filter by archive status. Use --archived to include only archived destinations, or --is-not-archived to list only active (not archived) destinations.'
68- )
72+ help = """Filter by archive status. Use --archived to include only archived
73+ destinations, or --is-not-archived to list only active (not archived)
74+ destinations.""" )
6975@click .option (
7076 '--is-owner/--is-not-owner' ,
7177 default = None ,
72- help = ' Filter by ownership. Use --is-owner to include only destinations owned by the requesting user, or --is-not-owner to include destinations not owned by the user.'
73- )
78+ help = """ Filter by ownership. Use --is-owner to include only destinations owned by
79+ the requesting user, or --is-not-owner to include destinations not owned by the user.""" )
7480@click .option (
7581 '--can-write/--can-not-write' ,
7682 default = None ,
77- help = ' Filter by write access. Use --can-write to include only destinations the user can modify, or --can-not-write to list destinations with read-only access for the user.'
78- )
83+ help = """ Filter by write access. Use --can-write to include only destinations the user can
84+ modify, or --can-not-write to list destinations with read-only access for the user.""" )
7985async def list_destinations (ctx , archived , is_owner , can_write , pretty ):
8086 """
8187 List destinations with optional filters
@@ -105,26 +111,31 @@ async def get_destination(ctx, destination_id, pretty):
105111 """
106112 await _get_destination (ctx , destination_id , pretty )
107113
114+
108115@destinations .group ()
109116def create ():
110117 """Create a new destination."""
111118 pass
112119
120+
113121@command (create , name = "s3" )
114122@click .argument ("bucket" )
115123@click .argument ("region" )
116124@click .argument ("access_key_id" )
117125@click .argument ("secret_access_key" )
118- @click .option (
119- "--explicit-sse" ,
120- is_flag = True ,
121- help = "Explicitly set headers for server-side encryption (SSE)."
122- )
123- @click .option (
124- "--name" ,
125- help = "Optional name to assign to the destination. Otherwise, the bucket name is used."
126- )
127- async def create_s3 (ctx , bucket , region , access_key_id , secret_access_key , explicit_sse , name , pretty ):
126+ @click .option ("--explicit-sse" ,
127+ is_flag = True ,
128+ help = "Explicitly set headers for server-side encryption (SSE)." )
129+ @click .option ("--name" ,
130+ help = "Optional name to assign to the destination. Otherwise, the bucket name is used." )
131+ async def create_s3 (ctx ,
132+ bucket ,
133+ region ,
134+ access_key_id ,
135+ secret_access_key ,
136+ explicit_sse ,
137+ name ,
138+ pretty ):
128139 """
129140 Create a new Amazon S3 destination.
130141
@@ -153,23 +164,29 @@ async def create_s3(ctx, bucket, region, access_key_id, secret_access_key, expli
153164
154165 await _create_destination (ctx , data , pretty )
155166
167+
156168@command (create , name = "s3-compatible" )
157169@click .argument ("bucket" )
158170@click .argument ("endpoint" )
159171@click .argument ("region" )
160172@click .argument ("access_key_id" )
161173@click .argument ("secret_access_key" )
162- @click .option (
163- "--use-path-style" ,
164- is_flag = True ,
165- default = False ,
166- help = "Use path-style addressing with bucket name in the URL."
167- )
174+ @click .option ("--use-path-style" ,
175+ is_flag = True ,
176+ default = False ,
177+ help = "Use path-style addressing with bucket name in the URL." )
168178@click .option (
169179 "--name" ,
170- help = "Optional name to assign to the destination. Otherwise, the bucket name is used."
171- )
172- async def create_s3_compatible (ctx , bucket , endpoint , region , access_key_id , secret_access_key , use_path_style , name , pretty ):
180+ help = """Optional name to assign to the destination. Otherwise, the bucket name is used.""" )
181+ async def create_s3_compatible (ctx ,
182+ bucket ,
183+ endpoint ,
184+ region ,
185+ access_key_id ,
186+ secret_access_key ,
187+ use_path_style ,
188+ name ,
189+ pretty ):
173190 """
174191 Create a new S3-compatible destination.
175192
@@ -200,6 +217,7 @@ async def create_s3_compatible(ctx, bucket, endpoint, region, access_key_id, sec
200217
201218 await _create_destination (ctx , data , pretty )
202219
220+
203221@command (create , name = "ocs" )
204222@click .argument ("bucket" )
205223@click .argument ("access_key_id" )
@@ -208,9 +226,15 @@ async def create_s3_compatible(ctx, bucket, endpoint, region, access_key_id, sec
208226@click .argument ("region" )
209227@click .option (
210228 "--name" ,
211- help = "Optional name to assign to the destination. Otherwise, the bucket name is used."
212- )
213- async def create_ocs (ctx , bucket , access_key_id , secret_access_key , namespace , region , name , pretty ):
229+ help = """Optional name to assign to the destination. Otherwise, the bucket name is used.""" )
230+ async def create_ocs (ctx ,
231+ bucket ,
232+ access_key_id ,
233+ secret_access_key ,
234+ namespace ,
235+ region ,
236+ name ,
237+ pretty ):
214238 """
215239 Create a new Oracle Cloud Storage (OCS) destination.
216240
@@ -238,20 +262,25 @@ async def create_ocs(ctx, bucket, access_key_id, secret_access_key, namespace, r
238262
239263 await _create_destination (ctx , data , pretty )
240264
265+
241266@command (create , name = "azure" )
242267@click .argument ("container" )
243268@click .argument ("account" )
244269@click .argument ("sas_token" )
245270@click .option (
246271 "--storage-endpoint-suffix" ,
247272 required = False ,
248- help = "Custom Azure Storage endpoint suffix (e.g., 'core.windows.net' or for sovereign clouds)."
249- )
273+ help = """Custom Azure Storage endpoint suffix (e.g., 'core.windows.net' or for sovereign clouds).""" )
250274@click .option (
251275 "--name" ,
252- help = "Optional name to assign to the destination. Otherwise, the container name is used."
253- )
254- async def create_azure (ctx , container , account , sas_token , storage_endpoint_suffix , name , pretty ):
276+ help = """Optional name to assign to the destination. Otherwise, the container name is used.""" )
277+ async def create_azure (ctx ,
278+ container ,
279+ account ,
280+ sas_token ,
281+ storage_endpoint_suffix ,
282+ name ,
283+ pretty ):
255284 """
256285 Create a new Azure Blob Storage destination.
257286
@@ -280,13 +309,13 @@ async def create_azure(ctx, container, account, sas_token, storage_endpoint_suff
280309
281310 await _create_destination (ctx , data , pretty )
282311
312+
283313@command (create , name = "gcs" )
284314@click .argument ("bucket" )
285315@click .argument ("credentials" )
286316@click .option (
287317 "--name" ,
288- help = "Optional name to assign to the destination. Otherwise, the bucket name is used."
289- )
318+ help = """Optional name to assign to the destination. Otherwise, the bucket name is used.""" )
290319async def create_gcs (ctx , bucket , credentials , name , pretty ):
291320 """
292321 Create a new Google Cloud Storage (GCS) destination.
@@ -319,11 +348,13 @@ async def create_gcs(ctx, bucket, credentials, name, pretty):
319348
320349 await _create_destination (ctx , data , pretty )
321350
351+
322352@destinations .group ()
323353def update ():
324354 """Update a destination."""
325355 pass
326356
357+
327358@command (destinations , name = "archive" )
328359@click .argument ('destination_id' )
329360async def archive (ctx , destination_id , pretty ):
@@ -342,6 +373,7 @@ async def archive(ctx, destination_id, pretty):
342373
343374 await _patch_destination (ctx , destination_id , data , pretty )
344375
376+
345377@command (destinations , name = "unarchive" )
346378@click .argument ('destination_id' )
347379async def unarchive (ctx , destination_id , pretty ):
@@ -359,6 +391,7 @@ async def unarchive(ctx, destination_id, pretty):
359391
360392 await _patch_destination (ctx , destination_id , data , pretty )
361393
394+
362395@command (destinations , name = "rename" )
363396@click .argument ('destination_id' )
364397@click .argument ('name' )
@@ -378,16 +411,20 @@ async def rename(ctx, destination_id, name, pretty):
378411
379412 await _patch_destination (ctx , destination_id , data , pretty )
380413
414+
381415@command (update , name = "s3" )
382416@click .argument ('destination_id' )
383417@click .argument ('access_key_id' )
384418@click .argument ('secret_access_key' )
385- @click .option (
386- '--explicit-sse' ,
387- is_flag = True ,
388- help = 'Explicitly set headers for server-side encryption (SSE).'
389- )
390- async def update_s3 (ctx , destination_id , access_key_id , secret_access_key , explicit_sse , pretty ):
419+ @click .option ('--explicit-sse' ,
420+ is_flag = True ,
421+ help = 'Explicitly set headers for server-side encryption (SSE).' )
422+ async def update_s3 (ctx ,
423+ destination_id ,
424+ access_key_id ,
425+ secret_access_key ,
426+ explicit_sse ,
427+ pretty ):
391428 """
392429 Update S3 destination parameters.
393430
@@ -412,6 +449,7 @@ async def update_s3(ctx, destination_id, access_key_id, secret_access_key, expli
412449
413450 await _patch_destination (ctx , destination_id , data , pretty )
414451
452+
415453@command (update , name = "azure" )
416454@click .argument ('destination_id' )
417455@click .argument ('sas_token' )
@@ -427,14 +465,11 @@ async def update_azure(ctx, destination_id, sas_token, pretty):
427465
428466 planet destinations update parameters azure my-destination-id NEW_SAS_TOKEN
429467 """
430- data = {
431- "parameters" : {
432- "sas_token" : sas_token
433- }
434- }
468+ data = {"parameters" : {"sas_token" : sas_token }}
435469
436470 await _patch_destination (ctx , destination_id , data , pretty )
437471
472+
438473@command (update , name = "gcs" )
439474@click .argument ('destination_id' )
440475@click .argument ('credentials' )
@@ -457,19 +492,20 @@ async def update_gcs(ctx, destination_id, credentials, pretty):
457492
458493 planet destinations update parameters gcs my-destination-id eyJ0eXAiOiJKV1Qi...
459494 """
460- data = {
461- "parameters" : {
462- "credentials" : credentials
463- }
464- }
495+ data = {"parameters" : {"credentials" : credentials }}
465496
466497 await _patch_destination (ctx , destination_id , data , pretty )
467498
499+
468500@command (update , name = "ocs" )
469501@click .argument ('destination_id' )
470502@click .argument ('access_key_id' )
471503@click .argument ('secret_access_key' )
472- async def update_ocs (ctx , destination_id , access_key_id , secret_access_key , pretty ):
504+ async def update_ocs (ctx ,
505+ destination_id ,
506+ access_key_id ,
507+ secret_access_key ,
508+ pretty ):
473509 """
474510 Update Oracle Cloud Storage (OCS) destination parameters.
475511
@@ -491,16 +527,20 @@ async def update_ocs(ctx, destination_id, access_key_id, secret_access_key, pret
491527
492528 await _patch_destination (ctx , destination_id , data , pretty )
493529
530+
494531@command (update , name = "s3-compatible" )
495532@click .argument ("destination_id" )
496533@click .argument ("access_key_id" )
497534@click .argument ("secret_access_key" )
498- @click .option (
499- "--use-path-style" ,
500- is_flag = True ,
501- help = "Use path-style addressing with bucket name in the URL."
502- )
503- async def update_s3_compatible (ctx , destination_id , access_key_id , secret_access_key , use_path_style , pretty ):
535+ @click .option ("--use-path-style" ,
536+ is_flag = True ,
537+ help = "Use path-style addressing with bucket name in the URL." )
538+ async def update_s3_compatible (ctx ,
539+ destination_id ,
540+ access_key_id ,
541+ secret_access_key ,
542+ use_path_style ,
543+ pretty ):
504544 """
505545 Update S3-compatible destination parameters.
506546
0 commit comments