com.amazonaws.services.config.model.Source Maven / Gradle / Ivy
Show all versions of aws-java-sdk-config Show documentation
/*
 * Copyright 2011-2016 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;
/**
 * 
 * Provides the AWS Config rule owner (AWS or customer), the rule identifier,
 * and the events that trigger the evaluation of your AWS resources.
 * 
 */
public class Source implements Serializable, Cloneable {
    /**
     * 
     * Indicates whether AWS or the customer owns and manages the AWS Config
     * rule.
     * 
     */
    private String owner;
    /**
     * 
     * For AWS managed Config rules, a pre-defined identifier from a list. To
     * reference the list, see Using AWS Managed Config Rules.
     * 
     * 
     * For custom Config rules, the identifier is the Amazon Resource Name (ARN)
     * of the rule's AWS Lambda function.
     * 
     */
    private String sourceIdentifier;
    /**
     * 
     * Provides the source and type of the event that causes AWS Config to
     * evaluate your AWS resources.
     * 
     */
    private com.amazonaws.internal.SdkInternalList sourceDetails;
    /**
     * 
     * Indicates whether AWS or the customer owns and manages the AWS Config
     * rule.
     * 
     * 
     * @param owner
     *        Indicates whether AWS or the customer owns and manages the AWS
     *        Config rule.
     * @see Owner
     */
    public void setOwner(String owner) {
        this.owner = owner;
    }
    /**
     * 
     * Indicates whether AWS or the customer owns and manages the AWS Config
     * rule.
     * 
     * 
     * @return Indicates whether AWS or the customer owns and manages the AWS
     *         Config rule.
     * @see Owner
     */
    public String getOwner() {
        return this.owner;
    }
    /**
     * 
     * Indicates whether AWS or the customer owns and manages the AWS Config
     * rule.
     * 
     * 
     * @param owner
     *        Indicates whether AWS or the customer owns and manages the AWS
     *        Config rule.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     * @see Owner
     */
    public Source withOwner(String owner) {
        setOwner(owner);
        return this;
    }
    /**
     * 
     * Indicates whether AWS or the customer owns and manages the AWS Config
     * rule.
     * 
     * 
     * @param owner
     *        Indicates whether AWS or the customer owns and manages the AWS
     *        Config rule.
     * @see Owner
     */
    public void setOwner(Owner owner) {
        this.owner = owner.toString();
    }
    /**
     * 
     * Indicates whether AWS or the customer owns and manages the AWS Config
     * rule.
     * 
     * 
     * @param owner
     *        Indicates whether AWS or the customer owns and manages the AWS
     *        Config rule.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     * @see Owner
     */
    public Source withOwner(Owner owner) {
        setOwner(owner);
        return this;
    }
    /**
     * 
     * For AWS managed Config rules, a pre-defined identifier from a list. To
     * reference the list, see Using AWS Managed Config Rules.
     * 
     * 
     * For custom Config rules, the identifier is the Amazon Resource Name (ARN)
     * of the rule's AWS Lambda function.
     * 
     * 
     * @param sourceIdentifier
     *        For AWS managed Config rules, a pre-defined identifier from a
     *        list. To reference the list, see Using AWS Managed Config Rules.
     *        
     *        For custom Config rules, the identifier is the Amazon Resource
     *        Name (ARN) of the rule's AWS Lambda function.
     */
    public void setSourceIdentifier(String sourceIdentifier) {
        this.sourceIdentifier = sourceIdentifier;
    }
    /**
     * 
     * For AWS managed Config rules, a pre-defined identifier from a list. To
     * reference the list, see Using AWS Managed Config Rules.
     * 
     * 
     * For custom Config rules, the identifier is the Amazon Resource Name (ARN)
     * of the rule's AWS Lambda function.
     * 
     * 
     * @return For AWS managed Config rules, a pre-defined identifier from a
     *         list. To reference the list, see Using AWS Managed Config Rules.
     *         
     *         For custom Config rules, the identifier is the Amazon Resource
     *         Name (ARN) of the rule's AWS Lambda function.
     */
    public String getSourceIdentifier() {
        return this.sourceIdentifier;
    }
    /**
     * 
     * For AWS managed Config rules, a pre-defined identifier from a list. To
     * reference the list, see Using AWS Managed Config Rules.
     * 
     * 
     * For custom Config rules, the identifier is the Amazon Resource Name (ARN)
     * of the rule's AWS Lambda function.
     * 
     * 
     * @param sourceIdentifier
     *        For AWS managed Config rules, a pre-defined identifier from a
     *        list. To reference the list, see Using AWS Managed Config Rules.
     *        
     *        For custom Config rules, the identifier is the Amazon Resource
     *        Name (ARN) of the rule's AWS Lambda function.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public Source withSourceIdentifier(String sourceIdentifier) {
        setSourceIdentifier(sourceIdentifier);
        return this;
    }
    /**
     * 
     * Provides the source and type of the event that causes AWS Config to
     * evaluate your AWS resources.
     * 
     * 
     * @return Provides the source and type of the event that causes AWS Config
     *         to evaluate your AWS resources.
     */
    public java.util.List getSourceDetails() {
        if (sourceDetails == null) {
            sourceDetails = new com.amazonaws.internal.SdkInternalList();
        }
        return sourceDetails;
    }
    /**
     * 
     * Provides the source and type of the event that causes AWS Config to
     * evaluate your AWS resources.
     * 
     * 
     * @param sourceDetails
     *        Provides the source and type of the event that causes AWS Config
     *        to evaluate your AWS resources.
     */
    public void setSourceDetails(
            java.util.Collection sourceDetails) {
        if (sourceDetails == null) {
            this.sourceDetails = null;
            return;
        }
        this.sourceDetails = new com.amazonaws.internal.SdkInternalList(
                sourceDetails);
    }
    /**
     * 
     * Provides the source and type of the event that causes AWS Config to
     * evaluate your AWS resources.
     * 
     * 
     * NOTE: This method appends the values to the existing list (if
     * any). Use {@link #setSourceDetails(java.util.Collection)} or
     * {@link #withSourceDetails(java.util.Collection)} if you want to override
     * the existing values.
     * 
     * 
     * @param sourceDetails
     *        Provides the source and type of the event that causes AWS Config
     *        to evaluate your AWS resources.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public Source withSourceDetails(SourceDetail... sourceDetails) {
        if (this.sourceDetails == null) {
            setSourceDetails(new com.amazonaws.internal.SdkInternalList(
                    sourceDetails.length));
        }
        for (SourceDetail ele : sourceDetails) {
            this.sourceDetails.add(ele);
        }
        return this;
    }
    /**
     * 
     * Provides the source and type of the event that causes AWS Config to
     * evaluate your AWS resources.
     * 
     * 
     * @param sourceDetails
     *        Provides the source and type of the event that causes AWS Config
     *        to evaluate your AWS resources.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public Source withSourceDetails(
            java.util.Collection sourceDetails) {
        setSourceDetails(sourceDetails);
        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 (getOwner() != null)
            sb.append("Owner: " + getOwner() + ",");
        if (getSourceIdentifier() != null)
            sb.append("SourceIdentifier: " + getSourceIdentifier() + ",");
        if (getSourceDetails() != null)
            sb.append("SourceDetails: " + getSourceDetails());
        sb.append("}");
        return sb.toString();
    }
    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (obj instanceof Source == false)
            return false;
        Source other = (Source) obj;
        if (other.getOwner() == null ^ this.getOwner() == null)
            return false;
        if (other.getOwner() != null
                && other.getOwner().equals(this.getOwner()) == false)
            return false;
        if (other.getSourceIdentifier() == null
                ^ this.getSourceIdentifier() == null)
            return false;
        if (other.getSourceIdentifier() != null
                && other.getSourceIdentifier().equals(
                        this.getSourceIdentifier()) == false)
            return false;
        if (other.getSourceDetails() == null ^ this.getSourceDetails() == null)
            return false;
        if (other.getSourceDetails() != null
                && other.getSourceDetails().equals(this.getSourceDetails()) == false)
            return false;
        return true;
    }
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        hashCode = prime * hashCode
                + ((getOwner() == null) ? 0 : getOwner().hashCode());
        hashCode = prime
                * hashCode
                + ((getSourceIdentifier() == null) ? 0 : getSourceIdentifier()
                        .hashCode());
        hashCode = prime
                * hashCode
                + ((getSourceDetails() == null) ? 0 : getSourceDetails()
                        .hashCode());
        return hashCode;
    }
    @Override
    public Source clone() {
        try {
            return (Source) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException(
                    "Got a CloneNotSupportedException from Object.clone() "
                            + "even though we're Cloneable!", e);
        }
    }
}