All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.huaweicloud.sdk.functiongraph.v2.model.UpdateFunctionCodeRequestBody 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.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Consumer;

/** UpdateFunctionCodeRequestBody */
public class UpdateFunctionCodeRequestBody {

    /** 函数代码类型,取值有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 = "func_code")

    private FuncCode funcCode;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "depend_list")

    private List dependList = null;

    public UpdateFunctionCodeRequestBody 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 UpdateFunctionCodeRequestBody 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 UpdateFunctionCodeRequestBody 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 UpdateFunctionCodeRequestBody withFuncCode(FuncCode funcCode) {
        this.funcCode = funcCode;
        return this;
    }

    public UpdateFunctionCodeRequestBody 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 UpdateFunctionCodeRequestBody withDependList(List dependList) {
        this.dependList = dependList;
        return this;
    }

    public UpdateFunctionCodeRequestBody addDependListItem(String dependListItem) {
        if (this.dependList == null) {
            this.dependList = new ArrayList<>();
        }
        this.dependList.add(dependListItem);
        return this;
    }

    public UpdateFunctionCodeRequestBody withDependList(Consumer> dependListSetter) {
        if (this.dependList == null) {
            this.dependList = new ArrayList<>();
        }
        dependListSetter.accept(this.dependList);
        return this;
    }

    /** 依赖id列表
     * 
     * @return dependList */
    public List getDependList() {
        return dependList;
    }

    public void setDependList(List dependList) {
        this.dependList = dependList;
    }

    @Override
    public boolean equals(java.lang.Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        UpdateFunctionCodeRequestBody updateFunctionCodeRequestBody = (UpdateFunctionCodeRequestBody) o;
        return Objects.equals(this.codeType, updateFunctionCodeRequestBody.codeType)
            && Objects.equals(this.codeUrl, updateFunctionCodeRequestBody.codeUrl)
            && Objects.equals(this.codeFilename, updateFunctionCodeRequestBody.codeFilename)
            && Objects.equals(this.funcCode, updateFunctionCodeRequestBody.funcCode)
            && Objects.equals(this.dependList, updateFunctionCodeRequestBody.dependList);
    }

    @Override
    public int hashCode() {
        return Objects.hash(codeType, codeUrl, codeFilename, funcCode, dependList);
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("class UpdateFunctionCodeRequestBody {\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("    funcCode: ").append(toIndentedString(funcCode)).append("\n");
        sb.append("    dependList: ").append(toIndentedString(dependList)).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