@@ -1613,6 +1613,259 @@ async def sample_mutate_deployed_model():
1613
1613
# Done; return the response.
1614
1614
return response
1615
1615
1616
+ async def set_publisher_model_config (
1617
+ self ,
1618
+ request : Optional [
1619
+ Union [endpoint_service .SetPublisherModelConfigRequest , dict ]
1620
+ ] = None ,
1621
+ * ,
1622
+ name : Optional [str ] = None ,
1623
+ publisher_model_config : Optional [endpoint .PublisherModelConfig ] = None ,
1624
+ retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
1625
+ timeout : Union [float , object ] = gapic_v1 .method .DEFAULT ,
1626
+ metadata : Sequence [Tuple [str , Union [str , bytes ]]] = (),
1627
+ ) -> operation_async .AsyncOperation :
1628
+ r"""Sets (creates or updates) configs of publisher
1629
+ models. For example, sets the request/response logging
1630
+ config.
1631
+
1632
+ .. code-block:: python
1633
+
1634
+ # This snippet has been automatically generated and should be regarded as a
1635
+ # code template only.
1636
+ # It will require modifications to work:
1637
+ # - It may require correct/in-range values for request initialization.
1638
+ # - It may require specifying regional endpoints when creating the service
1639
+ # client as shown in:
1640
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1641
+ from google.cloud import aiplatform_v1beta1
1642
+
1643
+ async def sample_set_publisher_model_config():
1644
+ # Create a client
1645
+ client = aiplatform_v1beta1.EndpointServiceAsyncClient()
1646
+
1647
+ # Initialize request argument(s)
1648
+ request = aiplatform_v1beta1.SetPublisherModelConfigRequest(
1649
+ name="name_value",
1650
+ )
1651
+
1652
+ # Make the request
1653
+ operation = client.set_publisher_model_config(request=request)
1654
+
1655
+ print("Waiting for operation to complete...")
1656
+
1657
+ response = (await operation).result()
1658
+
1659
+ # Handle the response
1660
+ print(response)
1661
+
1662
+ Args:
1663
+ request (Optional[Union[google.cloud.aiplatform_v1beta1.types.SetPublisherModelConfigRequest, dict]]):
1664
+ The request object. Request message for
1665
+ [EndpointService.SetPublisherModelConfig][google.cloud.aiplatform.v1beta1.EndpointService.SetPublisherModelConfig].
1666
+ name (:class:`str`):
1667
+ Required. The name of the publisher model, in the format
1668
+ of
1669
+ ``projects/{project}/locations/{location}/publishers/{publisher}/models/{model}``.
1670
+
1671
+ This corresponds to the ``name`` field
1672
+ on the ``request`` instance; if ``request`` is provided, this
1673
+ should not be set.
1674
+ publisher_model_config (:class:`google.cloud.aiplatform_v1beta1.types.PublisherModelConfig`):
1675
+ Required. The publisher model config.
1676
+ This corresponds to the ``publisher_model_config`` field
1677
+ on the ``request`` instance; if ``request`` is provided, this
1678
+ should not be set.
1679
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1680
+ should be retried.
1681
+ timeout (float): The timeout for this request.
1682
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1683
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1684
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1685
+ be of type `bytes`.
1686
+
1687
+ Returns:
1688
+ google.api_core.operation_async.AsyncOperation:
1689
+ An object representing a long-running operation.
1690
+
1691
+ The result type for the operation will be
1692
+ :class:`google.cloud.aiplatform_v1beta1.types.PublisherModelConfig`
1693
+ This message contains configs of a publisher model.
1694
+
1695
+ """
1696
+ # Create or coerce a protobuf request object.
1697
+ # - Quick check: If we got a request object, we should *not* have
1698
+ # gotten any keyword arguments that map to the request.
1699
+ flattened_params = [name , publisher_model_config ]
1700
+ has_flattened_params = (
1701
+ len ([param for param in flattened_params if param is not None ]) > 0
1702
+ )
1703
+ if request is not None and has_flattened_params :
1704
+ raise ValueError (
1705
+ "If the `request` argument is set, then none of "
1706
+ "the individual field arguments should be set."
1707
+ )
1708
+
1709
+ # - Use the request object if provided (there's no risk of modifying the input as
1710
+ # there are no flattened fields), or create one.
1711
+ if not isinstance (request , endpoint_service .SetPublisherModelConfigRequest ):
1712
+ request = endpoint_service .SetPublisherModelConfigRequest (request )
1713
+
1714
+ # If we have keyword arguments corresponding to fields on the
1715
+ # request, apply these.
1716
+ if name is not None :
1717
+ request .name = name
1718
+ if publisher_model_config is not None :
1719
+ request .publisher_model_config = publisher_model_config
1720
+
1721
+ # Wrap the RPC method; this adds retry and timeout information,
1722
+ # and friendly error handling.
1723
+ rpc = self ._client ._transport ._wrapped_methods [
1724
+ self ._client ._transport .set_publisher_model_config
1725
+ ]
1726
+
1727
+ # Certain fields should be provided within the metadata header;
1728
+ # add these here.
1729
+ metadata = tuple (metadata ) + (
1730
+ gapic_v1 .routing_header .to_grpc_metadata ((("name" , request .name ),)),
1731
+ )
1732
+
1733
+ # Validate the universe domain.
1734
+ self ._client ._validate_universe_domain ()
1735
+
1736
+ # Send the request.
1737
+ response = await rpc (
1738
+ request ,
1739
+ retry = retry ,
1740
+ timeout = timeout ,
1741
+ metadata = metadata ,
1742
+ )
1743
+
1744
+ # Wrap the response in an operation future.
1745
+ response = operation_async .from_gapic (
1746
+ response ,
1747
+ self ._client ._transport .operations_client ,
1748
+ endpoint .PublisherModelConfig ,
1749
+ metadata_type = endpoint_service .SetPublisherModelConfigOperationMetadata ,
1750
+ )
1751
+
1752
+ # Done; return the response.
1753
+ return response
1754
+
1755
+ async def fetch_publisher_model_config (
1756
+ self ,
1757
+ request : Optional [
1758
+ Union [endpoint_service .FetchPublisherModelConfigRequest , dict ]
1759
+ ] = None ,
1760
+ * ,
1761
+ name : Optional [str ] = None ,
1762
+ retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
1763
+ timeout : Union [float , object ] = gapic_v1 .method .DEFAULT ,
1764
+ metadata : Sequence [Tuple [str , Union [str , bytes ]]] = (),
1765
+ ) -> endpoint .PublisherModelConfig :
1766
+ r"""Fetches the configs of publisher models.
1767
+
1768
+ .. code-block:: python
1769
+
1770
+ # This snippet has been automatically generated and should be regarded as a
1771
+ # code template only.
1772
+ # It will require modifications to work:
1773
+ # - It may require correct/in-range values for request initialization.
1774
+ # - It may require specifying regional endpoints when creating the service
1775
+ # client as shown in:
1776
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1777
+ from google.cloud import aiplatform_v1beta1
1778
+
1779
+ async def sample_fetch_publisher_model_config():
1780
+ # Create a client
1781
+ client = aiplatform_v1beta1.EndpointServiceAsyncClient()
1782
+
1783
+ # Initialize request argument(s)
1784
+ request = aiplatform_v1beta1.FetchPublisherModelConfigRequest(
1785
+ name="name_value",
1786
+ )
1787
+
1788
+ # Make the request
1789
+ response = await client.fetch_publisher_model_config(request=request)
1790
+
1791
+ # Handle the response
1792
+ print(response)
1793
+
1794
+ Args:
1795
+ request (Optional[Union[google.cloud.aiplatform_v1beta1.types.FetchPublisherModelConfigRequest, dict]]):
1796
+ The request object. Request message for
1797
+ [EndpointService.FetchPublisherModelConfig][google.cloud.aiplatform.v1beta1.EndpointService.FetchPublisherModelConfig].
1798
+ name (:class:`str`):
1799
+ Required. The name of the publisher model, in the format
1800
+ of
1801
+ ``projects/{project}/locations/{location}/publishers/{publisher}/models/{model}``.
1802
+
1803
+ This corresponds to the ``name`` field
1804
+ on the ``request`` instance; if ``request`` is provided, this
1805
+ should not be set.
1806
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1807
+ should be retried.
1808
+ timeout (float): The timeout for this request.
1809
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1810
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1811
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1812
+ be of type `bytes`.
1813
+
1814
+ Returns:
1815
+ google.cloud.aiplatform_v1beta1.types.PublisherModelConfig:
1816
+ This message contains configs of a
1817
+ publisher model.
1818
+
1819
+ """
1820
+ # Create or coerce a protobuf request object.
1821
+ # - Quick check: If we got a request object, we should *not* have
1822
+ # gotten any keyword arguments that map to the request.
1823
+ flattened_params = [name ]
1824
+ has_flattened_params = (
1825
+ len ([param for param in flattened_params if param is not None ]) > 0
1826
+ )
1827
+ if request is not None and has_flattened_params :
1828
+ raise ValueError (
1829
+ "If the `request` argument is set, then none of "
1830
+ "the individual field arguments should be set."
1831
+ )
1832
+
1833
+ # - Use the request object if provided (there's no risk of modifying the input as
1834
+ # there are no flattened fields), or create one.
1835
+ if not isinstance (request , endpoint_service .FetchPublisherModelConfigRequest ):
1836
+ request = endpoint_service .FetchPublisherModelConfigRequest (request )
1837
+
1838
+ # If we have keyword arguments corresponding to fields on the
1839
+ # request, apply these.
1840
+ if name is not None :
1841
+ request .name = name
1842
+
1843
+ # Wrap the RPC method; this adds retry and timeout information,
1844
+ # and friendly error handling.
1845
+ rpc = self ._client ._transport ._wrapped_methods [
1846
+ self ._client ._transport .fetch_publisher_model_config
1847
+ ]
1848
+
1849
+ # Certain fields should be provided within the metadata header;
1850
+ # add these here.
1851
+ metadata = tuple (metadata ) + (
1852
+ gapic_v1 .routing_header .to_grpc_metadata ((("name" , request .name ),)),
1853
+ )
1854
+
1855
+ # Validate the universe domain.
1856
+ self ._client ._validate_universe_domain ()
1857
+
1858
+ # Send the request.
1859
+ response = await rpc (
1860
+ request ,
1861
+ retry = retry ,
1862
+ timeout = timeout ,
1863
+ metadata = metadata ,
1864
+ )
1865
+
1866
+ # Done; return the response.
1867
+ return response
1868
+
1616
1869
async def list_operations (
1617
1870
self ,
1618
1871
request : Optional [operations_pb2 .ListOperationsRequest ] = None ,
0 commit comments