66
77import httpx
88
9- from ..types import image_list_params , image_create_params
9+ from ..types import image_tag_params , image_list_params , image_create_params
1010from .._types import Body , Omit , Query , Headers , NoneType , NotGiven , omit , not_given
1111from .._utils import path_template , maybe_transform , async_maybe_transform
1212from .._compat import cached_property
@@ -206,6 +206,44 @@ def get(
206206 cast_to = Image ,
207207 )
208208
209+ def tag (
210+ self ,
211+ name : str ,
212+ * ,
213+ target : str ,
214+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
215+ # The extra values given here take precedence over values defined on the client or passed to this method.
216+ extra_headers : Headers | None = None ,
217+ extra_query : Query | None = None ,
218+ extra_body : Body | None = None ,
219+ timeout : float | httpx .Timeout | None | NotGiven = not_given ,
220+ ) -> Image :
221+ """
222+ Create or update a local image tag
223+
224+ Args:
225+ target: Target OCI image reference with a tag. The local tag points to the source image
226+ without pulling it again.
227+
228+ extra_headers: Send extra headers
229+
230+ extra_query: Add additional query parameters to the request
231+
232+ extra_body: Add additional JSON properties to the request
233+
234+ timeout: Override the client-level default timeout for this request, in seconds
235+ """
236+ if not name :
237+ raise ValueError (f"Expected a non-empty value for `name` but received { name !r} " )
238+ return self ._post (
239+ path_template ("/images/{name}/tag" , name = name ),
240+ body = maybe_transform ({"target" : target }, image_tag_params .ImageTagParams ),
241+ options = make_request_options (
242+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
243+ ),
244+ cast_to = Image ,
245+ )
246+
209247
210248class AsyncImagesResource (AsyncAPIResource ):
211249 @cached_property
@@ -388,6 +426,44 @@ async def get(
388426 cast_to = Image ,
389427 )
390428
429+ async def tag (
430+ self ,
431+ name : str ,
432+ * ,
433+ target : str ,
434+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
435+ # The extra values given here take precedence over values defined on the client or passed to this method.
436+ extra_headers : Headers | None = None ,
437+ extra_query : Query | None = None ,
438+ extra_body : Body | None = None ,
439+ timeout : float | httpx .Timeout | None | NotGiven = not_given ,
440+ ) -> Image :
441+ """
442+ Create or update a local image tag
443+
444+ Args:
445+ target: Target OCI image reference with a tag. The local tag points to the source image
446+ without pulling it again.
447+
448+ extra_headers: Send extra headers
449+
450+ extra_query: Add additional query parameters to the request
451+
452+ extra_body: Add additional JSON properties to the request
453+
454+ timeout: Override the client-level default timeout for this request, in seconds
455+ """
456+ if not name :
457+ raise ValueError (f"Expected a non-empty value for `name` but received { name !r} " )
458+ return await self ._post (
459+ path_template ("/images/{name}/tag" , name = name ),
460+ body = await async_maybe_transform ({"target" : target }, image_tag_params .ImageTagParams ),
461+ options = make_request_options (
462+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
463+ ),
464+ cast_to = Image ,
465+ )
466+
391467
392468class ImagesResourceWithRawResponse :
393469 def __init__ (self , images : ImagesResource ) -> None :
@@ -405,6 +481,9 @@ def __init__(self, images: ImagesResource) -> None:
405481 self .get = to_raw_response_wrapper (
406482 images .get ,
407483 )
484+ self .tag = to_raw_response_wrapper (
485+ images .tag ,
486+ )
408487
409488
410489class AsyncImagesResourceWithRawResponse :
@@ -423,6 +502,9 @@ def __init__(self, images: AsyncImagesResource) -> None:
423502 self .get = async_to_raw_response_wrapper (
424503 images .get ,
425504 )
505+ self .tag = async_to_raw_response_wrapper (
506+ images .tag ,
507+ )
426508
427509
428510class ImagesResourceWithStreamingResponse :
@@ -441,6 +523,9 @@ def __init__(self, images: ImagesResource) -> None:
441523 self .get = to_streamed_response_wrapper (
442524 images .get ,
443525 )
526+ self .tag = to_streamed_response_wrapper (
527+ images .tag ,
528+ )
444529
445530
446531class AsyncImagesResourceWithStreamingResponse :
@@ -459,3 +544,6 @@ def __init__(self, images: AsyncImagesResource) -> None:
459544 self .get = async_to_streamed_response_wrapper (
460545 images .get ,
461546 )
547+ self .tag = async_to_streamed_response_wrapper (
548+ images .tag ,
549+ )
0 commit comments