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

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

There is a newer version: 1.5.0.89
Show 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.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;

/**
 * CloneMultipleVolumesRequest  
 **/

public class CloneMultipleVolumesRequest implements Serializable {

    public static final long serialVersionUID = -6275597178319531856L;
    @SerializedName("volumes") private CloneMultipleVolumeParams[] volumes;
    @SerializedName("access") private Optional access;
    @SerializedName("groupSnapshotID") private Optional groupSnapshotID;
    @SerializedName("newAccountID") private Optional newAccountID;

    // empty constructor
    @Since("7.0")
    public CloneMultipleVolumesRequest() {}

    
    // parameterized constructor
    @Since("7.0")
    public CloneMultipleVolumesRequest(
        CloneMultipleVolumeParams[] volumes,
        Optional access,
        Optional groupSnapshotID,
        Optional newAccountID
    )
    {
        this.volumes = volumes;
        this.access = (access == null) ? Optional.empty() : access;
        this.groupSnapshotID = (groupSnapshotID == null) ? Optional.empty() : groupSnapshotID;
        this.newAccountID = (newAccountID == null) ? Optional.empty() : newAccountID;
    }

    /** 
     * Array of Unique ID for each volume to include in the clone with optional parameters. If optional parameters are not specified, the values will be inherited from the source volumes.
     **/
    public CloneMultipleVolumeParams[] getVolumes() { return this.volumes; }
    public void setVolumes(CloneMultipleVolumeParams[] volumes) { 
        this.volumes = volumes;
    }
    /** 
     * New default access method for the new volumes if not overridden by information passed in the volumes array.
     * readOnly: Only read operations are allowed.
     * readWrite: Reads and writes are allowed.
     * locked: No reads or writes are allowed.
     * replicationTarget: Identify a volume as the target volume for a paired set of volumes. If the volume is not paired, the access status is locked.
     * 
     * If unspecified, the access settings of the clone will be the same as the source.
     **/
    public Optional getAccess() { return this.access; }
    public void setAccess(Optional access) { 
        this.access = (access == null) ? Optional.empty() : access;
    }
    /** 
     * ID of the group snapshot to use as a basis for the clone.
     **/
    public Optional getGroupSnapshotID() { return this.groupSnapshotID; }
    public void setGroupSnapshotID(Optional groupSnapshotID) { 
        this.groupSnapshotID = (groupSnapshotID == null) ? Optional.empty() : groupSnapshotID;
    }
    /** 
     * New account ID for the volumes if not overridden by information passed in the volumes array.
     **/
    public Optional getNewAccountID() { return this.newAccountID; }
    public void setNewAccountID(Optional newAccountID) { 
        this.newAccountID = (newAccountID == null) ? Optional.empty() : newAccountID;
    }

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

        CloneMultipleVolumesRequest that = (CloneMultipleVolumesRequest) o;

        return 
            Arrays.equals(volumes, that.volumes) && 
            Objects.equals(access, that.access) && 
            Objects.equals(groupSnapshotID, that.groupSnapshotID) && 
            Objects.equals(newAccountID, that.newAccountID);
    }

    @Override
    public int hashCode() {
        return Objects.hash( (Object[])volumes,access,groupSnapshotID,newAccountID );
    }


    public java.util.Map toMap() {
        java.util.Map map = new HashMap<>();
        map.put("volumes", volumes);
        map.put("access", access);
        map.put("groupSnapshotID", groupSnapshotID);
        map.put("newAccountID", newAccountID);
        return map;
    }

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

        sb.append(" volumes : ").append(Arrays.toString(volumes)).append(",");
        if(null != access && access.isPresent()){
            sb.append(" access : ").append(access).append(",");
        }
        if(null != groupSnapshotID && groupSnapshotID.isPresent()){
            sb.append(" groupSnapshotID : ").append(groupSnapshotID).append(",");
        }
        if(null != newAccountID && newAccountID.isPresent()){
            sb.append(" newAccountID : ").append(newAccountID).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 CloneMultipleVolumeParams[] volumes;
        private Optional access;
        private Optional groupSnapshotID;
        private Optional newAccountID;

        private Builder() { }

        public CloneMultipleVolumesRequest build() {
            return new CloneMultipleVolumesRequest (
                         this.volumes,
                         this.access,
                         this.groupSnapshotID,
                         this.newAccountID);
        }

        private CloneMultipleVolumesRequest.Builder buildFrom(final CloneMultipleVolumesRequest req) {
            this.volumes = req.volumes;
            this.access = req.access;
            this.groupSnapshotID = req.groupSnapshotID;
            this.newAccountID = req.newAccountID;

            return this;
        }

        public CloneMultipleVolumesRequest.Builder volumes(final CloneMultipleVolumeParams[] volumes) {
            this.volumes = volumes;
            return this;
        }

        public CloneMultipleVolumesRequest.Builder optionalAccess(final String access) {
            this.access = (access == null) ? Optional.empty() : Optional.of(access);
            return this;
        }

        public CloneMultipleVolumesRequest.Builder optionalGroupSnapshotID(final Long groupSnapshotID) {
            this.groupSnapshotID = (groupSnapshotID == null) ? Optional.empty() : Optional.of(groupSnapshotID);
            return this;
        }

        public CloneMultipleVolumesRequest.Builder optionalNewAccountID(final Long newAccountID) {
            this.newAccountID = (newAccountID == null) ? Optional.empty() : Optional.of(newAccountID);
            return this;
        }

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy