@@ -542,6 +542,107 @@ async def sample_list_publisher_models():
542
542
# Done; return the response.
543
543
return response
544
544
545
+ async def deploy (
546
+ self ,
547
+ request : Optional [Union [model_garden_service .DeployRequest , dict ]] = None ,
548
+ * ,
549
+ retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
550
+ timeout : Union [float , object ] = gapic_v1 .method .DEFAULT ,
551
+ metadata : Sequence [Tuple [str , Union [str , bytes ]]] = (),
552
+ ) -> operation_async .AsyncOperation :
553
+ r"""Deploys a model to a new endpoint.
554
+
555
+ .. code-block:: python
556
+
557
+ # This snippet has been automatically generated and should be regarded as a
558
+ # code template only.
559
+ # It will require modifications to work:
560
+ # - It may require correct/in-range values for request initialization.
561
+ # - It may require specifying regional endpoints when creating the service
562
+ # client as shown in:
563
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
564
+ from google.cloud import aiplatform_v1beta1
565
+
566
+ async def sample_deploy():
567
+ # Create a client
568
+ client = aiplatform_v1beta1.ModelGardenServiceAsyncClient()
569
+
570
+ # Initialize request argument(s)
571
+ request = aiplatform_v1beta1.DeployRequest(
572
+ publisher_model_name="publisher_model_name_value",
573
+ destination="destination_value",
574
+ )
575
+
576
+ # Make the request
577
+ operation = client.deploy(request=request)
578
+
579
+ print("Waiting for operation to complete...")
580
+
581
+ response = (await operation).result()
582
+
583
+ # Handle the response
584
+ print(response)
585
+
586
+ Args:
587
+ request (Optional[Union[google.cloud.aiplatform_v1beta1.types.DeployRequest, dict]]):
588
+ The request object. Request message for
589
+ [ModelGardenService.Deploy][google.cloud.aiplatform.v1beta1.ModelGardenService.Deploy].
590
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
591
+ should be retried.
592
+ timeout (float): The timeout for this request.
593
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
594
+ sent along with the request as metadata. Normally, each value must be of type `str`,
595
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
596
+ be of type `bytes`.
597
+
598
+ Returns:
599
+ google.api_core.operation_async.AsyncOperation:
600
+ An object representing a long-running operation.
601
+
602
+ The result type for the operation will be :class:`google.cloud.aiplatform_v1beta1.types.DeployResponse` Response message for
603
+ [ModelGardenService.Deploy][google.cloud.aiplatform.v1beta1.ModelGardenService.Deploy].
604
+
605
+ """
606
+ # Create or coerce a protobuf request object.
607
+ # - Use the request object if provided (there's no risk of modifying the input as
608
+ # there are no flattened fields), or create one.
609
+ if not isinstance (request , model_garden_service .DeployRequest ):
610
+ request = model_garden_service .DeployRequest (request )
611
+
612
+ # Wrap the RPC method; this adds retry and timeout information,
613
+ # and friendly error handling.
614
+ rpc = self ._client ._transport ._wrapped_methods [self ._client ._transport .deploy ]
615
+
616
+ # Certain fields should be provided within the metadata header;
617
+ # add these here.
618
+ metadata = tuple (metadata ) + (
619
+ gapic_v1 .routing_header .to_grpc_metadata (
620
+ (("destination" , request .destination ),)
621
+ ),
622
+ )
623
+
624
+ # Validate the universe domain.
625
+ self ._client ._validate_universe_domain ()
626
+
627
+ # Send the request.
628
+ response = await rpc (
629
+ request ,
630
+ retry = retry ,
631
+ timeout = timeout ,
632
+ metadata = metadata ,
633
+ )
634
+
635
+ # Wrap the response in an operation future.
636
+ response = operation_async .from_gapic (
637
+ response ,
638
+ self ._client ._transport .operations_client ,
639
+ model_garden_service .DeployResponse ,
640
+ metadata_type = model_garden_service .DeployOperationMetadata ,
641
+ )
642
+
643
+ # Done; return the response.
644
+ return response
645
+
545
646
async def deploy_publisher_model (
546
647
self ,
547
648
request : Optional [
0 commit comments