com.amazonaws.services.inspector2.model.Resource Maven / Gradle / Ivy
Show all versions of aws-java-sdk-inspector2 Show documentation
/*
* 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.inspector2.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* Details about the resource involved in a finding.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class Resource implements Serializable, Cloneable, StructuredPojo {
/**
*
* An object that contains details about the resource involved in a finding.
*
*/
private ResourceDetails details;
/**
*
* The ID of the resource.
*
*/
private String id;
/**
*
* The partition of the resource.
*
*/
private String partition;
/**
*
* The Amazon Web Services Region the impacted resource is located in.
*
*/
private String region;
/**
*
* The tags attached to the resource.
*
*/
private java.util.Map tags;
/**
*
* The type of resource.
*
*/
private String type;
/**
*
* An object that contains details about the resource involved in a finding.
*
*
* @param details
* An object that contains details about the resource involved in a finding.
*/
public void setDetails(ResourceDetails details) {
this.details = details;
}
/**
*
* An object that contains details about the resource involved in a finding.
*
*
* @return An object that contains details about the resource involved in a finding.
*/
public ResourceDetails getDetails() {
return this.details;
}
/**
*
* An object that contains details about the resource involved in a finding.
*
*
* @param details
* An object that contains details about the resource involved in a finding.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Resource withDetails(ResourceDetails details) {
setDetails(details);
return this;
}
/**
*
* The ID of the resource.
*
*
* @param id
* The ID of the resource.
*/
public void setId(String id) {
this.id = id;
}
/**
*
* The ID of the resource.
*
*
* @return The ID of the resource.
*/
public String getId() {
return this.id;
}
/**
*
* The ID of the resource.
*
*
* @param id
* The ID of the resource.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Resource withId(String id) {
setId(id);
return this;
}
/**
*
* The partition of the resource.
*
*
* @param partition
* The partition of the resource.
*/
public void setPartition(String partition) {
this.partition = partition;
}
/**
*
* The partition of the resource.
*
*
* @return The partition of the resource.
*/
public String getPartition() {
return this.partition;
}
/**
*
* The partition of the resource.
*
*
* @param partition
* The partition of the resource.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Resource withPartition(String partition) {
setPartition(partition);
return this;
}
/**
*
* The Amazon Web Services Region the impacted resource is located in.
*
*
* @param region
* The Amazon Web Services Region the impacted resource is located in.
*/
public void setRegion(String region) {
this.region = region;
}
/**
*
* The Amazon Web Services Region the impacted resource is located in.
*
*
* @return The Amazon Web Services Region the impacted resource is located in.
*/
public String getRegion() {
return this.region;
}
/**
*
* The Amazon Web Services Region the impacted resource is located in.
*
*
* @param region
* The Amazon Web Services Region the impacted resource is located in.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Resource withRegion(String region) {
setRegion(region);
return this;
}
/**
*
* The tags attached to the resource.
*
*
* @return The tags attached to the resource.
*/
public java.util.Map getTags() {
return tags;
}
/**
*
* The tags attached to the resource.
*
*
* @param tags
* The tags attached to the resource.
*/
public void setTags(java.util.Map tags) {
this.tags = tags;
}
/**
*
* The tags attached to the resource.
*
*
* @param tags
* The tags attached to the resource.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Resource withTags(java.util.Map tags) {
setTags(tags);
return this;
}
/**
* Add a single Tags entry
*
* @see Resource#withTags
* @returns a reference to this object so that method calls can be chained together.
*/
public Resource addTagsEntry(String key, String value) {
if (null == this.tags) {
this.tags = new java.util.HashMap();
}
if (this.tags.containsKey(key))
throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
this.tags.put(key, value);
return this;
}
/**
* Removes all the entries added into Tags.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Resource clearTagsEntries() {
this.tags = null;
return this;
}
/**
*
* The type of resource.
*
*
* @param type
* The type of resource.
* @see ResourceType
*/
public void setType(String type) {
this.type = type;
}
/**
*
* The type of resource.
*
*
* @return The type of resource.
* @see ResourceType
*/
public String getType() {
return this.type;
}
/**
*
* The type of resource.
*
*
* @param type
* The type of resource.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ResourceType
*/
public Resource withType(String type) {
setType(type);
return this;
}
/**
*
* The type of resource.
*
*
* @param type
* The type of resource.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ResourceType
*/
public Resource withType(ResourceType type) {
this.type = type.toString();
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 (getDetails() != null)
sb.append("Details: ").append(getDetails()).append(",");
if (getId() != null)
sb.append("Id: ").append(getId()).append(",");
if (getPartition() != null)
sb.append("Partition: ").append(getPartition()).append(",");
if (getRegion() != null)
sb.append("Region: ").append(getRegion()).append(",");
if (getTags() != null)
sb.append("Tags: ").append(getTags()).append(",");
if (getType() != null)
sb.append("Type: ").append(getType());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof Resource == false)
return false;
Resource other = (Resource) obj;
if (other.getDetails() == null ^ this.getDetails() == null)
return false;
if (other.getDetails() != null && other.getDetails().equals(this.getDetails()) == false)
return false;
if (other.getId() == null ^ this.getId() == null)
return false;
if (other.getId() != null && other.getId().equals(this.getId()) == false)
return false;
if (other.getPartition() == null ^ this.getPartition() == null)
return false;
if (other.getPartition() != null && other.getPartition().equals(this.getPartition()) == false)
return false;
if (other.getRegion() == null ^ this.getRegion() == null)
return false;
if (other.getRegion() != null && other.getRegion().equals(this.getRegion()) == false)
return false;
if (other.getTags() == null ^ this.getTags() == null)
return false;
if (other.getTags() != null && other.getTags().equals(this.getTags()) == false)
return false;
if (other.getType() == null ^ this.getType() == null)
return false;
if (other.getType() != null && other.getType().equals(this.getType()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getDetails() == null) ? 0 : getDetails().hashCode());
hashCode = prime * hashCode + ((getId() == null) ? 0 : getId().hashCode());
hashCode = prime * hashCode + ((getPartition() == null) ? 0 : getPartition().hashCode());
hashCode = prime * hashCode + ((getRegion() == null) ? 0 : getRegion().hashCode());
hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode());
hashCode = prime * hashCode + ((getType() == null) ? 0 : getType().hashCode());
return hashCode;
}
@Override
public Resource clone() {
try {
return (Resource) 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.inspector2.model.transform.ResourceMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}