
com.huaweicloud.sdk.functiongraph.v2.model.CreateFunctionRequestBody Maven / Gradle / Ivy
package com.huaweicloud.sdk.functiongraph.v2.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.function.Consumer;
/** 函数属性结构体。 */
public class CreateFunctionRequestBody {
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "func_name")
private String funcName;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "package")
private String _package;
/** FunctionGraph函数的执行环境 支持Node.js6.10、Python2.7、Python3.6、Java8、Go1.8、Node.js 8.10、C#.NET Core 2.0、C#.NET Core
* 2.1、PHP7.3。 Python2.7: Python语言2.7版本。 Python3.6: Pyton语言3.6版本。 Go1.8: Go语言1.8版本。 Go1.x: Go语言1.x版本。 Java8:
* Java语言8版本。 Node.js6.10: Nodejs语言6.10版本。 Node.js8.10: Nodejs语言8.10版本。 Node.js10.16: Nodejs语言10.16版本。 Node.js12.13:
* Nodejs语言12.13版本。 C#(.NET Core 2.0): C#语言2.0版本。 C#(.NET Core 2.1): C#语言2.1版本。 C#(.NET Core 3.1): C#语言3.1版本。
* Custom: 自定义运行时。 PHP7.3: Php语言7.3版本。 Java11、Nodejs14.18、Python3.9在type为v2时支持 */
public static final class RuntimeEnum {
/** Enum JAVA8 for value: "Java8" */
public static final RuntimeEnum JAVA8 = new RuntimeEnum("Java8");
/** Enum JAVA11 for value: "Java11" */
public static final RuntimeEnum JAVA11 = new RuntimeEnum("Java11");
/** Enum NODE_JS6_10 for value: "Node.js6.10" */
public static final RuntimeEnum NODE_JS6_10 = new RuntimeEnum("Node.js6.10");
/** Enum NODE_JS8_10 for value: "Node.js8.10" */
public static final RuntimeEnum NODE_JS8_10 = new RuntimeEnum("Node.js8.10");
/** Enum NODE_JS10_16 for value: "Node.js10.16" */
public static final RuntimeEnum NODE_JS10_16 = new RuntimeEnum("Node.js10.16");
/** Enum NODE_JS12_13 for value: "Node.js12.13" */
public static final RuntimeEnum NODE_JS12_13 = new RuntimeEnum("Node.js12.13");
/** Enum NODE_JS14_18 for value: "Node.js14.18" */
public static final RuntimeEnum NODE_JS14_18 = new RuntimeEnum("Node.js14.18");
/** Enum PYTHON2_7 for value: "Python2.7" */
public static final RuntimeEnum PYTHON2_7 = new RuntimeEnum("Python2.7");
/** Enum PYTHON3_6 for value: "Python3.6" */
public static final RuntimeEnum PYTHON3_6 = new RuntimeEnum("Python3.6");
/** Enum PYTHON3_9 for value: "Python3.9" */
public static final RuntimeEnum PYTHON3_9 = new RuntimeEnum("Python3.9");
/** Enum GO1_8 for value: "Go1.8" */
public static final RuntimeEnum GO1_8 = new RuntimeEnum("Go1.8");
/** Enum GO1_X for value: "Go1.x" */
public static final RuntimeEnum GO1_X = new RuntimeEnum("Go1.x");
/** Enum C_NET_CORE_2_0_ for value: "C#(.NET Core 2.0)" */
public static final RuntimeEnum C_NET_CORE_2_0_ = new RuntimeEnum("C#(.NET Core 2.0)");
/** Enum C_NET_CORE_2_1_ for value: "C#(.NET Core 2.1)" */
public static final RuntimeEnum C_NET_CORE_2_1_ = new RuntimeEnum("C#(.NET Core 2.1)");
/** Enum C_NET_CORE_3_1_ for value: "C#(.NET Core 3.1)" */
public static final RuntimeEnum C_NET_CORE_3_1_ = new RuntimeEnum("C#(.NET Core 3.1)");
/** Enum PHP7_3 for value: "PHP7.3" */
public static final RuntimeEnum PHP7_3 = new RuntimeEnum("PHP7.3");
private static final Map STATIC_FIELDS = createStaticFields();
private static Map createStaticFields() {
Map map = new HashMap<>();
map.put("Java8", JAVA8);
map.put("Java11", JAVA11);
map.put("Node.js6.10", NODE_JS6_10);
map.put("Node.js8.10", NODE_JS8_10);
map.put("Node.js10.16", NODE_JS10_16);
map.put("Node.js12.13", NODE_JS12_13);
map.put("Node.js14.18", NODE_JS14_18);
map.put("Python2.7", PYTHON2_7);
map.put("Python3.6", PYTHON3_6);
map.put("Python3.9", PYTHON3_9);
map.put("Go1.8", GO1_8);
map.put("Go1.x", GO1_X);
map.put("C#(.NET Core 2.0)", C_NET_CORE_2_0_);
map.put("C#(.NET Core 2.1)", C_NET_CORE_2_1_);
map.put("C#(.NET Core 3.1)", C_NET_CORE_3_1_);
map.put("PHP7.3", PHP7_3);
return Collections.unmodifiableMap(map);
}
private String value;
RuntimeEnum(String value) {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static RuntimeEnum fromValue(String value) {
if (value == null) {
return null;
}
RuntimeEnum result = STATIC_FIELDS.get(value);
if (result == null) {
result = new RuntimeEnum(value);
}
return result;
}
public static RuntimeEnum valueOf(String value) {
if (value == null) {
return null;
}
RuntimeEnum result = STATIC_FIELDS.get(value);
if (result != null) {
return result;
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
@Override
public boolean equals(Object obj) {
if (obj instanceof RuntimeEnum) {
return this.value.equals(((RuntimeEnum) obj).value);
}
return false;
}
@Override
public int hashCode() {
return this.value.hashCode();
}
}
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "runtime")
private RuntimeEnum runtime;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "timeout")
private Integer timeout;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "handler")
private String handler;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "memory_size")
private Integer memorySize;
/** 函数代码类型,取值有4种。 inline: UI在线编辑代码。 zip: 函数代码为zip包。 obs: 函数代码来源于obs存储。 jar: 函数代码为jar包,主要针对Java函数。 */
public static final class CodeTypeEnum {
/** Enum INLINE for value: "inline" */
public static final CodeTypeEnum INLINE = new CodeTypeEnum("inline");
/** Enum ZIP for value: "zip" */
public static final CodeTypeEnum ZIP = new CodeTypeEnum("zip");
/** Enum OBS for value: "obs" */
public static final CodeTypeEnum OBS = new CodeTypeEnum("obs");
/** Enum JAR for value: "jar" */
public static final CodeTypeEnum JAR = new CodeTypeEnum("jar");
private static final Map STATIC_FIELDS = createStaticFields();
private static Map createStaticFields() {
Map map = new HashMap<>();
map.put("inline", INLINE);
map.put("zip", ZIP);
map.put("obs", OBS);
map.put("jar", JAR);
return Collections.unmodifiableMap(map);
}
private String value;
CodeTypeEnum(String value) {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static CodeTypeEnum fromValue(String value) {
if (value == null) {
return null;
}
CodeTypeEnum result = STATIC_FIELDS.get(value);
if (result == null) {
result = new CodeTypeEnum(value);
}
return result;
}
public static CodeTypeEnum valueOf(String value) {
if (value == null) {
return null;
}
CodeTypeEnum result = STATIC_FIELDS.get(value);
if (result != null) {
return result;
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
@Override
public boolean equals(Object obj) {
if (obj instanceof CodeTypeEnum) {
return this.value.equals(((CodeTypeEnum) obj).value);
}
return false;
}
@Override
public int hashCode() {
return this.value.hashCode();
}
}
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "code_type")
private CodeTypeEnum codeType;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "code_url")
private String codeUrl;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "code_filename")
private String codeFilename;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "user_data")
private String userData;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "xrole")
private String xrole;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "app_xrole")
private String appXrole;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "description")
private String description;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "func_code")
private FuncCode funcCode;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "initializer_handler")
private String initializerHandler;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "initializer_timeout")
private Integer initializerTimeout;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "enterprise_project_id")
private String enterpriseProjectId;
/** 函数版本。 */
public static final class TypeEnum {
/** Enum V1 for value: "v1" */
public static final TypeEnum V1 = new TypeEnum("v1");
/** Enum V2 for value: "v2" */
public static final TypeEnum V2 = new TypeEnum("v2");
private static final Map STATIC_FIELDS = createStaticFields();
private static Map createStaticFields() {
Map map = new HashMap<>();
map.put("v1", V1);
map.put("v2", V2);
return Collections.unmodifiableMap(map);
}
private String value;
TypeEnum(String value) {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static TypeEnum fromValue(String value) {
if (value == null) {
return null;
}
TypeEnum result = STATIC_FIELDS.get(value);
if (result == null) {
result = new TypeEnum(value);
}
return result;
}
public static TypeEnum valueOf(String value) {
if (value == null) {
return null;
}
TypeEnum result = STATIC_FIELDS.get(value);
if (result != null) {
return result;
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
@Override
public boolean equals(Object obj) {
if (obj instanceof TypeEnum) {
return this.value.equals(((TypeEnum) obj).value);
}
return false;
}
@Override
public int hashCode() {
return this.value.hashCode();
}
}
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "type")
private TypeEnum type;
public CreateFunctionRequestBody withFuncName(String funcName) {
this.funcName = funcName;
return this;
}
/** 函数名称。
*
* @return funcName */
public String getFuncName() {
return funcName;
}
public void setFuncName(String funcName) {
this.funcName = funcName;
}
public CreateFunctionRequestBody withPackage(String _package) {
this._package = _package;
return this;
}
/** 函数所属的分组Package,用于用户针对函数的自定义分组。
*
* @return _package */
public String getPackage() {
return _package;
}
public void setPackage(String _package) {
this._package = _package;
}
public CreateFunctionRequestBody withRuntime(RuntimeEnum runtime) {
this.runtime = runtime;
return this;
}
/** FunctionGraph函数的执行环境 支持Node.js6.10、Python2.7、Python3.6、Java8、Go1.8、Node.js 8.10、C#.NET Core 2.0、C#.NET Core
* 2.1、PHP7.3。 Python2.7: Python语言2.7版本。 Python3.6: Pyton语言3.6版本。 Go1.8: Go语言1.8版本。 Go1.x: Go语言1.x版本。 Java8:
* Java语言8版本。 Node.js6.10: Nodejs语言6.10版本。 Node.js8.10: Nodejs语言8.10版本。 Node.js10.16: Nodejs语言10.16版本。 Node.js12.13:
* Nodejs语言12.13版本。 C#(.NET Core 2.0): C#语言2.0版本。 C#(.NET Core 2.1): C#语言2.1版本。 C#(.NET Core 3.1): C#语言3.1版本。
* Custom: 自定义运行时。 PHP7.3: Php语言7.3版本。 Java11、Nodejs14.18、Python3.9在type为v2时支持
*
* @return runtime */
public RuntimeEnum getRuntime() {
return runtime;
}
public void setRuntime(RuntimeEnum runtime) {
this.runtime = runtime;
}
public CreateFunctionRequestBody withTimeout(Integer timeout) {
this.timeout = timeout;
return this;
}
/** 函数执行超时时间,超时函数将被强行停止,范围3~900秒
*
* @return timeout */
public Integer getTimeout() {
return timeout;
}
public void setTimeout(Integer timeout) {
this.timeout = timeout;
}
public CreateFunctionRequestBody withHandler(String handler) {
this.handler = handler;
return this;
}
/** 函数执行入口 规则:xx.xx,必须包含“. ” 举例:对于node.js函数:myfunction.handler,则表示函数的文件名为myfunction.js,执行的入口函数名为handler。
*
* @return handler */
public String getHandler() {
return handler;
}
public void setHandler(String handler) {
this.handler = handler;
}
public CreateFunctionRequestBody withMemorySize(Integer memorySize) {
this.memorySize = memorySize;
return this;
}
/** 函数消耗的内存。 单位M。 取值范围为:128、256、512、768、1024、1280、1536、1792、2048、2560、3072、3584、4096。 最小值为128,最大值为4096。
*
* @return memorySize */
public Integer getMemorySize() {
return memorySize;
}
public void setMemorySize(Integer memorySize) {
this.memorySize = memorySize;
}
public CreateFunctionRequestBody withCodeType(CodeTypeEnum codeType) {
this.codeType = codeType;
return this;
}
/** 函数代码类型,取值有4种。 inline: UI在线编辑代码。 zip: 函数代码为zip包。 obs: 函数代码来源于obs存储。 jar: 函数代码为jar包,主要针对Java函数。
*
* @return codeType */
public CodeTypeEnum getCodeType() {
return codeType;
}
public void setCodeType(CodeTypeEnum codeType) {
this.codeType = codeType;
}
public CreateFunctionRequestBody withCodeUrl(String codeUrl) {
this.codeUrl = codeUrl;
return this;
}
/** 当CodeType为obs时,该值为函数代码包在OBS上的地址,CodeType为其他值时,该字段为空。
*
* @return codeUrl */
public String getCodeUrl() {
return codeUrl;
}
public void setCodeUrl(String codeUrl) {
this.codeUrl = codeUrl;
}
public CreateFunctionRequestBody withCodeFilename(String codeFilename) {
this.codeFilename = codeFilename;
return this;
}
/** 函数的文件名,当CodeType为jar/zip时必须提供该字段,inline和obs不需要提供。
*
* @return codeFilename */
public String getCodeFilename() {
return codeFilename;
}
public void setCodeFilename(String codeFilename) {
this.codeFilename = codeFilename;
}
public CreateFunctionRequestBody withUserData(String userData) {
this.userData = userData;
return this;
}
/** 用户自定义的name/value信息。 在函数中使用的参数。 举例:如函数要访问某个主机,可以设置自定义参数:Host={host_ip},最多定义20个,总长度不超过4KB。
*
* @return userData */
public String getUserData() {
return userData;
}
public void setUserData(String userData) {
this.userData = userData;
}
public CreateFunctionRequestBody withXrole(String xrole) {
this.xrole = xrole;
return this;
}
/** 函数使用的权限委托名称,需要IAM支持,并在IAM界面创建委托,当函数需要访问其他服务时,必须提供该字段。
*
* @return xrole */
public String getXrole() {
return xrole;
}
public void setXrole(String xrole) {
this.xrole = xrole;
}
public CreateFunctionRequestBody withAppXrole(String appXrole) {
this.appXrole = appXrole;
return this;
}
/** 函数app使用的权限委托名称,需要IAM支持,并在IAM界面创建委托,当函数需要访问其他服务时,必须提供该字段。
*
* @return appXrole */
public String getAppXrole() {
return appXrole;
}
public void setAppXrole(String appXrole) {
this.appXrole = appXrole;
}
public CreateFunctionRequestBody withDescription(String description) {
this.description = description;
return this;
}
/** 函数描述。
*
* @return description */
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public CreateFunctionRequestBody withFuncCode(FuncCode funcCode) {
this.funcCode = funcCode;
return this;
}
public CreateFunctionRequestBody withFuncCode(Consumer funcCodeSetter) {
if (this.funcCode == null) {
this.funcCode = new FuncCode();
funcCodeSetter.accept(this.funcCode);
}
return this;
}
/** Get funcCode
*
* @return funcCode */
public FuncCode getFuncCode() {
return funcCode;
}
public void setFuncCode(FuncCode funcCode) {
this.funcCode = funcCode;
}
public CreateFunctionRequestBody withInitializerHandler(String initializerHandler) {
this.initializerHandler = initializerHandler;
return this;
}
/** 函数初始化入口,规则:xx.xx,必须包含“. ”。 举例:对于node.js函数:myfunction.initializer,则表示函数的文件名为myfunction.js,初始化的入口函数名为initializer。
*
* @return initializerHandler */
public String getInitializerHandler() {
return initializerHandler;
}
public void setInitializerHandler(String initializerHandler) {
this.initializerHandler = initializerHandler;
}
public CreateFunctionRequestBody withInitializerTimeout(Integer initializerTimeout) {
this.initializerTimeout = initializerTimeout;
return this;
}
/** 初始化超时时间,超时函数将被强行停止,范围1~300秒。
*
* @return initializerTimeout */
public Integer getInitializerTimeout() {
return initializerTimeout;
}
public void setInitializerTimeout(Integer initializerTimeout) {
this.initializerTimeout = initializerTimeout;
}
public CreateFunctionRequestBody withEnterpriseProjectId(String enterpriseProjectId) {
this.enterpriseProjectId = enterpriseProjectId;
return this;
}
/** 企业项目ID,在企业用户创建函数时必填。
*
* @return enterpriseProjectId */
public String getEnterpriseProjectId() {
return enterpriseProjectId;
}
public void setEnterpriseProjectId(String enterpriseProjectId) {
this.enterpriseProjectId = enterpriseProjectId;
}
public CreateFunctionRequestBody withType(TypeEnum type) {
this.type = type;
return this;
}
/** 函数版本。
*
* @return type */
public TypeEnum getType() {
return type;
}
public void setType(TypeEnum type) {
this.type = type;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
CreateFunctionRequestBody createFunctionRequestBody = (CreateFunctionRequestBody) o;
return Objects.equals(this.funcName, createFunctionRequestBody.funcName)
&& Objects.equals(this._package, createFunctionRequestBody._package)
&& Objects.equals(this.runtime, createFunctionRequestBody.runtime)
&& Objects.equals(this.timeout, createFunctionRequestBody.timeout)
&& Objects.equals(this.handler, createFunctionRequestBody.handler)
&& Objects.equals(this.memorySize, createFunctionRequestBody.memorySize)
&& Objects.equals(this.codeType, createFunctionRequestBody.codeType)
&& Objects.equals(this.codeUrl, createFunctionRequestBody.codeUrl)
&& Objects.equals(this.codeFilename, createFunctionRequestBody.codeFilename)
&& Objects.equals(this.userData, createFunctionRequestBody.userData)
&& Objects.equals(this.xrole, createFunctionRequestBody.xrole)
&& Objects.equals(this.appXrole, createFunctionRequestBody.appXrole)
&& Objects.equals(this.description, createFunctionRequestBody.description)
&& Objects.equals(this.funcCode, createFunctionRequestBody.funcCode)
&& Objects.equals(this.initializerHandler, createFunctionRequestBody.initializerHandler)
&& Objects.equals(this.initializerTimeout, createFunctionRequestBody.initializerTimeout)
&& Objects.equals(this.enterpriseProjectId, createFunctionRequestBody.enterpriseProjectId)
&& Objects.equals(this.type, createFunctionRequestBody.type);
}
@Override
public int hashCode() {
return Objects.hash(funcName,
_package,
runtime,
timeout,
handler,
memorySize,
codeType,
codeUrl,
codeFilename,
userData,
xrole,
appXrole,
description,
funcCode,
initializerHandler,
initializerTimeout,
enterpriseProjectId,
type);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class CreateFunctionRequestBody {\n");
sb.append(" funcName: ").append(toIndentedString(funcName)).append("\n");
sb.append(" _package: ").append(toIndentedString(_package)).append("\n");
sb.append(" runtime: ").append(toIndentedString(runtime)).append("\n");
sb.append(" timeout: ").append(toIndentedString(timeout)).append("\n");
sb.append(" handler: ").append(toIndentedString(handler)).append("\n");
sb.append(" memorySize: ").append(toIndentedString(memorySize)).append("\n");
sb.append(" codeType: ").append(toIndentedString(codeType)).append("\n");
sb.append(" codeUrl: ").append(toIndentedString(codeUrl)).append("\n");
sb.append(" codeFilename: ").append(toIndentedString(codeFilename)).append("\n");
sb.append(" userData: ").append(toIndentedString(userData)).append("\n");
sb.append(" xrole: ").append(toIndentedString(xrole)).append("\n");
sb.append(" appXrole: ").append(toIndentedString(appXrole)).append("\n");
sb.append(" description: ").append(toIndentedString(description)).append("\n");
sb.append(" funcCode: ").append(toIndentedString(funcCode)).append("\n");
sb.append(" initializerHandler: ").append(toIndentedString(initializerHandler)).append("\n");
sb.append(" initializerTimeout: ").append(toIndentedString(initializerTimeout)).append("\n");
sb.append(" enterpriseProjectId: ").append(toIndentedString(enterpriseProjectId)).append("\n");
sb.append(" type: ").append(toIndentedString(type)).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(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy