
com.amazonaws.services.iot.model.TestAuthorizationRequest Maven / Gradle / Ivy
/*
* Copyright 2015-2020 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.iot.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.AmazonWebServiceRequest;
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class TestAuthorizationRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable {
/**
*
* The principal. Valid principals are CertificateArn
* (arn:aws:iot:region:accountId:cert/certificateId), thingGroupArn
* (arn:aws:iot:region:accountId:thinggroup/groupName) and CognitoId (region:id).
*
*/
private String principal;
/**
*
* The Cognito identity pool ID.
*
*/
private String cognitoIdentityPoolId;
/**
*
* A list of authorization info objects. Simulating authorization will create a response for each
* authInfo
object in the list.
*
*/
private java.util.List authInfos;
/**
*
* The MQTT client ID.
*
*/
private String clientId;
/**
*
* When testing custom authorization, the policies specified here are treated as if they are attached to the
* principal being authorized.
*
*/
private java.util.List policyNamesToAdd;
/**
*
* When testing custom authorization, the policies specified here are treated as if they are not attached to the
* principal being authorized.
*
*/
private java.util.List policyNamesToSkip;
/**
*
* The principal. Valid principals are CertificateArn
* (arn:aws:iot:region:accountId:cert/certificateId), thingGroupArn
* (arn:aws:iot:region:accountId:thinggroup/groupName) and CognitoId (region:id).
*
*
* @param principal
* The principal. Valid principals are CertificateArn
* (arn:aws:iot:region:accountId:cert/certificateId), thingGroupArn
* (arn:aws:iot:region:accountId:thinggroup/groupName) and CognitoId
* (region:id).
*/
public void setPrincipal(String principal) {
this.principal = principal;
}
/**
*
* The principal. Valid principals are CertificateArn
* (arn:aws:iot:region:accountId:cert/certificateId), thingGroupArn
* (arn:aws:iot:region:accountId:thinggroup/groupName) and CognitoId (region:id).
*
*
* @return The principal. Valid principals are CertificateArn
* (arn:aws:iot:region:accountId:cert/certificateId), thingGroupArn
* (arn:aws:iot:region:accountId:thinggroup/groupName) and CognitoId
* (region:id).
*/
public String getPrincipal() {
return this.principal;
}
/**
*
* The principal. Valid principals are CertificateArn
* (arn:aws:iot:region:accountId:cert/certificateId), thingGroupArn
* (arn:aws:iot:region:accountId:thinggroup/groupName) and CognitoId (region:id).
*
*
* @param principal
* The principal. Valid principals are CertificateArn
* (arn:aws:iot:region:accountId:cert/certificateId), thingGroupArn
* (arn:aws:iot:region:accountId:thinggroup/groupName) and CognitoId
* (region:id).
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TestAuthorizationRequest withPrincipal(String principal) {
setPrincipal(principal);
return this;
}
/**
*
* The Cognito identity pool ID.
*
*
* @param cognitoIdentityPoolId
* The Cognito identity pool ID.
*/
public void setCognitoIdentityPoolId(String cognitoIdentityPoolId) {
this.cognitoIdentityPoolId = cognitoIdentityPoolId;
}
/**
*
* The Cognito identity pool ID.
*
*
* @return The Cognito identity pool ID.
*/
public String getCognitoIdentityPoolId() {
return this.cognitoIdentityPoolId;
}
/**
*
* The Cognito identity pool ID.
*
*
* @param cognitoIdentityPoolId
* The Cognito identity pool ID.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TestAuthorizationRequest withCognitoIdentityPoolId(String cognitoIdentityPoolId) {
setCognitoIdentityPoolId(cognitoIdentityPoolId);
return this;
}
/**
*
* A list of authorization info objects. Simulating authorization will create a response for each
* authInfo
object in the list.
*
*
* @return A list of authorization info objects. Simulating authorization will create a response for each
* authInfo
object in the list.
*/
public java.util.List getAuthInfos() {
return authInfos;
}
/**
*
* A list of authorization info objects. Simulating authorization will create a response for each
* authInfo
object in the list.
*
*
* @param authInfos
* A list of authorization info objects. Simulating authorization will create a response for each
* authInfo
object in the list.
*/
public void setAuthInfos(java.util.Collection authInfos) {
if (authInfos == null) {
this.authInfos = null;
return;
}
this.authInfos = new java.util.ArrayList(authInfos);
}
/**
*
* A list of authorization info objects. Simulating authorization will create a response for each
* authInfo
object in the list.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setAuthInfos(java.util.Collection)} or {@link #withAuthInfos(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param authInfos
* A list of authorization info objects. Simulating authorization will create a response for each
* authInfo
object in the list.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TestAuthorizationRequest withAuthInfos(AuthInfo... authInfos) {
if (this.authInfos == null) {
setAuthInfos(new java.util.ArrayList(authInfos.length));
}
for (AuthInfo ele : authInfos) {
this.authInfos.add(ele);
}
return this;
}
/**
*
* A list of authorization info objects. Simulating authorization will create a response for each
* authInfo
object in the list.
*
*
* @param authInfos
* A list of authorization info objects. Simulating authorization will create a response for each
* authInfo
object in the list.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TestAuthorizationRequest withAuthInfos(java.util.Collection authInfos) {
setAuthInfos(authInfos);
return this;
}
/**
*
* The MQTT client ID.
*
*
* @param clientId
* The MQTT client ID.
*/
public void setClientId(String clientId) {
this.clientId = clientId;
}
/**
*
* The MQTT client ID.
*
*
* @return The MQTT client ID.
*/
public String getClientId() {
return this.clientId;
}
/**
*
* The MQTT client ID.
*
*
* @param clientId
* The MQTT client ID.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TestAuthorizationRequest withClientId(String clientId) {
setClientId(clientId);
return this;
}
/**
*
* When testing custom authorization, the policies specified here are treated as if they are attached to the
* principal being authorized.
*
*
* @return When testing custom authorization, the policies specified here are treated as if they are attached to the
* principal being authorized.
*/
public java.util.List getPolicyNamesToAdd() {
return policyNamesToAdd;
}
/**
*
* When testing custom authorization, the policies specified here are treated as if they are attached to the
* principal being authorized.
*
*
* @param policyNamesToAdd
* When testing custom authorization, the policies specified here are treated as if they are attached to the
* principal being authorized.
*/
public void setPolicyNamesToAdd(java.util.Collection policyNamesToAdd) {
if (policyNamesToAdd == null) {
this.policyNamesToAdd = null;
return;
}
this.policyNamesToAdd = new java.util.ArrayList(policyNamesToAdd);
}
/**
*
* When testing custom authorization, the policies specified here are treated as if they are attached to the
* principal being authorized.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setPolicyNamesToAdd(java.util.Collection)} or {@link #withPolicyNamesToAdd(java.util.Collection)} if you
* want to override the existing values.
*
*
* @param policyNamesToAdd
* When testing custom authorization, the policies specified here are treated as if they are attached to the
* principal being authorized.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TestAuthorizationRequest withPolicyNamesToAdd(String... policyNamesToAdd) {
if (this.policyNamesToAdd == null) {
setPolicyNamesToAdd(new java.util.ArrayList(policyNamesToAdd.length));
}
for (String ele : policyNamesToAdd) {
this.policyNamesToAdd.add(ele);
}
return this;
}
/**
*
* When testing custom authorization, the policies specified here are treated as if they are attached to the
* principal being authorized.
*
*
* @param policyNamesToAdd
* When testing custom authorization, the policies specified here are treated as if they are attached to the
* principal being authorized.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TestAuthorizationRequest withPolicyNamesToAdd(java.util.Collection policyNamesToAdd) {
setPolicyNamesToAdd(policyNamesToAdd);
return this;
}
/**
*
* When testing custom authorization, the policies specified here are treated as if they are not attached to the
* principal being authorized.
*
*
* @return When testing custom authorization, the policies specified here are treated as if they are not attached to
* the principal being authorized.
*/
public java.util.List getPolicyNamesToSkip() {
return policyNamesToSkip;
}
/**
*
* When testing custom authorization, the policies specified here are treated as if they are not attached to the
* principal being authorized.
*
*
* @param policyNamesToSkip
* When testing custom authorization, the policies specified here are treated as if they are not attached to
* the principal being authorized.
*/
public void setPolicyNamesToSkip(java.util.Collection policyNamesToSkip) {
if (policyNamesToSkip == null) {
this.policyNamesToSkip = null;
return;
}
this.policyNamesToSkip = new java.util.ArrayList(policyNamesToSkip);
}
/**
*
* When testing custom authorization, the policies specified here are treated as if they are not attached to the
* principal being authorized.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setPolicyNamesToSkip(java.util.Collection)} or {@link #withPolicyNamesToSkip(java.util.Collection)} if
* you want to override the existing values.
*
*
* @param policyNamesToSkip
* When testing custom authorization, the policies specified here are treated as if they are not attached to
* the principal being authorized.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TestAuthorizationRequest withPolicyNamesToSkip(String... policyNamesToSkip) {
if (this.policyNamesToSkip == null) {
setPolicyNamesToSkip(new java.util.ArrayList(policyNamesToSkip.length));
}
for (String ele : policyNamesToSkip) {
this.policyNamesToSkip.add(ele);
}
return this;
}
/**
*
* When testing custom authorization, the policies specified here are treated as if they are not attached to the
* principal being authorized.
*
*
* @param policyNamesToSkip
* When testing custom authorization, the policies specified here are treated as if they are not attached to
* the principal being authorized.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TestAuthorizationRequest withPolicyNamesToSkip(java.util.Collection policyNamesToSkip) {
setPolicyNamesToSkip(policyNamesToSkip);
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 (getPrincipal() != null)
sb.append("Principal: ").append(getPrincipal()).append(",");
if (getCognitoIdentityPoolId() != null)
sb.append("CognitoIdentityPoolId: ").append(getCognitoIdentityPoolId()).append(",");
if (getAuthInfos() != null)
sb.append("AuthInfos: ").append(getAuthInfos()).append(",");
if (getClientId() != null)
sb.append("ClientId: ").append(getClientId()).append(",");
if (getPolicyNamesToAdd() != null)
sb.append("PolicyNamesToAdd: ").append(getPolicyNamesToAdd()).append(",");
if (getPolicyNamesToSkip() != null)
sb.append("PolicyNamesToSkip: ").append(getPolicyNamesToSkip());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof TestAuthorizationRequest == false)
return false;
TestAuthorizationRequest other = (TestAuthorizationRequest) obj;
if (other.getPrincipal() == null ^ this.getPrincipal() == null)
return false;
if (other.getPrincipal() != null && other.getPrincipal().equals(this.getPrincipal()) == false)
return false;
if (other.getCognitoIdentityPoolId() == null ^ this.getCognitoIdentityPoolId() == null)
return false;
if (other.getCognitoIdentityPoolId() != null && other.getCognitoIdentityPoolId().equals(this.getCognitoIdentityPoolId()) == false)
return false;
if (other.getAuthInfos() == null ^ this.getAuthInfos() == null)
return false;
if (other.getAuthInfos() != null && other.getAuthInfos().equals(this.getAuthInfos()) == false)
return false;
if (other.getClientId() == null ^ this.getClientId() == null)
return false;
if (other.getClientId() != null && other.getClientId().equals(this.getClientId()) == false)
return false;
if (other.getPolicyNamesToAdd() == null ^ this.getPolicyNamesToAdd() == null)
return false;
if (other.getPolicyNamesToAdd() != null && other.getPolicyNamesToAdd().equals(this.getPolicyNamesToAdd()) == false)
return false;
if (other.getPolicyNamesToSkip() == null ^ this.getPolicyNamesToSkip() == null)
return false;
if (other.getPolicyNamesToSkip() != null && other.getPolicyNamesToSkip().equals(this.getPolicyNamesToSkip()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getPrincipal() == null) ? 0 : getPrincipal().hashCode());
hashCode = prime * hashCode + ((getCognitoIdentityPoolId() == null) ? 0 : getCognitoIdentityPoolId().hashCode());
hashCode = prime * hashCode + ((getAuthInfos() == null) ? 0 : getAuthInfos().hashCode());
hashCode = prime * hashCode + ((getClientId() == null) ? 0 : getClientId().hashCode());
hashCode = prime * hashCode + ((getPolicyNamesToAdd() == null) ? 0 : getPolicyNamesToAdd().hashCode());
hashCode = prime * hashCode + ((getPolicyNamesToSkip() == null) ? 0 : getPolicyNamesToSkip().hashCode());
return hashCode;
}
@Override
public TestAuthorizationRequest clone() {
return (TestAuthorizationRequest) super.clone();
}
}