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

* An object that represents the details about the remediation configuration that includes the remediation action, * parameters, and data to execute the action. *

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

* The name of the Config rule. *

*/ private String configRuleName; /** *

* The type of the target. Target executes remediation. For example, SSM document. *

*/ private String targetType; /** *

* Target ID is the name of the SSM document. *

*/ private String targetId; /** *

* Version of the target. For example, version of the SSM document. *

* *

* If you make backward incompatible changes to the SSM document, you must call PutRemediationConfiguration API * again to ensure the remediations can run. *

*
*/ private String targetVersion; /** *

* An object of the RemediationParameterValue. *

*/ private java.util.Map parameters; /** *

* The type of a resource. *

*/ private String resourceType; /** *

* The remediation is triggered automatically. *

*/ private Boolean automatic; /** *

* An ExecutionControls object. *

*/ private ExecutionControls executionControls; /** *

* The maximum number of failed attempts for auto-remediation. If you do not select a number, the default is 5. *

*

* For example, if you specify MaximumAutomaticAttempts as 5 with RetryAttemptSeconds as 50 seconds, Config will put * a RemediationException on your behalf for the failing resource after the 5th failed attempt within 50 seconds. *

*/ private Integer maximumAutomaticAttempts; /** *

* Maximum time in seconds that Config runs auto-remediation. If you do not select a number, the default is 60 * seconds. *

*

* For example, if you specify RetryAttemptSeconds as 50 seconds and MaximumAutomaticAttempts as 5, Config will run * auto-remediations 5 times within 50 seconds before throwing an exception. *

*/ private Long retryAttemptSeconds; /** *

* Amazon Resource Name (ARN) of remediation configuration. *

*/ private String arn; /** *

* Name of the service that owns the service-linked rule, if applicable. *

*/ private String createdByService; /** *

* The name of the Config rule. *

* * @param configRuleName * The name of the Config rule. */ public void setConfigRuleName(String configRuleName) { this.configRuleName = configRuleName; } /** *

* The name of the Config rule. *

* * @return The name of the Config rule. */ public String getConfigRuleName() { return this.configRuleName; } /** *

* The name of the Config rule. *

* * @param configRuleName * The name of the Config rule. * @return Returns a reference to this object so that method calls can be chained together. */ public RemediationConfiguration withConfigRuleName(String configRuleName) { setConfigRuleName(configRuleName); return this; } /** *

* The type of the target. Target executes remediation. For example, SSM document. *

* * @param targetType * The type of the target. Target executes remediation. For example, SSM document. * @see RemediationTargetType */ public void setTargetType(String targetType) { this.targetType = targetType; } /** *

* The type of the target. Target executes remediation. For example, SSM document. *

* * @return The type of the target. Target executes remediation. For example, SSM document. * @see RemediationTargetType */ public String getTargetType() { return this.targetType; } /** *

* The type of the target. Target executes remediation. For example, SSM document. *

* * @param targetType * The type of the target. Target executes remediation. For example, SSM document. * @return Returns a reference to this object so that method calls can be chained together. * @see RemediationTargetType */ public RemediationConfiguration withTargetType(String targetType) { setTargetType(targetType); return this; } /** *

* The type of the target. Target executes remediation. For example, SSM document. *

* * @param targetType * The type of the target. Target executes remediation. For example, SSM document. * @return Returns a reference to this object so that method calls can be chained together. * @see RemediationTargetType */ public RemediationConfiguration withTargetType(RemediationTargetType targetType) { this.targetType = targetType.toString(); return this; } /** *

* Target ID is the name of the SSM document. *

* * @param targetId * Target ID is the name of the SSM document. */ public void setTargetId(String targetId) { this.targetId = targetId; } /** *

* Target ID is the name of the SSM document. *

* * @return Target ID is the name of the SSM document. */ public String getTargetId() { return this.targetId; } /** *

* Target ID is the name of the SSM document. *

* * @param targetId * Target ID is the name of the SSM document. * @return Returns a reference to this object so that method calls can be chained together. */ public RemediationConfiguration withTargetId(String targetId) { setTargetId(targetId); return this; } /** *

* Version of the target. For example, version of the SSM document. *

* *

* If you make backward incompatible changes to the SSM document, you must call PutRemediationConfiguration API * again to ensure the remediations can run. *

*
* * @param targetVersion * Version of the target. For example, version of the SSM document.

*

* If you make backward incompatible changes to the SSM document, you must call PutRemediationConfiguration * API again to ensure the remediations can run. *

*/ public void setTargetVersion(String targetVersion) { this.targetVersion = targetVersion; } /** *

* Version of the target. For example, version of the SSM document. *

* *

* If you make backward incompatible changes to the SSM document, you must call PutRemediationConfiguration API * again to ensure the remediations can run. *

*
* * @return Version of the target. For example, version of the SSM document.

*

* If you make backward incompatible changes to the SSM document, you must call PutRemediationConfiguration * API again to ensure the remediations can run. *

*/ public String getTargetVersion() { return this.targetVersion; } /** *

* Version of the target. For example, version of the SSM document. *

* *

* If you make backward incompatible changes to the SSM document, you must call PutRemediationConfiguration API * again to ensure the remediations can run. *

*
* * @param targetVersion * Version of the target. For example, version of the SSM document.

*

* If you make backward incompatible changes to the SSM document, you must call PutRemediationConfiguration * API again to ensure the remediations can run. *

* @return Returns a reference to this object so that method calls can be chained together. */ public RemediationConfiguration withTargetVersion(String targetVersion) { setTargetVersion(targetVersion); return this; } /** *

* An object of the RemediationParameterValue. *

* * @return An object of the RemediationParameterValue. */ public java.util.Map getParameters() { return parameters; } /** *

* An object of the RemediationParameterValue. *

* * @param parameters * An object of the RemediationParameterValue. */ public void setParameters(java.util.Map parameters) { this.parameters = parameters; } /** *

* An object of the RemediationParameterValue. *

* * @param parameters * An object of the RemediationParameterValue. * @return Returns a reference to this object so that method calls can be chained together. */ public RemediationConfiguration withParameters(java.util.Map parameters) { setParameters(parameters); return this; } /** * Add a single Parameters entry * * @see RemediationConfiguration#withParameters * @returns a reference to this object so that method calls can be chained together. */ public RemediationConfiguration addParametersEntry(String key, RemediationParameterValue value) { if (null == this.parameters) { this.parameters = new java.util.HashMap(); } if (this.parameters.containsKey(key)) throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided."); this.parameters.put(key, value); return this; } /** * Removes all the entries added into Parameters. * * @return Returns a reference to this object so that method calls can be chained together. */ public RemediationConfiguration clearParametersEntries() { this.parameters = null; return this; } /** *

* The type of a resource. *

* * @param resourceType * The type of a resource. */ public void setResourceType(String resourceType) { this.resourceType = resourceType; } /** *

* The type of a resource. *

* * @return The type of a resource. */ public String getResourceType() { return this.resourceType; } /** *

* The type of a resource. *

* * @param resourceType * The type of a resource. * @return Returns a reference to this object so that method calls can be chained together. */ public RemediationConfiguration withResourceType(String resourceType) { setResourceType(resourceType); return this; } /** *

* The remediation is triggered automatically. *

* * @param automatic * The remediation is triggered automatically. */ public void setAutomatic(Boolean automatic) { this.automatic = automatic; } /** *

* The remediation is triggered automatically. *

* * @return The remediation is triggered automatically. */ public Boolean getAutomatic() { return this.automatic; } /** *

* The remediation is triggered automatically. *

* * @param automatic * The remediation is triggered automatically. * @return Returns a reference to this object so that method calls can be chained together. */ public RemediationConfiguration withAutomatic(Boolean automatic) { setAutomatic(automatic); return this; } /** *

* The remediation is triggered automatically. *

* * @return The remediation is triggered automatically. */ public Boolean isAutomatic() { return this.automatic; } /** *

* An ExecutionControls object. *

* * @param executionControls * An ExecutionControls object. */ public void setExecutionControls(ExecutionControls executionControls) { this.executionControls = executionControls; } /** *

* An ExecutionControls object. *

* * @return An ExecutionControls object. */ public ExecutionControls getExecutionControls() { return this.executionControls; } /** *

* An ExecutionControls object. *

* * @param executionControls * An ExecutionControls object. * @return Returns a reference to this object so that method calls can be chained together. */ public RemediationConfiguration withExecutionControls(ExecutionControls executionControls) { setExecutionControls(executionControls); return this; } /** *

* The maximum number of failed attempts for auto-remediation. If you do not select a number, the default is 5. *

*

* For example, if you specify MaximumAutomaticAttempts as 5 with RetryAttemptSeconds as 50 seconds, Config will put * a RemediationException on your behalf for the failing resource after the 5th failed attempt within 50 seconds. *

* * @param maximumAutomaticAttempts * The maximum number of failed attempts for auto-remediation. If you do not select a number, the default is * 5.

*

* For example, if you specify MaximumAutomaticAttempts as 5 with RetryAttemptSeconds as 50 seconds, Config * will put a RemediationException on your behalf for the failing resource after the 5th failed attempt * within 50 seconds. */ public void setMaximumAutomaticAttempts(Integer maximumAutomaticAttempts) { this.maximumAutomaticAttempts = maximumAutomaticAttempts; } /** *

* The maximum number of failed attempts for auto-remediation. If you do not select a number, the default is 5. *

*

* For example, if you specify MaximumAutomaticAttempts as 5 with RetryAttemptSeconds as 50 seconds, Config will put * a RemediationException on your behalf for the failing resource after the 5th failed attempt within 50 seconds. *

* * @return The maximum number of failed attempts for auto-remediation. If you do not select a number, the default is * 5.

*

* For example, if you specify MaximumAutomaticAttempts as 5 with RetryAttemptSeconds as 50 seconds, Config * will put a RemediationException on your behalf for the failing resource after the 5th failed attempt * within 50 seconds. */ public Integer getMaximumAutomaticAttempts() { return this.maximumAutomaticAttempts; } /** *

* The maximum number of failed attempts for auto-remediation. If you do not select a number, the default is 5. *

*

* For example, if you specify MaximumAutomaticAttempts as 5 with RetryAttemptSeconds as 50 seconds, Config will put * a RemediationException on your behalf for the failing resource after the 5th failed attempt within 50 seconds. *

* * @param maximumAutomaticAttempts * The maximum number of failed attempts for auto-remediation. If you do not select a number, the default is * 5.

*

* For example, if you specify MaximumAutomaticAttempts as 5 with RetryAttemptSeconds as 50 seconds, Config * will put a RemediationException on your behalf for the failing resource after the 5th failed attempt * within 50 seconds. * @return Returns a reference to this object so that method calls can be chained together. */ public RemediationConfiguration withMaximumAutomaticAttempts(Integer maximumAutomaticAttempts) { setMaximumAutomaticAttempts(maximumAutomaticAttempts); return this; } /** *

* Maximum time in seconds that Config runs auto-remediation. If you do not select a number, the default is 60 * seconds. *

*

* For example, if you specify RetryAttemptSeconds as 50 seconds and MaximumAutomaticAttempts as 5, Config will run * auto-remediations 5 times within 50 seconds before throwing an exception. *

* * @param retryAttemptSeconds * Maximum time in seconds that Config runs auto-remediation. If you do not select a number, the default is * 60 seconds.

*

* For example, if you specify RetryAttemptSeconds as 50 seconds and MaximumAutomaticAttempts as 5, Config * will run auto-remediations 5 times within 50 seconds before throwing an exception. */ public void setRetryAttemptSeconds(Long retryAttemptSeconds) { this.retryAttemptSeconds = retryAttemptSeconds; } /** *

* Maximum time in seconds that Config runs auto-remediation. If you do not select a number, the default is 60 * seconds. *

*

* For example, if you specify RetryAttemptSeconds as 50 seconds and MaximumAutomaticAttempts as 5, Config will run * auto-remediations 5 times within 50 seconds before throwing an exception. *

* * @return Maximum time in seconds that Config runs auto-remediation. If you do not select a number, the default is * 60 seconds.

*

* For example, if you specify RetryAttemptSeconds as 50 seconds and MaximumAutomaticAttempts as 5, Config * will run auto-remediations 5 times within 50 seconds before throwing an exception. */ public Long getRetryAttemptSeconds() { return this.retryAttemptSeconds; } /** *

* Maximum time in seconds that Config runs auto-remediation. If you do not select a number, the default is 60 * seconds. *

*

* For example, if you specify RetryAttemptSeconds as 50 seconds and MaximumAutomaticAttempts as 5, Config will run * auto-remediations 5 times within 50 seconds before throwing an exception. *

* * @param retryAttemptSeconds * Maximum time in seconds that Config runs auto-remediation. If you do not select a number, the default is * 60 seconds.

*

* For example, if you specify RetryAttemptSeconds as 50 seconds and MaximumAutomaticAttempts as 5, Config * will run auto-remediations 5 times within 50 seconds before throwing an exception. * @return Returns a reference to this object so that method calls can be chained together. */ public RemediationConfiguration withRetryAttemptSeconds(Long retryAttemptSeconds) { setRetryAttemptSeconds(retryAttemptSeconds); return this; } /** *

* Amazon Resource Name (ARN) of remediation configuration. *

* * @param arn * Amazon Resource Name (ARN) of remediation configuration. */ public void setArn(String arn) { this.arn = arn; } /** *

* Amazon Resource Name (ARN) of remediation configuration. *

* * @return Amazon Resource Name (ARN) of remediation configuration. */ public String getArn() { return this.arn; } /** *

* Amazon Resource Name (ARN) of remediation configuration. *

* * @param arn * Amazon Resource Name (ARN) of remediation configuration. * @return Returns a reference to this object so that method calls can be chained together. */ public RemediationConfiguration withArn(String arn) { setArn(arn); return this; } /** *

* Name of the service that owns the service-linked rule, if applicable. *

* * @param createdByService * Name of the service that owns the service-linked rule, if applicable. */ public void setCreatedByService(String createdByService) { this.createdByService = createdByService; } /** *

* Name of the service that owns the service-linked rule, if applicable. *

* * @return Name of the service that owns the service-linked rule, if applicable. */ public String getCreatedByService() { return this.createdByService; } /** *

* Name of the service that owns the service-linked rule, if applicable. *

* * @param createdByService * Name of the service that owns the service-linked rule, if applicable. * @return Returns a reference to this object so that method calls can be chained together. */ public RemediationConfiguration withCreatedByService(String createdByService) { setCreatedByService(createdByService); 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 (getConfigRuleName() != null) sb.append("ConfigRuleName: ").append(getConfigRuleName()).append(","); if (getTargetType() != null) sb.append("TargetType: ").append(getTargetType()).append(","); if (getTargetId() != null) sb.append("TargetId: ").append(getTargetId()).append(","); if (getTargetVersion() != null) sb.append("TargetVersion: ").append(getTargetVersion()).append(","); if (getParameters() != null) sb.append("Parameters: ").append(getParameters()).append(","); if (getResourceType() != null) sb.append("ResourceType: ").append(getResourceType()).append(","); if (getAutomatic() != null) sb.append("Automatic: ").append(getAutomatic()).append(","); if (getExecutionControls() != null) sb.append("ExecutionControls: ").append(getExecutionControls()).append(","); if (getMaximumAutomaticAttempts() != null) sb.append("MaximumAutomaticAttempts: ").append(getMaximumAutomaticAttempts()).append(","); if (getRetryAttemptSeconds() != null) sb.append("RetryAttemptSeconds: ").append(getRetryAttemptSeconds()).append(","); if (getArn() != null) sb.append("Arn: ").append(getArn()).append(","); if (getCreatedByService() != null) sb.append("CreatedByService: ").append(getCreatedByService()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof RemediationConfiguration == false) return false; RemediationConfiguration other = (RemediationConfiguration) obj; if (other.getConfigRuleName() == null ^ this.getConfigRuleName() == null) return false; if (other.getConfigRuleName() != null && other.getConfigRuleName().equals(this.getConfigRuleName()) == false) return false; if (other.getTargetType() == null ^ this.getTargetType() == null) return false; if (other.getTargetType() != null && other.getTargetType().equals(this.getTargetType()) == false) return false; if (other.getTargetId() == null ^ this.getTargetId() == null) return false; if (other.getTargetId() != null && other.getTargetId().equals(this.getTargetId()) == false) return false; if (other.getTargetVersion() == null ^ this.getTargetVersion() == null) return false; if (other.getTargetVersion() != null && other.getTargetVersion().equals(this.getTargetVersion()) == false) return false; if (other.getParameters() == null ^ this.getParameters() == null) return false; if (other.getParameters() != null && other.getParameters().equals(this.getParameters()) == false) return false; if (other.getResourceType() == null ^ this.getResourceType() == null) return false; if (other.getResourceType() != null && other.getResourceType().equals(this.getResourceType()) == false) return false; if (other.getAutomatic() == null ^ this.getAutomatic() == null) return false; if (other.getAutomatic() != null && other.getAutomatic().equals(this.getAutomatic()) == false) return false; if (other.getExecutionControls() == null ^ this.getExecutionControls() == null) return false; if (other.getExecutionControls() != null && other.getExecutionControls().equals(this.getExecutionControls()) == false) return false; if (other.getMaximumAutomaticAttempts() == null ^ this.getMaximumAutomaticAttempts() == null) return false; if (other.getMaximumAutomaticAttempts() != null && other.getMaximumAutomaticAttempts().equals(this.getMaximumAutomaticAttempts()) == false) return false; if (other.getRetryAttemptSeconds() == null ^ this.getRetryAttemptSeconds() == null) return false; if (other.getRetryAttemptSeconds() != null && other.getRetryAttemptSeconds().equals(this.getRetryAttemptSeconds()) == false) return false; if (other.getArn() == null ^ this.getArn() == null) return false; if (other.getArn() != null && other.getArn().equals(this.getArn()) == false) return false; if (other.getCreatedByService() == null ^ this.getCreatedByService() == null) return false; if (other.getCreatedByService() != null && other.getCreatedByService().equals(this.getCreatedByService()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getConfigRuleName() == null) ? 0 : getConfigRuleName().hashCode()); hashCode = prime * hashCode + ((getTargetType() == null) ? 0 : getTargetType().hashCode()); hashCode = prime * hashCode + ((getTargetId() == null) ? 0 : getTargetId().hashCode()); hashCode = prime * hashCode + ((getTargetVersion() == null) ? 0 : getTargetVersion().hashCode()); hashCode = prime * hashCode + ((getParameters() == null) ? 0 : getParameters().hashCode()); hashCode = prime * hashCode + ((getResourceType() == null) ? 0 : getResourceType().hashCode()); hashCode = prime * hashCode + ((getAutomatic() == null) ? 0 : getAutomatic().hashCode()); hashCode = prime * hashCode + ((getExecutionControls() == null) ? 0 : getExecutionControls().hashCode()); hashCode = prime * hashCode + ((getMaximumAutomaticAttempts() == null) ? 0 : getMaximumAutomaticAttempts().hashCode()); hashCode = prime * hashCode + ((getRetryAttemptSeconds() == null) ? 0 : getRetryAttemptSeconds().hashCode()); hashCode = prime * hashCode + ((getArn() == null) ? 0 : getArn().hashCode()); hashCode = prime * hashCode + ((getCreatedByService() == null) ? 0 : getCreatedByService().hashCode()); return hashCode; } @Override public RemediationConfiguration clone() { try { return (RemediationConfiguration) 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.config.model.transform.RemediationConfigurationMarshaller.getInstance().marshall(this, protocolMarshaller); } }