All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.amazonaws.services.dlm.model.ShareRule Maven / Gradle / Ivy

/*
 * Copyright 2019-2024 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.dlm.model;

import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;

/**
 * 

* [Custom snapshot policies only] Specifies a rule for sharing snapshots across Amazon Web Services accounts. *

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

* The IDs of the Amazon Web Services accounts with which to share the snapshots. *

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

* The period after which snapshots that are shared with other Amazon Web Services accounts are automatically * unshared. *

*/ private Integer unshareInterval; /** *

* The unit of time for the automatic unsharing interval. *

*/ private String unshareIntervalUnit; /** *

* The IDs of the Amazon Web Services accounts with which to share the snapshots. *

* * @return The IDs of the Amazon Web Services accounts with which to share the snapshots. */ public java.util.List getTargetAccounts() { return targetAccounts; } /** *

* The IDs of the Amazon Web Services accounts with which to share the snapshots. *

* * @param targetAccounts * The IDs of the Amazon Web Services accounts with which to share the snapshots. */ public void setTargetAccounts(java.util.Collection targetAccounts) { if (targetAccounts == null) { this.targetAccounts = null; return; } this.targetAccounts = new java.util.ArrayList(targetAccounts); } /** *

* The IDs of the Amazon Web Services accounts with which to share the snapshots. *

*

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

* * @param targetAccounts * The IDs of the Amazon Web Services accounts with which to share the snapshots. * @return Returns a reference to this object so that method calls can be chained together. */ public ShareRule withTargetAccounts(String... targetAccounts) { if (this.targetAccounts == null) { setTargetAccounts(new java.util.ArrayList(targetAccounts.length)); } for (String ele : targetAccounts) { this.targetAccounts.add(ele); } return this; } /** *

* The IDs of the Amazon Web Services accounts with which to share the snapshots. *

* * @param targetAccounts * The IDs of the Amazon Web Services accounts with which to share the snapshots. * @return Returns a reference to this object so that method calls can be chained together. */ public ShareRule withTargetAccounts(java.util.Collection targetAccounts) { setTargetAccounts(targetAccounts); return this; } /** *

* The period after which snapshots that are shared with other Amazon Web Services accounts are automatically * unshared. *

* * @param unshareInterval * The period after which snapshots that are shared with other Amazon Web Services accounts are automatically * unshared. */ public void setUnshareInterval(Integer unshareInterval) { this.unshareInterval = unshareInterval; } /** *

* The period after which snapshots that are shared with other Amazon Web Services accounts are automatically * unshared. *

* * @return The period after which snapshots that are shared with other Amazon Web Services accounts are * automatically unshared. */ public Integer getUnshareInterval() { return this.unshareInterval; } /** *

* The period after which snapshots that are shared with other Amazon Web Services accounts are automatically * unshared. *

* * @param unshareInterval * The period after which snapshots that are shared with other Amazon Web Services accounts are automatically * unshared. * @return Returns a reference to this object so that method calls can be chained together. */ public ShareRule withUnshareInterval(Integer unshareInterval) { setUnshareInterval(unshareInterval); return this; } /** *

* The unit of time for the automatic unsharing interval. *

* * @param unshareIntervalUnit * The unit of time for the automatic unsharing interval. * @see RetentionIntervalUnitValues */ public void setUnshareIntervalUnit(String unshareIntervalUnit) { this.unshareIntervalUnit = unshareIntervalUnit; } /** *

* The unit of time for the automatic unsharing interval. *

* * @return The unit of time for the automatic unsharing interval. * @see RetentionIntervalUnitValues */ public String getUnshareIntervalUnit() { return this.unshareIntervalUnit; } /** *

* The unit of time for the automatic unsharing interval. *

* * @param unshareIntervalUnit * The unit of time for the automatic unsharing interval. * @return Returns a reference to this object so that method calls can be chained together. * @see RetentionIntervalUnitValues */ public ShareRule withUnshareIntervalUnit(String unshareIntervalUnit) { setUnshareIntervalUnit(unshareIntervalUnit); return this; } /** *

* The unit of time for the automatic unsharing interval. *

* * @param unshareIntervalUnit * The unit of time for the automatic unsharing interval. * @return Returns a reference to this object so that method calls can be chained together. * @see RetentionIntervalUnitValues */ public ShareRule withUnshareIntervalUnit(RetentionIntervalUnitValues unshareIntervalUnit) { this.unshareIntervalUnit = unshareIntervalUnit.toString(); 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 (getTargetAccounts() != null) sb.append("TargetAccounts: ").append(getTargetAccounts()).append(","); if (getUnshareInterval() != null) sb.append("UnshareInterval: ").append(getUnshareInterval()).append(","); if (getUnshareIntervalUnit() != null) sb.append("UnshareIntervalUnit: ").append(getUnshareIntervalUnit()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ShareRule == false) return false; ShareRule other = (ShareRule) obj; if (other.getTargetAccounts() == null ^ this.getTargetAccounts() == null) return false; if (other.getTargetAccounts() != null && other.getTargetAccounts().equals(this.getTargetAccounts()) == false) return false; if (other.getUnshareInterval() == null ^ this.getUnshareInterval() == null) return false; if (other.getUnshareInterval() != null && other.getUnshareInterval().equals(this.getUnshareInterval()) == false) return false; if (other.getUnshareIntervalUnit() == null ^ this.getUnshareIntervalUnit() == null) return false; if (other.getUnshareIntervalUnit() != null && other.getUnshareIntervalUnit().equals(this.getUnshareIntervalUnit()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getTargetAccounts() == null) ? 0 : getTargetAccounts().hashCode()); hashCode = prime * hashCode + ((getUnshareInterval() == null) ? 0 : getUnshareInterval().hashCode()); hashCode = prime * hashCode + ((getUnshareIntervalUnit() == null) ? 0 : getUnshareIntervalUnit().hashCode()); return hashCode; } @Override public ShareRule clone() { try { return (ShareRule) 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.dlm.model.transform.ShareRuleMarshaller.getInstance().marshall(this, protocolMarshaller); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy