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

com.solidfire.element.api.ModifyInitiator Maven / Gradle / Ivy

The newest version!
/*
 * Copyright © 2014-2016 NetApp, Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/*
 * DO NOT EDIT THIS CODE BY HAND! It has been generated with jsvcgen.
 */
package com.solidfire.element.api;

import com.solidfire.gson.Gson;
import com.solidfire.core.client.Attributes;
import com.solidfire.gson.annotations.SerializedName;
import com.solidfire.core.annotation.Since;
import com.solidfire.core.javautil.Optional;
import java.io.Serializable;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Objects;

/**
 * ModifyInitiator  
 * Object containing characteristics of each initiator to modify
 **/

public class ModifyInitiator implements Serializable {

    public static final long serialVersionUID = 2549938854226075210L;
    @SerializedName("initiatorID") private Long initiatorID;
    @SerializedName("alias") private Optional alias;
    @SerializedName("volumeAccessGroupID") private Optional volumeAccessGroupID;
    @SerializedName("attributes") private Optional attributes;
    // empty constructor
    @Since("7.0")
    public ModifyInitiator() {}

    
    // parameterized constructor
    @Since("7.0")
    public ModifyInitiator(
        Long initiatorID,
        Optional alias,
        Optional volumeAccessGroupID,
        Optional attributes
    )
    {
        this.initiatorID = initiatorID;
        this.alias = (alias == null) ? Optional.empty() : alias;
        this.volumeAccessGroupID = (volumeAccessGroupID == null) ? Optional.empty() : volumeAccessGroupID;
        this.attributes = (attributes == null) ? Optional.empty() : attributes;
    }

    /** 
     * (Required) The numeric ID of the initiator to modify. (Integer)
     **/
    public Long getInitiatorID() { return this.initiatorID; }
   
    public void setInitiatorID(Long initiatorID) { 
        this.initiatorID = initiatorID;
    }
    /** 
     * (Optional) A new friendly name to assign to the initiator. (String)
     **/
    public Optional getAlias() { return this.alias; }
   
    public void setAlias(Optional alias) { 
        this.alias = (alias == null) ? Optional.empty() : alias;
    }
    /** 
     * (Optional) The ID of the volume access group to which the newly created initiator should be added. If the initiator was previously in a different volume access group, it is removed from the old volume access group. If this key is present but null, the initiator is removed from its current volume access group, but not placed in any new volume access group. (Integer)
     **/
    public Optional getVolumeAccessGroupID() { return this.volumeAccessGroupID; }
   
    public void setVolumeAccessGroupID(Optional volumeAccessGroupID) { 
        this.volumeAccessGroupID = (volumeAccessGroupID == null) ? Optional.empty() : volumeAccessGroupID;
    }
    /** 
     * (Optional) A new set of JSON attributes assigned to this initiator. (JSON Object)
     **/
    public Optional getAttributes() { return this.attributes; }
   
    public void setAttributes(Optional attributes) { 
        this.attributes = (attributes == null) ? Optional.empty() : attributes;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        ModifyInitiator that = (ModifyInitiator) o;

        return 
            Objects.equals(initiatorID, that.initiatorID) && 
            Objects.equals(alias, that.alias) && 
            Objects.equals(volumeAccessGroupID, that.volumeAccessGroupID) && 
            Objects.equals(attributes, that.attributes);
    }

    @Override
    public int hashCode() {
        return Objects.hash( initiatorID,alias,volumeAccessGroupID,attributes );
    }


    public java.util.Map toMap() {
        java.util.Map map = new HashMap<>();
        map.put("initiatorID", initiatorID);
        map.put("alias", alias);
        map.put("volumeAccessGroupID", volumeAccessGroupID);
        map.put("attributes", attributes);
        return map;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder();
        Gson gson = new Gson();
        sb.append( "{ " );

        sb.append(" initiatorID : ").append(gson.toJson(initiatorID)).append(",");
        if(null != alias && alias.isPresent()){
            sb.append(" alias : ").append(gson.toJson(alias)).append(",");
        }
        else{
            sb.append(" alias : ").append("null").append(",");
        }
        if(null != volumeAccessGroupID && volumeAccessGroupID.isPresent()){
            sb.append(" volumeAccessGroupID : ").append(gson.toJson(volumeAccessGroupID)).append(",");
        }
        else{
            sb.append(" volumeAccessGroupID : ").append("null").append(",");
        }
        if(null != attributes && attributes.isPresent()){
            sb.append(" attributes : ").append(gson.toJson(attributes)).append(",");
        }
        else{
            sb.append(" attributes : ").append("null").append(",");
        }
        sb.append( " }" );

        if(sb.lastIndexOf(", }") != -1)
            sb.deleteCharAt(sb.lastIndexOf(", }"));

        return sb.toString();
    }

    public static Builder builder() {
        return new Builder();
    }

    public final Builder asBuilder() {
        return new Builder().buildFrom(this);
    }

    public static class Builder {
        private Long initiatorID;
        private Optional alias;
        private Optional volumeAccessGroupID;
        private Optional attributes;

        private Builder() { }

        public ModifyInitiator build() {
            return new ModifyInitiator (
                         this.initiatorID,
                         this.alias,
                         this.volumeAccessGroupID,
                         this.attributes);
        }

        private ModifyInitiator.Builder buildFrom(final ModifyInitiator req) {
            this.initiatorID = req.initiatorID;
            this.alias = req.alias;
            this.volumeAccessGroupID = req.volumeAccessGroupID;
            this.attributes = req.attributes;

            return this;
        }

        public ModifyInitiator.Builder initiatorID(final Long initiatorID) {
            this.initiatorID = initiatorID;
            return this;
        }

        public ModifyInitiator.Builder optionalAlias(final String alias) {
            this.alias = (alias == null) ? Optional.empty() : Optional.of(alias);
            return this;
        }

        public ModifyInitiator.Builder optionalVolumeAccessGroupID(final Long volumeAccessGroupID) {
            this.volumeAccessGroupID = (volumeAccessGroupID == null) ? Optional.empty() : Optional.of(volumeAccessGroupID);
            return this;
        }

        public ModifyInitiator.Builder optionalAttributes(final Attributes attributes) {
            this.attributes = (attributes == null) ? Optional.empty() : Optional.of(attributes);
            return this;
        }

    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy