/* * Copyright 2018-2023 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.route53.model; import java.io.Serializable; import javax.annotation.Generated; /** *
* A complex type that contains settings for a traffic policy. *
* * @see AWS API * Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class TrafficPolicy implements Serializable, Cloneable { /** ** The ID that Amazon Route 53 assigned to a traffic policy when you created it. *
*/ private String id; /** *
* The version number that Amazon Route 53 assigns to a traffic policy. For a new traffic policy, the value of
* Version
is always 1.
*
* The name that you specified when you created the traffic policy. *
*/ private String name; /** ** The DNS type of the resource record sets that Amazon Route 53 creates when you use a traffic policy to create a * traffic policy instance. *
*/ private String type; /** *
* The definition of a traffic policy in JSON format. You specify the JSON document to use for a new traffic policy
* in the CreateTrafficPolicy
request. For more information about the JSON format, see Traffic Policy Document Format.
*
* The comment that you specify in the CreateTrafficPolicy
request, if any.
*
* The ID that Amazon Route 53 assigned to a traffic policy when you created it. *
* * @param id * The ID that Amazon Route 53 assigned to a traffic policy when you created it. */ public void setId(String id) { this.id = id; } /** ** The ID that Amazon Route 53 assigned to a traffic policy when you created it. *
* * @return The ID that Amazon Route 53 assigned to a traffic policy when you created it. */ public String getId() { return this.id; } /** ** The ID that Amazon Route 53 assigned to a traffic policy when you created it. *
* * @param id * The ID that Amazon Route 53 assigned to a traffic policy when you created it. * @return Returns a reference to this object so that method calls can be chained together. */ public TrafficPolicy withId(String id) { setId(id); return this; } /** *
* The version number that Amazon Route 53 assigns to a traffic policy. For a new traffic policy, the value of
* Version
is always 1.
*
Version
is always 1.
*/
public void setVersion(Integer version) {
this.version = version;
}
/**
*
* The version number that Amazon Route 53 assigns to a traffic policy. For a new traffic policy, the value of
* Version
is always 1.
*
Version
is always 1.
*/
public Integer getVersion() {
return this.version;
}
/**
*
* The version number that Amazon Route 53 assigns to a traffic policy. For a new traffic policy, the value of
* Version
is always 1.
*
Version
is always 1.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TrafficPolicy withVersion(Integer version) {
setVersion(version);
return this;
}
/**
* * The name that you specified when you created the traffic policy. *
* * @param name * The name that you specified when you created the traffic policy. */ public void setName(String name) { this.name = name; } /** ** The name that you specified when you created the traffic policy. *
* * @return The name that you specified when you created the traffic policy. */ public String getName() { return this.name; } /** ** The name that you specified when you created the traffic policy. *
* * @param name * The name that you specified when you created the traffic policy. * @return Returns a reference to this object so that method calls can be chained together. */ public TrafficPolicy withName(String name) { setName(name); return this; } /** ** The DNS type of the resource record sets that Amazon Route 53 creates when you use a traffic policy to create a * traffic policy instance. *
* * @param type * The DNS type of the resource record sets that Amazon Route 53 creates when you use a traffic policy to * create a traffic policy instance. * @see RRType */ public void setType(String type) { this.type = type; } /** ** The DNS type of the resource record sets that Amazon Route 53 creates when you use a traffic policy to create a * traffic policy instance. *
* * @return The DNS type of the resource record sets that Amazon Route 53 creates when you use a traffic policy to * create a traffic policy instance. * @see RRType */ public String getType() { return this.type; } /** ** The DNS type of the resource record sets that Amazon Route 53 creates when you use a traffic policy to create a * traffic policy instance. *
* * @param type * The DNS type of the resource record sets that Amazon Route 53 creates when you use a traffic policy to * create a traffic policy instance. * @return Returns a reference to this object so that method calls can be chained together. * @see RRType */ public TrafficPolicy withType(String type) { setType(type); return this; } /** ** The DNS type of the resource record sets that Amazon Route 53 creates when you use a traffic policy to create a * traffic policy instance. *
* * @param type * The DNS type of the resource record sets that Amazon Route 53 creates when you use a traffic policy to * create a traffic policy instance. * @see RRType */ public void setType(RRType type) { withType(type); } /** ** The DNS type of the resource record sets that Amazon Route 53 creates when you use a traffic policy to create a * traffic policy instance. *
* * @param type * The DNS type of the resource record sets that Amazon Route 53 creates when you use a traffic policy to * create a traffic policy instance. * @return Returns a reference to this object so that method calls can be chained together. * @see RRType */ public TrafficPolicy withType(RRType type) { this.type = type.toString(); return this; } /** *
* The definition of a traffic policy in JSON format. You specify the JSON document to use for a new traffic policy
* in the CreateTrafficPolicy
request. For more information about the JSON format, see Traffic Policy Document Format.
*
CreateTrafficPolicy
request. For more information about the JSON format, see Traffic Policy Document Format.
*/
public void setDocument(String document) {
this.document = document;
}
/**
*
* The definition of a traffic policy in JSON format. You specify the JSON document to use for a new traffic policy
* in the CreateTrafficPolicy
request. For more information about the JSON format, see Traffic Policy Document Format.
*
CreateTrafficPolicy
request. For more information about the JSON format, see
* Traffic Policy Document Format.
*/
public String getDocument() {
return this.document;
}
/**
*
* The definition of a traffic policy in JSON format. You specify the JSON document to use for a new traffic policy
* in the CreateTrafficPolicy
request. For more information about the JSON format, see Traffic Policy Document Format.
*
CreateTrafficPolicy
request. For more information about the JSON format, see Traffic Policy Document Format.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TrafficPolicy withDocument(String document) {
setDocument(document);
return this;
}
/**
*
* The comment that you specify in the CreateTrafficPolicy
request, if any.
*
CreateTrafficPolicy
request, if any.
*/
public void setComment(String comment) {
this.comment = comment;
}
/**
*
* The comment that you specify in the CreateTrafficPolicy
request, if any.
*
CreateTrafficPolicy
request, if any.
*/
public String getComment() {
return this.comment;
}
/**
*
* The comment that you specify in the CreateTrafficPolicy
request, if any.
*
CreateTrafficPolicy
request, if any.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TrafficPolicy withComment(String comment) {
setComment(comment);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getId() != null)
sb.append("Id: ").append(getId()).append(",");
if (getVersion() != null)
sb.append("Version: ").append(getVersion()).append(",");
if (getName() != null)
sb.append("Name: ").append(getName()).append(",");
if (getType() != null)
sb.append("Type: ").append(getType()).append(",");
if (getDocument() != null)
sb.append("Document: ").append(getDocument()).append(",");
if (getComment() != null)
sb.append("Comment: ").append(getComment());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof TrafficPolicy == false)
return false;
TrafficPolicy other = (TrafficPolicy) obj;
if (other.getId() == null ^ this.getId() == null)
return false;
if (other.getId() != null && other.getId().equals(this.getId()) == false)
return false;
if (other.getVersion() == null ^ this.getVersion() == null)
return false;
if (other.getVersion() != null && other.getVersion().equals(this.getVersion()) == false)
return false;
if (other.getName() == null ^ this.getName() == null)
return false;
if (other.getName() != null && other.getName().equals(this.getName()) == false)
return false;
if (other.getType() == null ^ this.getType() == null)
return false;
if (other.getType() != null && other.getType().equals(this.getType()) == false)
return false;
if (other.getDocument() == null ^ this.getDocument() == null)
return false;
if (other.getDocument() != null && other.getDocument().equals(this.getDocument()) == false)
return false;
if (other.getComment() == null ^ this.getComment() == null)
return false;
if (other.getComment() != null && other.getComment().equals(this.getComment()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getId() == null) ? 0 : getId().hashCode());
hashCode = prime * hashCode + ((getVersion() == null) ? 0 : getVersion().hashCode());
hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode());
hashCode = prime * hashCode + ((getType() == null) ? 0 : getType().hashCode());
hashCode = prime * hashCode + ((getDocument() == null) ? 0 : getDocument().hashCode());
hashCode = prime * hashCode + ((getComment() == null) ? 0 : getComment().hashCode());
return hashCode;
}
@Override
public TrafficPolicy clone() {
try {
return (TrafficPolicy) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}