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

odata.msgraph.client.entity.PrivilegedAccessGroupEligibilityScheduleInstance Maven / Gradle / Ivy

There is a newer version: 0.2.2
Show newest version
package odata.msgraph.client.entity;

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.github.davidmoten.odata.client.ClientException;
import com.github.davidmoten.odata.client.NameValue;
import com.github.davidmoten.odata.client.ODataEntityType;
import com.github.davidmoten.odata.client.RequestOptions;
import com.github.davidmoten.odata.client.UnmappedFields;
import com.github.davidmoten.odata.client.Util;
import com.github.davidmoten.odata.client.annotation.NavigationProperty;
import com.github.davidmoten.odata.client.annotation.Property;
import com.github.davidmoten.odata.client.internal.ChangedFields;
import com.github.davidmoten.odata.client.internal.RequestHelper;
import com.github.davidmoten.odata.client.internal.UnmappedFieldsImpl;

import java.lang.Object;
import java.lang.Override;
import java.lang.String;
import java.lang.StringBuilder;
import java.time.OffsetDateTime;
import java.util.Optional;

import odata.msgraph.client.entity.request.DirectoryObjectRequest;
import odata.msgraph.client.entity.request.GroupRequest;
import odata.msgraph.client.enums.PrivilegedAccessGroupMemberType;
import odata.msgraph.client.enums.PrivilegedAccessGroupRelationships;

@JsonPropertyOrder({
    "@odata.type", 
    "accessId", 
    "eligibilityScheduleId", 
    "groupId", 
    "memberType", 
    "principalId"})
@JsonInclude(Include.NON_NULL)
public class PrivilegedAccessGroupEligibilityScheduleInstance extends PrivilegedAccessScheduleInstance implements ODataEntityType {

    @Override
    public String odataTypeName() {
        return "microsoft.graph.privilegedAccessGroupEligibilityScheduleInstance";
    }

    @JsonProperty("accessId")
    protected PrivilegedAccessGroupRelationships accessId;

    @JsonProperty("eligibilityScheduleId")
    protected String eligibilityScheduleId;

    @JsonProperty("groupId")
    protected String groupId;

    @JsonProperty("memberType")
    protected PrivilegedAccessGroupMemberType memberType;

    @JsonProperty("principalId")
    protected String principalId;

    protected PrivilegedAccessGroupEligibilityScheduleInstance() {
        super();
    }

    /**
     * Returns a builder which is used to create a new
     * instance of this class (given that this class is immutable).
     *
     * @return a new Builder for this class
     */
    // Suffix used on builder factory method to differentiate the method
    // from static builder methods on superclasses
    public static Builder builderPrivilegedAccessGroupEligibilityScheduleInstance() {
        return new Builder();
    }

    public static final class Builder {
        private String id;
        private OffsetDateTime endDateTime;
        private OffsetDateTime startDateTime;
        private PrivilegedAccessGroupRelationships accessId;
        private String eligibilityScheduleId;
        private String groupId;
        private PrivilegedAccessGroupMemberType memberType;
        private String principalId;
        private ChangedFields changedFields = ChangedFields.EMPTY;

        Builder() {
            // prevent instantiation
        }

        public Builder id(String id) {
            this.id = id;
            this.changedFields = changedFields.add("id");
            return this;
        }

        public Builder endDateTime(OffsetDateTime endDateTime) {
            this.endDateTime = endDateTime;
            this.changedFields = changedFields.add("endDateTime");
            return this;
        }

        public Builder startDateTime(OffsetDateTime startDateTime) {
            this.startDateTime = startDateTime;
            this.changedFields = changedFields.add("startDateTime");
            return this;
        }

        public Builder accessId(PrivilegedAccessGroupRelationships accessId) {
            this.accessId = accessId;
            this.changedFields = changedFields.add("accessId");
            return this;
        }

        public Builder eligibilityScheduleId(String eligibilityScheduleId) {
            this.eligibilityScheduleId = eligibilityScheduleId;
            this.changedFields = changedFields.add("eligibilityScheduleId");
            return this;
        }

