com.solidfire.element.api.TestPingRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of solidfire-sdk-java Show documentation
Show all versions of solidfire-sdk-java Show documentation
Library for interfacing with the Public and Incubating SolidFire Element API.
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;
/**
* TestPingRequest
* You can use the TestPing API method to validate the
* connection to all the nodes in a cluster on both 1G and 10G interfaces by using ICMP packets. The test uses the appropriate MTU sizes for each packet based on the MTU settings in the network configuration.
* Note: This method is available only through the per-node API endpoint 5.0 or later.
**/
public class TestPingRequest implements Serializable {
public static final long serialVersionUID = -6798451733195067348L;
@SerializedName("attempts") private Optional attempts;
@SerializedName("hosts") private Optional hosts;
@SerializedName("totalTimeoutSec") private Optional totalTimeoutSec;
@SerializedName("packetSize") private Optional packetSize;
@SerializedName("pingTimeoutMsec") private Optional pingTimeoutMsec;
@SerializedName("prohibitFragmentation") private Optional prohibitFragmentation;
// empty constructor
@Since("7.0")
public TestPingRequest() {}
// parameterized constructor
@Since("7.0")
public TestPingRequest(
Optional attempts,
Optional hosts,
Optional totalTimeoutSec,
Optional packetSize,
Optional pingTimeoutMsec,
Optional prohibitFragmentation
)
{
this.attempts = (attempts == null) ? Optional.empty() : attempts;
this.hosts = (hosts == null) ? Optional.empty() : hosts;
this.totalTimeoutSec = (totalTimeoutSec == null) ? Optional.empty() : totalTimeoutSec;
this.packetSize = (packetSize == null) ? Optional.empty() : packetSize;
this.pingTimeoutMsec = (pingTimeoutMsec == null) ? Optional.empty() : pingTimeoutMsec;
this.prohibitFragmentation = (prohibitFragmentation == null) ? Optional.empty() : prohibitFragmentation;
}
/**
* Specifies the number of times the system
* should repeat the test ping. The default value is 5.
**/
public Optional getAttempts() { return this.attempts; }
public void setAttempts(Optional attempts) {
this.attempts = (attempts == null) ? Optional.empty() : attempts;
}
/**
* Specifies a comma-separated list of addresses or hostnames of devices to ping.
**/
public Optional getHosts() { return this.hosts; }
public void setHosts(Optional hosts) {
this.hosts = (hosts == null) ? Optional.empty() : hosts;
}
/**
* Specifies the length of time the ping should wait for a system response before issuing the next ping attempt or ending the process.
**/
public Optional getTotalTimeoutSec() { return this.totalTimeoutSec; }
public void setTotalTimeoutSec(Optional totalTimeoutSec) {
this.totalTimeoutSec = (totalTimeoutSec == null) ? Optional.empty() : totalTimeoutSec;
}
/**
* Specifies the number of bytes to send in the ICMP packet that is sent to each IP. The number must be less than the maximum MTU specified in the network configuration.
**/
public Optional getPacketSize() { return this.packetSize; }
public void setPacketSize(Optional packetSize) {
this.packetSize = (packetSize == null) ? Optional.empty() : packetSize;
}
/**
* Specifies the number of milliseconds to wait for each individual ping response. The default value is 500 ms.
**/
public Optional getPingTimeoutMsec() { return this.pingTimeoutMsec; }
public void setPingTimeoutMsec(Optional pingTimeoutMsec) {
this.pingTimeoutMsec = (pingTimeoutMsec == null) ? Optional.empty() : pingTimeoutMsec;
}
/**
* Specifies that the Do not Fragment (DF) flag is enabled for the ICMP packets.
**/
public Optional getProhibitFragmentation() { return this.prohibitFragmentation; }
public void setProhibitFragmentation(Optional prohibitFragmentation) {
this.prohibitFragmentation = (prohibitFragmentation == null) ? Optional.empty() : prohibitFragmentation;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TestPingRequest that = (TestPingRequest) o;
return
Objects.equals(attempts, that.attempts) &&
Objects.equals(hosts, that.hosts) &&
Objects.equals(totalTimeoutSec, that.totalTimeoutSec) &&
Objects.equals(packetSize, that.packetSize) &&
Objects.equals(pingTimeoutMsec, that.pingTimeoutMsec) &&
Objects.equals(prohibitFragmentation, that.prohibitFragmentation);
}
@Override
public int hashCode() {
return Objects.hash( attempts,hosts,totalTimeoutSec,packetSize,pingTimeoutMsec,prohibitFragmentation );
}
public java.util.Map toMap() {
java.util.Map map = new HashMap<>();
map.put("attempts", attempts);
map.put("hosts", hosts);
map.put("totalTimeoutSec", totalTimeoutSec);
map.put("packetSize", packetSize);
map.put("pingTimeoutMsec", pingTimeoutMsec);
map.put("prohibitFragmentation", prohibitFragmentation);
return map;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
Gson gson = new Gson();
sb.append( "{ " );
if(null != attempts && attempts.isPresent()){
sb.append(" attempts : ").append(gson.toJson(attempts)).append(",");
}
else{
sb.append(" attempts : ").append("null").append(",");
}
if(null != hosts && hosts.isPresent()){
sb.append(" hosts : ").append(gson.toJson(hosts)).append(",");
}
else{
sb.append(" hosts : ").append("null").append(",");
}
if(null != totalTimeoutSec && totalTimeoutSec.isPresent()){
sb.append(" totalTimeoutSec : ").append(gson.toJson(totalTimeoutSec)).append(",");
}
else{
sb.append(" totalTimeoutSec : ").append("null").append(",");
}
if(null != packetSize && packetSize.isPresent()){
sb.append(" packetSize : ").append(gson.toJson(packetSize)).append(",");
}
else{
sb.append(" packetSize : ").append("null").append(",");
}
if(null != pingTimeoutMsec && pingTimeoutMsec.isPresent()){
sb.append(" pingTimeoutMsec : ").append(gson.toJson(pingTimeoutMsec)).append(",");
}
else{
sb.append(" pingTimeoutMsec : ").append("null").append(",");
}
if(null != prohibitFragmentation && prohibitFragmentation.isPresent()){
sb.append(" prohibitFragmentation : ").append(gson.toJson(prohibitFragmentation)).append(",");
}
else{
sb.append(" prohibitFragmentation : ").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 Optional attempts;
private Optional hosts;
private Optional totalTimeoutSec;
private Optional packetSize;
private Optional pingTimeoutMsec;
private Optional prohibitFragmentation;
private Builder() { }
public TestPingRequest build() {
return new TestPingRequest (
this.attempts,
this.hosts,
this.totalTimeoutSec,
this.packetSize,
this.pingTimeoutMsec,
this.prohibitFragmentation);
}
private TestPingRequest.Builder buildFrom(final TestPingRequest req) {
this.attempts = req.attempts;
this.hosts = req.hosts;
this.totalTimeoutSec = req.totalTimeoutSec;
this.packetSize = req.packetSize;
this.pingTimeoutMsec = req.pingTimeoutMsec;
this.prohibitFragmentation = req.prohibitFragmentation;
return this;
}
public TestPingRequest.Builder optionalAttempts(final Long attempts) {
this.attempts = (attempts == null) ? Optional.empty() : Optional.of(attempts);
return this;
}
public TestPingRequest.Builder optionalHosts(final String hosts) {
this.hosts = (hosts == null) ? Optional.empty() : Optional.of(hosts);
return this;
}
public TestPingRequest.Builder optionalTotalTimeoutSec(final Long totalTimeoutSec) {
this.totalTimeoutSec = (totalTimeoutSec == null) ? Optional.empty() : Optional.of(totalTimeoutSec);
return this;
}
public TestPingRequest.Builder optionalPacketSize(final Long packetSize) {
this.packetSize = (packetSize == null) ? Optional.empty() : Optional.of(packetSize);
return this;
}
public TestPingRequest.Builder optionalPingTimeoutMsec(final Long pingTimeoutMsec) {
this.pingTimeoutMsec = (pingTimeoutMsec == null) ? Optional.empty() : Optional.of(pingTimeoutMsec);
return this;
}
public TestPingRequest.Builder optionalProhibitFragmentation(final Boolean prohibitFragmentation) {
this.prohibitFragmentation = (prohibitFragmentation == null) ? Optional.empty() : Optional.of(prohibitFragmentation);
return this;
}
}
}