首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Filter DHCP选项集Boto3

Filter DHCP选项集Boto3
EN

Stack Overflow用户
提问于 2022-02-24 17:45:16
回答 1查看 67关注 0票数 0

我想通过使用Boto3的域名和域名服务器过滤DHCP选项集。文档声明我可以使用几个过滤器。https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#dhcpoptions

看起来我应该能够使用一个“键”过滤器来过滤域名。

“键--其中一个选项的键(例如,域名)。”

下面的代码会产生错误。

代码语言:javascript
复制
def query_dhcp_options_set():

    ec2_client = boto3.client('ec2', region_name='us-west-1')

    filters = [
        {'Name':'domain-name', 'Values':['example.com']},
    ]

    return ec2_client.describe_dhcp_options(Filters=filters)

botocore.exceptions.ClientError: An error occurred (InvalidParameterValue) when calling the DescribeDhcpOptions operation: The filter 'domain-name' is invalid

我还尝试了以下代码

代码语言:javascript
复制
def query_dhcp_options_set():

    ec2_client = boto3.client('ec2', region_name='us-west-1')

    filters = [
        {'Name':'key:domain-name', 'Values':['example.com']},
    ]

    return ec2_client.describe_dhcp_options(Filters=filters)

botocore.exceptions.ClientError: An error occurred (InvalidParameterValue) when calling the DescribeDhcpOptions operation: The filter 'key:domain-name' is invalid

可以通过域名和域名服务器属性提供查询DHCP选项集的示例吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-02-24 19:50:33

试试[ { "Name":"key", "Values":[ "domain-name" ] }, { "Name":"value", "Values":[ "example.com" ] } ]

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71256126

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档