You need to enable JavaScript to run this app.
文件存储 vePFS

文件存储 vePFS

复制全文
Python SDK
代码示例
复制全文
代码示例

本文介绍文件存储 vePFS Python SDK 的代码示例供您参考。

前提条件

  1. 下载安装 SDK
  2. 初始化客户端

请求超时时间设置

使用 Python SDK 调用文件存储 vePFS 接口时,默认无超时时间限制。
您可以在发起接口调用请求时,在代码的最后加上 _request_timeout 参数来指定请求的超时时间(单位:秒),若未在该时间内完成,请求即会终止并报超时错误。

例如,您可以在调用 DescribeFileSystems 接口时,通过如下代码将超时时间设置为 10 秒。

resp = api_instance.describe_file_systems(volcenginesdkvepfs.DescribeFileSystemsRequest(), _request_timeout=10)

创建文件系统

说明

关于下述 SDK 代码中所使用参数的定义、取值范围等信息,请参见 CreateFileSystem

import volcenginesdkvepfs
import volcenginesdkcore
from volcenginesdkcore.rest import ApiException
from pprint import pprint

if __name__ == "__main__":
    try:
        # api_instance 详见初始化客户端部分
        resp = api_instance.create_file_system(volcenginesdkvepfs.CreateFileSystemRequest(
            zone_id="cn-beijing-a",
            file_system_name="python_sdk_test",
            file_system_type="VePFS",
            protocol_type="VePFS",
            charge_type="PayAsYouGo",
            capacity=6,
            store_type="Advance_100",
            subnet_id="subnet-11wlfzpho**************",
            vpc_id="vpc-11w4ygf1zls7*************",
        ))
        pprint(resp)
    except ApiException as e:
        print("Exception when calling VEPFSApi->create_file_system: %s\n" % e)

列举文件系统

说明

关于下述 SDK 请求中所使用参数的定义、取值范围等信息,请参见 DescribeFileSystems

import volcenginesdkvepfs
import volcenginesdkcore
from volcenginesdkcore.rest import ApiException
from pprint import pprint

if __name__ == "__main__":
    try:
        # api_instance 详见初始化客户端部分
        resp = api_instance.describe_file_systems(volcenginesdkvepfs.DescribeFileSystemsRequest())
        pprint(resp)
    except ApiException as e:
        print("Exception when calling VEPFSApi->describe_file_systems: %s\n" % e)
最近更新时间:2023.12.19 16:19:37
这个页面对您有帮助吗?
有用
有用
无用
无用