@SuppressWarnings("unchecked")
    private <T extends ResourceData, R extends ResourceDTO> R create(final String uri, final T data) {
        log.info("trying to create resource({}) name: {}", data.getClass().getSimpleName(), data.getName());

        data.setName(NameUtils.wrap(data.getName(), scenarioId));

        HttpEntity<T> entity = new HttpEntity<>(data, basicAuth);
        ResponseEntity<ShenYuResult> response = template.postForEntity(baseURL + uri, entity, ShenYuResult.class);
        Assertions.assertEquals(HttpStatus.OK, response.getStatusCode(), "status code");

        ShenYuResult rst = response.getBody();
        Assertions.assertNotNull(rst, "checking http response body");
        Assertions.assertEquals(200, rst.getCode(), "checking shenyu result code");
        Assertions.assertEquals("create success", rst.getMessage(), "checking shenyu result message");

        SearchedResources<?> searchedResources = null;
        if (data instanceof SelectorData) {
            searchedResources = searchSelectors(data.getName());
        } else if (data instanceof RuleData) {
            searchedResources = searchRules(data.getName());
        }
        Assertions.assertNotNull(searchedResources, "checking searchedResources object is non-null");
        Assertions.assertEquals(1, searchedResources.getTotal(), "checking the total hits of searching");

        ResourceDTO created = searchedResources.getList().get(0);
        Assertions.assertNotNull(created, "checking created object is non-null");
        log.info("create resource({}) successful. name: {}, id: {}", data.getClass().getSimpleName(), data.getName(), created.getId());

        return (R) created;
    }
Create Rule.

@param rule rule
@return RuleDTO
shenyu-e2e/shenyu-e2e-client/src/main/java/org/apache/shenyu/e2e/client/admin/AdminClient.java