        public Builder groupId(String groupId) {
            this.groupId = groupId;
            this.changedFields = changedFields.add("groupId");
            return this;
        }

        public Builder memberType(PrivilegedAccessGroupMemberType memberType) {
            this.memberType = memberType;
            this.changedFields = changedFields.add("memberType");
            return this;
        }

        public Builder principalId(String principalId) {
            this.principalId = principalId;
            this.changedFields = changedFields.add("principalId");
            return this;
        }

        public PrivilegedAccessGroupEligibilityScheduleInstance build() {
            PrivilegedAccessGroupEligibilityScheduleInstance _x = new PrivilegedAccessGroupEligibilityScheduleInstance();
            _x.contextPath = null;
            _x.changedFields = changedFields;
            _x.unmappedFields = new UnmappedFieldsImpl();
            _x.odataType = "microsoft.graph.privilegedAccessGroupEligibilityScheduleInstance";
            _x.id = id;
            _x.endDateTime = endDateTime;
            _x.startDateTime = startDateTime;
            _x.accessId = accessId;
            _x.eligibilityScheduleId = eligibilityScheduleId;
            _x.groupId = groupId;
            _x.memberType = memberType;
            _x.principalId = principalId;
            return _x;
        }
    }

    @Override
    @JsonIgnore
    public ChangedFields getChangedFields() {
        return changedFields;
    }

    @Override
    public void postInject(boolean addKeysToContextPath) {
        if (addKeysToContextPath && id != null) {
            contextPath = contextPath.clearQueries().addKeys(new NameValue(id, String.class));
        }
    }

    @Property(name="accessId")
    @JsonIgnore
    public Optional getAccessId() {
        return Optional.ofNullable(accessId);
    }

    public PrivilegedAccessGroupEligibilityScheduleInstance withAccessId(PrivilegedAccessGroupRelationships accessId) {
        PrivilegedAccessGroupEligibilityScheduleInstance _x = _copy();
        _x.changedFields = changedFields.add("accessId");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.privilegedAccessGroupEligibilityScheduleInstance");
        _x.accessId = accessId;
        return _x;
    }

    @Property(name="eligibilityScheduleId")
    @JsonIgnore
    public Optional getEligibilityScheduleId() {
        return Optional.ofNullable(eligibilityScheduleId);
    }

    public PrivilegedAccessGroupEligibilityScheduleInstance withEligibilityScheduleId(String eligibilityScheduleId) {
        PrivilegedAccessGroupEligibilityScheduleInstance _x = _copy();
        _x.changedFields = changedFields.add("eligibilityScheduleId");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.privilegedAccessGroupEligibilityScheduleInstance");
        _x.eligibilityScheduleId = eligibilityScheduleId;
        return _x;
    }

    @Property(name="groupId")
    @JsonIgnore
    public Optional getGroupId() {
        return Optional.ofNullable(groupId);
    }

    public PrivilegedAccessGroupEligibilityScheduleInstance withGroupId(String groupId) {
        PrivilegedAccessGroupEligibilityScheduleInstance _x = _copy();
        _x.changedFields = changedFields.add("groupId");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.privilegedAccessGroupEligibilityScheduleInstance");
        _x.groupId = groupId;
        return _x;
    }

    @Property(name="memberType")
    @JsonIgnore
    public Optional getMemberType() {
        return Optional.ofNullable(memberType);
    }

    public PrivilegedAccessGroupEligibilityScheduleInstance withMemberType(PrivilegedAccessGroupMemberType memberType) {
        PrivilegedAccessGroupEligibilityScheduleInstance _x = _copy();
        _x.changedFields = changedFields.add("memberType");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.privilegedAccessGroupEligibilityScheduleInstance");
        _x.memberType = memberType;
        return _x;
    }

    @Property(name="principalId")
    @JsonIgnore
    public Optional getPrincipalId() {
        return Optional.ofNullable(principalId);
    }

    public PrivilegedAccessGroupEligibilityScheduleInstance withPrincipalId(String principalId) {
        PrivilegedAccessGroupEligibilityScheduleInstance _x = _copy();
        _x.changedFields = changedFields.add("principalId");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.privilegedAccessGroupEligibilityScheduleInstance");
        _x.principalId = principalId;
        return _x;
    }

