getSites()
Cloud Run 处于 Alpha 状态,且尚未积极开发。
获取你在 GCP 项目中的 Cloud Storage 中的 Remotion 项目数组。
🌐 Gets an array of Remotion projects in Cloud Storage, in your GCP project.
这些项目位于你的 Cloud Storage 存储桶的 sites/ 子目录中。请记住——每个区域的 Remotion Cloud Run 只应有一个存储桶,因此你不需要为此函数指定存储桶名称。
🌐 The projects are located in the sites/ subdirectory of your Cloud Storage bucket. Remember - you should only have one bucket for Remotion Cloud Run per region, therefore you do not need to specify the name of the bucket for this function.
示例
🌐 Example
获取所有站点并记录有关它们的信息。
🌐 Gets all sites and logs information about them.
import {getSites } from '@remotion/cloudrun';
const {sites , buckets } = await getSites ('europe-west4');
for (const site of sites ) {
console .log (site .id ); // A unique ID for referring to that project
console .log (site .bucketName ); // In which bucket the site resides in.
console .log (site .bucketRegion ); // In which region the bucket resides in.
console .log (site .serveUrl ); // URL of the deployed site that you can pass to `renderMediaOnCloudRun()`
}
for (const bucket of buckets ) {
console .log (bucket .name ); // The name of the Cloud Storage bucket.
console .log (bucket .creationDate ); // A unix timestamp of when the site was created.
console .log (bucket .region ); // 'europe-west4'
}参数
🌐 Arguments
一个具有以下属性的对象:
🌐 An object with the following properties:
region
你想查询的 GCP 地区。或者,你可以传入“所有地区”以返回所有地区的站点。
🌐 The GCP region which you want to query. Alternatively, you can pass 'all regions' to return sites across all regions.
import {getSites } from '@remotion/cloudrun';
const {sites , buckets } = await getSites ('all regions');返回值
🌐 Return value
一个承诺,解析为具有以下属性的对象:
🌐 A promise resolving to an object with the following properties:
sites
一组已部署的 Remotion 项目,你可以用于渲染。
🌐 An array of deployed Remotion projects that you can use for rendering.
每个项目包含以下属性:
🌐 Each item contains the following properties:
id
该项目的唯一标识符。
🌐 A unique identifier for that project.
bucketName
项目所在的桶。
🌐 The bucket in which the project resides in.
bucketRegion
桶所在的区域。
🌐 The region in which the bucket resides in.
serveUrl
已部署站点的 URL。你可以将其传入 renderMediaOnCloudRun() 来渲染视频或音频。
🌐 URL of the deployed site. You can pass it into renderMediaOnCloudRun() to render a video or audio.
buckets
你账户中所选区域中所有以 remotioncloudrun- 开头的存储桶数组。
🌐 An array of all buckets in the selected region in your account that start with remotioncloudrun-.
你在每个区域的所有 Remotion 项目中应该只使用 1 个桶。
每个项目包含以下属性:
🌐 Each item contains the following properties:
region
桶所在的区域。
🌐 The region the bucket resides in.
name
存储桶的名称。云存储桶具有全球唯一的名称。
🌐 The name of the bucket. Cloud Storage buckets have globally unique names.
creationDate
桶首次创建时的 UNIX 时间戳。
🌐 A UNIX timestamp of the point when the bucket was first created.
另请参阅
🌐 See also