/* * Copyright 2012-2017 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.AmazonWebServiceRequest; /** * * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/RegisterTargetWithMaintenanceWindow" * target="_top">AWS API Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class RegisterTargetWithMaintenanceWindowRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable { /** * <p> * The ID of the Maintenance Window the target should be registered with. * </p> */ private String windowId; /** * <p> * The type of target being registered with the Maintenance Window. * </p> */ private String resourceType; /** * <p> * The targets (either instances or tags). Instances are specified using * Key=instanceids,Values=<instanceid1>,<instanceid2>. Tags are specified using Key=<tag * name>,Values=<tag value>. * </p> */ private com.amazonaws.internal.SdkInternalList<Target> targets; /** * <p> * User-provided value that will be included in any CloudWatch events raised while running tasks for these targets * in this Maintenance Window. * </p> */ private String ownerInformation; /** * <p> * User-provided idempotency token. * </p> */ private String clientToken; /** * <p> * The ID of the Maintenance Window the target should be registered with. * </p> * * @param windowId * The ID of the Maintenance Window the target should be registered with. */ public void setWindowId(String windowId) { this.windowId = windowId; } /** * <p> * The ID of the Maintenance Window the target should be registered with. * </p> * * @return The ID of the Maintenance Window the target should be registered with. */ public String getWindowId() { return this.windowId; } /** * <p> * The ID of the Maintenance Window the target should be registered with. * </p> * * @param windowId * The ID of the Maintenance Window the target should be registered with. * @return Returns a reference to this object so that method calls can be chained together. */ public RegisterTargetWithMaintenanceWindowRequest withWindowId(String windowId) { setWindowId(windowId); return this; } /** * <p> * The type of target being registered with the Maintenance Window. * </p> * * @param resourceType * The type of target being registered with the Maintenance Window. * @see MaintenanceWindowResourceType */ public void setResourceType(String resourceType) { this.resourceType = resourceType; } /** * <p> * The type of target being registered with the Maintenance Window. * </p> * * @return The type of target being registered with the Maintenance Window. * @see MaintenanceWindowResourceType */ public String getResourceType() { return this.resourceType; } /** * <p> * The type of target being registered with the Maintenance Window. * </p> * * @param resourceType * The type of target being registered with the Maintenance Window. * @return Returns a reference to this object so that method calls can be chained together. * @see MaintenanceWindowResourceType */ public RegisterTargetWithMaintenanceWindowRequest withResourceType(String resourceType) { setResourceType(resourceType); return this; } /** * <p> * The type of target being registered with the Maintenance Window. * </p> * * @param resourceType * The type of target being registered with the Maintenance Window. * @see MaintenanceWindowResourceType */ public void setResourceType(MaintenanceWindowResourceType resourceType) { this.resourceType = resourceType.toString(); } /** * <p> * The type of target being registered with the Maintenance Window. * </p> * * @param resourceType * The type of target being registered with the Maintenance Window. * @return Returns a reference to this object so that method calls can be chained together. * @see MaintenanceWindowResourceType */ public RegisterTargetWithMaintenanceWindowRequest withResourceType(MaintenanceWindowResourceType resourceType) { setResourceType(resourceType); return this; } /** * <p> * The targets (either instances or tags). Instances are specified using * Key=instanceids,Values=<instanceid1>,<instanceid2>. Tags are specified using Key=<tag * name>,Values=<tag value>. * </p> * * @return The targets (either instances or tags). Instances are specified using * Key=instanceids,Values=<instanceid1>,<instanceid2>. Tags are specified using Key=<tag * name>,Values=<tag value>. */ public java.util.List<Target> getTargets() { if (targets == null) { targets = new com.amazonaws.internal.SdkInternalList<Target>(); } return targets; } /** * <p> * The targets (either instances or tags). Instances are specified using * Key=instanceids,Values=<instanceid1>,<instanceid2>. Tags are specified using Key=<tag * name>,Values=<tag value>. * </p> * * @param targets * The targets (either instances or tags). Instances are specified using * Key=instanceids,Values=<instanceid1>,<instanceid2>. Tags are specified using Key=<tag * name>,Values=<tag value>. */ public void setTargets(java.util.Collection<Target> targets) { if (targets == null) { this.targets = null; return; } this.targets = new com.amazonaws.internal.SdkInternalList<Target>(targets); } /** * <p> * The targets (either instances or tags). Instances are specified using * Key=instanceids,Values=<instanceid1>,<instanceid2>. Tags are specified using Key=<tag * name>,Values=<tag value>. * </p> * <p> * <b>NOTE:</b> 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. * </p> * * @param targets * The targets (either instances or tags). Instances are specified using * Key=instanceids,Values=<instanceid1>,<instanceid2>. Tags are specified using Key=<tag * name>,Values=<tag value>. * @return Returns a reference to this object so that method calls can be chained together. */ public RegisterTargetWithMaintenanceWindowRequest withTargets(Target... targets) { if (this.targets == null) { setTargets(new com.amazonaws.internal.SdkInternalList<Target>(targets.length)); } for (Target ele : targets) { this.targets.add(ele); } return this; } /** * <p> * The targets (either instances or tags). Instances are specified using * Key=instanceids,Values=<instanceid1>,<instanceid2>. Tags are specified using Key=<tag * name>,Values=<tag value>. * </p> * * @param targets * The targets (either instances or tags). Instances are specified using * Key=instanceids,Values=<instanceid1>,<instanceid2>. Tags are specified using Key=<tag * name>,Values=<tag value>. * @return Returns a reference to this object so that method calls can be chained together. */ public RegisterTargetWithMaintenanceWindowRequest withTargets(java.util.Collection<Target> targets) { setTargets(targets); return this; } /** * <p> * User-provided value that will be included in any CloudWatch events raised while running tasks for these targets * in this Maintenance Window. * </p> * * @param ownerInformation * User-provided value that will be included in any CloudWatch events raised while running tasks for these * targets in this Maintenance Window. */ public void setOwnerInformation(String ownerInformation) { this.ownerInformation = ownerInformation; } /** * <p> * User-provided value that will be included in any CloudWatch events raised while running tasks for these targets * in this Maintenance Window. * </p> * * @return User-provided value that will be included in any CloudWatch events raised while running tasks for these * targets in this Maintenance Window. */ public String getOwnerInformation() { return this.ownerInformation; } /** * <p> * User-provided value that will be included in any CloudWatch events raised while running tasks for these targets * in this Maintenance Window. * </p> * * @param ownerInformation * User-provided value that will be included in any CloudWatch events raised while running tasks for these * targets in this Maintenance Window. * @return Returns a reference to this object so that method calls can be chained together. */ public RegisterTargetWithMaintenanceWindowRequest withOwnerInformation(String ownerInformation) { setOwnerInformation(ownerInformation); return this; } /** * <p> * User-provided idempotency token. * </p> * * @param clientToken * User-provided idempotency token. */ public void setClientToken(String clientToken) { this.clientToken = clientToken; } /** * <p> * User-provided idempotency token. * </p> * * @return User-provided idempotency token. */ public String getClientToken() { return this.clientToken; } /** * <p> * User-provided idempotency token. * </p> * * @param clientToken * User-provided idempotency token. * @return Returns a reference to this object so that method calls can be chained together. */ public RegisterTargetWithMaintenanceWindowRequest withClientToken(String clientToken) { setClientToken(clientToken); 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 (getWindowId() != null) sb.append("WindowId: ").append(getWindowId()).append(","); if (getResourceType() != null) sb.append("ResourceType: ").append(getResourceType()).append(","); if (getTargets() != null) sb.append("Targets: ").append(getTargets()).append(","); if (getOwnerInformation() != null) sb.append("OwnerInformation: ").append(getOwnerInformation()).append(","); if (getClientToken() != null) sb.append("ClientToken: ").append(getClientToken()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof RegisterTargetWithMaintenanceWindowRequest == false) return false; RegisterTargetWithMaintenanceWindowRequest other = (RegisterTargetWithMaintenanceWindowRequest) obj; if (other.getWindowId() == null ^ this.getWindowId() == null) return false; if (other.getWindowId() != null && other.getWindowId().equals(this.getWindowId()) == 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.getTargets() == null ^ this.getTargets() == null) return false; if (other.getTargets() != null && other.getTargets().equals(this.getTargets()) == false) return false; if (other.getOwnerInformation() == null ^ this.getOwnerInformation() == null) return false; if (other.getOwnerInformation() != null && other.getOwnerInformation().equals(this.getOwnerInformation()) == false) return false; if (other.getClientToken() == null ^ this.getClientToken() == null) return false; if (other.getClientToken() != null && other.getClientToken().equals(this.getClientToken()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getWindowId() == null) ? 0 : getWindowId().hashCode()); hashCode = prime * hashCode + ((getResourceType() == null) ? 0 : getResourceType().hashCode()); hashCode = prime * hashCode + ((getTargets() == null) ? 0 : getTargets().hashCode()); hashCode = prime * hashCode + ((getOwnerInformation() == null) ? 0 : getOwnerInformation().hashCode()); hashCode = prime * hashCode + ((getClientToken() == null) ? 0 : getClientToken().hashCode()); return hashCode; } @Override public RegisterTargetWithMaintenanceWindowRequest clone() { return (RegisterTargetWithMaintenanceWindowRequest) super.clone(); } }