2 * Copyright (c) 2023 PANTHEON.tech, s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.restconf.openapi.model;
10 import static java.util.Objects.requireNonNull;
11 import static javax.ws.rs.core.Response.Status.NO_CONTENT;
13 import com.fasterxml.jackson.core.JsonGenerator;
14 import java.io.IOException;
15 import java.util.List;
16 import javax.ws.rs.HttpMethod;
17 import org.eclipse.jdt.annotation.NonNull;
18 import org.eclipse.jdt.annotation.Nullable;
19 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
21 public final class DeleteEntity extends OperationEntity {
23 public DeleteEntity(final @NonNull SchemaNode schema, final @NonNull String deviceName,
24 final @NonNull String moduleName, final @NonNull List<ParameterEntity> parameters,
25 final @Nullable String refPath) {
26 super(requireNonNull(schema), deviceName, moduleName, requireNonNull(parameters), refPath);
30 protected @NonNull String operation() {
35 @NonNull String summary() {
36 return SUMMARY_TEMPLATE.formatted(HttpMethod.DELETE, deviceName(), moduleName(), nodeName());
40 void generateResponses(final @NonNull JsonGenerator generator) throws IOException {
41 generator.writeObjectFieldStart(RESPONSES);
42 generator.writeObjectFieldStart(String.valueOf(NO_CONTENT.getStatusCode()));
43 generator.writeStringField(DESCRIPTION, "Deleted");
44 generator.writeEndObject();
45 generator.writeEndObject();