
com.amazonaws.services.ram.model.Principal Maven / Gradle / Ivy
/*
* 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.ram.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* Describes a principal for use with Resource Access Manager.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class Principal implements Serializable, Cloneable, StructuredPojo {
/**
*
* The ID of the principal that can be associated with a resource share.
*
*/
private String id;
/**
*
* The Amazon Resource Name
* (ARN) of a resource share the principal is associated with.
*
*/
private String resourceShareArn;
/**
*
* The date and time when the principal was associated with the resource share.
*
*/
private java.util.Date creationTime;
/**
*
* The date and time when the association between the resource share and the principal was last updated.
*
*/
private java.util.Date lastUpdatedTime;
/**
*
* Indicates the relationship between the Amazon Web Services account the principal belongs to and the account that
* owns the resource share:
*
*
* -
*
* True
– The two accounts belong to same organization.
*
*
* -
*
* False
– The two accounts do not belong to the same organization.
*
*
*
*/
private Boolean external;
/**
*
* The ID of the principal that can be associated with a resource share.
*
*
* @param id
* The ID of the principal that can be associated with a resource share.
*/
public void setId(String id) {
this.id = id;
}
/**
*
* The ID of the principal that can be associated with a resource share.
*
*
* @return The ID of the principal that can be associated with a resource share.
*/
public String getId() {
return this.id;
}
/**
*
* The ID of the principal that can be associated with a resource share.
*
*
* @param id
* The ID of the principal that can be associated with a resource share.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Principal withId(String id) {
setId(id);
return this;
}
/**
*
* The Amazon Resource Name
* (ARN) of a resource share the principal is associated with.
*
*
* @param resourceShareArn
* The Amazon Resource
* Name (ARN) of a resource share the principal is associated with.
*/
public void setResourceShareArn(String resourceShareArn) {
this.resourceShareArn = resourceShareArn;
}
/**
*
* The Amazon Resource Name
* (ARN) of a resource share the principal is associated with.
*
*
* @return The Amazon Resource
* Name (ARN) of a resource share the principal is associated with.
*/
public String getResourceShareArn() {
return this.resourceShareArn;
}
/**
*
* The Amazon Resource Name
* (ARN) of a resource share the principal is associated with.
*
*
* @param resourceShareArn
* The Amazon Resource
* Name (ARN) of a resource share the principal is associated with.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Principal withResourceShareArn(String resourceShareArn) {
setResourceShareArn(resourceShareArn);
return this;
}
/**
*
* The date and time when the principal was associated with the resource share.
*
*
* @param creationTime
* The date and time when the principal was associated with the resource share.
*/
public void setCreationTime(java.util.Date creationTime) {
this.creationTime = creationTime;
}
/**
*
* The date and time when the principal was associated with the resource share.
*
*
* @return The date and time when the principal was associated with the resource share.
*/
public java.util.Date getCreationTime() {
return this.creationTime;
}
/**
*
* The date and time when the principal was associated with the resource share.
*
*
* @param creationTime
* The date and time when the principal was associated with the resource share.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Principal withCreationTime(java.util.Date creationTime) {
setCreationTime(creationTime);
return this;
}
/**
*
* The date and time when the association between the resource share and the principal was last updated.
*
*
* @param lastUpdatedTime
* The date and time when the association between the resource share and the principal was last updated.
*/
public void setLastUpdatedTime(java.util.Date lastUpdatedTime) {
this.lastUpdatedTime = lastUpdatedTime;
}
/**
*
* The date and time when the association between the resource share and the principal was last updated.
*
*
* @return The date and time when the association between the resource share and the principal was last updated.
*/
public java.util.Date getLastUpdatedTime() {
return this.lastUpdatedTime;
}
/**
*
* The date and time when the association between the resource share and the principal was last updated.
*
*
* @param lastUpdatedTime
* The date and time when the association between the resource share and the principal was last updated.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Principal withLastUpdatedTime(java.util.Date lastUpdatedTime) {
setLastUpdatedTime(lastUpdatedTime);
return this;
}
/**
*
* Indicates the relationship between the Amazon Web Services account the principal belongs to and the account that
* owns the resource share:
*
*
* -
*
* True
– The two accounts belong to same organization.
*
*
* -
*
* False
– The two accounts do not belong to the same organization.
*
*
*
*
* @param external
* Indicates the relationship between the Amazon Web Services account the principal belongs to and the
* account that owns the resource share:
*
* -
*
* True
– The two accounts belong to same organization.
*
*
* -
*
* False
– The two accounts do not belong to the same organization.
*
*
*/
public void setExternal(Boolean external) {
this.external = external;
}
/**
*
* Indicates the relationship between the Amazon Web Services account the principal belongs to and the account that
* owns the resource share:
*
*
* -
*
* True
– The two accounts belong to same organization.
*
*
* -
*
* False
– The two accounts do not belong to the same organization.
*
*
*
*
* @return Indicates the relationship between the Amazon Web Services account the principal belongs to and the
* account that owns the resource share:
*
* -
*
* True
– The two accounts belong to same organization.
*
*
* -
*
* False
– The two accounts do not belong to the same organization.
*
*
*/
public Boolean getExternal() {
return this.external;
}
/**
*
* Indicates the relationship between the Amazon Web Services account the principal belongs to and the account that
* owns the resource share:
*
*
* -
*
* True
– The two accounts belong to same organization.
*
*
* -
*
* False
– The two accounts do not belong to the same organization.
*
*
*
*
* @param external
* Indicates the relationship between the Amazon Web Services account the principal belongs to and the
* account that owns the resource share:
*
* -
*
* True
– The two accounts belong to same organization.
*
*
* -
*
* False
– The two accounts do not belong to the same organization.
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Principal withExternal(Boolean external) {
setExternal(external);
return this;
}
/**
*
* Indicates the relationship between the Amazon Web Services account the principal belongs to and the account that
* owns the resource share:
*
*
* -
*
* True
– The two accounts belong to same organization.
*
*
* -
*
* False
– The two accounts do not belong to the same organization.
*
*
*
*
* @return Indicates the relationship between the Amazon Web Services account the principal belongs to and the
* account that owns the resource share:
*
* -
*
* True
– The two accounts belong to same organization.
*
*
* -
*
* False
– The two accounts do not belong to the same organization.
*
*
*/
public Boolean isExternal() {
return this.external;
}
/**
* 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 (getResourceShareArn() != null)
sb.append("ResourceShareArn: ").append(getResourceShareArn()).append(",");
if (getCreationTime() != null)
sb.append("CreationTime: ").append(getCreationTime()).append(",");
if (getLastUpdatedTime() != null)
sb.append("LastUpdatedTime: ").append(getLastUpdatedTime()).append(",");
if (getExternal() != null)
sb.append("External: ").append(getExternal());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof Principal == false)
return false;
Principal other = (Principal) obj;
if (other.getId() == null ^ this.getId() == null)
return false;
if (other.getId() != null && other.getId().equals(this.getId()) == false)
return false;
if (other.getResourceShareArn() == null ^ this.getResourceShareArn() == null)
return false;
if (other.getResourceShareArn() != null && other.getResourceShareArn().equals(this.getResourceShareArn()) == false)
return false;
if (other.getCreationTime() == null ^ this.getCreationTime() == null)
return false;
if (other.getCreationTime() != null && other.getCreationTime().equals(this.getCreationTime()) == false)
return false;
if (other.getLastUpdatedTime() == null ^ this.getLastUpdatedTime() == null)
return false;
if (other.getLastUpdatedTime() != null && other.getLastUpdatedTime().equals(this.getLastUpdatedTime()) == false)
return false;
if (other.getExternal() == null ^ this.getExternal() == null)
return false;
if (other.getExternal() != null && other.getExternal().equals(this.getExternal()) == 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 + ((getResourceShareArn() == null) ? 0 : getResourceShareArn().hashCode());
hashCode = prime * hashCode + ((getCreationTime() == null) ? 0 : getCreationTime().hashCode());
hashCode = prime * hashCode + ((getLastUpdatedTime() == null) ? 0 : getLastUpdatedTime().hashCode());
hashCode = prime * hashCode + ((getExternal() == null) ? 0 : getExternal().hashCode());
return hashCode;
}
@Override
public Principal clone() {
try {
return (Principal) 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.ram.model.transform.PrincipalMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}