    public PrivilegedAccessGroupEligibilityScheduleInstance withUnmappedField(String name, Object value) {
        PrivilegedAccessGroupEligibilityScheduleInstance _x = _copy();
        _x.setUnmappedField(name, value);
        return _x;
    }

    @NavigationProperty(name="group")
    @JsonIgnore
    public GroupRequest getGroup() {
        return new GroupRequest(contextPath.addSegment("group"), RequestHelper.getValue(unmappedFields, "group"));
    }

    @NavigationProperty(name="principal")
    @JsonIgnore
    public DirectoryObjectRequest getPrincipal() {
        return new DirectoryObjectRequest(contextPath.addSegment("principal"), RequestHelper.getValue(unmappedFields, "principal"));
    }

    @JsonAnySetter
    private void setUnmappedField(String name, Object value) {
        if (unmappedFields == null) {
            unmappedFields = new UnmappedFieldsImpl();
        }
        unmappedFields.put(name, value);
    }

    @JsonAnyGetter
    private UnmappedFieldsImpl unmappedFields() {
        return unmappedFields == null ? UnmappedFieldsImpl.EMPTY : unmappedFields;
    }

    @Override
    public UnmappedFields getUnmappedFields() {
        return unmappedFields();
    }

    /**
     * Submits only changed fields for update and returns an 
     * immutable copy of {@code this} with changed fields reset.
     *
     * @return a copy of {@code this} with changed fields reset
     * @throws ClientException if HTTP response is not as expected
     */
    public PrivilegedAccessGroupEligibilityScheduleInstance patch() {
        RequestHelper.patch(this, contextPath, RequestOptions.EMPTY);
        PrivilegedAccessGroupEligibilityScheduleInstance _x = _copy();
        _x.changedFields = null;
        return _x;
    }

    /**
     * Submits all fields for update and returns an immutable copy of {@code this}
     * with changed fields reset (they were ignored anyway).
     *
     * @return a copy of {@code this} with changed fields reset
     * @throws ClientException if HTTP response is not as expected
     */
    public PrivilegedAccessGroupEligibilityScheduleInstance put() {
        RequestHelper.put(this, contextPath, RequestOptions.EMPTY);
        PrivilegedAccessGroupEligibilityScheduleInstance _x = _copy();
        _x.changedFields = null;
        return _x;
    }

    private PrivilegedAccessGroupEligibilityScheduleInstance _copy() {
        PrivilegedAccessGroupEligibilityScheduleInstance _x = new PrivilegedAccessGroupEligibilityScheduleInstance();
        _x.contextPath = contextPath;
        _x.changedFields = changedFields;
        _x.unmappedFields = unmappedFields.copy();
        _x.odataType = odataType;
        _x.id = id;
        _x.endDateTime = endDateTime;
        _x.startDateTime = startDateTime;
        _x.accessId = accessId;
        _x.eligibilityScheduleId = eligibilityScheduleId;
        _x.groupId = groupId;
        _x.memberType = memberType;
        _x.principalId = principalId;
        return _x;
    }

    @Override
    public String toString() {
        StringBuilder b = new StringBuilder();
        b.append("PrivilegedAccessGroupEligibilityScheduleInstance[");
        b.append("id=");
        b.append(this.id);
        b.append(", ");
        b.append("endDateTime=");
        b.append(this.endDateTime);
        b.append(", ");
        b.append("startDateTime=");
        b.append(this.startDateTime);
        b.append(", ");
        b.append("accessId=");
        b.append(this.accessId);
        b.append(", ");
        b.append("eligibilityScheduleId=");
        b.append(this.eligibilityScheduleId);
        b.append(", ");
        b.append("groupId=");
        b.append(this.groupId);
        b.append(", ");
        b.append("memberType=");
        b.append(this.memberType);
        b.append(", ");
        b.append("principalId=");
        b.append(this.principalId);
        b.append("]");
        b.append(",unmappedFields=");
        b.append(unmappedFields);
        b.append(",odataType=");
        b.append(odataType);
        return b.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy