272 lines
7.3 KiB
Java
272 lines
7.3 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 com.muse.dto.ToolGrantScopeResourceRefsInner;
|
||
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 批准后的工具可用范围,AI runtime 只能按该范围消费。
|
||
*/
|
||
|
||
@Schema(name = "ToolGrantScope", description = "Security facade 批准后的工具可用范围,AI runtime 只能按该范围消费。")
|
||
@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 ToolGrantScope implements Serializable {
|
||
|
||
private static final long serialVersionUID = 1L;
|
||
|
||
/**
|
||
* 授权范围类型
|
||
*/
|
||
public enum ScopeTypeEnum {
|
||
SYSTEM("system"),
|
||
|
||
WORK("work"),
|
||
|
||
CHAPTER("chapter"),
|
||
|
||
KNOWLEDGE_BASE("knowledge_base"),
|
||
|
||
MARKET_ASSET("market_asset"),
|
||
|
||
EXTERNAL_ENDPOINT("external_endpoint");
|
||
|
||
private final String value;
|
||
|
||
ScopeTypeEnum(String value) {
|
||
this.value = value;
|
||
}
|
||
|
||
@JsonValue
|
||
public String getValue() {
|
||
return value;
|
||
}
|
||
|
||
@Override
|
||
public String toString() {
|
||
return String.valueOf(value);
|
||
}
|
||
|
||
@JsonCreator
|
||
public static ScopeTypeEnum fromValue(String value) {
|
||
for (ScopeTypeEnum b : ScopeTypeEnum.values()) {
|
||
if (b.value.equals(value)) {
|
||
return b;
|
||
}
|
||
}
|
||
throw new IllegalArgumentException("Unexpected value '" + value + "'");
|
||
}
|
||
}
|
||
|
||
private ScopeTypeEnum scopeType;
|
||
|
||
/**
|
||
* 范围 owner 类型
|
||
*/
|
||
public enum OwnerTypeEnum {
|
||
SYSTEM("system"),
|
||
|
||
USER("user"),
|
||
|
||
WORK("work"),
|
||
|
||
KNOWLEDGE("knowledge"),
|
||
|
||
MARKET("market");
|
||
|
||
private final String value;
|
||
|
||
OwnerTypeEnum(String value) {
|
||
this.value = value;
|
||
}
|
||
|
||
@JsonValue
|
||
public String getValue() {
|
||
return value;
|
||
}
|
||
|
||
@Override
|
||
public String toString() {
|
||
return String.valueOf(value);
|
||
}
|
||
|
||
@JsonCreator
|
||
public static OwnerTypeEnum fromValue(String value) {
|
||
for (OwnerTypeEnum b : OwnerTypeEnum.values()) {
|
||
if (b.value.equals(value)) {
|
||
return b;
|
||
}
|
||
}
|
||
throw new IllegalArgumentException("Unexpected value '" + value + "'");
|
||
}
|
||
}
|
||
|
||
private OwnerTypeEnum ownerType;
|
||
|
||
@Valid
|
||
private List<@Valid ToolGrantScopeResourceRefsInner> resourceRefs = new ArrayList<>();
|
||
|
||
private Boolean crossWorkAllowed = false;
|
||
|
||
public ToolGrantScope() {
|
||
super();
|
||
}
|
||
|
||
/**
|
||
* Constructor with only required parameters
|
||
*/
|
||
public ToolGrantScope(ScopeTypeEnum scopeType, OwnerTypeEnum ownerType, List<@Valid ToolGrantScopeResourceRefsInner> resourceRefs) {
|
||
this.scopeType = scopeType;
|
||
this.ownerType = ownerType;
|
||
this.resourceRefs = resourceRefs;
|
||
}
|
||
|
||
public ToolGrantScope scopeType(ScopeTypeEnum scopeType) {
|
||
this.scopeType = scopeType;
|
||
return this;
|
||
}
|
||
|
||
/**
|
||
* 授权范围类型
|
||
* @return scopeType
|
||
*/
|
||
@NotNull
|
||
@Schema(name = "scopeType", description = "授权范围类型", requiredMode = Schema.RequiredMode.REQUIRED)
|
||
@JsonProperty("scopeType")
|
||
public ScopeTypeEnum getScopeType() {
|
||
return scopeType;
|
||
}
|
||
|
||
@JsonProperty("scopeType")
|
||
public void setScopeType(ScopeTypeEnum scopeType) {
|
||
this.scopeType = scopeType;
|
||
}
|
||
|
||
public ToolGrantScope ownerType(OwnerTypeEnum ownerType) {
|
||
this.ownerType = ownerType;
|
||
return this;
|
||
}
|
||
|
||
/**
|
||
* 范围 owner 类型
|
||
* @return ownerType
|
||
*/
|
||
@NotNull
|
||
@Schema(name = "ownerType", description = "范围 owner 类型", requiredMode = Schema.RequiredMode.REQUIRED)
|
||
@JsonProperty("ownerType")
|
||
public OwnerTypeEnum getOwnerType() {
|
||
return ownerType;
|
||
}
|
||
|
||
@JsonProperty("ownerType")
|
||
public void setOwnerType(OwnerTypeEnum ownerType) {
|
||
this.ownerType = ownerType;
|
||
}
|
||
|
||
public ToolGrantScope resourceRefs(List<@Valid ToolGrantScopeResourceRefsInner> resourceRefs) {
|
||
this.resourceRefs = resourceRefs;
|
||
return this;
|
||
}
|
||
|
||
public ToolGrantScope addResourceRefsItem(ToolGrantScopeResourceRefsInner resourceRefsItem) {
|
||
if (this.resourceRefs == null) {
|
||
this.resourceRefs = new ArrayList<>();
|
||
}
|
||
this.resourceRefs.add(resourceRefsItem);
|
||
return this;
|
||
}
|
||
|
||
/**
|
||
* 可访问资源引用;跨作品资源必须由 Security facade 单独批准。
|
||
* @return resourceRefs
|
||
*/
|
||
@NotNull @Valid @Size(min = 1)
|
||
@Schema(name = "resourceRefs", description = "可访问资源引用;跨作品资源必须由 Security facade 单独批准。", requiredMode = Schema.RequiredMode.REQUIRED)
|
||
@JsonProperty("resourceRefs")
|
||
public List<@Valid ToolGrantScopeResourceRefsInner> getResourceRefs() {
|
||
return resourceRefs;
|
||
}
|
||
|
||
@JsonProperty("resourceRefs")
|
||
public void setResourceRefs(List<@Valid ToolGrantScopeResourceRefsInner> resourceRefs) {
|
||
this.resourceRefs = resourceRefs;
|
||
}
|
||
|
||
public ToolGrantScope crossWorkAllowed(Boolean crossWorkAllowed) {
|
||
this.crossWorkAllowed = crossWorkAllowed;
|
||
return this;
|
||
}
|
||
|
||
/**
|
||
* 是否允许跨作品访问;只能由 Security facade 审批结果置为 true。
|
||
* @return crossWorkAllowed
|
||
*/
|
||
|
||
@Schema(name = "crossWorkAllowed", description = "是否允许跨作品访问;只能由 Security facade 审批结果置为 true。", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||
@JsonProperty("crossWorkAllowed")
|
||
public Boolean getCrossWorkAllowed() {
|
||
return crossWorkAllowed;
|
||
}
|
||
|
||
@JsonProperty("crossWorkAllowed")
|
||
public void setCrossWorkAllowed(Boolean crossWorkAllowed) {
|
||
this.crossWorkAllowed = crossWorkAllowed;
|
||
}
|
||
|
||
@Override
|
||
public boolean equals(Object o) {
|
||
if (this == o) {
|
||
return true;
|
||
}
|
||
if (o == null || getClass() != o.getClass()) {
|
||
return false;
|
||
}
|
||
ToolGrantScope toolGrantScope = (ToolGrantScope) o;
|
||
return Objects.equals(this.scopeType, toolGrantScope.scopeType) &&
|
||
Objects.equals(this.ownerType, toolGrantScope.ownerType) &&
|
||
Objects.equals(this.resourceRefs, toolGrantScope.resourceRefs) &&
|
||
Objects.equals(this.crossWorkAllowed, toolGrantScope.crossWorkAllowed);
|
||
}
|
||
|
||
@Override
|
||
public int hashCode() {
|
||
return Objects.hash(scopeType, ownerType, resourceRefs, crossWorkAllowed);
|
||
}
|
||
|
||
@Override
|
||
public String toString() {
|
||
StringBuilder sb = new StringBuilder();
|
||
sb.append("class ToolGrantScope {\n");
|
||
sb.append(" scopeType: ").append(toIndentedString(scopeType)).append("\n");
|
||
sb.append(" ownerType: ").append(toIndentedString(ownerType)).append("\n");
|
||
sb.append(" resourceRefs: ").append(toIndentedString(resourceRefs)).append("\n");
|
||
sb.append(" crossWorkAllowed: ").append(toIndentedString(crossWorkAllowed)).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 ");
|
||
}
|
||
}
|
||
|