canonicalwebteam.store-api 4.12.2__py3-none-any.whl → 4.13.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- canonicalwebteam/store_api/stores/charmstore.py +17 -2
- canonicalwebteam/store_api/stores/snapstore.py +53 -3
- {canonicalwebteam_store_api-4.12.2.dist-info → canonicalwebteam_store_api-4.13.3.dist-info}/METADATA +1 -1
- {canonicalwebteam_store_api-4.12.2.dist-info → canonicalwebteam_store_api-4.13.3.dist-info}/RECORD +6 -6
- {canonicalwebteam_store_api-4.12.2.dist-info → canonicalwebteam_store_api-4.13.3.dist-info}/LICENSE +0 -0
- {canonicalwebteam_store_api-4.12.2.dist-info → canonicalwebteam_store_api-4.13.3.dist-info}/WHEEL +0 -0
|
@@ -490,7 +490,14 @@ class CharmPublisher(Publisher):
|
|
|
490
490
|
)
|
|
491
491
|
return response
|
|
492
492
|
|
|
493
|
-
def create_track(
|
|
493
|
+
def create_track(
|
|
494
|
+
self,
|
|
495
|
+
publisher_auth,
|
|
496
|
+
charm_name,
|
|
497
|
+
track_name,
|
|
498
|
+
version_pattern=None,
|
|
499
|
+
auto_phasing_percentage=None,
|
|
500
|
+
):
|
|
494
501
|
"""
|
|
495
502
|
Create a track for a charm base on the charm's guardrail pattern.
|
|
496
503
|
Documentation: https://api.charmhub.io/docs/default.html#create_tracks
|
|
@@ -501,10 +508,18 @@ class CharmPublisher(Publisher):
|
|
|
501
508
|
publisher_auth: Serialized macaroon to consume the API.
|
|
502
509
|
charm_name: Name of the charm
|
|
503
510
|
track_name: Name of the track
|
|
511
|
+
version_pattern: Version pattern for the track (optional)
|
|
512
|
+
auto_phasing_percentage: phasing percentage for track (optional)
|
|
504
513
|
"""
|
|
514
|
+
|
|
515
|
+
payload = {
|
|
516
|
+
"name": track_name,
|
|
517
|
+
"version-pattern": version_pattern,
|
|
518
|
+
"automatic-phasing-percentage": auto_phasing_percentage,
|
|
519
|
+
}
|
|
505
520
|
response = self.session.post(
|
|
506
521
|
url=self.get_endpoint_url(f"charm/{charm_name}/tracks"),
|
|
507
522
|
headers=self._get_authorization_header(publisher_auth),
|
|
508
|
-
json=[
|
|
523
|
+
json=[payload],
|
|
509
524
|
)
|
|
510
525
|
return response
|
|
@@ -125,6 +125,9 @@ class SnapPublisher(Publisher):
|
|
|
125
125
|
|
|
126
126
|
return self.process_response(response)
|
|
127
127
|
|
|
128
|
+
def get_dashboard_endpoint_url(self, endpoint):
|
|
129
|
+
return f"{SNAPSTORE_DASHBOARD_API_URL}api/v2/{endpoint}"
|
|
130
|
+
|
|
128
131
|
def get_publisherwg_endpoint_url(self, endpoint):
|
|
129
132
|
return f"{SNAPSTORE_PUBLISHERWG_API_URL}v1/{endpoint}"
|
|
130
133
|
|
|
@@ -256,16 +259,34 @@ class SnapPublisher(Publisher):
|
|
|
256
259
|
)
|
|
257
260
|
return self.process_response(response)
|
|
258
261
|
|
|
259
|
-
def create_track(
|
|
262
|
+
def create_track(
|
|
263
|
+
self,
|
|
264
|
+
session,
|
|
265
|
+
snap_name,
|
|
266
|
+
track_name,
|
|
267
|
+
version_pattern=None,
|
|
268
|
+
auto_phasing_percentage=None,
|
|
269
|
+
):
|
|
260
270
|
"""
|
|
261
271
|
Create a track for a snap base on the snap's guardrail pattern.
|
|
262
272
|
Documentation: https://api.charmhub.io/docs/default.html#create_tracks
|
|
263
273
|
Endpoint: [POST] https://api.charmhub.io/v1/snap/{snap_name}/tracks
|
|
264
|
-
|
|
274
|
+
Args:
|
|
275
|
+
publisher_auth: Serialized macaroon to consume the API.
|
|
276
|
+
snap_name: Name of the snap
|
|
277
|
+
track_name: Name of the track
|
|
278
|
+
version_pattern: Version pattern for the track (optional)
|
|
279
|
+
auto_phasing_percentage: phasing percentage for track (optional)
|
|
280
|
+
"""
|
|
281
|
+
payload = {
|
|
282
|
+
"name": track_name,
|
|
283
|
+
"version-pattern": version_pattern,
|
|
284
|
+
"automatic-phasing-percentage": auto_phasing_percentage,
|
|
285
|
+
}
|
|
265
286
|
response = self.session.post(
|
|
266
287
|
url=self.get_publisherwg_endpoint_url(f"snap/{snap_name}/tracks"),
|
|
267
288
|
headers=self._get_publisherwg_authorization_header(session),
|
|
268
|
-
json=[
|
|
289
|
+
json=[payload],
|
|
269
290
|
)
|
|
270
291
|
return response
|
|
271
292
|
|
|
@@ -309,6 +330,35 @@ class SnapPublisher(Publisher):
|
|
|
309
330
|
)
|
|
310
331
|
return response
|
|
311
332
|
|
|
333
|
+
def get_validation_sets(self, publisher_auth):
|
|
334
|
+
"""
|
|
335
|
+
Return a list of validation sets for the current account
|
|
336
|
+
Documentation:
|
|
337
|
+
https://dashboard.snapcraft.io/docs/reference/v2/en/validation-sets.html
|
|
338
|
+
Endpoint: [GET] https://dashboard.snapcraft.io/api/v2/validation-sets
|
|
339
|
+
"""
|
|
340
|
+
url = self.get_dashboard_endpoint_url("validation-sets")
|
|
341
|
+
response = self.session.get(
|
|
342
|
+
url, headers=self._get_authorization_header(publisher_auth)
|
|
343
|
+
)
|
|
344
|
+
return response
|
|
345
|
+
|
|
346
|
+
def get_validation_set(self, publisher_auth, validation_set_id):
|
|
347
|
+
"""
|
|
348
|
+
Return a validation set for the current account
|
|
349
|
+
Documentation:
|
|
350
|
+
https://dashboard.snapcraft.io/docs/reference/v2/en/validation-sets.html
|
|
351
|
+
Endpoint:
|
|
352
|
+
[GET] https://dashboard.snapcraft.io/api/v2/validation-sets/{id}
|
|
353
|
+
"""
|
|
354
|
+
url = self.get_dashboard_endpoint_url(
|
|
355
|
+
f"validation-sets/{validation_set_id}"
|
|
356
|
+
)
|
|
357
|
+
response = self.session.get(
|
|
358
|
+
url, headers=self._get_authorization_header(publisher_auth)
|
|
359
|
+
)
|
|
360
|
+
return response
|
|
361
|
+
|
|
312
362
|
|
|
313
363
|
class SnapStoreAdmin(SnapPublisher):
|
|
314
364
|
def get_endpoint_url(self, endpoint, api_version=2):
|
{canonicalwebteam_store_api-4.12.2.dist-info → canonicalwebteam_store_api-4.13.3.dist-info}/RECORD
RENAMED
|
@@ -4,9 +4,9 @@ canonicalwebteam/store_api/exceptions.py,sha256=A49LRhiEIfXNB2zC-zNcZEcdh0ugw6G7
|
|
|
4
4
|
canonicalwebteam/store_api/publisher.py,sha256=4gSCJOtpEfK0luYal5xOEa0XF7DzOrdGMwMIUN4X8_o,15111
|
|
5
5
|
canonicalwebteam/store_api/store.py,sha256=Uk1BMGM4S8uVXepuUiF2FNqw3MCnqtd3EGbrlwzod7Y,7826
|
|
6
6
|
canonicalwebteam/store_api/stores/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
-
canonicalwebteam/store_api/stores/charmstore.py,sha256=
|
|
8
|
-
canonicalwebteam/store_api/stores/snapstore.py,sha256=
|
|
9
|
-
canonicalwebteam_store_api-4.
|
|
10
|
-
canonicalwebteam_store_api-4.
|
|
11
|
-
canonicalwebteam_store_api-4.
|
|
12
|
-
canonicalwebteam_store_api-4.
|
|
7
|
+
canonicalwebteam/store_api/stores/charmstore.py,sha256=1eovt1EkwUmxzCx_oR7Jf6b0xDHRRHlHUVGHhKQnKjw,17505
|
|
8
|
+
canonicalwebteam/store_api/stores/snapstore.py,sha256=MXQkiCMn3iPfYbkn_DANXYJfBh3PBaAnq7mWEfOexMI,27259
|
|
9
|
+
canonicalwebteam_store_api-4.13.3.dist-info/LICENSE,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
|
|
10
|
+
canonicalwebteam_store_api-4.13.3.dist-info/METADATA,sha256=Gym5iaTYa6X7o_mxkQvlc9ukrF0jD9pi9BJlDg8iiKc,2265
|
|
11
|
+
canonicalwebteam_store_api-4.13.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
12
|
+
canonicalwebteam_store_api-4.13.3.dist-info/RECORD,,
|
{canonicalwebteam_store_api-4.12.2.dist-info → canonicalwebteam_store_api-4.13.3.dist-info}/LICENSE
RENAMED
|
File without changes
|
{canonicalwebteam_store_api-4.12.2.dist-info → canonicalwebteam_store_api-4.13.3.dist-info}/WHEEL
RENAMED
|
File without changes
|