
com.amazonaws.services.accessanalyzer.model.AnalyzedResource 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.accessanalyzer.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* Contains details about the analyzed resource.
*
*
* @see AWS
* API Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AnalyzedResource implements Serializable, Cloneable, StructuredPojo {
/**
*
* The ARN of the resource that was analyzed.
*
*/
private String resourceArn;
/**
*
* The type of the resource that was analyzed.
*
*/
private String resourceType;
/**
*
* The time at which the finding was created.
*
*/
private java.util.Date createdAt;
/**
*
* The time at which the resource was analyzed.
*
*/
private java.util.Date analyzedAt;
/**
*
* The time at which the finding was updated.
*
*/
private java.util.Date updatedAt;
/**
*
* Indicates whether the policy that generated the finding grants public access to the resource.
*
*/
private Boolean isPublic;
/**
*
* The actions that an external principal is granted permission to use by the policy that generated the finding.
*
*/
private java.util.List actions;
/**
*
* Indicates how the access that generated the finding is granted. This is populated for Amazon S3 bucket findings.
*
*/
private java.util.List sharedVia;
/**
*
* The current status of the finding generated from the analyzed resource.
*
*/
private String status;
/**
*
* The Amazon Web Services account ID that owns the resource.
*
*/
private String resourceOwnerAccount;
/**
*
* An error message.
*
*/
private String error;
/**
*
* The ARN of the resource that was analyzed.
*
*
* @param resourceArn
* The ARN of the resource that was analyzed.
*/
public void setResourceArn(String resourceArn) {
this.resourceArn = resourceArn;
}
/**
*
* The ARN of the resource that was analyzed.
*
*
* @return The ARN of the resource that was analyzed.
*/
public String getResourceArn() {
return this.resourceArn;
}
/**
*
* The ARN of the resource that was analyzed.
*
*
* @param resourceArn
* The ARN of the resource that was analyzed.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public AnalyzedResource withResourceArn(String resourceArn) {
setResourceArn(resourceArn);
return this;
}
/**
*
* The type of the resource that was analyzed.
*
*
* @param resourceType
* The type of the resource that was analyzed.
* @see ResourceType
*/
public void setResourceType(String resourceType) {
this.resourceType = resourceType;
}
/**
*
* The type of the resource that was analyzed.
*
*
* @return The type of the resource that was analyzed.
* @see ResourceType
*/
public String getResourceType() {
return this.resourceType;
}
/**
*
* The type of the resource that was analyzed.
*
*
* @param resourceType
* The type of the resource that was analyzed.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ResourceType
*/
public AnalyzedResource withResourceType(String resourceType) {
setResourceType(resourceType);
return this;
}
/**
*
* The type of the resource that was analyzed.
*
*
* @param resourceType
* The type of the resource that was analyzed.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ResourceType
*/
public AnalyzedResource withResourceType(ResourceType resourceType) {
this.resourceType = resourceType.toString();
return this;
}
/**
*
* The time at which the finding was created.
*
*
* @param createdAt
* The time at which the finding was created.
*/
public void setCreatedAt(java.util.Date createdAt) {
this.createdAt = createdAt;
}
/**
*
* The time at which the finding was created.
*
*
* @return The time at which the finding was created.
*/
public java.util.Date getCreatedAt() {
return this.createdAt;
}
/**
*
* The time at which the finding was created.
*
*
* @param createdAt
* The time at which the finding was created.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public AnalyzedResource withCreatedAt(java.util.Date createdAt) {
setCreatedAt(createdAt);
return this;
}
/**
*
* The time at which the resource was analyzed.
*
*
* @param analyzedAt
* The time at which the resource was analyzed.
*/
public void setAnalyzedAt(java.util.Date analyzedAt) {
this.analyzedAt = analyzedAt;
}
/**
*
* The time at which the resource was analyzed.
*
*
* @return The time at which the resource was analyzed.
*/
public java.util.Date getAnalyzedAt() {
return this.analyzedAt;
}
/**
*
* The time at which the resource was analyzed.
*
*
* @param analyzedAt
* The time at which the resource was analyzed.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public AnalyzedResource withAnalyzedAt(java.util.Date analyzedAt) {
setAnalyzedAt(analyzedAt);
return this;
}
/**
*
* The time at which the finding was updated.
*
*
* @param updatedAt
* The time at which the finding was updated.
*/
public void setUpdatedAt(java.util.Date updatedAt) {
this.updatedAt = updatedAt;
}
/**
*
* The time at which the finding was updated.
*
*
* @return The time at which the finding was updated.
*/
public java.util.Date getUpdatedAt() {
return this.updatedAt;
}
/**
*
* The time at which the finding was updated.
*
*
* @param updatedAt
* The time at which the finding was updated.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public AnalyzedResource withUpdatedAt(java.util.Date updatedAt) {
setUpdatedAt(updatedAt);
return this;
}
/**
*
* Indicates whether the policy that generated the finding grants public access to the resource.
*
*
* @param isPublic
* Indicates whether the policy that generated the finding grants public access to the resource.
*/
public void setIsPublic(Boolean isPublic) {
this.isPublic = isPublic;
}
/**
*
* Indicates whether the policy that generated the finding grants public access to the resource.
*
*
* @return Indicates whether the policy that generated the finding grants public access to the resource.
*/
public Boolean getIsPublic() {
return this.isPublic;
}
/**
*
* Indicates whether the policy that generated the finding grants public access to the resource.
*
*
* @param isPublic
* Indicates whether the policy that generated the finding grants public access to the resource.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public AnalyzedResource withIsPublic(Boolean isPublic) {
setIsPublic(isPublic);
return this;
}
/**
*
* Indicates whether the policy that generated the finding grants public access to the resource.
*
*
* @return Indicates whether the policy that generated the finding grants public access to the resource.
*/
public Boolean isPublic() {
return this.isPublic;
}
/**
*
* The actions that an external principal is granted permission to use by the policy that generated the finding.
*
*
* @return The actions that an external principal is granted permission to use by the policy that generated the
* finding.
*/
public java.util.List getActions() {
return actions;
}
/**
*
* The actions that an external principal is granted permission to use by the policy that generated the finding.
*
*
* @param actions
* The actions that an external principal is granted permission to use by the policy that generated the
* finding.
*/
public void setActions(java.util.Collection actions) {
if (actions == null) {
this.actions = null;
return;
}
this.actions = new java.util.ArrayList(actions);
}
/**
*
* The actions that an external principal is granted permission to use by the policy that generated the finding.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setActions(java.util.Collection)} or {@link #withActions(java.util.Collection)} if you want to override
* the existing values.
*
*
* @param actions
* The actions that an external principal is granted permission to use by the policy that generated the
* finding.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public AnalyzedResource withActions(String... actions) {
if (this.actions == null) {
setActions(new java.util.ArrayList(actions.length));
}
for (String ele : actions) {
this.actions.add(ele);
}
return this;
}
/**
*
* The actions that an external principal is granted permission to use by the policy that generated the finding.
*
*
* @param actions
* The actions that an external principal is granted permission to use by the policy that generated the
* finding.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public AnalyzedResource withActions(java.util.Collection actions) {
setActions(actions);
return this;
}
/**
*
* Indicates how the access that generated the finding is granted. This is populated for Amazon S3 bucket findings.
*
*
* @return Indicates how the access that generated the finding is granted. This is populated for Amazon S3 bucket
* findings.
*/
public java.util.List getSharedVia() {
return sharedVia;
}
/**
*
* Indicates how the access that generated the finding is granted. This is populated for Amazon S3 bucket findings.
*
*
* @param sharedVia
* Indicates how the access that generated the finding is granted. This is populated for Amazon S3 bucket
* findings.
*/
public void setSharedVia(java.util.Collection sharedVia) {
if (sharedVia == null) {
this.sharedVia = null;
return;
}
this.sharedVia = new java.util.ArrayList(sharedVia);
}
/**
*
* Indicates how the access that generated the finding is granted. This is populated for Amazon S3 bucket findings.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setSharedVia(java.util.Collection)} or {@link #withSharedVia(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param sharedVia
* Indicates how the access that generated the finding is granted. This is populated for Amazon S3 bucket
* findings.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public AnalyzedResource withSharedVia(String... sharedVia) {
if (this.sharedVia == null) {
setSharedVia(new java.util.ArrayList(sharedVia.length));
}
for (String ele : sharedVia) {
this.sharedVia.add(ele);
}
return this;
}
/**
*
* Indicates how the access that generated the finding is granted. This is populated for Amazon S3 bucket findings.
*
*
* @param sharedVia
* Indicates how the access that generated the finding is granted. This is populated for Amazon S3 bucket
* findings.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public AnalyzedResource withSharedVia(java.util.Collection sharedVia) {
setSharedVia(sharedVia);
return this;
}
/**
*
* The current status of the finding generated from the analyzed resource.
*
*
* @param status
* The current status of the finding generated from the analyzed resource.
* @see FindingStatus
*/
public void setStatus(String status) {
this.status = status;
}
/**
*
* The current status of the finding generated from the analyzed resource.
*
*
* @return The current status of the finding generated from the analyzed resource.
* @see FindingStatus
*/
public String getStatus() {
return this.status;
}
/**
*
* The current status of the finding generated from the analyzed resource.
*
*
* @param status
* The current status of the finding generated from the analyzed resource.
* @return Returns a reference to this object so that method calls can be chained together.
* @see FindingStatus
*/
public AnalyzedResource withStatus(String status) {
setStatus(status);
return this;
}
/**
*
* The current status of the finding generated from the analyzed resource.
*
*
* @param status
* The current status of the finding generated from the analyzed resource.
* @return Returns a reference to this object so that method calls can be chained together.
* @see FindingStatus
*/
public AnalyzedResource withStatus(FindingStatus status) {
this.status = status.toString();
return this;
}
/**
*
* The Amazon Web Services account ID that owns the resource.
*
*
* @param resourceOwnerAccount
* The Amazon Web Services account ID that owns the resource.
*/
public void setResourceOwnerAccount(String resourceOwnerAccount) {
this.resourceOwnerAccount = resourceOwnerAccount;
}
/**
*
* The Amazon Web Services account ID that owns the resource.
*
*
* @return The Amazon Web Services account ID that owns the resource.
*/
public String getResourceOwnerAccount() {
return this.resourceOwnerAccount;
}
/**
*
* The Amazon Web Services account ID that owns the resource.
*
*
* @param resourceOwnerAccount
* The Amazon Web Services account ID that owns the resource.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public AnalyzedResource withResourceOwnerAccount(String resourceOwnerAccount) {
setResourceOwnerAccount(resourceOwnerAccount);
return this;
}
/**
*
* An error message.
*
*
* @param error
* An error message.
*/
public void setError(String error) {
this.error = error;
}
/**
*
* An error message.
*
*
* @return An error message.
*/
public String getError() {
return this.error;
}
/**
*
* An error message.
*
*
* @param error
* An error message.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public AnalyzedResource withError(String error) {
setError(error);
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 (getResourceArn() != null)
sb.append("ResourceArn: ").append(getResourceArn()).append(",");
if (getResourceType() != null)
sb.append("ResourceType: ").append(getResourceType()).append(",");
if (getCreatedAt() != null)
sb.append("CreatedAt: ").append(getCreatedAt()).append(",");
if (getAnalyzedAt() != null)
sb.append("AnalyzedAt: ").append(getAnalyzedAt()).append(",");
if (getUpdatedAt() != null)
sb.append("UpdatedAt: ").append(getUpdatedAt()).append(",");
if (getIsPublic() != null)
sb.append("IsPublic: ").append(getIsPublic()).append(",");
if (getActions() != null)
sb.append("Actions: ").append(getActions()).append(",");
if (getSharedVia() != null)
sb.append("SharedVia: ").append(getSharedVia()).append(",");
if (getStatus() != null)
sb.append("Status: ").append(getStatus()).append(",");
if (getResourceOwnerAccount() != null)
sb.append("ResourceOwnerAccount: ").append(getResourceOwnerAccount()).append(",");
if (getError() != null)
sb.append("Error: ").append(getError());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof AnalyzedResource == false)
return false;
AnalyzedResource other = (AnalyzedResource) obj;
if (other.getResourceArn() == null ^ this.getResourceArn() == null)
return false;
if (other.getResourceArn() != null && other.getResourceArn().equals(this.getResourceArn()) == false)
return false;
if (other.getResourceType() == null ^ this.getResourceType() == null)
return false;
if (other.getResourceType() != null && other.getResourceType().equals(this.getResourceType()) == false)
return false;
if (other.getCreatedAt() == null ^ this.getCreatedAt() == null)
return false;
if (other.getCreatedAt() != null && other.getCreatedAt().equals(this.getCreatedAt()) == false)
return false;
if (other.getAnalyzedAt() == null ^ this.getAnalyzedAt() == null)
return false;
if (other.getAnalyzedAt() != null && other.getAnalyzedAt().equals(this.getAnalyzedAt()) == false)
return false;
if (other.getUpdatedAt() == null ^ this.getUpdatedAt() == null)
return false;
if (other.getUpdatedAt() != null && other.getUpdatedAt().equals(this.getUpdatedAt()) == false)
return false;
if (other.getIsPublic() == null ^ this.getIsPublic() == null)
return false;
if (other.getIsPublic() != null && other.getIsPublic().equals(this.getIsPublic()) == false)
return false;
if (other.getActions() == null ^ this.getActions() == null)
return false;
if (other.getActions() != null && other.getActions().equals(this.getActions()) == false)
return false;
if (other.getSharedVia() == null ^ this.getSharedVia() == null)
return false;
if (other.getSharedVia() != null && other.getSharedVia().equals(this.getSharedVia()) == false)
return false;
if (other.getStatus() == null ^ this.getStatus() == null)
return false;
if (other.getStatus() != null && other.getStatus().equals(this.getStatus()) == false)
return false;
if (other.getResourceOwnerAccount() == null ^ this.getResourceOwnerAccount() == null)
return false;
if (other.getResourceOwnerAccount() != null && other.getResourceOwnerAccount().equals(this.getResourceOwnerAccount()) == false)
return false;
if (other.getError() == null ^ this.getError() == null)
return false;
if (other.getError() != null && other.getError().equals(this.getError()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getResourceArn() == null) ? 0 : getResourceArn().hashCode());
hashCode = prime * hashCode + ((getResourceType() == null) ? 0 : getResourceType().hashCode());
hashCode = prime * hashCode + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode());
hashCode = prime * hashCode + ((getAnalyzedAt() == null) ? 0 : getAnalyzedAt().hashCode());
hashCode = prime * hashCode + ((getUpdatedAt() == null) ? 0 : getUpdatedAt().hashCode());
hashCode = prime * hashCode + ((getIsPublic() == null) ? 0 : getIsPublic().hashCode());
hashCode = prime * hashCode + ((getActions() == null) ? 0 : getActions().hashCode());
hashCode = prime * hashCode + ((getSharedVia() == null) ? 0 : getSharedVia().hashCode());
hashCode = prime * hashCode + ((getStatus() == null) ? 0 : getStatus().hashCode());
hashCode = prime * hashCode + ((getResourceOwnerAccount() == null) ? 0 : getResourceOwnerAccount().hashCode());
hashCode = prime * hashCode + ((getError() == null) ? 0 : getError().hashCode());
return hashCode;
}
@Override
public AnalyzedResource clone() {
try {
return (AnalyzedResource) 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.accessanalyzer.model.transform.AnalyzedResourceMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}