
com.amazonaws.services.accessanalyzer.model.UnusedPermissionDetails 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 information about an unused access finding for a permission. IAM Access Analyzer charges for unused access
* analysis based on the number of IAM roles and users analyzed per month. For more details on pricing, see IAM Access Analyzer pricing.
*
*
* @see AWS API Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class UnusedPermissionDetails implements Serializable, Cloneable, StructuredPojo {
/**
*
* A list of unused actions for which the unused access finding was generated.
*
*/
private java.util.List actions;
/**
*
* The namespace of the Amazon Web Services service that contains the unused actions.
*
*/
private String serviceNamespace;
/**
*
* The time at which the permission last accessed.
*
*/
private java.util.Date lastAccessed;
/**
*
* A list of unused actions for which the unused access finding was generated.
*
*
* @return A list of unused actions for which the unused access finding was generated.
*/
public java.util.List getActions() {
return actions;
}
/**
*
* A list of unused actions for which the unused access finding was generated.
*
*
* @param actions
* A list of unused actions for which the unused access finding was generated.
*/
public void setActions(java.util.Collection actions) {
if (actions == null) {
this.actions = null;
return;
}
this.actions = new java.util.ArrayList(actions);
}
/**
*
* A list of unused actions for which the unused access finding was generated.
*
*
* 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
* A list of unused actions for which the unused access finding was generated.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public UnusedPermissionDetails withActions(UnusedAction... actions) {
if (this.actions == null) {
setActions(new java.util.ArrayList(actions.length));
}
for (UnusedAction ele : actions) {
this.actions.add(ele);
}
return this;
}
/**
*
* A list of unused actions for which the unused access finding was generated.
*
*
* @param actions
* A list of unused actions for which the unused access finding was generated.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public UnusedPermissionDetails withActions(java.util.Collection actions) {
setActions(actions);
return this;
}
/**
*
* The namespace of the Amazon Web Services service that contains the unused actions.
*
*
* @param serviceNamespace
* The namespace of the Amazon Web Services service that contains the unused actions.
*/
public void setServiceNamespace(String serviceNamespace) {
this.serviceNamespace = serviceNamespace;
}
/**
*
* The namespace of the Amazon Web Services service that contains the unused actions.
*
*
* @return The namespace of the Amazon Web Services service that contains the unused actions.
*/
public String getServiceNamespace() {
return this.serviceNamespace;
}
/**
*
* The namespace of the Amazon Web Services service that contains the unused actions.
*
*
* @param serviceNamespace
* The namespace of the Amazon Web Services service that contains the unused actions.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public UnusedPermissionDetails withServiceNamespace(String serviceNamespace) {
setServiceNamespace(serviceNamespace);
return this;
}
/**
*
* The time at which the permission last accessed.
*
*
* @param lastAccessed
* The time at which the permission last accessed.
*/
public void setLastAccessed(java.util.Date lastAccessed) {
this.lastAccessed = lastAccessed;
}
/**
*
* The time at which the permission last accessed.
*
*
* @return The time at which the permission last accessed.
*/
public java.util.Date getLastAccessed() {
return this.lastAccessed;
}
/**
*
* The time at which the permission last accessed.
*
*
* @param lastAccessed
* The time at which the permission last accessed.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public UnusedPermissionDetails withLastAccessed(java.util.Date lastAccessed) {
setLastAccessed(lastAccessed);
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 (getActions() != null)
sb.append("Actions: ").append(getActions()).append(",");
if (getServiceNamespace() != null)
sb.append("ServiceNamespace: ").append(getServiceNamespace()).append(",");
if (getLastAccessed() != null)
sb.append("LastAccessed: ").append(getLastAccessed());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof UnusedPermissionDetails == false)
return false;
UnusedPermissionDetails other = (UnusedPermissionDetails) obj;
if (other.getActions() == null ^ this.getActions() == null)
return false;
if (other.getActions() != null && other.getActions().equals(this.getActions()) == false)
return false;
if (other.getServiceNamespace() == null ^ this.getServiceNamespace() == null)
return false;
if (other.getServiceNamespace() != null && other.getServiceNamespace().equals(this.getServiceNamespace()) == false)
return false;
if (other.getLastAccessed() == null ^ this.getLastAccessed() == null)
return false;
if (other.getLastAccessed() != null && other.getLastAccessed().equals(this.getLastAccessed()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getActions() == null) ? 0 : getActions().hashCode());
hashCode = prime * hashCode + ((getServiceNamespace() == null) ? 0 : getServiceNamespace().hashCode());
hashCode = prime * hashCode + ((getLastAccessed() == null) ? 0 : getLastAccessed().hashCode());
return hashCode;
}
@Override
public UnusedPermissionDetails clone() {
try {
return (UnusedPermissionDetails) 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.UnusedPermissionDetailsMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}