mirror of https://github.com/halo-dev/halo
Provide storage policy config APIs to make it easy to use (#7527)
* Provide storage policy config APIs to make it easy to use * Update api client Signed-off-by: Ryan Wang <i@ryanc.cc> --------- Signed-off-by: Ryan Wang <i@ryanc.cc> Co-authored-by: Ryan Wang <i@ryanc.cc>pull/7521/head^2
parent
315073406f
commit
aeea3a5488
|
@ -7408,6 +7408,89 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/apis/console.api.storage.halo.run/v1alpha1/policies/{name}/configs/{group}": {
|
||||||
|
"get": {
|
||||||
|
"description": "Get policy config by group",
|
||||||
|
"operationId": "getPolicyConfigByGroup",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"description": "Name of the policy",
|
||||||
|
"in": "path",
|
||||||
|
"name": "name",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Name of the group",
|
||||||
|
"in": "path",
|
||||||
|
"name": "group",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"default": {
|
||||||
|
"content": {
|
||||||
|
"*/*": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/JsonNode"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description": "default response"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tags": [
|
||||||
|
"PolicyAlpha1Console"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"put": {
|
||||||
|
"description": "Update policy config by group",
|
||||||
|
"operationId": "updatePolicyConfigByGroup",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"description": "Name of the policy",
|
||||||
|
"in": "path",
|
||||||
|
"name": "name",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Name of the group",
|
||||||
|
"in": "path",
|
||||||
|
"name": "group",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"requestBody": {
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/JsonNode"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"responses": {
|
||||||
|
"204": {
|
||||||
|
"description": "No Content"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tags": [
|
||||||
|
"PolicyAlpha1Console"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
"/apis/content.halo.run/v1alpha1/categories": {
|
"/apis/content.halo.run/v1alpha1/categories": {
|
||||||
"get": {
|
"get": {
|
||||||
"description": "List Category",
|
"description": "List Category",
|
||||||
|
|
|
@ -3284,6 +3284,89 @@
|
||||||
"UserV1alpha1Console"
|
"UserV1alpha1Console"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"/apis/console.api.storage.halo.run/v1alpha1/policies/{name}/configs/{group}": {
|
||||||
|
"get": {
|
||||||
|
"description": "Get policy config by group",
|
||||||
|
"operationId": "getPolicyConfigByGroup",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"description": "Name of the policy",
|
||||||
|
"in": "path",
|
||||||
|
"name": "name",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Name of the group",
|
||||||
|
"in": "path",
|
||||||
|
"name": "group",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"default": {
|
||||||
|
"content": {
|
||||||
|
"*/*": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/JsonNode"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description": "default response"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tags": [
|
||||||
|
"PolicyAlpha1Console"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"put": {
|
||||||
|
"description": "Update policy config by group",
|
||||||
|
"operationId": "updatePolicyConfigByGroup",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"description": "Name of the policy",
|
||||||
|
"in": "path",
|
||||||
|
"name": "name",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Name of the group",
|
||||||
|
"in": "path",
|
||||||
|
"name": "group",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"requestBody": {
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/JsonNode"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"responses": {
|
||||||
|
"204": {
|
||||||
|
"description": "No Content"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tags": [
|
||||||
|
"PolicyAlpha1Console"
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"components": {
|
"components": {
|
||||||
|
@ -4326,6 +4409,9 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"JsonNode": {
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
"JsonPatch": {
|
"JsonPatch": {
|
||||||
"minItems": 1,
|
"minItems": 1,
|
||||||
"uniqueItems": true,
|
"uniqueItems": true,
|
||||||
|
|
|
@ -0,0 +1,183 @@
|
||||||
|
package run.halo.app.core.attachment.endpoint;
|
||||||
|
|
||||||
|
import static org.springdoc.core.fn.builders.apiresponse.Builder.responseBuilder;
|
||||||
|
import static org.springdoc.core.fn.builders.parameter.Builder.parameterBuilder;
|
||||||
|
import static org.springdoc.core.fn.builders.requestbody.Builder.requestBodyBuilder;
|
||||||
|
import static org.springframework.http.HttpStatus.NO_CONTENT;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import io.swagger.v3.oas.annotations.enums.ParameterIn;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Objects;
|
||||||
|
import org.springdoc.webflux.core.fn.SpringdocRouteBuilder;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.transaction.ReactiveTransactionManager;
|
||||||
|
import org.springframework.transaction.reactive.TransactionalOperator;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
import org.springframework.web.reactive.function.server.RequestPredicates;
|
||||||
|
import org.springframework.web.reactive.function.server.RouterFunction;
|
||||||
|
import org.springframework.web.reactive.function.server.ServerRequest;
|
||||||
|
import org.springframework.web.reactive.function.server.ServerResponse;
|
||||||
|
import org.springframework.web.server.ServerWebInputException;
|
||||||
|
import reactor.core.publisher.Mono;
|
||||||
|
import run.halo.app.core.extension.attachment.Policy;
|
||||||
|
import run.halo.app.core.extension.endpoint.CustomEndpoint;
|
||||||
|
import run.halo.app.extension.ConfigMap;
|
||||||
|
import run.halo.app.extension.GroupVersion;
|
||||||
|
import run.halo.app.extension.Metadata;
|
||||||
|
import run.halo.app.extension.ReactiveExtensionClient;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
class PolicyEndpoint implements CustomEndpoint {
|
||||||
|
|
||||||
|
private final ReactiveExtensionClient client;
|
||||||
|
|
||||||
|
private final ObjectMapper mapper;
|
||||||
|
|
||||||
|
private final ReactiveTransactionManager txManager;
|
||||||
|
|
||||||
|
PolicyEndpoint(ReactiveExtensionClient client, ObjectMapper mapper,
|
||||||
|
ReactiveTransactionManager txManager) {
|
||||||
|
this.client = client;
|
||||||
|
this.mapper = mapper;
|
||||||
|
this.txManager = txManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RouterFunction<ServerResponse> endpoint() {
|
||||||
|
var tag = "PolicyAlpha1Console";
|
||||||
|
return SpringdocRouteBuilder.route()
|
||||||
|
.GET(
|
||||||
|
"/policies/{name}/configs/{group}",
|
||||||
|
this::getPolicyConfigByGroup,
|
||||||
|
builder -> builder.operationId("getPolicyConfigByGroup")
|
||||||
|
.description("Get policy config by group")
|
||||||
|
.tag(tag)
|
||||||
|
.parameter(parameterBuilder()
|
||||||
|
.in(ParameterIn.PATH)
|
||||||
|
.name("name")
|
||||||
|
.description("Name of the policy")
|
||||||
|
.required(true)
|
||||||
|
.implementation(String.class)
|
||||||
|
)
|
||||||
|
.parameter(parameterBuilder()
|
||||||
|
.in(ParameterIn.PATH)
|
||||||
|
.name("group")
|
||||||
|
.description("Name of the group")
|
||||||
|
.required(true)
|
||||||
|
.implementation(String.class)
|
||||||
|
)
|
||||||
|
.response(responseBuilder().implementation(JsonNode.class))
|
||||||
|
)
|
||||||
|
.PUT(
|
||||||
|
"/policies/{name}/configs/{group}",
|
||||||
|
RequestPredicates.contentType(MediaType.APPLICATION_JSON),
|
||||||
|
this::updatePolicyConfigByGroup,
|
||||||
|
builder -> builder.operationId("updatePolicyConfigByGroup")
|
||||||
|
.description("Update policy config by group")
|
||||||
|
.tag(tag)
|
||||||
|
.parameter(parameterBuilder()
|
||||||
|
.in(ParameterIn.PATH)
|
||||||
|
.name("name")
|
||||||
|
.description("Name of the policy")
|
||||||
|
.required(true)
|
||||||
|
.implementation(String.class)
|
||||||
|
)
|
||||||
|
.parameter(parameterBuilder()
|
||||||
|
.in(ParameterIn.PATH)
|
||||||
|
.name("group")
|
||||||
|
.description("Name of the group")
|
||||||
|
.required(true)
|
||||||
|
.implementation(String.class)
|
||||||
|
)
|
||||||
|
.requestBody(
|
||||||
|
requestBodyBuilder().required(true).implementation(JsonNode.class))
|
||||||
|
.response(
|
||||||
|
responseBuilder().responseCode(String.valueOf(NO_CONTENT.value()))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Mono<ServerResponse> updatePolicyConfigByGroup(ServerRequest serverRequest) {
|
||||||
|
var policyName = serverRequest.pathVariable("name");
|
||||||
|
var configGroup = serverRequest.pathVariable("group");
|
||||||
|
return serverRequest.bodyToMono(JsonNode.class)
|
||||||
|
.switchIfEmpty(Mono.error(() -> new ServerWebInputException(
|
||||||
|
"Request body is required.")
|
||||||
|
))
|
||||||
|
.flatMap(jsonNode -> {
|
||||||
|
var tx = TransactionalOperator.create(txManager);
|
||||||
|
return client.get(Policy.class, policyName)
|
||||||
|
.flatMap(policy -> Mono.justOrEmpty(policy.getSpec())
|
||||||
|
.mapNotNull(Policy.PolicySpec::getConfigMapName)
|
||||||
|
.filter(StringUtils::hasText)
|
||||||
|
.flatMap(cmName -> client.fetch(ConfigMap.class, cmName))
|
||||||
|
.switchIfEmpty(Mono.fromSupplier(() -> {
|
||||||
|
// create a new configmap
|
||||||
|
var cm = new ConfigMap();
|
||||||
|
cm.setMetadata(new Metadata());
|
||||||
|
cm.getMetadata().setGenerateName(policyName + "-config-");
|
||||||
|
return cm;
|
||||||
|
}))
|
||||||
|
.flatMap(cm -> Mono.fromCallable(() -> {
|
||||||
|
if (cm.getData() == null) {
|
||||||
|
cm.setData(new HashMap<>());
|
||||||
|
}
|
||||||
|
var oldJson = cm.getData().get(configGroup);
|
||||||
|
if (StringUtils.hasText(oldJson)
|
||||||
|
&& Objects.equals(jsonNode, mapper.readTree(oldJson))) {
|
||||||
|
// skip if no change
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var newJson = mapper.writeValueAsString(jsonNode);
|
||||||
|
cm.getData().put(configGroup, newJson);
|
||||||
|
return cm;
|
||||||
|
}))
|
||||||
|
.flatMap(cm -> {
|
||||||
|
if (cm.getMetadata().getVersion() != null) {
|
||||||
|
return client.update(cm);
|
||||||
|
}
|
||||||
|
return client.create(cm);
|
||||||
|
})
|
||||||
|
.flatMap(cm -> {
|
||||||
|
var cmName = cm.getMetadata().getName();
|
||||||
|
if (policy.getSpec() != null
|
||||||
|
&& Objects.equals(policy.getSpec().getConfigMapName(), cmName)) {
|
||||||
|
return Mono.just(cm);
|
||||||
|
}
|
||||||
|
if (policy.getSpec() == null) {
|
||||||
|
policy.setSpec(new Policy.PolicySpec());
|
||||||
|
}
|
||||||
|
policy.getSpec().setConfigMapName(cmName);
|
||||||
|
return client.update(policy);
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.as(tx::transactional);
|
||||||
|
})
|
||||||
|
.then(ServerResponse.noContent().build());
|
||||||
|
}
|
||||||
|
|
||||||
|
private Mono<ServerResponse> getPolicyConfigByGroup(ServerRequest serverRequest) {
|
||||||
|
var policyName = serverRequest.pathVariable("name");
|
||||||
|
var configGroup = serverRequest.pathVariable("group");
|
||||||
|
|
||||||
|
return client.get(Policy.class, policyName)
|
||||||
|
.filter(p -> p.getSpec() != null)
|
||||||
|
.map(p -> p.getSpec().getConfigMapName())
|
||||||
|
.filter(StringUtils::hasText)
|
||||||
|
.flatMap(cmName -> client.fetch(ConfigMap.class, cmName))
|
||||||
|
.filter(cm -> cm.getData() != null && cm.getData().containsKey(configGroup))
|
||||||
|
.map(cm -> cm.getData().get(configGroup))
|
||||||
|
.flatMap(json -> Mono.fromCallable(() -> mapper.readTree(json)))
|
||||||
|
.defaultIfEmpty(mapper.nullNode())
|
||||||
|
.flatMap(config -> ServerResponse.ok().bodyValue(config));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GroupVersion groupVersion() {
|
||||||
|
return GroupVersion.parseAPIVersion("console.api.storage.halo.run/v1alpha1");
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,13 +1,18 @@
|
||||||
package run.halo.app.extension.exception;
|
package run.halo.app.extension.exception;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import run.halo.app.extension.GroupVersionKind;
|
import run.halo.app.extension.GroupVersionKind;
|
||||||
|
|
||||||
public class ExtensionNotFoundException extends ExtensionException {
|
public class ExtensionNotFoundException extends ExtensionException {
|
||||||
|
|
||||||
|
public static final URI TYPE =
|
||||||
|
URI.create("https://www.halo.run/api/errors/extension-not-found");
|
||||||
|
|
||||||
public ExtensionNotFoundException(GroupVersionKind gvk, String name) {
|
public ExtensionNotFoundException(GroupVersionKind gvk, String name) {
|
||||||
super(HttpStatus.NOT_FOUND, "Extension " + gvk + "/" + name + " was not found.",
|
super(HttpStatus.NOT_FOUND, "Extension " + gvk + "/" + name + " was not found.",
|
||||||
null, null, new Object[] {gvk, name});
|
null, null, new Object[] {gvk, name});
|
||||||
|
setType(TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,230 @@
|
||||||
|
package run.halo.app.core.attachment.endpoint;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
|
import static org.mockito.ArgumentMatchers.assertArg;
|
||||||
|
import static org.mockito.Mockito.mock;
|
||||||
|
import static org.mockito.Mockito.verify;
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.databind.json.JsonMapper;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.InjectMocks;
|
||||||
|
import org.mockito.Mock;
|
||||||
|
import org.mockito.Spy;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
import org.skyscreamer.jsonassert.JSONAssert;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||||
|
import org.springframework.transaction.ReactiveTransaction;
|
||||||
|
import org.springframework.transaction.ReactiveTransactionManager;
|
||||||
|
import reactor.core.publisher.Mono;
|
||||||
|
import run.halo.app.core.extension.attachment.Policy;
|
||||||
|
import run.halo.app.extension.ConfigMap;
|
||||||
|
import run.halo.app.extension.Metadata;
|
||||||
|
import run.halo.app.extension.ReactiveExtensionClient;
|
||||||
|
import run.halo.app.extension.Scheme;
|
||||||
|
import run.halo.app.extension.exception.ExtensionNotFoundException;
|
||||||
|
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
class PolicyEndpointTest {
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
ReactiveExtensionClient client;
|
||||||
|
|
||||||
|
@Spy
|
||||||
|
ObjectMapper mapper = JsonMapper.builder().build();
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
ReactiveTransactionManager txManager;
|
||||||
|
|
||||||
|
@InjectMocks
|
||||||
|
PolicyEndpoint endpoint;
|
||||||
|
|
||||||
|
WebTestClient webClient;
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
void setUp() {
|
||||||
|
webClient = WebTestClient.bindToRouterFunction(endpoint.endpoint())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldRespondNotFoundIfPolicyNotFound() {
|
||||||
|
// Implement test logic here
|
||||||
|
var policyScheme = Scheme.buildFromType(Policy.class);
|
||||||
|
when(client.get(Policy.class, "fake-policy"))
|
||||||
|
.thenReturn(Mono.error(() -> new ExtensionNotFoundException(
|
||||||
|
policyScheme.groupVersionKind(), "fake-policy")
|
||||||
|
));
|
||||||
|
webClient.get().uri("/policies/fake-policy/configs/fake-group")
|
||||||
|
.exchange()
|
||||||
|
.expectStatus().isNotFound();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldRespondNullIfNoConfigFound() {
|
||||||
|
when(client.get(Policy.class, "fake-policy")).thenReturn(Mono.fromSupplier(() -> {
|
||||||
|
var policy = new Policy();
|
||||||
|
policy.setSpec(new Policy.PolicySpec());
|
||||||
|
policy.getSpec().setConfigMapName("fake-config-map");
|
||||||
|
return policy;
|
||||||
|
}));
|
||||||
|
|
||||||
|
when(client.fetch(ConfigMap.class, "fake-config-map"))
|
||||||
|
.thenReturn(Mono.empty());
|
||||||
|
|
||||||
|
webClient.get().uri("/policies/fake-policy/configs/fake-group")
|
||||||
|
.exchange()
|
||||||
|
.expectStatus().isOk()
|
||||||
|
.expectBody(String.class)
|
||||||
|
.isEqualTo("null");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldRespondNullIfGroupNotFound() {
|
||||||
|
when(client.get(Policy.class, "fake-policy")).thenReturn(Mono.fromSupplier(() -> {
|
||||||
|
var policy = new Policy();
|
||||||
|
policy.setSpec(new Policy.PolicySpec());
|
||||||
|
policy.getSpec().setConfigMapName("fake-config-map");
|
||||||
|
return policy;
|
||||||
|
}));
|
||||||
|
|
||||||
|
when(client.fetch(ConfigMap.class, "fake-config-map"))
|
||||||
|
.thenReturn(Mono.fromSupplier(() -> {
|
||||||
|
var cm = new ConfigMap();
|
||||||
|
cm.setData(new HashMap<>());
|
||||||
|
return cm;
|
||||||
|
}));
|
||||||
|
|
||||||
|
webClient.get().uri("/policies/fake-policy/configs/fake-group")
|
||||||
|
.exchange()
|
||||||
|
.expectStatus().isOk()
|
||||||
|
.expectBody(String.class)
|
||||||
|
.isEqualTo("null");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldRespondConfigIfGroupFound() {
|
||||||
|
when(client.get(Policy.class, "fake-policy")).thenReturn(Mono.fromSupplier(() -> {
|
||||||
|
var policy = new Policy();
|
||||||
|
policy.setSpec(new Policy.PolicySpec());
|
||||||
|
policy.getSpec().setConfigMapName("fake-config-map");
|
||||||
|
return policy;
|
||||||
|
}));
|
||||||
|
|
||||||
|
when(client.fetch(ConfigMap.class, "fake-config-map"))
|
||||||
|
.thenReturn(Mono.fromSupplier(() -> {
|
||||||
|
var cm = new ConfigMap();
|
||||||
|
cm.setData(new HashMap<>());
|
||||||
|
cm.getData().put("fake-group", """
|
||||||
|
{
|
||||||
|
"halo": "awesome"
|
||||||
|
}""");
|
||||||
|
return cm;
|
||||||
|
}));
|
||||||
|
|
||||||
|
webClient.get().uri("/policies/fake-policy/configs/fake-group")
|
||||||
|
.exchange()
|
||||||
|
.expectStatus().isOk()
|
||||||
|
.expectBody()
|
||||||
|
.jsonPath("$.halo").isEqualTo("awesome");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldUpdateConfigIfPresent() {
|
||||||
|
when(client.get(Policy.class, "fake-policy")).thenReturn(Mono.fromSupplier(() -> {
|
||||||
|
var policy = new Policy();
|
||||||
|
policy.setSpec(new Policy.PolicySpec());
|
||||||
|
policy.getSpec().setConfigMapName("fake-config-map");
|
||||||
|
return policy;
|
||||||
|
}));
|
||||||
|
|
||||||
|
var cm = new ConfigMap();
|
||||||
|
cm.setMetadata(new Metadata());
|
||||||
|
cm.getMetadata().setName("fake-config-map");
|
||||||
|
cm.getMetadata().setVersion(1L);
|
||||||
|
cm.setData(new HashMap<>());
|
||||||
|
cm.getData().put("fake-group", """
|
||||||
|
{
|
||||||
|
"halo": "awesome"
|
||||||
|
}""");
|
||||||
|
when(client.fetch(ConfigMap.class, "fake-config-map"))
|
||||||
|
.thenReturn(Mono.just(cm));
|
||||||
|
|
||||||
|
var tx = mock(ReactiveTransaction.class);
|
||||||
|
when(txManager.getReactiveTransaction(any())).thenReturn(Mono.just(tx));
|
||||||
|
when(txManager.commit(tx)).thenReturn(Mono.empty());
|
||||||
|
|
||||||
|
when(client.update(cm)).thenReturn(Mono.just(cm));
|
||||||
|
|
||||||
|
var body = """
|
||||||
|
{
|
||||||
|
"halo": "nice",
|
||||||
|
"key": "value"
|
||||||
|
}""";
|
||||||
|
|
||||||
|
webClient.put().uri("/policies/fake-policy/configs/fake-group")
|
||||||
|
.contentType(MediaType.APPLICATION_JSON)
|
||||||
|
.bodyValue(body)
|
||||||
|
.exchange()
|
||||||
|
.expectStatus().isNoContent();
|
||||||
|
|
||||||
|
verify(client).<ConfigMap>update(assertArg(gotCm -> {
|
||||||
|
var data = gotCm.getData();
|
||||||
|
JSONAssert.assertEquals(body, data.get("fake-group"), true);
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldCreateConfigIfAbsent() {
|
||||||
|
var policy = new Policy();
|
||||||
|
policy.setSpec(new Policy.PolicySpec());
|
||||||
|
when(client.get(Policy.class, "fake-policy")).thenReturn(Mono.just(policy));
|
||||||
|
|
||||||
|
|
||||||
|
var tx = mock(ReactiveTransaction.class);
|
||||||
|
when(txManager.getReactiveTransaction(any())).thenReturn(Mono.just(tx));
|
||||||
|
when(txManager.commit(tx)).thenReturn(Mono.empty());
|
||||||
|
|
||||||
|
var cm = new ConfigMap();
|
||||||
|
cm.setMetadata(new Metadata());
|
||||||
|
cm.getMetadata().setName("fake-config-map");
|
||||||
|
cm.getMetadata().setVersion(1L);
|
||||||
|
cm.setData(new HashMap<>());
|
||||||
|
cm.getData().put("fake-group", """
|
||||||
|
{
|
||||||
|
"halo": "nice",
|
||||||
|
"key": "value"
|
||||||
|
}\
|
||||||
|
""");
|
||||||
|
when(client.create(any(ConfigMap.class))).thenReturn(Mono.just(cm));
|
||||||
|
when(client.update(policy)).thenReturn(Mono.just(policy));
|
||||||
|
|
||||||
|
var body = """
|
||||||
|
{
|
||||||
|
"halo": "nice",
|
||||||
|
"key": "value"
|
||||||
|
}""";
|
||||||
|
|
||||||
|
webClient.put().uri("/policies/fake-policy/configs/fake-group")
|
||||||
|
.contentType(MediaType.APPLICATION_JSON)
|
||||||
|
.bodyValue(body)
|
||||||
|
.exchange()
|
||||||
|
.expectStatus().isNoContent();
|
||||||
|
|
||||||
|
verify(client).<ConfigMap>create(assertArg(gotCm -> {
|
||||||
|
var data = gotCm.getData();
|
||||||
|
JSONAssert.assertEquals(body, data.get("fake-group"), true);
|
||||||
|
}));
|
||||||
|
|
||||||
|
verify(client).<Policy>update(assertArg(
|
||||||
|
gotPolicy -> assertEquals("fake-config-map", gotPolicy.getSpec().getConfigMapName())
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
|
@ -66,6 +66,7 @@ import {
|
||||||
UserV1alpha1Api,
|
UserV1alpha1Api,
|
||||||
UserV1alpha1ConsoleApi,
|
UserV1alpha1ConsoleApi,
|
||||||
UserPreferenceV1alpha1UcApi,
|
UserPreferenceV1alpha1UcApi,
|
||||||
|
PolicyAlpha1ConsoleApi,
|
||||||
} from "../src";
|
} from "../src";
|
||||||
|
|
||||||
const defaultAxiosInstance = axios.create({
|
const defaultAxiosInstance = axios.create({
|
||||||
|
@ -281,6 +282,7 @@ function createConsoleApiClient(axiosInstance: AxiosInstance) {
|
||||||
baseURL,
|
baseURL,
|
||||||
axiosInstance
|
axiosInstance
|
||||||
),
|
),
|
||||||
|
policy: new PolicyAlpha1ConsoleApi(undefined, baseURL, axiosInstance),
|
||||||
},
|
},
|
||||||
auth: {
|
auth: {
|
||||||
authProvider: new AuthProviderV1alpha1ConsoleApi(
|
authProvider: new AuthProviderV1alpha1ConsoleApi(
|
||||||
|
|
|
@ -42,6 +42,7 @@ api/personal-access-token-v1alpha1-uc-api.ts
|
||||||
api/plugin-v1alpha1-api.ts
|
api/plugin-v1alpha1-api.ts
|
||||||
api/plugin-v1alpha1-console-api.ts
|
api/plugin-v1alpha1-console-api.ts
|
||||||
api/plugin-v1alpha1-public-api.ts
|
api/plugin-v1alpha1-public-api.ts
|
||||||
|
api/policy-alpha1-console-api.ts
|
||||||
api/policy-template-v1alpha1-api.ts
|
api/policy-template-v1alpha1-api.ts
|
||||||
api/policy-v1alpha1-api.ts
|
api/policy-v1alpha1-api.ts
|
||||||
api/post-v1alpha1-api.ts
|
api/post-v1alpha1-api.ts
|
||||||
|
|
|
@ -54,6 +54,7 @@ export * from './api/personal-access-token-v1alpha1-uc-api';
|
||||||
export * from './api/plugin-v1alpha1-api';
|
export * from './api/plugin-v1alpha1-api';
|
||||||
export * from './api/plugin-v1alpha1-console-api';
|
export * from './api/plugin-v1alpha1-console-api';
|
||||||
export * from './api/plugin-v1alpha1-public-api';
|
export * from './api/plugin-v1alpha1-public-api';
|
||||||
|
export * from './api/policy-alpha1-console-api';
|
||||||
export * from './api/policy-template-v1alpha1-api';
|
export * from './api/policy-template-v1alpha1-api';
|
||||||
export * from './api/policy-v1alpha1-api';
|
export * from './api/policy-v1alpha1-api';
|
||||||
export * from './api/post-v1alpha1-api';
|
export * from './api/post-v1alpha1-api';
|
||||||
|
|
|
@ -0,0 +1,272 @@
|
||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
/**
|
||||||
|
* Halo
|
||||||
|
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 2.21.0-SNAPSHOT
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
import type { Configuration } from '../configuration';
|
||||||
|
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
|
||||||
|
import globalAxios from 'axios';
|
||||||
|
// Some imports not used depending on template conditions
|
||||||
|
// @ts-ignore
|
||||||
|
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common';
|
||||||
|
// @ts-ignore
|
||||||
|
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base';
|
||||||
|
/**
|
||||||
|
* PolicyAlpha1ConsoleApi - axios parameter creator
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const PolicyAlpha1ConsoleApiAxiosParamCreator = function (configuration?: Configuration) {
|
||||||
|
return {
|
||||||
|
/**
|
||||||
|
* Get policy config by group
|
||||||
|
* @param {string} name Name of the policy
|
||||||
|
* @param {string} group Name of the group
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
*/
|
||||||
|
getPolicyConfigByGroup: async (name: string, group: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||||
|
// verify required parameter 'name' is not null or undefined
|
||||||
|
assertParamExists('getPolicyConfigByGroup', 'name', name)
|
||||||
|
// verify required parameter 'group' is not null or undefined
|
||||||
|
assertParamExists('getPolicyConfigByGroup', 'group', group)
|
||||||
|
const localVarPath = `/apis/console.api.storage.halo.run/v1alpha1/policies/{name}/configs/{group}`
|
||||||
|
.replace(`{${"name"}}`, encodeURIComponent(String(name)))
|
||||||
|
.replace(`{${"group"}}`, encodeURIComponent(String(group)));
|
||||||
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||||
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||||
|
let baseOptions;
|
||||||
|
if (configuration) {
|
||||||
|
baseOptions = configuration.baseOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
|
||||||
|
const localVarHeaderParameter = {} as any;
|
||||||
|
const localVarQueryParameter = {} as any;
|
||||||
|
|
||||||
|
// authentication basicAuth required
|
||||||
|
// http basic authentication required
|
||||||
|
setBasicAuthToObject(localVarRequestOptions, configuration)
|
||||||
|
|
||||||
|
// authentication bearerAuth required
|
||||||
|
// http bearer authentication required
|
||||||
|
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
||||||
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||||
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||||
|
|
||||||
|
return {
|
||||||
|
url: toPathString(localVarUrlObj),
|
||||||
|
options: localVarRequestOptions,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Update policy config by group
|
||||||
|
* @param {string} name Name of the policy
|
||||||
|
* @param {string} group Name of the group
|
||||||
|
* @param {object} body
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
*/
|
||||||
|
updatePolicyConfigByGroup: async (name: string, group: string, body: object, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||||
|
// verify required parameter 'name' is not null or undefined
|
||||||
|
assertParamExists('updatePolicyConfigByGroup', 'name', name)
|
||||||
|
// verify required parameter 'group' is not null or undefined
|
||||||
|
assertParamExists('updatePolicyConfigByGroup', 'group', group)
|
||||||
|
// verify required parameter 'body' is not null or undefined
|
||||||
|
assertParamExists('updatePolicyConfigByGroup', 'body', body)
|
||||||
|
const localVarPath = `/apis/console.api.storage.halo.run/v1alpha1/policies/{name}/configs/{group}`
|
||||||
|
.replace(`{${"name"}}`, encodeURIComponent(String(name)))
|
||||||
|
.replace(`{${"group"}}`, encodeURIComponent(String(group)));
|
||||||
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||||
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||||
|
let baseOptions;
|
||||||
|
if (configuration) {
|
||||||
|
baseOptions = configuration.baseOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options};
|
||||||
|
const localVarHeaderParameter = {} as any;
|
||||||
|
const localVarQueryParameter = {} as any;
|
||||||
|
|
||||||
|
// authentication basicAuth required
|
||||||
|
// http basic authentication required
|
||||||
|
setBasicAuthToObject(localVarRequestOptions, configuration)
|
||||||
|
|
||||||
|
// authentication bearerAuth required
|
||||||
|
// http bearer authentication required
|
||||||
|
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
localVarHeaderParameter['Content-Type'] = 'application/json';
|
||||||
|
|
||||||
|
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
||||||
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||||
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||||
|
localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration)
|
||||||
|
|
||||||
|
return {
|
||||||
|
url: toPathString(localVarUrlObj),
|
||||||
|
options: localVarRequestOptions,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PolicyAlpha1ConsoleApi - functional programming interface
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const PolicyAlpha1ConsoleApiFp = function(configuration?: Configuration) {
|
||||||
|
const localVarAxiosParamCreator = PolicyAlpha1ConsoleApiAxiosParamCreator(configuration)
|
||||||
|
return {
|
||||||
|
/**
|
||||||
|
* Get policy config by group
|
||||||
|
* @param {string} name Name of the policy
|
||||||
|
* @param {string} group Name of the group
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
*/
|
||||||
|
async getPolicyConfigByGroup(name: string, group: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<object>> {
|
||||||
|
const localVarAxiosArgs = await localVarAxiosParamCreator.getPolicyConfigByGroup(name, group, options);
|
||||||
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
||||||
|
const localVarOperationServerBasePath = operationServerMap['PolicyAlpha1ConsoleApi.getPolicyConfigByGroup']?.[localVarOperationServerIndex]?.url;
|
||||||
|
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Update policy config by group
|
||||||
|
* @param {string} name Name of the policy
|
||||||
|
* @param {string} group Name of the group
|
||||||
|
* @param {object} body
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
*/
|
||||||
|
async updatePolicyConfigByGroup(name: string, group: string, body: object, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
||||||
|
const localVarAxiosArgs = await localVarAxiosParamCreator.updatePolicyConfigByGroup(name, group, body, options);
|
||||||
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
||||||
|
const localVarOperationServerBasePath = operationServerMap['PolicyAlpha1ConsoleApi.updatePolicyConfigByGroup']?.[localVarOperationServerIndex]?.url;
|
||||||
|
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PolicyAlpha1ConsoleApi - factory interface
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export const PolicyAlpha1ConsoleApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
|
||||||
|
const localVarFp = PolicyAlpha1ConsoleApiFp(configuration)
|
||||||
|
return {
|
||||||
|
/**
|
||||||
|
* Get policy config by group
|
||||||
|
* @param {PolicyAlpha1ConsoleApiGetPolicyConfigByGroupRequest} requestParameters Request parameters.
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
*/
|
||||||
|
getPolicyConfigByGroup(requestParameters: PolicyAlpha1ConsoleApiGetPolicyConfigByGroupRequest, options?: RawAxiosRequestConfig): AxiosPromise<object> {
|
||||||
|
return localVarFp.getPolicyConfigByGroup(requestParameters.name, requestParameters.group, options).then((request) => request(axios, basePath));
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Update policy config by group
|
||||||
|
* @param {PolicyAlpha1ConsoleApiUpdatePolicyConfigByGroupRequest} requestParameters Request parameters.
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
*/
|
||||||
|
updatePolicyConfigByGroup(requestParameters: PolicyAlpha1ConsoleApiUpdatePolicyConfigByGroupRequest, options?: RawAxiosRequestConfig): AxiosPromise<void> {
|
||||||
|
return localVarFp.updatePolicyConfigByGroup(requestParameters.name, requestParameters.group, requestParameters.body, options).then((request) => request(axios, basePath));
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request parameters for getPolicyConfigByGroup operation in PolicyAlpha1ConsoleApi.
|
||||||
|
* @export
|
||||||
|
* @interface PolicyAlpha1ConsoleApiGetPolicyConfigByGroupRequest
|
||||||
|
*/
|
||||||
|
export interface PolicyAlpha1ConsoleApiGetPolicyConfigByGroupRequest {
|
||||||
|
/**
|
||||||
|
* Name of the policy
|
||||||
|
* @type {string}
|
||||||
|
* @memberof PolicyAlpha1ConsoleApiGetPolicyConfigByGroup
|
||||||
|
*/
|
||||||
|
readonly name: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name of the group
|
||||||
|
* @type {string}
|
||||||
|
* @memberof PolicyAlpha1ConsoleApiGetPolicyConfigByGroup
|
||||||
|
*/
|
||||||
|
readonly group: string
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request parameters for updatePolicyConfigByGroup operation in PolicyAlpha1ConsoleApi.
|
||||||
|
* @export
|
||||||
|
* @interface PolicyAlpha1ConsoleApiUpdatePolicyConfigByGroupRequest
|
||||||
|
*/
|
||||||
|
export interface PolicyAlpha1ConsoleApiUpdatePolicyConfigByGroupRequest {
|
||||||
|
/**
|
||||||
|
* Name of the policy
|
||||||
|
* @type {string}
|
||||||
|
* @memberof PolicyAlpha1ConsoleApiUpdatePolicyConfigByGroup
|
||||||
|
*/
|
||||||
|
readonly name: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name of the group
|
||||||
|
* @type {string}
|
||||||
|
* @memberof PolicyAlpha1ConsoleApiUpdatePolicyConfigByGroup
|
||||||
|
*/
|
||||||
|
readonly group: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @type {object}
|
||||||
|
* @memberof PolicyAlpha1ConsoleApiUpdatePolicyConfigByGroup
|
||||||
|
*/
|
||||||
|
readonly body: object
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PolicyAlpha1ConsoleApi - object-oriented interface
|
||||||
|
* @export
|
||||||
|
* @class PolicyAlpha1ConsoleApi
|
||||||
|
* @extends {BaseAPI}
|
||||||
|
*/
|
||||||
|
export class PolicyAlpha1ConsoleApi extends BaseAPI {
|
||||||
|
/**
|
||||||
|
* Get policy config by group
|
||||||
|
* @param {PolicyAlpha1ConsoleApiGetPolicyConfigByGroupRequest} requestParameters Request parameters.
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @memberof PolicyAlpha1ConsoleApi
|
||||||
|
*/
|
||||||
|
public getPolicyConfigByGroup(requestParameters: PolicyAlpha1ConsoleApiGetPolicyConfigByGroupRequest, options?: RawAxiosRequestConfig) {
|
||||||
|
return PolicyAlpha1ConsoleApiFp(this.configuration).getPolicyConfigByGroup(requestParameters.name, requestParameters.group, options).then((request) => request(this.axios, this.basePath));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update policy config by group
|
||||||
|
* @param {PolicyAlpha1ConsoleApiUpdatePolicyConfigByGroupRequest} requestParameters Request parameters.
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @memberof PolicyAlpha1ConsoleApi
|
||||||
|
*/
|
||||||
|
public updatePolicyConfigByGroup(requestParameters: PolicyAlpha1ConsoleApiUpdatePolicyConfigByGroupRequest, options?: RawAxiosRequestConfig) {
|
||||||
|
return PolicyAlpha1ConsoleApiFp(this.configuration).updatePolicyConfigByGroup(requestParameters.name, requestParameters.group, requestParameters.body, options).then((request) => request(this.axios, this.basePath));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue