236 lines
6.4 KiB
Java
236 lines
6.4 KiB
Java
package com.muse.dto;
|
||
|
||
import java.net.URI;
|
||
import java.util.Objects;
|
||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||
import com.fasterxml.jackson.annotation.JsonValue;
|
||
import java.util.ArrayList;
|
||
import java.util.Arrays;
|
||
import java.util.List;
|
||
import org.springframework.lang.Nullable;
|
||
import java.io.Serializable;
|
||
import java.time.OffsetDateTime;
|
||
import jakarta.validation.Valid;
|
||
import jakarta.validation.constraints.*;
|
||
import io.swagger.v3.oas.annotations.media.Schema;
|
||
|
||
|
||
import java.util.*;
|
||
import jakarta.annotation.Generated;
|
||
|
||
/**
|
||
* Security facade 批准后的外发策略。
|
||
*/
|
||
|
||
@Schema(name = "ToolGrantOutboundPolicy", description = "Security facade 批准后的外发策略。")
|
||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2026-05-24T16:47:40.290595+08:00[Asia/Shanghai]", comments = "Generator version: 7.22.0")
|
||
public class ToolGrantOutboundPolicy implements Serializable {
|
||
|
||
private static final long serialVersionUID = 1L;
|
||
|
||
/**
|
||
* 网络外发模式
|
||
*/
|
||
public enum NetworkModeEnum {
|
||
NONE("none"),
|
||
|
||
INTERNAL_ONLY("internal_only"),
|
||
|
||
ALLOWLIST("allowlist");
|
||
|
||
private final String value;
|
||
|
||
NetworkModeEnum(String value) {
|
||
this.value = value;
|
||
}
|
||
|
||
@JsonValue
|
||
public String getValue() {
|
||
return value;
|
||
}
|
||
|
||
@Override
|
||
public String toString() {
|
||
return String.valueOf(value);
|
||
}
|
||
|
||
@JsonCreator
|
||
public static NetworkModeEnum fromValue(String value) {
|
||
for (NetworkModeEnum b : NetworkModeEnum.values()) {
|
||
if (b.value.equals(value)) {
|
||
return b;
|
||
}
|
||
}
|
||
throw new IllegalArgumentException("Unexpected value '" + value + "'");
|
||
}
|
||
}
|
||
|
||
private NetworkModeEnum networkMode;
|
||
|
||
@Valid
|
||
private List<String> allowedDestinations = new ArrayList<>();
|
||
|
||
/**
|
||
* 用户内容外发策略
|
||
*/
|
||
public enum DataPolicyEnum {
|
||
NO_USER_CONTENT("no_user_content"),
|
||
|
||
REDACTED_USER_CONTENT("redacted_user_content"),
|
||
|
||
APPROVED_CONTEXT_ONLY("approved_context_only");
|
||
|
||
private final String value;
|
||
|
||
DataPolicyEnum(String value) {
|
||
this.value = value;
|
||
}
|
||
|
||
@JsonValue
|
||
public String getValue() {
|
||
return value;
|
||
}
|
||
|
||
@Override
|
||
public String toString() {
|
||
return String.valueOf(value);
|
||
}
|
||
|
||
@JsonCreator
|
||
public static DataPolicyEnum fromValue(String value) {
|
||
for (DataPolicyEnum b : DataPolicyEnum.values()) {
|
||
if (b.value.equals(value)) {
|
||
return b;
|
||
}
|
||
}
|
||
throw new IllegalArgumentException("Unexpected value '" + value + "'");
|
||
}
|
||
}
|
||
|
||
private DataPolicyEnum dataPolicy;
|
||
|
||
public ToolGrantOutboundPolicy() {
|
||
super();
|
||
}
|
||
|
||
/**
|
||
* Constructor with only required parameters
|
||
*/
|
||
public ToolGrantOutboundPolicy(NetworkModeEnum networkMode, List<String> allowedDestinations, DataPolicyEnum dataPolicy) {
|
||
this.networkMode = networkMode;
|
||
this.allowedDestinations = allowedDestinations;
|
||
this.dataPolicy = dataPolicy;
|
||
}
|
||
|
||
public ToolGrantOutboundPolicy networkMode(NetworkModeEnum networkMode) {
|
||
this.networkMode = networkMode;
|
||
return this;
|
||
}
|
||
|
||
/**
|
||
* 网络外发模式
|
||
* @return networkMode
|
||
*/
|
||
@NotNull
|
||
@Schema(name = "networkMode", description = "网络外发模式", requiredMode = Schema.RequiredMode.REQUIRED)
|
||
@JsonProperty("networkMode")
|
||
public NetworkModeEnum getNetworkMode() {
|
||
return networkMode;
|
||
}
|
||
|
||
@JsonProperty("networkMode")
|
||
public void setNetworkMode(NetworkModeEnum networkMode) {
|
||
this.networkMode = networkMode;
|
||
}
|
||
|
||
public ToolGrantOutboundPolicy allowedDestinations(List<String> allowedDestinations) {
|
||
this.allowedDestinations = allowedDestinations;
|
||
return this;
|
||
}
|
||
|
||
public ToolGrantOutboundPolicy addAllowedDestinationsItem(String allowedDestinationsItem) {
|
||
if (this.allowedDestinations == null) {
|
||
this.allowedDestinations = new ArrayList<>();
|
||
}
|
||
this.allowedDestinations.add(allowedDestinationsItem);
|
||
return this;
|
||
}
|
||
|
||
/**
|
||
* 允许访问的外部目的地 key 或域名;networkMode=allowlist 时必填非空。
|
||
* @return allowedDestinations
|
||
*/
|
||
@NotNull
|
||
@Schema(name = "allowedDestinations", description = "允许访问的外部目的地 key 或域名;networkMode=allowlist 时必填非空。", requiredMode = Schema.RequiredMode.REQUIRED)
|
||
@JsonProperty("allowedDestinations")
|
||
public List<String> getAllowedDestinations() {
|
||
return allowedDestinations;
|
||
}
|
||
|
||
@JsonProperty("allowedDestinations")
|
||
public void setAllowedDestinations(List<String> allowedDestinations) {
|
||
this.allowedDestinations = allowedDestinations;
|
||
}
|
||
|
||
public ToolGrantOutboundPolicy dataPolicy(DataPolicyEnum dataPolicy) {
|
||
this.dataPolicy = dataPolicy;
|
||
return this;
|
||
}
|
||
|
||
/**
|
||
* 用户内容外发策略
|
||
* @return dataPolicy
|
||
*/
|
||
@NotNull
|
||
@Schema(name = "dataPolicy", description = "用户内容外发策略", requiredMode = Schema.RequiredMode.REQUIRED)
|
||
@JsonProperty("dataPolicy")
|
||
public DataPolicyEnum getDataPolicy() {
|
||
return dataPolicy;
|
||
}
|
||
|
||
@JsonProperty("dataPolicy")
|
||
public void setDataPolicy(DataPolicyEnum dataPolicy) {
|
||
this.dataPolicy = dataPolicy;
|
||
}
|
||
|
||
@Override
|
||
public boolean equals(Object o) {
|
||
if (this == o) {
|
||
return true;
|
||
}
|
||
if (o == null || getClass() != o.getClass()) {
|
||
return false;
|
||
}
|
||
ToolGrantOutboundPolicy toolGrantOutboundPolicy = (ToolGrantOutboundPolicy) o;
|
||
return Objects.equals(this.networkMode, toolGrantOutboundPolicy.networkMode) &&
|
||
Objects.equals(this.allowedDestinations, toolGrantOutboundPolicy.allowedDestinations) &&
|
||
Objects.equals(this.dataPolicy, toolGrantOutboundPolicy.dataPolicy);
|
||
}
|
||
|
||
@Override
|
||
public int hashCode() {
|
||
return Objects.hash(networkMode, allowedDestinations, dataPolicy);
|
||
}
|
||
|
||
@Override
|
||
public String toString() {
|
||
StringBuilder sb = new StringBuilder();
|
||
sb.append("class ToolGrantOutboundPolicy {\n");
|
||
sb.append(" networkMode: ").append(toIndentedString(networkMode)).append("\n");
|
||
sb.append(" allowedDestinations: ").append(toIndentedString(allowedDestinations)).append("\n");
|
||
sb.append(" dataPolicy: ").append(toIndentedString(dataPolicy)).append("\n");
|
||
sb.append("}");
|
||
return sb.toString();
|
||
}
|
||
|
||
/**
|
||
* Convert the given object to string with each line indented by 4 spaces
|
||
* (except the first line).
|
||
*/
|
||
private String toIndentedString(@Nullable Object o) {
|
||
return o == null ? "null" : o.toString().replace("\n", "\n ");
|
||
}
|
||
}
|
||
|