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

com.amazonaws.services.gamelift.model.IpPermission Maven / Gradle / Ivy

Go to download

The AWS SDK for Java with support for OSGi. The AWS SDK for Java provides Java APIs for building software on AWS' cost-effective, scalable, and reliable infrastructure products. The AWS Java SDK allows developers to code against APIs for all of Amazon's infrastructure web services (Amazon S3, Amazon EC2, Amazon SQS, Amazon Relational Database Service, Amazon AutoScaling, etc).

There is a newer version: 1.11.60
Show newest version
/*
 * Copyright 2011-2016 Amazon.com, Inc. or its affiliates. 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. A copy of the License is
 * located at
 * 
 * http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file 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.
 */
package com.amazonaws.services.gamelift.model;

import java.io.Serializable;

/**
 * 

* A range of IP addresses and port settings that allow inbound traffic to * connect to server processes on GameLift. Each game session hosted on a fleet * is assigned a unique combination of IP address and port number, which must * fall into the fleet's allowed ranges. This combination is included in the * GameSession object. *

*/ public class IpPermission implements Serializable, Cloneable { /** *

* Starting value for a range of allowed port numbers. *

*/ private Integer fromPort; /** *

* Ending value for a range of allowed port numbers. Port numbers are * end-inclusive. This value must be higher than FromPort. *

*/ private Integer toPort; /** *

* Range of allowed IP addresses. This value must be expressed in CIDR notation. Example: " * 000.000.000.000/[subnet mask] * " or optionally the shortened version "0.0.0.0/[subnet mask] * ". *

*/ private String ipRange; /** *

* Network communication protocol used by the fleet. *

*/ private String protocol; /** *

* Starting value for a range of allowed port numbers. *

* * @param fromPort * Starting value for a range of allowed port numbers. */ public void setFromPort(Integer fromPort) { this.fromPort = fromPort; } /** *

* Starting value for a range of allowed port numbers. *

* * @return Starting value for a range of allowed port numbers. */ public Integer getFromPort() { return this.fromPort; } /** *

* Starting value for a range of allowed port numbers. *

* * @param fromPort * Starting value for a range of allowed port numbers. * @return Returns a reference to this object so that method calls can be * chained together. */ public IpPermission withFromPort(Integer fromPort) { setFromPort(fromPort); return this; } /** *

* Ending value for a range of allowed port numbers. Port numbers are * end-inclusive. This value must be higher than FromPort. *

* * @param toPort * Ending value for a range of allowed port numbers. Port numbers are * end-inclusive. This value must be higher than * FromPort. */ public void setToPort(Integer toPort) { this.toPort = toPort; } /** *

* Ending value for a range of allowed port numbers. Port numbers are * end-inclusive. This value must be higher than FromPort. *

* * @return Ending value for a range of allowed port numbers. Port numbers * are end-inclusive. This value must be higher than * FromPort. */ public Integer getToPort() { return this.toPort; } /** *

* Ending value for a range of allowed port numbers. Port numbers are * end-inclusive. This value must be higher than FromPort. *

* * @param toPort * Ending value for a range of allowed port numbers. Port numbers are * end-inclusive. This value must be higher than * FromPort. * @return Returns a reference to this object so that method calls can be * chained together. */ public IpPermission withToPort(Integer toPort) { setToPort(toPort); return this; } /** *

* Range of allowed IP addresses. This value must be expressed in CIDR notation. Example: " * 000.000.000.000/[subnet mask] * " or optionally the shortened version "0.0.0.0/[subnet mask] * ". *

* * @param ipRange * Range of allowed IP addresses. This value must be expressed in CIDR notation. Example: * "000.000.000.000/[subnet mask] * " or optionally the shortened version " * 0.0.0.0/[subnet mask]". */ public void setIpRange(String ipRange) { this.ipRange = ipRange; } /** *

* Range of allowed IP addresses. This value must be expressed in CIDR notation. Example: " * 000.000.000.000/[subnet mask] * " or optionally the shortened version "0.0.0.0/[subnet mask] * ". *

* * @return Range of allowed IP addresses. This value must be expressed in CIDR notation. Example: * "000.000.000.000/[subnet mask] * " or optionally the shortened version " * 0.0.0.0/[subnet mask]". */ public String getIpRange() { return this.ipRange; } /** *

* Range of allowed IP addresses. This value must be expressed in CIDR notation. Example: " * 000.000.000.000/[subnet mask] * " or optionally the shortened version "0.0.0.0/[subnet mask] * ". *

* * @param ipRange * Range of allowed IP addresses. This value must be expressed in CIDR notation. Example: * "000.000.000.000/[subnet mask] * " or optionally the shortened version " * 0.0.0.0/[subnet mask]". * @return Returns a reference to this object so that method calls can be * chained together. */ public IpPermission withIpRange(String ipRange) { setIpRange(ipRange); return this; } /** *

* Network communication protocol used by the fleet. *

* * @param protocol * Network communication protocol used by the fleet. * @see IpProtocol */ public void setProtocol(String protocol) { this.protocol = protocol; } /** *

* Network communication protocol used by the fleet. *

* * @return Network communication protocol used by the fleet. * @see IpProtocol */ public String getProtocol() { return this.protocol; } /** *

* Network communication protocol used by the fleet. *

* * @param protocol * Network communication protocol used by the fleet. * @return Returns a reference to this object so that method calls can be * chained together. * @see IpProtocol */ public IpPermission withProtocol(String protocol) { setProtocol(protocol); return this; } /** *

* Network communication protocol used by the fleet. *

* * @param protocol * Network communication protocol used by the fleet. * @see IpProtocol */ public void setProtocol(IpProtocol protocol) { this.protocol = protocol.toString(); } /** *

* Network communication protocol used by the fleet. *

* * @param protocol * Network communication protocol used by the fleet. * @return Returns a reference to this object so that method calls can be * chained together. * @see IpProtocol */ public IpPermission withProtocol(IpProtocol protocol) { setProtocol(protocol); return this; } /** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getFromPort() != null) sb.append("FromPort: " + getFromPort() + ","); if (getToPort() != null) sb.append("ToPort: " + getToPort() + ","); if (getIpRange() != null) sb.append("IpRange: " + getIpRange() + ","); if (getProtocol() != null) sb.append("Protocol: " + getProtocol()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof IpPermission == false) return false; IpPermission other = (IpPermission) obj; if (other.getFromPort() == null ^ this.getFromPort() == null) return false; if (other.getFromPort() != null && other.getFromPort().equals(this.getFromPort()) == false) return false; if (other.getToPort() == null ^ this.getToPort() == null) return false; if (other.getToPort() != null && other.getToPort().equals(this.getToPort()) == false) return false; if (other.getIpRange() == null ^ this.getIpRange() == null) return false; if (other.getIpRange() != null && other.getIpRange().equals(this.getIpRange()) == false) return false; if (other.getProtocol() == null ^ this.getProtocol() == null) return false; if (other.getProtocol() != null && other.getProtocol().equals(this.getProtocol()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getFromPort() == null) ? 0 : getFromPort().hashCode()); hashCode = prime * hashCode + ((getToPort() == null) ? 0 : getToPort().hashCode()); hashCode = prime * hashCode + ((getIpRange() == null) ? 0 : getIpRange().hashCode()); hashCode = prime * hashCode + ((getProtocol() == null) ? 0 : getProtocol().hashCode()); return hashCode; } @Override public IpPermission clone() { try { return (IpPermission) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException( "Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy