com.amazonaws.services.inspector2.model.LambdaFunctionMetadata 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;
/**
*
* The Amazon Web Services Lambda function metadata.
*
*
* @see AWS
* API Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class LambdaFunctionMetadata implements Serializable, Cloneable, StructuredPojo {
/**
*
* The name of a function.
*
*/
private String functionName;
/**
*
* The resource tags on an Amazon Web Services Lambda function.
*
*/
private java.util.Map functionTags;
/**
*
* The layers for an Amazon Web Services Lambda function. A Lambda function can have up to five layers.
*
*/
private java.util.List layers;
/**
*
* An Amazon Web Services Lambda function's runtime.
*
*/
private String runtime;
/**
*
* The name of a function.
*
*
* @param functionName
* The name of a function.
*/
public void setFunctionName(String functionName) {
this.functionName = functionName;
}
/**
*
* The name of a function.
*
*
* @return The name of a function.
*/
public String getFunctionName() {
return this.functionName;
}
/**
*
* The name of a function.
*
*
* @param functionName
* The name of a function.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LambdaFunctionMetadata withFunctionName(String functionName) {
setFunctionName(functionName);
return this;
}
/**
*
* The resource tags on an Amazon Web Services Lambda function.
*
*
* @return The resource tags on an Amazon Web Services Lambda function.
*/
public java.util.Map getFunctionTags() {
return functionTags;
}
/**
*
* The resource tags on an Amazon Web Services Lambda function.
*
*
* @param functionTags
* The resource tags on an Amazon Web Services Lambda function.
*/
public void setFunctionTags(java.util.Map functionTags) {
this.functionTags = functionTags;
}
/**
*
* The resource tags on an Amazon Web Services Lambda function.
*
*
* @param functionTags
* The resource tags on an Amazon Web Services Lambda function.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LambdaFunctionMetadata withFunctionTags(java.util.Map functionTags) {
setFunctionTags(functionTags);
return this;
}
/**
* Add a single FunctionTags entry
*
* @see LambdaFunctionMetadata#withFunctionTags
* @returns a reference to this object so that method calls can be chained together.
*/
public LambdaFunctionMetadata addFunctionTagsEntry(String key, String value) {
if (null == this.functionTags) {
this.functionTags = new java.util.HashMap();
}
if (this.functionTags.containsKey(key))
throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
this.functionTags.put(key, value);
return this;
}
/**
* Removes all the entries added into FunctionTags.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LambdaFunctionMetadata clearFunctionTagsEntries() {
this.functionTags = null;
return this;
}
/**
*
* The layers for an Amazon Web Services Lambda function. A Lambda function can have up to five layers.
*
*
* @return The layers for an Amazon Web Services Lambda function. A Lambda function can have up to five layers.
*/
public java.util.List getLayers() {
return layers;
}
/**
*
* The layers for an Amazon Web Services Lambda function. A Lambda function can have up to five layers.
*
*
* @param layers
* The layers for an Amazon Web Services Lambda function. A Lambda function can have up to five layers.
*/
public void setLayers(java.util.Collection layers) {
if (layers == null) {
this.layers = null;
return;
}
this.layers = new java.util.ArrayList(layers);
}
/**
*
* The layers for an Amazon Web Services Lambda function. A Lambda function can have up to five layers.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setLayers(java.util.Collection)} or {@link #withLayers(java.util.Collection)} if you want to override the
* existing values.
*
*
* @param layers
* The layers for an Amazon Web Services Lambda function. A Lambda function can have up to five layers.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LambdaFunctionMetadata withLayers(String... layers) {
if (this.layers == null) {
setLayers(new java.util.ArrayList(layers.length));
}
for (String ele : layers) {
this.layers.add(ele);
}
return this;
}
/**
*
* The layers for an Amazon Web Services Lambda function. A Lambda function can have up to five layers.
*
*
* @param layers
* The layers for an Amazon Web Services Lambda function. A Lambda function can have up to five layers.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LambdaFunctionMetadata withLayers(java.util.Collection layers) {
setLayers(layers);
return this;
}
/**
*
* An Amazon Web Services Lambda function's runtime.
*
*
* @param runtime
* An Amazon Web Services Lambda function's runtime.
* @see Runtime
*/
public void setRuntime(String runtime) {
this.runtime = runtime;
}
/**
*
* An Amazon Web Services Lambda function's runtime.
*
*
* @return An Amazon Web Services Lambda function's runtime.
* @see Runtime
*/
public String getRuntime() {
return this.runtime;
}
/**
*
* An Amazon Web Services Lambda function's runtime.
*
*
* @param runtime
* An Amazon Web Services Lambda function's runtime.
* @return Returns a reference to this object so that method calls can be chained together.
* @see Runtime
*/
public LambdaFunctionMetadata withRuntime(String runtime) {
setRuntime(runtime);
return this;
}
/**
*
* An Amazon Web Services Lambda function's runtime.
*
*
* @param runtime
* An Amazon Web Services Lambda function's runtime.
* @return Returns a reference to this object so that method calls can be chained together.
* @see Runtime
*/
public LambdaFunctionMetadata withRuntime(Runtime runtime) {
this.runtime = runtime.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 (getFunctionName() != null)
sb.append("FunctionName: ").append(getFunctionName()).append(",");
if (getFunctionTags() != null)
sb.append("FunctionTags: ").append(getFunctionTags()).append(",");
if (getLayers() != null)
sb.append("Layers: ").append(getLayers()).append(",");
if (getRuntime() != null)
sb.append("Runtime: ").append(getRuntime());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof LambdaFunctionMetadata == false)
return false;
LambdaFunctionMetadata other = (LambdaFunctionMetadata) obj;
if (other.getFunctionName() == null ^ this.getFunctionName() == null)
return false;
if (other.getFunctionName() != null && other.getFunctionName().equals(this.getFunctionName()) == false)
return false;
if (other.getFunctionTags() == null ^ this.getFunctionTags() == null)
return false;
if (other.getFunctionTags() != null && other.getFunctionTags().equals(this.getFunctionTags()) == false)
return false;
if (other.getLayers() == null ^ this.getLayers() == null)
return false;
if (other.getLayers() != null && other.getLayers().equals(this.getLayers()) == false)
return false;
if (other.getRuntime() == null ^ this.getRuntime() == null)
return false;
if (other.getRuntime() != null && other.getRuntime().equals(this.getRuntime()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getFunctionName() == null) ? 0 : getFunctionName().hashCode());
hashCode = prime * hashCode + ((getFunctionTags() == null) ? 0 : getFunctionTags().hashCode());
hashCode = prime * hashCode + ((getLayers() == null) ? 0 : getLayers().hashCode());
hashCode = prime * hashCode + ((getRuntime() == null) ? 0 : getRuntime().hashCode());
return hashCode;
}
@Override
public LambdaFunctionMetadata clone() {
try {
return (LambdaFunctionMetadata) 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.LambdaFunctionMetadataMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}