/* * Copyright 2018-2023 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.computeoptimizer.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** *

* Describes a recommendation option for an Lambda function. *

* * @see AWS API Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class LambdaFunctionMemoryRecommendationOption implements Serializable, Cloneable, StructuredPojo { /** *

* The rank of the function recommendation option. *

*

* The top recommendation option is ranked as 1. *

*/ private Integer rank; /** *

* The memory size, in MB, of the function recommendation option. *

*/ private Integer memorySize; /** *

* An array of objects that describe the projected utilization metrics of the function recommendation option. *

*/ private java.util.List projectedUtilizationMetrics; /** *

* An object that describes the savings opportunity for the Lambda function recommendation option. Savings * opportunity includes the estimated monthly savings amount and percentage. *

*/ private SavingsOpportunity savingsOpportunity; /** *

* The rank of the function recommendation option. *

*

* The top recommendation option is ranked as 1. *

* * @param rank * The rank of the function recommendation option.

*

* The top recommendation option is ranked as 1. */ public void setRank(Integer rank) { this.rank = rank; } /** *

* The rank of the function recommendation option. *

*

* The top recommendation option is ranked as 1. *

* * @return The rank of the function recommendation option.

*

* The top recommendation option is ranked as 1. */ public Integer getRank() { return this.rank; } /** *

* The rank of the function recommendation option. *

*

* The top recommendation option is ranked as 1. *

* * @param rank * The rank of the function recommendation option.

*

* The top recommendation option is ranked as 1. * @return Returns a reference to this object so that method calls can be chained together. */ public LambdaFunctionMemoryRecommendationOption withRank(Integer rank) { setRank(rank); return this; } /** *

* The memory size, in MB, of the function recommendation option. *

* * @param memorySize * The memory size, in MB, of the function recommendation option. */ public void setMemorySize(Integer memorySize) { this.memorySize = memorySize; } /** *

* The memory size, in MB, of the function recommendation option. *

* * @return The memory size, in MB, of the function recommendation option. */ public Integer getMemorySize() { return this.memorySize; } /** *

* The memory size, in MB, of the function recommendation option. *

* * @param memorySize * The memory size, in MB, of the function recommendation option. * @return Returns a reference to this object so that method calls can be chained together. */ public LambdaFunctionMemoryRecommendationOption withMemorySize(Integer memorySize) { setMemorySize(memorySize); return this; } /** *

* An array of objects that describe the projected utilization metrics of the function recommendation option. *

* * @return An array of objects that describe the projected utilization metrics of the function recommendation * option. */ public java.util.List getProjectedUtilizationMetrics() { return projectedUtilizationMetrics; } /** *

* An array of objects that describe the projected utilization metrics of the function recommendation option. *

* * @param projectedUtilizationMetrics * An array of objects that describe the projected utilization metrics of the function recommendation option. */ public void setProjectedUtilizationMetrics(java.util.Collection projectedUtilizationMetrics) { if (projectedUtilizationMetrics == null) { this.projectedUtilizationMetrics = null; return; } this.projectedUtilizationMetrics = new java.util.ArrayList(projectedUtilizationMetrics); } /** *

* An array of objects that describe the projected utilization metrics of the function recommendation option. *

*

* NOTE: This method appends the values to the existing list (if any). Use * {@link #setProjectedUtilizationMetrics(java.util.Collection)} or * {@link #withProjectedUtilizationMetrics(java.util.Collection)} if you want to override the existing values. *

* * @param projectedUtilizationMetrics * An array of objects that describe the projected utilization metrics of the function recommendation option. * @return Returns a reference to this object so that method calls can be chained together. */ public LambdaFunctionMemoryRecommendationOption withProjectedUtilizationMetrics(LambdaFunctionMemoryProjectedMetric... projectedUtilizationMetrics) { if (this.projectedUtilizationMetrics == null) { setProjectedUtilizationMetrics(new java.util.ArrayList(projectedUtilizationMetrics.length)); } for (LambdaFunctionMemoryProjectedMetric ele : projectedUtilizationMetrics) { this.projectedUtilizationMetrics.add(ele); } return this; } /** *

* An array of objects that describe the projected utilization metrics of the function recommendation option. *

* * @param projectedUtilizationMetrics * An array of objects that describe the projected utilization metrics of the function recommendation option. * @return Returns a reference to this object so that method calls can be chained together. */ public LambdaFunctionMemoryRecommendationOption withProjectedUtilizationMetrics( java.util.Collection projectedUtilizationMetrics) { setProjectedUtilizationMetrics(projectedUtilizationMetrics); return this; } /** *

* An object that describes the savings opportunity for the Lambda function recommendation option. Savings * opportunity includes the estimated monthly savings amount and percentage. *

* * @param savingsOpportunity * An object that describes the savings opportunity for the Lambda function recommendation option. Savings * opportunity includes the estimated monthly savings amount and percentage. */ public void setSavingsOpportunity(SavingsOpportunity savingsOpportunity) { this.savingsOpportunity = savingsOpportunity; } /** *

* An object that describes the savings opportunity for the Lambda function recommendation option. Savings * opportunity includes the estimated monthly savings amount and percentage. *

* * @return An object that describes the savings opportunity for the Lambda function recommendation option. Savings * opportunity includes the estimated monthly savings amount and percentage. */ public SavingsOpportunity getSavingsOpportunity() { return this.savingsOpportunity; } /** *

* An object that describes the savings opportunity for the Lambda function recommendation option. Savings * opportunity includes the estimated monthly savings amount and percentage. *

* * @param savingsOpportunity * An object that describes the savings opportunity for the Lambda function recommendation option. Savings * opportunity includes the estimated monthly savings amount and percentage. * @return Returns a reference to this object so that method calls can be chained together. */ public LambdaFunctionMemoryRecommendationOption withSavingsOpportunity(SavingsOpportunity savingsOpportunity) { setSavingsOpportunity(savingsOpportunity); 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 (getRank() != null) sb.append("Rank: ").append(getRank()).append(","); if (getMemorySize() != null) sb.append("MemorySize: ").append(getMemorySize()).append(","); if (getProjectedUtilizationMetrics() != null) sb.append("ProjectedUtilizationMetrics: ").append(getProjectedUtilizationMetrics()).append(","); if (getSavingsOpportunity() != null) sb.append("SavingsOpportunity: ").append(getSavingsOpportunity()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof LambdaFunctionMemoryRecommendationOption == false) return false; LambdaFunctionMemoryRecommendationOption other = (LambdaFunctionMemoryRecommendationOption) obj; if (other.getRank() == null ^ this.getRank() == null) return false; if (other.getRank() != null && other.getRank().equals(this.getRank()) == false) return false; if (other.getMemorySize() == null ^ this.getMemorySize() == null) return false; if (other.getMemorySize() != null && other.getMemorySize().equals(this.getMemorySize()) == false) return false; if (other.getProjectedUtilizationMetrics() == null ^ this.getProjectedUtilizationMetrics() == null) return false; if (other.getProjectedUtilizationMetrics() != null && other.getProjectedUtilizationMetrics().equals(this.getProjectedUtilizationMetrics()) == false) return false; if (other.getSavingsOpportunity() == null ^ this.getSavingsOpportunity() == null) return false; if (other.getSavingsOpportunity() != null && other.getSavingsOpportunity().equals(this.getSavingsOpportunity()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getRank() == null) ? 0 : getRank().hashCode()); hashCode = prime * hashCode + ((getMemorySize() == null) ? 0 : getMemorySize().hashCode()); hashCode = prime * hashCode + ((getProjectedUtilizationMetrics() == null) ? 0 : getProjectedUtilizationMetrics().hashCode()); hashCode = prime * hashCode + ((getSavingsOpportunity() == null) ? 0 : getSavingsOpportunity().hashCode()); return hashCode; } @Override public LambdaFunctionMemoryRecommendationOption clone() { try { return (LambdaFunctionMemoryRecommendationOption) 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.computeoptimizer.model.transform.LambdaFunctionMemoryRecommendationOptionMarshaller.getInstance().marshall(this, protocolMarshaller); } }