/* * Copyright 2010-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.iot.model; import java.io.Serializable; import com.amazonaws.AmazonWebServiceRequest; /** *

* Defines an action that can be applied to audit findings by using * StartAuditMitigationActionsTask. Only certain types of mitigation actions can * be applied to specific check names. For more information, see Mitigation actions. Each mitigation action can apply only one type of * change. *

*

* Requires permission to access the CreateMitigationAction action. *

*/ public class CreateMitigationActionRequest extends AmazonWebServiceRequest implements Serializable { /** *

* A friendly name for the action. Choose a friendly name that accurately * describes the action (for example, EnableLoggingAction). *

*

* Constraints:
* Length: - 128
* Pattern: [a-zA-Z0-9_-]+
*/ private String actionName; /** *

* The ARN of the IAM role that is used to apply the mitigation action. *

*

* Constraints:
* Length: 20 - 2048
*/ private String roleArn; /** *

* Defines the type of action and the parameters for that action. *

*/ private MitigationActionParams actionParams; /** *

* Metadata that can be used to manage the mitigation action. *

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

* A friendly name for the action. Choose a friendly name that accurately * describes the action (for example, EnableLoggingAction). *

*

* Constraints:
* Length: - 128
* Pattern: [a-zA-Z0-9_-]+
* * @return

* A friendly name for the action. Choose a friendly name that * accurately describes the action (for example, * EnableLoggingAction). *

*/ public String getActionName() { return actionName; } /** *

* A friendly name for the action. Choose a friendly name that accurately * describes the action (for example, EnableLoggingAction). *

*

* Constraints:
* Length: - 128
* Pattern: [a-zA-Z0-9_-]+
* * @param actionName

* A friendly name for the action. Choose a friendly name that * accurately describes the action (for example, * EnableLoggingAction). *

*/ public void setActionName(String actionName) { this.actionName = actionName; } /** *

* A friendly name for the action. Choose a friendly name that accurately * describes the action (for example, EnableLoggingAction). *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Length: - 128
* Pattern: [a-zA-Z0-9_-]+
* * @param actionName

* A friendly name for the action. Choose a friendly name that * accurately describes the action (for example, * EnableLoggingAction). *

* @return A reference to this updated object so that method calls can be * chained together. */ public CreateMitigationActionRequest withActionName(String actionName) { this.actionName = actionName; return this; } /** *

* The ARN of the IAM role that is used to apply the mitigation action. *

*

* Constraints:
* Length: 20 - 2048
* * @return

* The ARN of the IAM role that is used to apply the mitigation * action. *

*/ public String getRoleArn() { return roleArn; } /** *

* The ARN of the IAM role that is used to apply the mitigation action. *

*

* Constraints:
* Length: 20 - 2048
* * @param roleArn

* The ARN of the IAM role that is used to apply the mitigation * action. *

*/ public void setRoleArn(String roleArn) { this.roleArn = roleArn; } /** *

* The ARN of the IAM role that is used to apply the mitigation action. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Length: 20 - 2048
* * @param roleArn

* The ARN of the IAM role that is used to apply the mitigation * action. *

* @return A reference to this updated object so that method calls can be * chained together. */ public CreateMitigationActionRequest withRoleArn(String roleArn) { this.roleArn = roleArn; return this; } /** *

* Defines the type of action and the parameters for that action. *

* * @return

* Defines the type of action and the parameters for that action. *

*/ public MitigationActionParams getActionParams() { return actionParams; } /** *

* Defines the type of action and the parameters for that action. *

* * @param actionParams

* Defines the type of action and the parameters for that action. *

*/ public void setActionParams(MitigationActionParams actionParams) { this.actionParams = actionParams; } /** *

* Defines the type of action and the parameters for that action. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param actionParams

* Defines the type of action and the parameters for that action. *

* @return A reference to this updated object so that method calls can be * chained together. */ public CreateMitigationActionRequest withActionParams(MitigationActionParams actionParams) { this.actionParams = actionParams; return this; } /** *

* Metadata that can be used to manage the mitigation action. *

* * @return

* Metadata that can be used to manage the mitigation action. *

*/ public java.util.List getTags() { return tags; } /** *

* Metadata that can be used to manage the mitigation action. *

* * @param tags

* Metadata that can be used to manage the mitigation action. *

*/ public void setTags(java.util.Collection tags) { if (tags == null) { this.tags = null; return; } this.tags = new java.util.ArrayList(tags); } /** *

* Metadata that can be used to manage the mitigation action. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param tags

* Metadata that can be used to manage the mitigation action. *

* @return A reference to this updated object so that method calls can be * chained together. */ public CreateMitigationActionRequest withTags(Tag... tags) { if (getTags() == null) { this.tags = new java.util.ArrayList(tags.length); } for (Tag value : tags) { this.tags.add(value); } return this; } /** *

* Metadata that can be used to manage the mitigation action. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param tags

* Metadata that can be used to manage the mitigation action. *

* @return A reference to this updated object so that method calls can be * chained together. */ public CreateMitigationActionRequest withTags(java.util.Collection tags) { setTags(tags); return this; } /** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getActionName() != null) sb.append("actionName: " + getActionName() + ","); if (getRoleArn() != null) sb.append("roleArn: " + getRoleArn() + ","); if (getActionParams() != null) sb.append("actionParams: " + getActionParams() + ","); if (getTags() != null) sb.append("tags: " + getTags()); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getActionName() == null) ? 0 : getActionName().hashCode()); hashCode = prime * hashCode + ((getRoleArn() == null) ? 0 : getRoleArn().hashCode()); hashCode = prime * hashCode + ((getActionParams() == null) ? 0 : getActionParams().hashCode()); hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof CreateMitigationActionRequest == false) return false; CreateMitigationActionRequest other = (CreateMitigationActionRequest) obj; if (other.getActionName() == null ^ this.getActionName() == null) return false; if (other.getActionName() != null && other.getActionName().equals(this.getActionName()) == false) return false; if (other.getRoleArn() == null ^ this.getRoleArn() == null) return false; if (other.getRoleArn() != null && other.getRoleArn().equals(this.getRoleArn()) == false) return false; if (other.getActionParams() == null ^ this.getActionParams() == null) return false; if (other.getActionParams() != null && other.getActionParams().equals(this.getActionParams()) == false) return false; if (other.getTags() == null ^ this.getTags() == null) return false; if (other.getTags() != null && other.getTags().equals(this.getTags()) == false) return false; return true; } }