本文整理汇总了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