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

* Describes an association of a Amazon Web Services Systems Manager document (SSM document) and a managed node. *

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

* The name of the SSM document. *

*/ private String name; /** *

* The managed node ID. *

*/ private String instanceId; /** *

* The ID created by the system when you create an association. An association is a binding between a document and a * set of targets with a schedule. *

*/ private String associationId; /** *

* The association version. *

*/ private String associationVersion; /** *

* The version of the document used in the association. If you change a document version for a State Manager * association, Systems Manager immediately runs the association unless you previously specifed the * apply-only-at-cron-interval parameter. *

* *

* State Manager doesn't support running associations that use a new version of a document if that document is * shared from another account. State Manager always runs the default version of a document if shared * from another account, even though the Systems Manager console shows that a new version was processed. If you want * to run an association using a new version of a document shared form another account, you must set the document * version to default. *

*
*/ private String documentVersion; /** *

* The managed nodes targeted by the request to create an association. You can target all managed nodes in an Amazon * Web Services account by specifying the InstanceIds key with a value of *. *

*/ private com.amazonaws.internal.SdkInternalList targets; /** *

* The date on which the association was last run. *

*/ private java.util.Date lastExecutionDate; /** *

* Information about the association. *

*/ private AssociationOverview overview; /** *

* A cron expression that specifies a schedule when the association runs. The schedule runs in Coordinated Universal * Time (UTC). *

*/ private String scheduleExpression; /** *

* The association name. *

*/ private String associationName; /** *

* Number of days to wait after the scheduled day to run an association. *

*/ private Integer scheduleOffset; /** *

* A key-value mapping of document parameters to target resources. Both Targets and TargetMaps can't be specified * together. *

*/ private com.amazonaws.internal.SdkInternalList>> targetMaps; /** *

* The name of the SSM document. *

* * @param name * The name of the SSM document. */ public void setName(String name) { this.name = name; } /** *

* The name of the SSM document. *

* * @return The name of the SSM document. */ public String getName() { return this.name; } /** *

* The name of the SSM document. *

* * @param name * The name of the SSM document. * @return Returns a reference to this object so that method calls can be chained together. */ public Association withName(String name) { setName(name); return this; } /** *

* The managed node ID. *

* * @param instanceId * The managed node ID. */ public void setInstanceId(String instanceId) { this.instanceId = instanceId; } /** *

* The managed node ID. *

* * @return The managed node ID. */ public String getInstanceId() { return this.instanceId; } /** *

* The managed node ID. *

* * @param instanceId * The managed node ID. * @return Returns a reference to this object so that method calls can be chained together. */ public Association withInstanceId(String instanceId) { setInstanceId(instanceId); return this; } /** *

* The ID created by the system when you create an association. An association is a binding between a document and a * set of targets with a schedule. *

* * @param associationId * The ID created by the system when you create an association. An association is a binding between a * document and a set of targets with a schedule. */ public void setAssociationId(String associationId) { this.associationId = associationId; } /** *

* The ID created by the system when you create an association. An association is a binding between a document and a * set of targets with a schedule. *

* * @return The ID created by the system when you create an association. An association is a binding between a * document and a set of targets with a schedule. */ public String getAssociationId() { return this.associationId; } /** *

* The ID created by the system when you create an association. An association is a binding between a document and a * set of targets with a schedule. *

* * @param associationId * The ID created by the system when you create an association. An association is a binding between a * document and a set of targets with a schedule. * @return Returns a reference to this object so that method calls can be chained together. */ public Association withAssociationId(String associationId) { setAssociationId(associationId); return this; } /** *

* The association version. *

* * @param associationVersion * The association version. */ public void setAssociationVersion(String associationVersion) { this.associationVersion = associationVersion; } /** *

* The association version. *

* * @return The association version. */ public String getAssociationVersion() { return this.associationVersion; } /** *

* The association version. *

* * @param associationVersion * The association version. * @return Returns a reference to this object so that method calls can be chained together. */ public Association withAssociationVersion(String associationVersion) { setAssociationVersion(associationVersion); return this; } /** *

* The version of the document used in the association. If you change a document version for a State Manager * association, Systems Manager immediately runs the association unless you previously specifed the * apply-only-at-cron-interval parameter. *

* *

* State Manager doesn't support running associations that use a new version of a document if that document is * shared from another account. State Manager always runs the default version of a document if shared * from another account, even though the Systems Manager console shows that a new version was processed. If you want * to run an association using a new version of a document shared form another account, you must set the document * version to default. *

*
* * @param documentVersion * The version of the document used in the association. If you change a document version for a State Manager * association, Systems Manager immediately runs the association unless you previously specifed the * apply-only-at-cron-interval parameter.

*

* State Manager doesn't support running associations that use a new version of a document if that document * is shared from another account. State Manager always runs the default version of a document * if shared from another account, even though the Systems Manager console shows that a new version was * processed. If you want to run an association using a new version of a document shared form another * account, you must set the document version to default. *

*/ public void setDocumentVersion(String documentVersion) { this.documentVersion = documentVersion; } /** *

* The version of the document used in the association. If you change a document version for a State Manager * association, Systems Manager immediately runs the association unless you previously specifed the * apply-only-at-cron-interval parameter. *

* *

* State Manager doesn't support running associations that use a new version of a document if that document is * shared from another account. State Manager always runs the default version of a document if shared * from another account, even though the Systems Manager console shows that a new version was processed. If you want * to run an association using a new version of a document shared form another account, you must set the document * version to default. *

*
* * @return The version of the document used in the association. If you change a document version for a State Manager * association, Systems Manager immediately runs the association unless you previously specifed the * apply-only-at-cron-interval parameter.

*

* State Manager doesn't support running associations that use a new version of a document if that document * is shared from another account. State Manager always runs the default version of a document * if shared from another account, even though the Systems Manager console shows that a new version was * processed. If you want to run an association using a new version of a document shared form another * account, you must set the document version to default. *

*/ public String getDocumentVersion() { return this.documentVersion; } /** *

* The version of the document used in the association. If you change a document version for a State Manager * association, Systems Manager immediately runs the association unless you previously specifed the * apply-only-at-cron-interval parameter. *

* *

* State Manager doesn't support running associations that use a new version of a document if that document is * shared from another account. State Manager always runs the default version of a document if shared * from another account, even though the Systems Manager console shows that a new version was processed. If you want * to run an association using a new version of a document shared form another account, you must set the document * version to default. *

*
* * @param documentVersion * The version of the document used in the association. If you change a document version for a State Manager * association, Systems Manager immediately runs the association unless you previously specifed the * apply-only-at-cron-interval parameter.

*

* State Manager doesn't support running associations that use a new version of a document if that document * is shared from another account. State Manager always runs the default version of a document * if shared from another account, even though the Systems Manager console shows that a new version was * processed. If you want to run an association using a new version of a document shared form another * account, you must set the document version to default. *

* @return Returns a reference to this object so that method calls can be chained together. */ public Association withDocumentVersion(String documentVersion) { setDocumentVersion(documentVersion); return this; } /** *

* The managed nodes targeted by the request to create an association. You can target all managed nodes in an Amazon * Web Services account by specifying the InstanceIds key with a value of *. *

* * @return The managed nodes targeted by the request to create an association. You can target all managed nodes in * an Amazon Web Services account by specifying the InstanceIds key with a value of * *. */ public java.util.List getTargets() { if (targets == null) { targets = new com.amazonaws.internal.SdkInternalList(); } return targets; } /** *

* The managed nodes targeted by the request to create an association. You can target all managed nodes in an Amazon * Web Services account by specifying the InstanceIds key with a value of *. *

* * @param targets * The managed nodes targeted by the request to create an association. You can target all managed nodes in an * Amazon Web Services account by specifying the InstanceIds key with a value of *. */ public void setTargets(java.util.Collection targets) { if (targets == null) { this.targets = null; return; } this.targets = new com.amazonaws.internal.SdkInternalList(targets); } /** *

* The managed nodes targeted by the request to create an association. You can target all managed nodes in an Amazon * Web Services account by specifying the InstanceIds key with a value of *. *

*

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

* * @param targets * The managed nodes targeted by the request to create an association. You can target all managed nodes in an * Amazon Web Services account by specifying the InstanceIds key with a value of *. * @return Returns a reference to this object so that method calls can be chained together. */ public Association withTargets(Target... targets) { if (this.targets == null) { setTargets(new com.amazonaws.internal.SdkInternalList(targets.length)); } for (Target ele : targets) { this.targets.add(ele); } return this; } /** *

* The managed nodes targeted by the request to create an association. You can target all managed nodes in an Amazon * Web Services account by specifying the InstanceIds key with a value of *. *

* * @param targets * The managed nodes targeted by the request to create an association. You can target all managed nodes in an * Amazon Web Services account by specifying the InstanceIds key with a value of *. * @return Returns a reference to this object so that method calls can be chained together. */ public Association withTargets(java.util.Collection targets) { setTargets(targets); return this; } /** *

* The date on which the association was last run. *

* * @param lastExecutionDate * The date on which the association was last run. */ public void setLastExecutionDate(java.util.Date lastExecutionDate) { this.lastExecutionDate = lastExecutionDate; } /** *

* The date on which the association was last run. *

* * @return The date on which the association was last run. */ public java.util.Date getLastExecutionDate() { return this.lastExecutionDate; } /** *

* The date on which the association was last run. *

* * @param lastExecutionDate * The date on which the association was last run. * @return Returns a reference to this object so that method calls can be chained together. */ public Association withLastExecutionDate(java.util.Date lastExecutionDate) { setLastExecutionDate(lastExecutionDate); return this; } /** *

* Information about the association. *

* * @param overview * Information about the association. */ public void setOverview(AssociationOverview overview) { this.overview = overview; } /** *

* Information about the association. *

* * @return Information about the association. */ public AssociationOverview getOverview() { return this.overview; } /** *

* Information about the association. *

* * @param overview * Information about the association. * @return Returns a reference to this object so that method calls can be chained together. */ public Association withOverview(AssociationOverview overview) { setOverview(overview); return this; } /** *

* A cron expression that specifies a schedule when the association runs. The schedule runs in Coordinated Universal * Time (UTC). *

* * @param scheduleExpression * A cron expression that specifies a schedule when the association runs. The schedule runs in Coordinated * Universal Time (UTC). */ public void setScheduleExpression(String scheduleExpression) { this.scheduleExpression = scheduleExpression; } /** *

* A cron expression that specifies a schedule when the association runs. The schedule runs in Coordinated Universal * Time (UTC). *

* * @return A cron expression that specifies a schedule when the association runs. The schedule runs in Coordinated * Universal Time (UTC). */ public String getScheduleExpression() { return this.scheduleExpression; } /** *

* A cron expression that specifies a schedule when the association runs. The schedule runs in Coordinated Universal * Time (UTC). *

* * @param scheduleExpression * A cron expression that specifies a schedule when the association runs. The schedule runs in Coordinated * Universal Time (UTC). * @return Returns a reference to this object so that method calls can be chained together. */ public Association withScheduleExpression(String scheduleExpression) { setScheduleExpression(scheduleExpression); return this; } /** *

* The association name. *

* * @param associationName * The association name. */ public void setAssociationName(String associationName) { this.associationName = associationName; } /** *

* The association name. *

* * @return The association name. */ public String getAssociationName() { return this.associationName; } /** *

* The association name. *

* * @param associationName * The association name. * @return Returns a reference to this object so that method calls can be chained together. */ public Association withAssociationName(String associationName) { setAssociationName(associationName); return this; } /** *

* Number of days to wait after the scheduled day to run an association. *

* * @param scheduleOffset * Number of days to wait after the scheduled day to run an association. */ public void setScheduleOffset(Integer scheduleOffset) { this.scheduleOffset = scheduleOffset; } /** *

* Number of days to wait after the scheduled day to run an association. *

* * @return Number of days to wait after the scheduled day to run an association. */ public Integer getScheduleOffset() { return this.scheduleOffset; } /** *

* Number of days to wait after the scheduled day to run an association. *

* * @param scheduleOffset * Number of days to wait after the scheduled day to run an association. * @return Returns a reference to this object so that method calls can be chained together. */ public Association withScheduleOffset(Integer scheduleOffset) { setScheduleOffset(scheduleOffset); return this; } /** *

* A key-value mapping of document parameters to target resources. Both Targets and TargetMaps can't be specified * together. *

* * @return A key-value mapping of document parameters to target resources. Both Targets and TargetMaps can't be * specified together. */ public java.util.List>> getTargetMaps() { if (targetMaps == null) { targetMaps = new com.amazonaws.internal.SdkInternalList>>(); } return targetMaps; } /** *

* A key-value mapping of document parameters to target resources. Both Targets and TargetMaps can't be specified * together. *

* * @param targetMaps * A key-value mapping of document parameters to target resources. Both Targets and TargetMaps can't be * specified together. */ public void setTargetMaps(java.util.Collection>> targetMaps) { if (targetMaps == null) { this.targetMaps = null; return; } this.targetMaps = new com.amazonaws.internal.SdkInternalList>>(targetMaps); } /** *

* A key-value mapping of document parameters to target resources. Both Targets and TargetMaps can't be specified * together. *

*

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

* * @param targetMaps * A key-value mapping of document parameters to target resources. Both Targets and TargetMaps can't be * specified together. * @return Returns a reference to this object so that method calls can be chained together. */ public Association withTargetMaps(java.util.Map>... targetMaps) { if (this.targetMaps == null) { setTargetMaps(new com.amazonaws.internal.SdkInternalList>>(targetMaps.length)); } for (java.util.Map> ele : targetMaps) { this.targetMaps.add(ele); } return this; } /** *

* A key-value mapping of document parameters to target resources. Both Targets and TargetMaps can't be specified * together. *

* * @param targetMaps * A key-value mapping of document parameters to target resources. Both Targets and TargetMaps can't be * specified together. * @return Returns a reference to this object so that method calls can be chained together. */ public Association withTargetMaps(java.util.Collection>> targetMaps) { setTargetMaps(targetMaps); 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 (getName() != null) sb.append("Name: ").append(getName()).append(","); if (getInstanceId() != null) sb.append("InstanceId: ").append(getInstanceId()).append(","); if (getAssociationId() != null) sb.append("AssociationId: ").append(getAssociationId()).append(","); if (getAssociationVersion() != null) sb.append("AssociationVersion: ").append(getAssociationVersion()).append(","); if (getDocumentVersion() != null) sb.append("DocumentVersion: ").append(getDocumentVersion()).append(","); if (getTargets() != null) sb.append("Targets: ").append(getTargets()).append(","); if (getLastExecutionDate() != null) sb.append("LastExecutionDate: ").append(getLastExecutionDate()).append(","); if (getOverview() != null) sb.append("Overview: ").append(getOverview()).append(","); if (getScheduleExpression() != null) sb.append("ScheduleExpression: ").append(getScheduleExpression()).append(","); if (getAssociationName() != null) sb.append("AssociationName: ").append(getAssociationName()).append(","); if (getScheduleOffset() != null) sb.append("ScheduleOffset: ").append(getScheduleOffset()).append(","); if (getTargetMaps() != null) sb.append("TargetMaps: ").append(getTargetMaps()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof Association == false) return false; Association other = (Association) obj; if (other.getName() == null ^ this.getName() == null) return false; if (other.getName() != null && other.getName().equals(this.getName()) == false) return false; if (other.getInstanceId() == null ^ this.getInstanceId() == null) return false; if (other.getInstanceId() != null && other.getInstanceId().equals(this.getInstanceId()) == false) return false; if (other.getAssociationId() == null ^ this.getAssociationId() == null) return false; if (other.getAssociationId() != null && other.getAssociationId().equals(this.getAssociationId()) == false) return false; if (other.getAssociationVersion() == null ^ this.getAssociationVersion() == null) return false; if (other.getAssociationVersion() != null && other.getAssociationVersion().equals(this.getAssociationVersion()) == false) return false; if (other.getDocumentVersion() == null ^ this.getDocumentVersion() == null) return false; if (other.getDocumentVersion() != null && other.getDocumentVersion().equals(this.getDocumentVersion()) == false) return false; if (other.getTargets() == null ^ this.getTargets() == null) return false; if (other.getTargets() != null && other.getTargets().equals(this.getTargets()) == false) return false; if (other.getLastExecutionDate() == null ^ this.getLastExecutionDate() == null) return false; if (other.getLastExecutionDate() != null && other.getLastExecutionDate().equals(this.getLastExecutionDate()) == false) return false; if (other.getOverview() == null ^ this.getOverview() == null) return false; if (other.getOverview() != null && other.getOverview().equals(this.getOverview()) == false) return false; if (other.getScheduleExpression() == null ^ this.getScheduleExpression() == null) return false; if (other.getScheduleExpression() != null && other.getScheduleExpression().equals(this.getScheduleExpression()) == false) return false; if (other.getAssociationName() == null ^ this.getAssociationName() == null) return false; if (other.getAssociationName() != null && other.getAssociationName().equals(this.getAssociationName()) == false) return false; if (other.getScheduleOffset() == null ^ this.getScheduleOffset() == null) return false; if (other.getScheduleOffset() != null && other.getScheduleOffset().equals(this.getScheduleOffset()) == false) return false; if (other.getTargetMaps() == null ^ this.getTargetMaps() == null) return false; if (other.getTargetMaps() != null && other.getTargetMaps().equals(this.getTargetMaps()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode()); hashCode = prime * hashCode + ((getInstanceId() == null) ? 0 : getInstanceId().hashCode()); hashCode = prime * hashCode + ((getAssociationId() == null) ? 0 : getAssociationId().hashCode()); hashCode = prime * hashCode + ((getAssociationVersion() == null) ? 0 : getAssociationVersion().hashCode()); hashCode = prime * hashCode + ((getDocumentVersion() == null) ? 0 : getDocumentVersion().hashCode()); hashCode = prime * hashCode + ((getTargets() == null) ? 0 : getTargets().hashCode()); hashCode = prime * hashCode + ((getLastExecutionDate() == null) ? 0 : getLastExecutionDate().hashCode()); hashCode = prime * hashCode + ((getOverview() == null) ? 0 : getOverview().hashCode()); hashCode = prime * hashCode + ((getScheduleExpression() == null) ? 0 : getScheduleExpression().hashCode()); hashCode = prime * hashCode + ((getAssociationName() == null) ? 0 : getAssociationName().hashCode()); hashCode = prime * hashCode + ((getScheduleOffset() == null) ? 0 : getScheduleOffset().hashCode()); hashCode = prime * hashCode + ((getTargetMaps() == null) ? 0 : getTargetMaps().hashCode()); return hashCode; } @Override public Association clone() { try { return (Association) 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.simplesystemsmanagement.model.transform.AssociationMarshaller.getInstance().marshall(this, protocolMarshaller); } }