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

com.amazonaws.services.identitymanagement.model.ContextEntry Maven / Gradle / Ivy

Go to download

The AWS Java SDK for AWS IAM module holds the client classes that are used for communicating with AWS Identity and Access Management Service

There is a newer version: 1.12.782
Show newest version
/*
 * Copyright 2010-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.identitymanagement.model;

import java.io.Serializable;

/**
 * 

* Contains information about a condition context key. It includes the name of * the key and specifies the value (or values, if the context key supports * multiple values) to use in the simulation. This information is used when * evaluating the Condition elements of the input policies. *

*

* This data type is used as an input parameter to * SimulateCustomPolicy and * SimulateCustomPolicy . *

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

* The full name of a condition context key, including the service prefix. * For example, aws:SourceIp or s3:VersionId. *

*/ private String contextKeyName; /** *

* The value (or values, if the condition context key supports multiple * values) to provide to the simulation for use when the key is referenced * by a Condition element in an input policy. *

*/ private com.amazonaws.internal.SdkInternalList contextKeyValues; /** *

* The data type of the value (or values) specified in the * ContextKeyValues parameter. *

*/ private String contextKeyType; /** *

* The full name of a condition context key, including the service prefix. * For example, aws:SourceIp or s3:VersionId. *

* * @param contextKeyName * The full name of a condition context key, including the service * prefix. For example, aws:SourceIp or * s3:VersionId. */ public void setContextKeyName(String contextKeyName) { this.contextKeyName = contextKeyName; } /** *

* The full name of a condition context key, including the service prefix. * For example, aws:SourceIp or s3:VersionId. *

* * @return The full name of a condition context key, including the service * prefix. For example, aws:SourceIp or * s3:VersionId. */ public String getContextKeyName() { return this.contextKeyName; } /** *

* The full name of a condition context key, including the service prefix. * For example, aws:SourceIp or s3:VersionId. *

* * @param contextKeyName * The full name of a condition context key, including the service * prefix. For example, aws:SourceIp or * s3:VersionId. * @return Returns a reference to this object so that method calls can be * chained together. */ public ContextEntry withContextKeyName(String contextKeyName) { setContextKeyName(contextKeyName); return this; } /** *

* The value (or values, if the condition context key supports multiple * values) to provide to the simulation for use when the key is referenced * by a Condition element in an input policy. *

* * @return The value (or values, if the condition context key supports * multiple values) to provide to the simulation for use when the * key is referenced by a Condition element in an input * policy. */ public java.util.List getContextKeyValues() { if (contextKeyValues == null) { contextKeyValues = new com.amazonaws.internal.SdkInternalList(); } return contextKeyValues; } /** *

* The value (or values, if the condition context key supports multiple * values) to provide to the simulation for use when the key is referenced * by a Condition element in an input policy. *

* * @param contextKeyValues * The value (or values, if the condition context key supports * multiple values) to provide to the simulation for use when the key * is referenced by a Condition element in an input * policy. */ public void setContextKeyValues( java.util.Collection contextKeyValues) { if (contextKeyValues == null) { this.contextKeyValues = null; return; } this.contextKeyValues = new com.amazonaws.internal.SdkInternalList( contextKeyValues); } /** *

* The value (or values, if the condition context key supports multiple * values) to provide to the simulation for use when the key is referenced * by a Condition element in an input policy. *

*

* NOTE: This method appends the values to the existing list (if * any). Use {@link #setContextKeyValues(java.util.Collection)} or * {@link #withContextKeyValues(java.util.Collection)} if you want to * override the existing values. *

* * @param contextKeyValues * The value (or values, if the condition context key supports * multiple values) to provide to the simulation for use when the key * is referenced by a Condition element in an input * policy. * @return Returns a reference to this object so that method calls can be * chained together. */ public ContextEntry withContextKeyValues(String... contextKeyValues) { if (this.contextKeyValues == null) { setContextKeyValues(new com.amazonaws.internal.SdkInternalList( contextKeyValues.length)); } for (String ele : contextKeyValues) { this.contextKeyValues.add(ele); } return this; } /** *

* The value (or values, if the condition context key supports multiple * values) to provide to the simulation for use when the key is referenced * by a Condition element in an input policy. *

* * @param contextKeyValues * The value (or values, if the condition context key supports * multiple values) to provide to the simulation for use when the key * is referenced by a Condition element in an input * policy. * @return Returns a reference to this object so that method calls can be * chained together. */ public ContextEntry withContextKeyValues( java.util.Collection contextKeyValues) { setContextKeyValues(contextKeyValues); return this; } /** *

* The data type of the value (or values) specified in the * ContextKeyValues parameter. *

* * @param contextKeyType * The data type of the value (or values) specified in the * ContextKeyValues parameter. * @see ContextKeyTypeEnum */ public void setContextKeyType(String contextKeyType) { this.contextKeyType = contextKeyType; } /** *

* The data type of the value (or values) specified in the * ContextKeyValues parameter. *

* * @return The data type of the value (or values) specified in the * ContextKeyValues parameter. * @see ContextKeyTypeEnum */ public String getContextKeyType() { return this.contextKeyType; } /** *

* The data type of the value (or values) specified in the * ContextKeyValues parameter. *

* * @param contextKeyType * The data type of the value (or values) specified in the * ContextKeyValues parameter. * @return Returns a reference to this object so that method calls can be * chained together. * @see ContextKeyTypeEnum */ public ContextEntry withContextKeyType(String contextKeyType) { setContextKeyType(contextKeyType); return this; } /** *

* The data type of the value (or values) specified in the * ContextKeyValues parameter. *

* * @param contextKeyType * The data type of the value (or values) specified in the * ContextKeyValues parameter. * @see ContextKeyTypeEnum */ public void setContextKeyType(ContextKeyTypeEnum contextKeyType) { this.contextKeyType = contextKeyType.toString(); } /** *

* The data type of the value (or values) specified in the * ContextKeyValues parameter. *

* * @param contextKeyType * The data type of the value (or values) specified in the * ContextKeyValues parameter. * @return Returns a reference to this object so that method calls can be * chained together. * @see ContextKeyTypeEnum */ public ContextEntry withContextKeyType(ContextKeyTypeEnum contextKeyType) { setContextKeyType(contextKeyType); 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 (getContextKeyName() != null) sb.append("ContextKeyName: " + getContextKeyName() + ","); if (getContextKeyValues() != null) sb.append("ContextKeyValues: " + getContextKeyValues() + ","); if (getContextKeyType() != null) sb.append("ContextKeyType: " + getContextKeyType()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ContextEntry == false) return false; ContextEntry other = (ContextEntry) obj; if (other.getContextKeyName() == null ^ this.getContextKeyName() == null) return false; if (other.getContextKeyName() != null && other.getContextKeyName().equals(this.getContextKeyName()) == false) return false; if (other.getContextKeyValues() == null ^ this.getContextKeyValues() == null) return false; if (other.getContextKeyValues() != null && other.getContextKeyValues().equals( this.getContextKeyValues()) == false) return false; if (other.getContextKeyType() == null ^ this.getContextKeyType() == null) return false; if (other.getContextKeyType() != null && other.getContextKeyType().equals(this.getContextKeyType()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getContextKeyName() == null) ? 0 : getContextKeyName() .hashCode()); hashCode = prime * hashCode + ((getContextKeyValues() == null) ? 0 : getContextKeyValues() .hashCode()); hashCode = prime * hashCode + ((getContextKeyType() == null) ? 0 : getContextKeyType() .hashCode()); return hashCode; } @Override public ContextEntry clone() { try { return (ContextEntry) 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