@@ -323,6 +323,63 @@ def get_tags(self, request: operations.GetTagsRequest) -> operations.GetTagsResp
323
323
324
324
325
325
326
+ def post_tags (self , request : operations .PostTagsRequest ) -> operations .PostTagsResponse :
327
+ r"""Add tags to an existing revision"""
328
+ hook_ctx = HookContext (operation_id = 'postTags' , oauth2_scopes = [], security_source = self .sdk_configuration .security )
329
+ base_url = utils .template_url (* self .sdk_configuration .get_server_details ())
330
+
331
+ url = utils .generate_url (base_url , '/v1/artifacts/namespaces/{namespace_name}/tags' , request )
332
+
333
+ if callable (self .sdk_configuration .security ):
334
+ headers , query_params = utils .get_security (self .sdk_configuration .security ())
335
+ else :
336
+ headers , query_params = utils .get_security (self .sdk_configuration .security )
337
+
338
+ req_content_type , data , form = utils .serialize_request_body (request , operations .PostTagsRequest , "add_tags" , False , True , 'json' )
339
+ if req_content_type is not None and req_content_type not in ('multipart/form-data' , 'multipart/mixed' ):
340
+ headers ['content-type' ] = req_content_type
341
+ headers ['Accept' ] = 'application/json'
342
+ headers ['user-agent' ] = self .sdk_configuration .user_agent
343
+ client = self .sdk_configuration .client
344
+
345
+ try :
346
+ req = client .prepare_request (requests_http .Request ('POST' , url , params = query_params , data = data , files = form , headers = headers ))
347
+ req = self .sdk_configuration .get_hooks ().before_request (BeforeRequestContext (hook_ctx ), req )
348
+ http_res = client .send (req )
349
+ except Exception as e :
350
+ _ , e = self .sdk_configuration .get_hooks ().after_error (AfterErrorContext (hook_ctx ), None , e )
351
+ if e is not None :
352
+ raise e
353
+
354
+ if utils .match_status_codes (['4XX' ,'5XX' ], http_res .status_code ):
355
+ result , e = self .sdk_configuration .get_hooks ().after_error (AfterErrorContext (hook_ctx ), http_res , None )
356
+ if e is not None :
357
+ raise e
358
+ if result is not None :
359
+ http_res = result
360
+ else :
361
+ http_res = self .sdk_configuration .get_hooks ().after_success (AfterSuccessContext (hook_ctx ), http_res )
362
+
363
+
364
+
365
+ res = operations .PostTagsResponse (status_code = http_res .status_code , content_type = http_res .headers .get ('Content-Type' ) or '' , raw_response = http_res )
366
+
367
+ if http_res .status_code == 200 :
368
+ pass
369
+ elif http_res .status_code >= 400 and http_res .status_code < 500 or http_res .status_code >= 500 and http_res .status_code < 600 :
370
+ raise errors .SDKError ('API error occurred' , http_res .status_code , http_res .text , http_res )
371
+ else :
372
+ if utils .match_content_type (http_res .headers .get ('Content-Type' ) or '' , 'application/json' ):
373
+ out = utils .unmarshal_json (http_res .text , Optional [errors .Error ])
374
+ res .error = out
375
+ else :
376
+ content_type = http_res .headers .get ('Content-Type' )
377
+ raise errors .SDKError (f'unknown content-type received: { content_type } ' , http_res .status_code , http_res .text , http_res )
378
+
379
+ return res
380
+
381
+
382
+
326
383
def preflight (self , request : Optional [shared .PreflightRequest ]) -> operations .PreflightResponse :
327
384
r"""Get access token for communicating with OCI distribution endpoints"""
328
385
hook_ctx = HookContext (operation_id = 'preflight' , oauth2_scopes = [], security_source = self .sdk_configuration .security )
0 commit comments