本文整理匯總了Python中synthtool.gcp.GAPICBazel方法的典型用法代碼示例。如果您正苦於以下問題:Python gcp.GAPICBazel方法的具體用法?Python gcp.GAPICBazel怎麽用?Python gcp.GAPICBazel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類synthtool.gcp
的用法示例。
在下文中一共展示了gcp.GAPICBazel方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: bazel_library
# 需要導入模塊: from synthtool import gcp [as 別名]
# 或者: from synthtool.gcp import GAPICBazel [as 別名]
def bazel_library(
service: str,
version: str,
package_pattern: str = "com.google.cloud.{service}.{version}",
gapic: gcp.GAPICBazel = None,
destination_name: str = None,
**kwargs,
) -> Path:
"""Generate a Java library using the gapic-generator via bazel.
Generates code into a temp directory, fixes missing header fields, and
copies into the expected locations.
Args:
service (str): Name of the service.
version (str): Service API version.
package_pattern (str, optional): Package name template for fixing file
headers. Defaults to "com.google.cloud.{service}.{version}".
gapic (GAPICBazel, optional): Generator instance.
destination_name (str, optional): Override the service name for the
destination of the output code. Defaults to the service name.
**kwargs: Additional options for gapic.java_library()
Returns:
The path to the temp directory containing the generated client.
"""
if gapic is None:
gapic = gcp.GAPICBazel()
library = gapic.java_library(service=service, version=version, **kwargs)
_common_generation(
service=service,
version=version,
library=library / f"google-cloud-{service}-{version}-java",
package_pattern=package_pattern,
suffix="-java",
destination_name=destination_name,
)
return library