use_git_repository 方法

命名空间和模块:tencent.cloud.serverless.functions.client.FunctionCode

简要

配置使用给定 Git 仓库作为无服务器云函数源代码来源。

def use_git_repository(self,
    git_url: str,
    git_branch_name: str = None,
    git_directory_name: str = None,
    git_commit_id: str = None,
    git_username: str = None,
    git_password: str = None
)

参数

该方法具有以下参数,其参数、参数类型和参数描述如下:

参数

类型

必选

描述

git_url

str

Git 仓库 URL 字符串。

git_branch_name

str

Git 仓库中已创建的分支名称。

git_directory_name

str

Git 仓库中包含用于无服务器云函数源代码的目录名称。

git_commit_id

str

Git 仓库中包含用于无服务器云函数源代码的提交 ID。

git_username

str

拥有给定 Git 仓库访问权限的用户名。

git_password

str

拥有给定 Git 仓库访问权限用户的密码。

返回值

该方法返回当前代表无服务器云函数源代码配置的 FunctionCode 类实例本身。

异常

该方法可能会主动引发的异常类型如下:

ValueError

参数值或类型不符合预期。

示例

下面我们将通过一段 Python 代码向您演示如何使用该方法:

functions.FunctionCode.use_git_repository(
    git_url = 'https://github.com/tencentyun/scf-demo-repo.git',
    git_directory_name = 'Python3.6-helloworld'
)

适用于

Tencent Cloud SDK for Python

产品软件包:tencent-cloud-sdk-serverless-functions >= 0.1.1

最后更新于