com.amazonaws.services.workmail.model.ImpersonationRule Maven / Gradle / Ivy
Show all versions of aws-java-sdk-workmail Show documentation
/*
* Copyright 2019-2024 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.workmail.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* The rules for the given impersonation role.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ImpersonationRule implements Serializable, Cloneable, StructuredPojo {
/**
*
* The identifier of the rule.
*
*/
private String impersonationRuleId;
/**
*
* The rule name.
*
*/
private String name;
/**
*
* The rule description.
*
*/
private String description;
/**
*
* The effect of the rule when it matches the input. Allowed effect values are ALLOW
or
* DENY
.
*
*/
private String effect;
/**
*
* A list of user IDs that match the rule.
*
*/
private java.util.List targetUsers;
/**
*
* A list of user IDs that don't match the rule.
*
*/
private java.util.List notTargetUsers;
/**
*
* The identifier of the rule.
*
*
* @param impersonationRuleId
* The identifier of the rule.
*/
public void setImpersonationRuleId(String impersonationRuleId) {
this.impersonationRuleId = impersonationRuleId;
}
/**
*
* The identifier of the rule.
*
*
* @return The identifier of the rule.
*/
public String getImpersonationRuleId() {
return this.impersonationRuleId;
}
/**
*
* The identifier of the rule.
*
*
* @param impersonationRuleId
* The identifier of the rule.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ImpersonationRule withImpersonationRuleId(String impersonationRuleId) {
setImpersonationRuleId(impersonationRuleId);
return this;
}
/**
*
* The rule name.
*
*
* @param name
* The rule name.
*/
public void setName(String name) {
this.name = name;
}
/**
*
* The rule name.
*
*
* @return The rule name.
*/
public String getName() {
return this.name;
}
/**
*
* The rule name.
*
*
* @param name
* The rule name.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ImpersonationRule withName(String name) {
setName(name);
return this;
}
/**
*
* The rule description.
*
*
* @param description
* The rule description.
*/
public void setDescription(String description) {
this.description = description;
}
/**
*
* The rule description.
*
*
* @return The rule description.
*/
public String getDescription() {
return this.description;
}
/**
*
* The rule description.
*
*
* @param description
* The rule description.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ImpersonationRule withDescription(String description) {
setDescription(description);
return this;
}
/**
*
* The effect of the rule when it matches the input. Allowed effect values are ALLOW
or
* DENY
.
*
*
* @param effect
* The effect of the rule when it matches the input. Allowed effect values are ALLOW
or
* DENY
.
* @see AccessEffect
*/
public void setEffect(String effect) {
this.effect = effect;
}
/**
*
* The effect of the rule when it matches the input. Allowed effect values are ALLOW
or
* DENY
.
*
*
* @return The effect of the rule when it matches the input. Allowed effect values are ALLOW
or
* DENY
.
* @see AccessEffect
*/
public String getEffect() {
return this.effect;
}
/**
*
* The effect of the rule when it matches the input. Allowed effect values are ALLOW
or
* DENY
.
*
*
* @param effect
* The effect of the rule when it matches the input. Allowed effect values are ALLOW
or
* DENY
.
* @return Returns a reference to this object so that method calls can be chained together.
* @see AccessEffect
*/
public ImpersonationRule withEffect(String effect) {
setEffect(effect);
return this;
}
/**
*
* The effect of the rule when it matches the input. Allowed effect values are ALLOW
or
* DENY
.
*
*
* @param effect
* The effect of the rule when it matches the input. Allowed effect values are ALLOW
or
* DENY
.
* @return Returns a reference to this object so that method calls can be chained together.
* @see AccessEffect
*/
public ImpersonationRule withEffect(AccessEffect effect) {
this.effect = effect.toString();
return this;
}
/**
*
* A list of user IDs that match the rule.
*
*
* @return A list of user IDs that match the rule.
*/
public java.util.List getTargetUsers() {
return targetUsers;
}
/**
*
* A list of user IDs that match the rule.
*
*
* @param targetUsers
* A list of user IDs that match the rule.
*/
public void setTargetUsers(java.util.Collection targetUsers) {
if (targetUsers == null) {
this.targetUsers = null;
return;
}
this.targetUsers = new java.util.ArrayList(targetUsers);
}
/**
*
* A list of user IDs that match the rule.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setTargetUsers(java.util.Collection)} or {@link #withTargetUsers(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param targetUsers
* A list of user IDs that match the rule.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ImpersonationRule withTargetUsers(String... targetUsers) {
if (this.targetUsers == null) {
setTargetUsers(new java.util.ArrayList(targetUsers.length));
}
for (String ele : targetUsers) {
this.targetUsers.add(ele);
}
return this;
}
/**
*
* A list of user IDs that match the rule.
*
*
* @param targetUsers
* A list of user IDs that match the rule.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ImpersonationRule withTargetUsers(java.util.Collection targetUsers) {
setTargetUsers(targetUsers);
return this;
}
/**
*
* A list of user IDs that don't match the rule.
*
*
* @return A list of user IDs that don't match the rule.
*/
public java.util.List getNotTargetUsers() {
return notTargetUsers;
}
/**
*
* A list of user IDs that don't match the rule.
*
*
* @param notTargetUsers
* A list of user IDs that don't match the rule.
*/
public void setNotTargetUsers(java.util.Collection notTargetUsers) {
if (notTargetUsers == null) {
this.notTargetUsers = null;
return;
}
this.notTargetUsers = new java.util.ArrayList(notTargetUsers);
}
/**
*
* A list of user IDs that don't match the rule.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setNotTargetUsers(java.util.Collection)} or {@link #withNotTargetUsers(java.util.Collection)} if you want
* to override the existing values.
*
*
* @param notTargetUsers
* A list of user IDs that don't match the rule.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ImpersonationRule withNotTargetUsers(String... notTargetUsers) {
if (this.notTargetUsers == null) {
setNotTargetUsers(new java.util.ArrayList(notTargetUsers.length));
}
for (String ele : notTargetUsers) {
this.notTargetUsers.add(ele);
}
return this;
}
/**
*
* A list of user IDs that don't match the rule.
*
*
* @param notTargetUsers
* A list of user IDs that don't match the rule.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ImpersonationRule withNotTargetUsers(java.util.Collection notTargetUsers) {
setNotTargetUsers(notTargetUsers);
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 (getImpersonationRuleId() != null)
sb.append("ImpersonationRuleId: ").append(getImpersonationRuleId()).append(",");
if (getName() != null)
sb.append("Name: ").append(getName()).append(",");
if (getDescription() != null)
sb.append("Description: ").append(getDescription()).append(",");
if (getEffect() != null)
sb.append("Effect: ").append(getEffect()).append(",");
if (getTargetUsers() != null)
sb.append("TargetUsers: ").append(getTargetUsers()).append(",");
if (getNotTargetUsers() != null)
sb.append("NotTargetUsers: ").append(getNotTargetUsers());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof ImpersonationRule == false)
return false;
ImpersonationRule other = (ImpersonationRule) obj;
if (other.getImpersonationRuleId() == null ^ this.getImpersonationRuleId() == null)
return false;
if (other.getImpersonationRuleId() != null && other.getImpersonationRuleId().equals(this.getImpersonationRuleId()) == 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.getDescription() == null ^ this.getDescription() == null)
return false;
if (other.getDescription() != null && other.getDescription().equals(this.getDescription()) == false)
return false;
if (other.getEffect() == null ^ this.getEffect() == null)
return false;
if (other.getEffect() != null && other.getEffect().equals(this.getEffect()) == false)
return false;
if (other.getTargetUsers() == null ^ this.getTargetUsers() == null)
return false;
if (other.getTargetUsers() != null && other.getTargetUsers().equals(this.getTargetUsers()) == false)
return false;
if (other.getNotTargetUsers() == null ^ this.getNotTargetUsers() == null)
return false;
if (other.getNotTargetUsers() != null && other.getNotTargetUsers().equals(this.getNotTargetUsers()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getImpersonationRuleId() == null) ? 0 : getImpersonationRuleId().hashCode());
hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode());
hashCode = prime * hashCode + ((getDescription() == null) ? 0 : getDescription().hashCode());
hashCode = prime * hashCode + ((getEffect() == null) ? 0 : getEffect().hashCode());
hashCode = prime * hashCode + ((getTargetUsers() == null) ? 0 : getTargetUsers().hashCode());
hashCode = prime * hashCode + ((getNotTargetUsers() == null) ? 0 : getNotTargetUsers().hashCode());
return hashCode;
}
@Override
public ImpersonationRule clone() {
try {
return (ImpersonationRule) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.workmail.model.transform.ImpersonationRuleMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}