public void testUpdateFirewallRule() throws IOException, InterruptedException, URISyntaxException { MockWebServer server = mockOpenStackServer(); server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json")))); server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/extension_list.json")))); server.enqueue(addCommonHeaders( new MockResponse().setResponseCode(201).setBody(stringFromResource("/firewall_rule_update_response.json")))); try { NeutronApi neutronApi = api(server.getUrl("/").toString(), "openstack-neutron", overrides); FWaaSApi api = neutronApi.getFWaaSApi("RegionOne").get(); UpdateFirewallRule updateFirewallRule = UpdateFirewallRule.builder() .build(); FirewallRule firewallRule = api.updateFirewallRule("12345", updateFirewallRule); /* * Check request */ assertEquals(server.getRequestCount(), 3); assertAuthentication(server); assertExtensions(server, uriApiVersion + ""); assertRequest(server.takeRequest(), "PUT", uriApiVersion + "/fw/firewall_rules/12345", "/firewall_rule_update_request.json"); /* * Check response */ assertNotNull(firewallRule); } finally { server.shutdown(); } }
@SerializedNames({ "tenant_id", "name", "description", "firewall_policy_id", "shared", "protocol", "ip_version", "source_ip_address", "destination_ip_address", "source_port", "destination_port", "position", "action", "enabled"}) public static UpdateFirewallRule create(String tenantId, String name, String description, String firewallPolicyId, Boolean shared, String protocol, IpVersion ipVersion, String sourceIpAddress, String destinationIpAddress, String sourcePort, String destinationPort, int position, String action, Boolean enabled) { return builder().tenantId(tenantId).name(name).description(description).firewallPolicyId(firewallPolicyId).shared(shared) .protocol(protocol).ipVersion(ipVersion).sourceIpAddress(sourceIpAddress).destinationIpAddress(destinationIpAddress).sourcePort(sourcePort) .destinationPort(destinationPort).position(position).action(action).enabled(enabled).build(); }
@SerializedNames({ "tenant_id", "name", "description", "firewall_policy_id", "shared", "protocol", "ip_version", "source_ip_address", "destination_ip_address", "source_port", "destination_port", "position", "action", "enabled"}) public static UpdateFirewallRule create(String tenantId, String name, String description, String firewallPolicyId, Boolean shared, String protocol, IpVersion ipVersion, String sourceIpAddress, String destinationIpAddress, String sourcePort, String destinationPort, int position, String action, Boolean enabled) { return builder().tenantId(tenantId).name(name).description(description).firewallPolicyId(firewallPolicyId).shared(shared) .protocol(protocol).ipVersion(ipVersion).sourceIpAddress(sourceIpAddress).destinationIpAddress(destinationIpAddress).sourcePort(sourcePort) .destinationPort(destinationPort).position(position).action(action).enabled(enabled).build(); }