/* * 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; /** *

* The Amazon ECS service configurations used for recommendations. *

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

* The amount of memory used by the tasks in the Amazon ECS service. *

*/ private Integer memory; /** *

* The number of CPU units used by the tasks in the Amazon ECS service. *

*/ private Integer cpu; /** *

* The container configurations within a task of an Amazon ECS service. *

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

* Describes the Auto Scaling configuration methods for an Amazon ECS service. This affects the generated * recommendations. For example, if Auto Scaling is configured on a service’s CPU, then Compute Optimizer doesn’t * generate CPU size recommendations. *

*

* The Auto Scaling configuration methods include: *

* *

* For more information about step scaling and target scaling, see Step scaling policies for Application Auto Scaling and * Target tracking scaling policies for Application Auto Scaling in the Application Auto Scaling User * Guide. *

*/ private String autoScalingConfiguration; /** *

* The task definition ARN used by the tasks in the Amazon ECS service. *

*/ private String taskDefinitionArn; /** *

* The amount of memory used by the tasks in the Amazon ECS service. *

* * @param memory * The amount of memory used by the tasks in the Amazon ECS service. */ public void setMemory(Integer memory) { this.memory = memory; } /** *

* The amount of memory used by the tasks in the Amazon ECS service. *

* * @return The amount of memory used by the tasks in the Amazon ECS service. */ public Integer getMemory() { return this.memory; } /** *

* The amount of memory used by the tasks in the Amazon ECS service. *

* * @param memory * The amount of memory used by the tasks in the Amazon ECS service. * @return Returns a reference to this object so that method calls can be chained together. */ public ServiceConfiguration withMemory(Integer memory) { setMemory(memory); return this; } /** *

* The number of CPU units used by the tasks in the Amazon ECS service. *

* * @param cpu * The number of CPU units used by the tasks in the Amazon ECS service. */ public void setCpu(Integer cpu) { this.cpu = cpu; } /** *

* The number of CPU units used by the tasks in the Amazon ECS service. *

* * @return The number of CPU units used by the tasks in the Amazon ECS service. */ public Integer getCpu() { return this.cpu; } /** *

* The number of CPU units used by the tasks in the Amazon ECS service. *

* * @param cpu * The number of CPU units used by the tasks in the Amazon ECS service. * @return Returns a reference to this object so that method calls can be chained together. */ public ServiceConfiguration withCpu(Integer cpu) { setCpu(cpu); return this; } /** *

* The container configurations within a task of an Amazon ECS service. *

* * @return The container configurations within a task of an Amazon ECS service. */ public java.util.List getContainerConfigurations() { return containerConfigurations; } /** *

* The container configurations within a task of an Amazon ECS service. *

* * @param containerConfigurations * The container configurations within a task of an Amazon ECS service. */ public void setContainerConfigurations(java.util.Collection containerConfigurations) { if (containerConfigurations == null) { this.containerConfigurations = null; return; } this.containerConfigurations = new java.util.ArrayList(containerConfigurations); } /** *

* The container configurations within a task of an Amazon ECS service. *

*

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

* * @param containerConfigurations * The container configurations within a task of an Amazon ECS service. * @return Returns a reference to this object so that method calls can be chained together. */ public ServiceConfiguration withContainerConfigurations(ContainerConfiguration... containerConfigurations) { if (this.containerConfigurations == null) { setContainerConfigurations(new java.util.ArrayList(containerConfigurations.length)); } for (ContainerConfiguration ele : containerConfigurations) { this.containerConfigurations.add(ele); } return this; } /** *

* The container configurations within a task of an Amazon ECS service. *

* * @param containerConfigurations * The container configurations within a task of an Amazon ECS service. * @return Returns a reference to this object so that method calls can be chained together. */ public ServiceConfiguration withContainerConfigurations(java.util.Collection containerConfigurations) { setContainerConfigurations(containerConfigurations); return this; } /** *

* Describes the Auto Scaling configuration methods for an Amazon ECS service. This affects the generated * recommendations. For example, if Auto Scaling is configured on a service’s CPU, then Compute Optimizer doesn’t * generate CPU size recommendations. *

*

* The Auto Scaling configuration methods include: *

*
    *
  • *

    * TARGET_TRACKING_SCALING_CPU — If the Amazon ECS service is configured to use target scaling on CPU, * Compute Optimizer doesn't generate CPU recommendations. *

    *
  • *
  • *

    * TARGET_TRACKING_SCALING_MEMORY — If the Amazon ECS service is configured to use target scaling on * memory, Compute Optimizer doesn't generate memory recommendations. *

    *
  • *
*

* For more information about step scaling and target scaling, see Step scaling policies for Application Auto Scaling and * Target tracking scaling policies for Application Auto Scaling in the Application Auto Scaling User * Guide. *

* * @param autoScalingConfiguration * Describes the Auto Scaling configuration methods for an Amazon ECS service. This affects the generated * recommendations. For example, if Auto Scaling is configured on a service’s CPU, then Compute Optimizer * doesn’t generate CPU size recommendations.

*

* The Auto Scaling configuration methods include: *

*
    *
  • *

    * TARGET_TRACKING_SCALING_CPU — If the Amazon ECS service is configured to use target scaling * on CPU, Compute Optimizer doesn't generate CPU recommendations. *

    *
  • *
  • *

    * TARGET_TRACKING_SCALING_MEMORY — If the Amazon ECS service is configured to use target * scaling on memory, Compute Optimizer doesn't generate memory recommendations. *

    *
  • *
*

* For more information about step scaling and target scaling, see Step scaling policies for Application Auto Scaling and Target tracking scaling policies for Application Auto Scaling in the Application Auto Scaling * User Guide. * @see AutoScalingConfiguration */ public void setAutoScalingConfiguration(String autoScalingConfiguration) { this.autoScalingConfiguration = autoScalingConfiguration; } /** *

* Describes the Auto Scaling configuration methods for an Amazon ECS service. This affects the generated * recommendations. For example, if Auto Scaling is configured on a service’s CPU, then Compute Optimizer doesn’t * generate CPU size recommendations. *

*

* The Auto Scaling configuration methods include: *

*
    *
  • *

    * TARGET_TRACKING_SCALING_CPU — If the Amazon ECS service is configured to use target scaling on CPU, * Compute Optimizer doesn't generate CPU recommendations. *

    *
  • *
  • *

    * TARGET_TRACKING_SCALING_MEMORY — If the Amazon ECS service is configured to use target scaling on * memory, Compute Optimizer doesn't generate memory recommendations. *

    *
  • *
*

* For more information about step scaling and target scaling, see Step scaling policies for Application Auto Scaling and * Target tracking scaling policies for Application Auto Scaling in the Application Auto Scaling User * Guide. *

* * @return Describes the Auto Scaling configuration methods for an Amazon ECS service. This affects the generated * recommendations. For example, if Auto Scaling is configured on a service’s CPU, then Compute Optimizer * doesn’t generate CPU size recommendations.

*

* The Auto Scaling configuration methods include: *

*
    *
  • *

    * TARGET_TRACKING_SCALING_CPU — If the Amazon ECS service is configured to use target scaling * on CPU, Compute Optimizer doesn't generate CPU recommendations. *

    *
  • *
  • *

    * TARGET_TRACKING_SCALING_MEMORY — If the Amazon ECS service is configured to use target * scaling on memory, Compute Optimizer doesn't generate memory recommendations. *

    *
  • *
*

* For more information about step scaling and target scaling, see Step scaling policies for Application Auto Scaling and Target tracking scaling policies for Application Auto Scaling in the Application Auto Scaling * User Guide. * @see AutoScalingConfiguration */ public String getAutoScalingConfiguration() { return this.autoScalingConfiguration; } /** *

* Describes the Auto Scaling configuration methods for an Amazon ECS service. This affects the generated * recommendations. For example, if Auto Scaling is configured on a service’s CPU, then Compute Optimizer doesn’t * generate CPU size recommendations. *

*

* The Auto Scaling configuration methods include: *

*
    *
  • *

    * TARGET_TRACKING_SCALING_CPU — If the Amazon ECS service is configured to use target scaling on CPU, * Compute Optimizer doesn't generate CPU recommendations. *

    *
  • *
  • *

    * TARGET_TRACKING_SCALING_MEMORY — If the Amazon ECS service is configured to use target scaling on * memory, Compute Optimizer doesn't generate memory recommendations. *

    *
  • *
*

* For more information about step scaling and target scaling, see Step scaling policies for Application Auto Scaling and * Target tracking scaling policies for Application Auto Scaling in the Application Auto Scaling User * Guide. *

* * @param autoScalingConfiguration * Describes the Auto Scaling configuration methods for an Amazon ECS service. This affects the generated * recommendations. For example, if Auto Scaling is configured on a service’s CPU, then Compute Optimizer * doesn’t generate CPU size recommendations.

*

* The Auto Scaling configuration methods include: *

*
    *
  • *

    * TARGET_TRACKING_SCALING_CPU — If the Amazon ECS service is configured to use target scaling * on CPU, Compute Optimizer doesn't generate CPU recommendations. *

    *
  • *
  • *

    * TARGET_TRACKING_SCALING_MEMORY — If the Amazon ECS service is configured to use target * scaling on memory, Compute Optimizer doesn't generate memory recommendations. *

    *
  • *
*

* For more information about step scaling and target scaling, see Step scaling policies for Application Auto Scaling and Target tracking scaling policies for Application Auto Scaling in the Application Auto Scaling * User Guide. * @return Returns a reference to this object so that method calls can be chained together. * @see AutoScalingConfiguration */ public ServiceConfiguration withAutoScalingConfiguration(String autoScalingConfiguration) { setAutoScalingConfiguration(autoScalingConfiguration); return this; } /** *

* Describes the Auto Scaling configuration methods for an Amazon ECS service. This affects the generated * recommendations. For example, if Auto Scaling is configured on a service’s CPU, then Compute Optimizer doesn’t * generate CPU size recommendations. *

*

* The Auto Scaling configuration methods include: *

*
    *
  • *

    * TARGET_TRACKING_SCALING_CPU — If the Amazon ECS service is configured to use target scaling on CPU, * Compute Optimizer doesn't generate CPU recommendations. *

    *
  • *
  • *

    * TARGET_TRACKING_SCALING_MEMORY — If the Amazon ECS service is configured to use target scaling on * memory, Compute Optimizer doesn't generate memory recommendations. *

    *
  • *
*

* For more information about step scaling and target scaling, see Step scaling policies for Application Auto Scaling and * Target tracking scaling policies for Application Auto Scaling in the Application Auto Scaling User * Guide. *

* * @param autoScalingConfiguration * Describes the Auto Scaling configuration methods for an Amazon ECS service. This affects the generated * recommendations. For example, if Auto Scaling is configured on a service’s CPU, then Compute Optimizer * doesn’t generate CPU size recommendations.

*

* The Auto Scaling configuration methods include: *

*
    *
  • *

    * TARGET_TRACKING_SCALING_CPU — If the Amazon ECS service is configured to use target scaling * on CPU, Compute Optimizer doesn't generate CPU recommendations. *

    *
  • *
  • *

    * TARGET_TRACKING_SCALING_MEMORY — If the Amazon ECS service is configured to use target * scaling on memory, Compute Optimizer doesn't generate memory recommendations. *

    *
  • *
*

* For more information about step scaling and target scaling, see Step scaling policies for Application Auto Scaling and Target tracking scaling policies for Application Auto Scaling in the Application Auto Scaling * User Guide. * @return Returns a reference to this object so that method calls can be chained together. * @see AutoScalingConfiguration */ public ServiceConfiguration withAutoScalingConfiguration(AutoScalingConfiguration autoScalingConfiguration) { this.autoScalingConfiguration = autoScalingConfiguration.toString(); return this; } /** *

* The task definition ARN used by the tasks in the Amazon ECS service. *

* * @param taskDefinitionArn * The task definition ARN used by the tasks in the Amazon ECS service. */ public void setTaskDefinitionArn(String taskDefinitionArn) { this.taskDefinitionArn = taskDefinitionArn; } /** *

* The task definition ARN used by the tasks in the Amazon ECS service. *

* * @return The task definition ARN used by the tasks in the Amazon ECS service. */ public String getTaskDefinitionArn() { return this.taskDefinitionArn; } /** *

* The task definition ARN used by the tasks in the Amazon ECS service. *

* * @param taskDefinitionArn * The task definition ARN used by the tasks in the Amazon ECS service. * @return Returns a reference to this object so that method calls can be chained together. */ public ServiceConfiguration withTaskDefinitionArn(String taskDefinitionArn) { setTaskDefinitionArn(taskDefinitionArn); 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 (getMemory() != null) sb.append("Memory: ").append(getMemory()).append(","); if (getCpu() != null) sb.append("Cpu: ").append(getCpu()).append(","); if (getContainerConfigurations() != null) sb.append("ContainerConfigurations: ").append(getContainerConfigurations()).append(","); if (getAutoScalingConfiguration() != null) sb.append("AutoScalingConfiguration: ").append(getAutoScalingConfiguration()).append(","); if (getTaskDefinitionArn() != null) sb.append("TaskDefinitionArn: ").append(getTaskDefinitionArn()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ServiceConfiguration == false) return false; ServiceConfiguration other = (ServiceConfiguration) obj; if (other.getMemory() == null ^ this.getMemory() == null) return false; if (other.getMemory() != null && other.getMemory().equals(this.getMemory()) == false) return false; if (other.getCpu() == null ^ this.getCpu() == null) return false; if (other.getCpu() != null && other.getCpu().equals(this.getCpu()) == false) return false; if (other.getContainerConfigurations() == null ^ this.getContainerConfigurations() == null) return false; if (other.getContainerConfigurations() != null && other.getContainerConfigurations().equals(this.getContainerConfigurations()) == false) return false; if (other.getAutoScalingConfiguration() == null ^ this.getAutoScalingConfiguration() == null) return false; if (other.getAutoScalingConfiguration() != null && other.getAutoScalingConfiguration().equals(this.getAutoScalingConfiguration()) == false) return false; if (other.getTaskDefinitionArn() == null ^ this.getTaskDefinitionArn() == null) return false; if (other.getTaskDefinitionArn() != null && other.getTaskDefinitionArn().equals(this.getTaskDefinitionArn()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getMemory() == null) ? 0 : getMemory().hashCode()); hashCode = prime * hashCode + ((getCpu() == null) ? 0 : getCpu().hashCode()); hashCode = prime * hashCode + ((getContainerConfigurations() == null) ? 0 : getContainerConfigurations().hashCode()); hashCode = prime * hashCode + ((getAutoScalingConfiguration() == null) ? 0 : getAutoScalingConfiguration().hashCode()); hashCode = prime * hashCode + ((getTaskDefinitionArn() == null) ? 0 : getTaskDefinitionArn().hashCode()); return hashCode; } @Override public ServiceConfiguration clone() { try { return (ServiceConfiguration) 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.ServiceConfigurationMarshaller.getInstance().marshall(this, protocolMarshaller); } }