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

odata.msgraph.client.entity.PrivilegedAccessGroupEligibilitySchedule 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.complex.RequestSchedule;
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", 
    "groupId", 
    "memberType", 
    "principalId"})
@JsonInclude(Include.NON_NULL)
public class PrivilegedAccessGroupEligibilitySchedule extends PrivilegedAccessSchedule implements ODataEntityType {

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

    @JsonProperty("accessId")
    protected PrivilegedAccessGroupRelationships accessId;

    @JsonProperty("groupId")
    protected String groupId;

    @JsonProperty("memberType")
    protected PrivilegedAccessGroupMemberType memberType;

    @JsonProperty("principalId")
    protected String principalId;

    protected PrivilegedAccessGroupEligibilitySchedule() {
        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 builderPrivilegedAccessGroupEligibilitySchedule() {
        return new Builder();
    }

    public static final class Builder {
        private String id;
        private OffsetDateTime createdDateTime;
        private String createdUsing;
        private OffsetDateTime modifiedDateTime;
        private RequestSchedule scheduleInfo;
        private String status;
        private PrivilegedAccessGroupRelationships accessId;
        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 createdDateTime(OffsetDateTime createdDateTime) {
            this.createdDateTime = createdDateTime;
            this.changedFields = changedFields.add("createdDateTime");
            return this;
        }

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

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

        public Builder scheduleInfo(RequestSchedule scheduleInfo) {
            this.scheduleInfo = scheduleInfo;
            this.changedFields = changedFields.add("scheduleInfo");
            return this;
        }

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

        public Builder accessId(PrivilegedAccessGroupRelationships accessId) {
            this.accessId = accessId;
            this.changedFields = changedFields.add("accessId");
            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 PrivilegedAccessGroupEligibilitySchedule build() {
            PrivilegedAccessGroupEligibilitySchedule _x = new PrivilegedAccessGroupEligibilitySchedule();
            _x.contextPath = null;
            _x.changedFields = changedFields;
            _x.unmappedFields = new UnmappedFieldsImpl();
            _x.odataType = "microsoft.graph.privilegedAccessGroupEligibilitySchedule";
            _x.id = id;
            _x.createdDateTime = createdDateTime;
            _x.createdUsing = createdUsing;
            _x.modifiedDateTime = modifiedDateTime;
            _x.scheduleInfo = scheduleInfo;
            _x.status = status;
            _x.accessId = accessId;
            _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 PrivilegedAccessGroupEligibilitySchedule withAccessId(PrivilegedAccessGroupRelationships accessId) {
        PrivilegedAccessGroupEligibilitySchedule _x = _copy();
        _x.changedFields = changedFields.add("accessId");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.privilegedAccessGroupEligibilitySchedule");
        _x.accessId = accessId;
        return _x;
    }

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

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

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

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

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

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

    public PrivilegedAccessGroupEligibilitySchedule withUnmappedField(String name, Object value) {
        PrivilegedAccessGroupEligibilitySchedule _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 PrivilegedAccessGroupEligibilitySchedule patch() {
        RequestHelper.patch(this, contextPath, RequestOptions.EMPTY);
        PrivilegedAccessGroupEligibilitySchedule _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 PrivilegedAccessGroupEligibilitySchedule put() {
        RequestHelper.put(this, contextPath, RequestOptions.EMPTY);
        PrivilegedAccessGroupEligibilitySchedule _x = _copy();
        _x.changedFields = null;
        return _x;
    }

    private PrivilegedAccessGroupEligibilitySchedule _copy() {
        PrivilegedAccessGroupEligibilitySchedule _x = new PrivilegedAccessGroupEligibilitySchedule();
        _x.contextPath = contextPath;
        _x.changedFields = changedFields;
        _x.unmappedFields = unmappedFields.copy();
        _x.odataType = odataType;
        _x.id = id;
        _x.createdDateTime = createdDateTime;
        _x.createdUsing = createdUsing;
        _x.modifiedDateTime = modifiedDateTime;
        _x.scheduleInfo = scheduleInfo;
        _x.status = status;
        _x.accessId = accessId;
        _x.groupId = groupId;
        _x.memberType = memberType;
        _x.principalId = principalId;
        return _x;
    }

    @Override
    public String toString() {
        StringBuilder b = new StringBuilder();
        b.append("PrivilegedAccessGroupEligibilitySchedule[");
        b.append("id=");
        b.append(this.id);
        b.append(", ");
        b.append("createdDateTime=");
        b.append(this.createdDateTime);
        b.append(", ");
        b.append("createdUsing=");
        b.append(this.createdUsing);
        b.append(", ");
        b.append("modifiedDateTime=");
        b.append(this.modifiedDateTime);
        b.append(", ");
        b.append("scheduleInfo=");
        b.append(this.scheduleInfo);
        b.append(", ");
        b.append("status=");
        b.append(this.status);
        b.append(", ");
        b.append("accessId=");
        b.append(this.accessId);
        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