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

com.okta.sdk.resource.model.PolicyRule Maven / Gradle / Ivy

Go to download

The Okta Java SDK API .jar provides a Java API that your code can use to make calls to the Okta API. This .jar is the only compile-time dependency within the Okta SDK project that your code should depend on. Implementations of this API (implementation .jars) should be runtime dependencies only.

There is a newer version: 21.0.0
Show newest version
package com.okta.sdk.resource.model;

import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import com.okta.sdk.resource.model.LifecycleStatus;
import com.okta.sdk.resource.model.PolicyLinks;
import com.okta.sdk.resource.model.PolicyRuleType;
import java.time.OffsetDateTime;
import org.openapitools.jackson.nullable.JsonNullable;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.openapitools.jackson.nullable.JsonNullable;
import java.util.NoSuchElementException;
import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonTypeName;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModel;

/**
 * PolicyRule
 */
@JsonPropertyOrder({ PolicyRule.JSON_PROPERTY_CREATED, PolicyRule.JSON_PROPERTY_ID,
        PolicyRule.JSON_PROPERTY_LAST_UPDATED, PolicyRule.JSON_PROPERTY_NAME, PolicyRule.JSON_PROPERTY_PRIORITY,
        PolicyRule.JSON_PROPERTY_STATUS, PolicyRule.JSON_PROPERTY_SYSTEM, PolicyRule.JSON_PROPERTY_TYPE,
        PolicyRule.JSON_PROPERTY_LINKS })
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-11-15T08:48:47.130589-06:00[America/Chicago]", comments = "Generator version: 7.8.0")
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true, defaultImpl = PolicyRule.class)
@JsonSubTypes({ @JsonSubTypes.Type(value = AccessPolicyRule.class, name = "ACCESS_POLICY"),
        @JsonSubTypes.Type(value = EntityRiskPolicyRule.class, name = "ENTITY_RISK"),
        @JsonSubTypes.Type(value = IdpDiscoveryPolicyRule.class, name = "IDP_DISCOVERY"),
        @JsonSubTypes.Type(value = AuthenticatorEnrollmentPolicyRule.class, name = "MFA_ENROLL"),
        @JsonSubTypes.Type(value = PasswordPolicyRule.class, name = "PASSWORD"),
        @JsonSubTypes.Type(value = PostAuthSessionPolicyRule.class, name = "POST_AUTH_SESSION"),
        @JsonSubTypes.Type(value = ProfileEnrollmentPolicyRule.class, name = "PROFILE_ENROLLMENT"),
        @JsonSubTypes.Type(value = AuthorizationServerPolicyRule.class, name = "RESOURCE_ACCESS"),
        @JsonSubTypes.Type(value = OktaSignOnPolicyRule.class, name = "SIGN_ON"), })

public class PolicyRule implements Serializable {

    private static final long serialVersionUID = 1L;

    public static final String JSON_PROPERTY_CREATED = "created";
    private JsonNullable created = JsonNullable. undefined();

    public static final String JSON_PROPERTY_ID = "id";
    private String id;

    public static final String JSON_PROPERTY_LAST_UPDATED = "lastUpdated";
    private JsonNullable lastUpdated = JsonNullable. undefined();

    public static final String JSON_PROPERTY_NAME = "name";
    private String name;

    public static final String JSON_PROPERTY_PRIORITY = "priority";
    private Integer priority;

    public static final String JSON_PROPERTY_STATUS = "status";
    private LifecycleStatus status;

    public static final String JSON_PROPERTY_SYSTEM = "system";
    private Boolean system = false;

    public static final String JSON_PROPERTY_TYPE = "type";
    protected PolicyRuleType type;

    public static final String JSON_PROPERTY_LINKS = "_links";
    private PolicyLinks links;

    public PolicyRule() {
    }

    /*
     * @JsonCreator public PolicyRule(
     *
     * @JsonProperty(JSON_PROPERTY_CREATED) OffsetDateTime created,
     *
     * @JsonProperty(JSON_PROPERTY_LAST_UPDATED) OffsetDateTime lastUpdated ) { this(); this.created = created;
     * this.lastUpdated = lastUpdated; }
     */

    /**
     * Timestamp when the rule was created
     *
     * @return created
     **/
    @javax.annotation.Nullable
    @ApiModelProperty(value = "Timestamp when the rule was created")
    @JsonIgnore

    public OffsetDateTime getCreated() {

        if (created == null) {
            created = JsonNullable. undefined();
        }
        return created.orElse(null);
    }

    @JsonProperty(JSON_PROPERTY_CREATED)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

    public JsonNullable getCreated_JsonNullable() {
        return created;
    }

    @JsonProperty(JSON_PROPERTY_CREATED)
    private void setCreated_JsonNullable(JsonNullable created) {
        this.created = created;
    }

    public PolicyRule id(String id) {

        this.id = id;
        return this;
    }

    /**
     * Identifier for the rule
     *
     * @return id
     **/
    @javax.annotation.Nullable
    @ApiModelProperty(value = "Identifier for the rule")
    @JsonProperty(JSON_PROPERTY_ID)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

    public String getId() {
        return id;
    }

    @JsonProperty(JSON_PROPERTY_ID)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setId(String id) {
        this.id = id;
    }

    /**
     * Timestamp when the rule was last modified
     *
     * @return lastUpdated
     **/
    @javax.annotation.Nullable
    @ApiModelProperty(value = "Timestamp when the rule was last modified")
    @JsonIgnore

    public OffsetDateTime getLastUpdated() {

        if (lastUpdated == null) {
            lastUpdated = JsonNullable. undefined();
        }
        return lastUpdated.orElse(null);
    }

    @JsonProperty(JSON_PROPERTY_LAST_UPDATED)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

    public JsonNullable getLastUpdated_JsonNullable() {
        return lastUpdated;
    }

    @JsonProperty(JSON_PROPERTY_LAST_UPDATED)
    private void setLastUpdated_JsonNullable(JsonNullable lastUpdated) {
        this.lastUpdated = lastUpdated;
    }

    public PolicyRule name(String name) {

        this.name = name;
        return this;
    }

    /**
     * Name of the rule
     *
     * @return name
     **/
    @javax.annotation.Nullable
    @ApiModelProperty(value = "Name of the rule")
    @JsonProperty(JSON_PROPERTY_NAME)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

    public String getName() {
        return name;
    }

    @JsonProperty(JSON_PROPERTY_NAME)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setName(String name) {
        this.name = name;
    }

    public PolicyRule priority(Integer priority) {

        this.priority = priority;
        return this;
    }

    /**
     * Priority of the rule
     *
     * @return priority
     **/
    @javax.annotation.Nullable
    @ApiModelProperty(value = "Priority of the rule")
    @JsonProperty(JSON_PROPERTY_PRIORITY)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

    public Integer getPriority() {
        return priority;
    }

    @JsonProperty(JSON_PROPERTY_PRIORITY)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setPriority(Integer priority) {
        this.priority = priority;
    }

    public PolicyRule status(LifecycleStatus status) {

        this.status = status;
        return this;
    }

    /**
     * Get status
     *
     * @return status
     **/
    @javax.annotation.Nullable
    @ApiModelProperty(value = "")
    @JsonProperty(JSON_PROPERTY_STATUS)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

    public LifecycleStatus getStatus() {
        return status;
    }

    @JsonProperty(JSON_PROPERTY_STATUS)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setStatus(LifecycleStatus status) {
        this.status = status;
    }

    public PolicyRule system(Boolean system) {

        this.system = system;
        return this;
    }

    /**
     * Specifies whether Okta created the Policy Rule (`system=true`). You can't delete Policy Rules
     * that have `system` set to `true`.
     *
     * @return system
     **/
    @javax.annotation.Nullable
    @ApiModelProperty(value = "Specifies whether Okta created the Policy Rule (`system=true`). You can't delete Policy Rules that have `system` set to `true`.")
    @JsonProperty(JSON_PROPERTY_SYSTEM)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

    public Boolean getSystem() {
        return system;
    }

    @JsonProperty(JSON_PROPERTY_SYSTEM)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setSystem(Boolean system) {
        this.system = system;
    }

    public PolicyRule type(PolicyRuleType type) {

        this.type = type;
        return this;
    }

    /**
     * Get type
     *
     * @return type
     **/
    @javax.annotation.Nullable
    @ApiModelProperty(value = "")
    @JsonProperty(JSON_PROPERTY_TYPE)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

    public PolicyRuleType getType() {
        return type;
    }

    @JsonProperty(JSON_PROPERTY_TYPE)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setType(PolicyRuleType type) {
        this.type = type;
    }

    public PolicyRule links(PolicyLinks links) {

        this.links = links;
        return this;
    }

    /**
     * Get links
     *
     * @return links
     **/
    @javax.annotation.Nullable
    @ApiModelProperty(value = "")
    @JsonProperty(JSON_PROPERTY_LINKS)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

    public PolicyLinks getLinks() {
        return links;
    }

    @JsonProperty(JSON_PROPERTY_LINKS)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setLinks(PolicyLinks links) {
        this.links = links;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        PolicyRule policyRule = (PolicyRule) o;
        return equalsNullable(this.created, policyRule.created) && Objects.equals(this.id, policyRule.id)
                && equalsNullable(this.lastUpdated, policyRule.lastUpdated)
                && Objects.equals(this.name, policyRule.name) && Objects.equals(this.priority, policyRule.priority)
                && Objects.equals(this.status, policyRule.status) && Objects.equals(this.system, policyRule.system)
                && Objects.equals(this.type, policyRule.type) && Objects.equals(this.links, policyRule.links);
        // ;
    }

    private static  boolean equalsNullable(JsonNullable a, JsonNullable b) {
        return a == b
                || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
    }

    @Override
    public int hashCode() {
        return Objects.hash(hashCodeNullable(created), id, hashCodeNullable(lastUpdated), name, priority, status,
                system, type, links);
    }

    private static  int hashCodeNullable(JsonNullable a) {
        if (a == null) {
            return 1;
        }
        return a.isPresent() ? Arrays.deepHashCode(new Object[] { a.get() }) : 31;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("class PolicyRule {\n");
        sb.append("    created: ").append(toIndentedString(created)).append("\n");
        sb.append("    id: ").append(toIndentedString(id)).append("\n");
        sb.append("    lastUpdated: ").append(toIndentedString(lastUpdated)).append("\n");
        sb.append("    name: ").append(toIndentedString(name)).append("\n");
        sb.append("    priority: ").append(toIndentedString(priority)).append("\n");
        sb.append("    status: ").append(toIndentedString(status)).append("\n");
        sb.append("    system: ").append(toIndentedString(system)).append("\n");
        sb.append("    type: ").append(toIndentedString(type)).append("\n");
        sb.append("    links: ").append(toIndentedString(links)).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(Object o) {
        if (o == null) {
            return "null";
        }
        return o.toString().replace("\n", "\n    ");
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy