コード例 #1
0
ファイル: dhcp_options.py プロジェクト: elastic-coders/moto
 def describe_dhcp_options(self):
     if "Filter.1.Name" in self.querystring:
         raise NotImplementedError("Filtering not supported in describe_dhcp_options.")
     elif "DhcpOptionsId.1" in self.querystring:
         dhcp_opt_ids = sequence_from_querystring("DhcpOptionsId", self.querystring)
         dhcp_opt = ec2_backend.describe_dhcp_options(dhcp_opt_ids)
     else:
         dhcp_opt = ec2_backend.describe_dhcp_options()
     template = Template(DESCRIBE_DHCP_OPTIONS_RESPONSE)
     return template.render(dhcp_options=dhcp_opt)
コード例 #2
0
ファイル: dhcp_options.py プロジェクト: invenia/moto
 def describe_dhcp_options(self):
     if "Filter.1.Name" in self.querystring:
         raise NotImplementedError("Filtering not supported in describe_dhcp_options.")
     elif "DhcpOptionsId.1" in self.querystring:
         dhcp_opt_ids = sequence_from_querystring("DhcpOptionsId", self.querystring)
         dhcp_opt = ec2_backend.describe_dhcp_options(dhcp_opt_ids)
     else:
         dhcp_opt = ec2_backend.describe_dhcp_options()
     template = Template(DESCRIBE_DHCP_OPTIONS_RESPONSE)
     return template.render(dhcp_options=dhcp_opt)
コード例 #3
0
ファイル: dhcp_options.py プロジェクト: ghalib/moto
    def associate_dhcp_options(self):
        dhcp_opt_id = self.querystring.get("DhcpOptionsId", [None])[0]
        vpc_id = self.querystring.get("VpcId", [None])[0]

        dhcp_opt = ec2_backend.describe_dhcp_options([dhcp_opt_id])[0]
        vpc = ec2_backend.get_vpc(vpc_id)

        ec2_backend.associate_dhcp_options(dhcp_opt, vpc)

        template = Template(ASSOCIATE_DHCP_OPTIONS_RESPONSE)
        return template.render()
コード例 #4
0
ファイル: dhcp_options.py プロジェクト: elastic-coders/moto
    def associate_dhcp_options(self):
        dhcp_opt_id = self.querystring.get("DhcpOptionsId", [None])[0]
        vpc_id = self.querystring.get("VpcId", [None])[0]

        dhcp_opt = ec2_backend.describe_dhcp_options([dhcp_opt_id])[0]
        vpc = ec2_backend.get_vpc(vpc_id)

        ec2_backend.associate_dhcp_options(dhcp_opt, vpc)

        template = Template(ASSOCIATE_DHCP_OPTIONS_RESPONSE)
        return template.render()