Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2015 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.rds.model;
 
 
Container for the parameters to the CreateEventSubscription operation.

Creates an RDS event notification subscription. This action requires a topic ARN (Amazon Resource Name) created by either the RDS console, the SNS console, or the SNS API. To obtain an ARN with SNS, you must create a topic in Amazon SNS and subscribe to the topic. The ARN is displayed in the SNS console.

You can specify the type of source (SourceType) you want to be notified of, provide a list of RDS sources (SourceIds) that triggers the events, and provide a list of event categories (EventCategories) for events you want to be notified of. For example, you can specify SourceType = db-instance, SourceIds = mydbinstance1, mydbinstance2 and EventCategories = Availability, Backup.

If you specify both the SourceType and SourceIds, such as SourceType = db-instance and SourceIdentifier = myDBInstance1, you will be notified of all the db-instance events for the specified source. If you specify a SourceType but do not specify a SourceIdentifier, you will receive notice of the events for that source type for all your RDS sources. If you do not specify either the SourceType nor the SourceIdentifier, you will be notified of events generated from all RDS sources belonging to your customer account.

 
 public class CreateEventSubscriptionRequest extends AmazonWebServiceRequest implements SerializableCloneable {

    
The name of the subscription.

Constraints: The name must be less than 255 characters.

 
     private String subscriptionName;

    
The Amazon Resource Name (ARN) of the SNS topic created for event notification. The ARN is created by Amazon SNS when you create a topic and subscribe to it.
 
     private String snsTopicArn;

    
The type of source that will be generating the events. For example, if you want to be notified of events generated by a DB instance, you would set this parameter to db-instance. if this value is not specified, all events are returned.

Valid values: db-instance | db-parameter-group | db-security-group | db-snapshot

 
     private String sourceType;

    
A list of event categories for a SourceType that you want to subscribe to. You can see a list of the categories for a given SourceType in the Events topic in the Amazon RDS User Guide or by using the DescribeEventCategories action.
 
The list of identifiers of the event sources for which events will be returned. If not specified, then all sources are included in the response. An identifier must begin with a letter and must contain only ASCII letters, digits, and hyphens; it cannot end with a hyphen or contain two consecutive hyphens.

Constraints:

  • If SourceIds are supplied, SourceType must also be provided.
  • If the source type is a DB instance, then a DBInstanceIdentifier must be supplied.
  • If the source type is a DB security group, a DBSecurityGroupName must be supplied.
  • If the source type is a DB parameter group, a DBParameterGroupName must be supplied.
  • If the source type is a DB snapshot, a DBSnapshotIdentifier must be supplied.
 
A Boolean value; set to true to activate the subscription, set to false to create the subscription but not active it.
    private Boolean enabled;

    
A list of tags.
The name of the subscription.

Constraints: The name must be less than 255 characters.

Returns:
The name of the subscription.

Constraints: The name must be less than 255 characters.

    public String getSubscriptionName() {
        return ;
    }
    
    
The name of the subscription.

Constraints: The name must be less than 255 characters.

Parameters:
subscriptionName The name of the subscription.

Constraints: The name must be less than 255 characters.

    public void setSubscriptionName(String subscriptionName) {
        this. = subscriptionName;
    }
    
    
The name of the subscription.

Constraints: The name must be less than 255 characters.

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

Parameters:
subscriptionName The name of the subscription.

Constraints: The name must be less than 255 characters.

Returns:
A reference to this updated object so that method calls can be chained together.
    public CreateEventSubscriptionRequest withSubscriptionName(String subscriptionName) {
        this. = subscriptionName;
        return this;
    }

    
The Amazon Resource Name (ARN) of the SNS topic created for event notification. The ARN is created by Amazon SNS when you create a topic and subscribe to it.

Returns:
The Amazon Resource Name (ARN) of the SNS topic created for event notification. The ARN is created by Amazon SNS when you create a topic and subscribe to it.
    public String getSnsTopicArn() {
        return ;
    }
    
    
The Amazon Resource Name (ARN) of the SNS topic created for event notification. The ARN is created by Amazon SNS when you create a topic and subscribe to it.

Parameters:
snsTopicArn The Amazon Resource Name (ARN) of the SNS topic created for event notification. The ARN is created by Amazon SNS when you create a topic and subscribe to it.
    public void setSnsTopicArn(String snsTopicArn) {
        this. = snsTopicArn;
    }
    
    
The Amazon Resource Name (ARN) of the SNS topic created for event notification. The ARN is created by Amazon SNS when you create a topic and subscribe to it.

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

Parameters:
snsTopicArn The Amazon Resource Name (ARN) of the SNS topic created for event notification. The ARN is created by Amazon SNS when you create a topic and subscribe to it.
Returns:
A reference to this updated object so that method calls can be chained together.
    public CreateEventSubscriptionRequest withSnsTopicArn(String snsTopicArn) {
        this. = snsTopicArn;
        return this;
    }

    
The type of source that will be generating the events. For example, if you want to be notified of events generated by a DB instance, you would set this parameter to db-instance. if this value is not specified, all events are returned.

Valid values: db-instance | db-parameter-group | db-security-group | db-snapshot

Returns:
The type of source that will be generating the events. For example, if you want to be notified of events generated by a DB instance, you would set this parameter to db-instance. if this value is not specified, all events are returned.

Valid values: db-instance | db-parameter-group | db-security-group | db-snapshot

    public String getSourceType() {
        return ;
    }
    
    
The type of source that will be generating the events. For example, if you want to be notified of events generated by a DB instance, you would set this parameter to db-instance. if this value is not specified, all events are returned.

Valid values: db-instance | db-parameter-group | db-security-group | db-snapshot

Parameters:
sourceType The type of source that will be generating the events. For example, if you want to be notified of events generated by a DB instance, you would set this parameter to db-instance. if this value is not specified, all events are returned.

Valid values: db-instance | db-parameter-group | db-security-group | db-snapshot

    public void setSourceType(String sourceType) {
        this. = sourceType;
    }
    
    
The type of source that will be generating the events. For example, if you want to be notified of events generated by a DB instance, you would set this parameter to db-instance. if this value is not specified, all events are returned.

Valid values: db-instance | db-parameter-group | db-security-group | db-snapshot

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

Parameters:
sourceType The type of source that will be generating the events. For example, if you want to be notified of events generated by a DB instance, you would set this parameter to db-instance. if this value is not specified, all events are returned.

Valid values: db-instance | db-parameter-group | db-security-group | db-snapshot

Returns:
A reference to this updated object so that method calls can be chained together.
        this. = sourceType;
        return this;
    }

    
A list of event categories for a SourceType that you want to subscribe to. You can see a list of the categories for a given SourceType in the Events topic in the Amazon RDS User Guide or by using the DescribeEventCategories action.

Returns:
A list of event categories for a SourceType that you want to subscribe to. You can see a list of the categories for a given SourceType in the Events topic in the Amazon RDS User Guide or by using the DescribeEventCategories action.
    public java.util.List<StringgetEventCategories() {
        if ( == null) {
               = new com.amazonaws.internal.ListWithAutoConstructFlag<String>();
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
A list of event categories for a SourceType that you want to subscribe to. You can see a list of the categories for a given SourceType in the Events topic in the Amazon RDS User Guide or by using the DescribeEventCategories action.

Parameters:
eventCategories A list of event categories for a SourceType that you want to subscribe to. You can see a list of the categories for a given SourceType in the Events topic in the Amazon RDS User Guide or by using the DescribeEventCategories action.
    public void setEventCategories(java.util.Collection<StringeventCategories) {
        if (eventCategories == null) {
            this. = null;
            return;
        }
        com.amazonaws.internal.ListWithAutoConstructFlag<StringeventCategoriesCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(eventCategories.size());
        eventCategoriesCopy.addAll(eventCategories);
        this. = eventCategoriesCopy;
    }
    
    
A list of event categories for a SourceType that you want to subscribe to. You can see a list of the categories for a given SourceType in the Events topic in the Amazon RDS User Guide or by using the DescribeEventCategories action.

NOTE: This method appends the values to the existing list (if any). Use setEventCategories(java.util.Collection) or withEventCategories(java.util.Collection) if you want to override the existing values.

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

Parameters:
eventCategories A list of event categories for a SourceType that you want to subscribe to. You can see a list of the categories for a given SourceType in the Events topic in the Amazon RDS User Guide or by using the DescribeEventCategories action.
Returns:
A reference to this updated object so that method calls can be chained together.
    public CreateEventSubscriptionRequest withEventCategories(String... eventCategories) {
        if (getEventCategories() == nullsetEventCategories(new java.util.ArrayList<String>(eventCategories.length));
        for (String value : eventCategories) {
            getEventCategories().add(value);
        }
        return this;
    }
    
    
A list of event categories for a SourceType that you want to subscribe to. You can see a list of the categories for a given SourceType in the Events topic in the Amazon RDS User Guide or by using the DescribeEventCategories action.

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

Parameters:
eventCategories A list of event categories for a SourceType that you want to subscribe to. You can see a list of the categories for a given SourceType in the Events topic in the Amazon RDS User Guide or by using the DescribeEventCategories action.
Returns:
A reference to this updated object so that method calls can be chained together.
        if (eventCategories == null) {
            this. = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<StringeventCategoriesCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(eventCategories.size());
            eventCategoriesCopy.addAll(eventCategories);
            this. = eventCategoriesCopy;
        }
        return this;
    }

    
The list of identifiers of the event sources for which events will be returned. If not specified, then all sources are included in the response. An identifier must begin with a letter and must contain only ASCII letters, digits, and hyphens; it cannot end with a hyphen or contain two consecutive hyphens.

Constraints:

  • If SourceIds are supplied, SourceType must also be provided.
  • If the source type is a DB instance, then a DBInstanceIdentifier must be supplied.
  • If the source type is a DB security group, a DBSecurityGroupName must be supplied.
  • If the source type is a DB parameter group, a DBParameterGroupName must be supplied.
  • If the source type is a DB snapshot, a DBSnapshotIdentifier must be supplied.

Returns:
The list of identifiers of the event sources for which events will be returned. If not specified, then all sources are included in the response. An identifier must begin with a letter and must contain only ASCII letters, digits, and hyphens; it cannot end with a hyphen or contain two consecutive hyphens.

Constraints:

  • If SourceIds are supplied, SourceType must also be provided.
  • If the source type is a DB instance, then a DBInstanceIdentifier must be supplied.
  • If the source type is a DB security group, a DBSecurityGroupName must be supplied.
  • If the source type is a DB parameter group, a DBParameterGroupName must be supplied.
  • If the source type is a DB snapshot, a DBSnapshotIdentifier must be supplied.
    public java.util.List<StringgetSourceIds() {
        if ( == null) {
               = new com.amazonaws.internal.ListWithAutoConstructFlag<String>();
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
The list of identifiers of the event sources for which events will be returned. If not specified, then all sources are included in the response. An identifier must begin with a letter and must contain only ASCII letters, digits, and hyphens; it cannot end with a hyphen or contain two consecutive hyphens.

Constraints:

  • If SourceIds are supplied, SourceType must also be provided.
  • If the source type is a DB instance, then a DBInstanceIdentifier must be supplied.
  • If the source type is a DB security group, a DBSecurityGroupName must be supplied.
  • If the source type is a DB parameter group, a DBParameterGroupName must be supplied.
  • If the source type is a DB snapshot, a DBSnapshotIdentifier must be supplied.

Parameters:
sourceIds The list of identifiers of the event sources for which events will be returned. If not specified, then all sources are included in the response. An identifier must begin with a letter and must contain only ASCII letters, digits, and hyphens; it cannot end with a hyphen or contain two consecutive hyphens.

Constraints:

  • If SourceIds are supplied, SourceType must also be provided.
  • If the source type is a DB instance, then a DBInstanceIdentifier must be supplied.
  • If the source type is a DB security group, a DBSecurityGroupName must be supplied.
  • If the source type is a DB parameter group, a DBParameterGroupName must be supplied.
  • If the source type is a DB snapshot, a DBSnapshotIdentifier must be supplied.
    public void setSourceIds(java.util.Collection<StringsourceIds) {
        if (sourceIds == null) {
            this. = null;
            return;
        }
        sourceIdsCopy.addAll(sourceIds);
        this. = sourceIdsCopy;
    }
    
    
The list of identifiers of the event sources for which events will be returned. If not specified, then all sources are included in the response. An identifier must begin with a letter and must contain only ASCII letters, digits, and hyphens; it cannot end with a hyphen or contain two consecutive hyphens.

Constraints:

  • If SourceIds are supplied, SourceType must also be provided.
  • If the source type is a DB instance, then a DBInstanceIdentifier must be supplied.
  • If the source type is a DB security group, a DBSecurityGroupName must be supplied.
  • If the source type is a DB parameter group, a DBParameterGroupName must be supplied.
  • If the source type is a DB snapshot, a DBSnapshotIdentifier must be supplied.

NOTE: This method appends the values to the existing list (if any). Use setSourceIds(java.util.Collection) or withSourceIds(java.util.Collection) if you want to override the existing values.

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

Parameters:
sourceIds The list of identifiers of the event sources for which events will be returned. If not specified, then all sources are included in the response. An identifier must begin with a letter and must contain only ASCII letters, digits, and hyphens; it cannot end with a hyphen or contain two consecutive hyphens.

Constraints:

  • If SourceIds are supplied, SourceType must also be provided.
  • If the source type is a DB instance, then a DBInstanceIdentifier must be supplied.
  • If the source type is a DB security group, a DBSecurityGroupName must be supplied.
  • If the source type is a DB parameter group, a DBParameterGroupName must be supplied.
  • If the source type is a DB snapshot, a DBSnapshotIdentifier must be supplied.
Returns:
A reference to this updated object so that method calls can be chained together.
    public CreateEventSubscriptionRequest withSourceIds(String... sourceIds) {
        if (getSourceIds() == nullsetSourceIds(new java.util.ArrayList<String>(sourceIds.length));
        for (String value : sourceIds) {
            getSourceIds().add(value);
        }
        return this;
    }
    
    
The list of identifiers of the event sources for which events will be returned. If not specified, then all sources are included in the response. An identifier must begin with a letter and must contain only ASCII letters, digits, and hyphens; it cannot end with a hyphen or contain two consecutive hyphens.

Constraints:

  • If SourceIds are supplied, SourceType must also be provided.
  • If the source type is a DB instance, then a DBInstanceIdentifier must be supplied.
  • If the source type is a DB security group, a DBSecurityGroupName must be supplied.
  • If the source type is a DB parameter group, a DBParameterGroupName must be supplied.
  • If the source type is a DB snapshot, a DBSnapshotIdentifier must be supplied.

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

Parameters:
sourceIds The list of identifiers of the event sources for which events will be returned. If not specified, then all sources are included in the response. An identifier must begin with a letter and must contain only ASCII letters, digits, and hyphens; it cannot end with a hyphen or contain two consecutive hyphens.

Constraints:

  • If SourceIds are supplied, SourceType must also be provided.
  • If the source type is a DB instance, then a DBInstanceIdentifier must be supplied.
  • If the source type is a DB security group, a DBSecurityGroupName must be supplied.
  • If the source type is a DB parameter group, a DBParameterGroupName must be supplied.
  • If the source type is a DB snapshot, a DBSnapshotIdentifier must be supplied.
Returns:
A reference to this updated object so that method calls can be chained together.
        if (sourceIds == null) {
            this. = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<StringsourceIdsCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(sourceIds.size());
            sourceIdsCopy.addAll(sourceIds);
            this. = sourceIdsCopy;
        }
        return this;
    }

    
A Boolean value; set to true to activate the subscription, set to false to create the subscription but not active it.

Returns:
A Boolean value; set to true to activate the subscription, set to false to create the subscription but not active it.
    public Boolean isEnabled() {
        return ;
    }
    
    
A Boolean value; set to true to activate the subscription, set to false to create the subscription but not active it.

Parameters:
enabled A Boolean value; set to true to activate the subscription, set to false to create the subscription but not active it.
    public void setEnabled(Boolean enabled) {
        this. = enabled;
    }
    
    
A Boolean value; set to true to activate the subscription, set to false to create the subscription but not active it.

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

Parameters:
enabled A Boolean value; set to true to activate the subscription, set to false to create the subscription but not active it.
Returns:
A reference to this updated object so that method calls can be chained together.
        this. = enabled;
        return this;
    }

    
A Boolean value; set to true to activate the subscription, set to false to create the subscription but not active it.

Returns:
A Boolean value; set to true to activate the subscription, set to false to create the subscription but not active it.
    public Boolean getEnabled() {
        return ;
    }

    
A list of tags.

Returns:
A list of tags.
    public java.util.List<TaggetTags() {
        if ( == null) {
               = new com.amazonaws.internal.ListWithAutoConstructFlag<Tag>();
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
A list of tags.

Parameters:
tags A list of tags.
    public void setTags(java.util.Collection<Tagtags) {
        if (tags == null) {
            this. = null;
            return;
        }
        tagsCopy.addAll(tags);
        this. = tagsCopy;
    }
    
    
A list of tags.

NOTE: This method appends the values to the existing list (if any). Use setTags(java.util.Collection) or withTags(java.util.Collection) if you want to override the existing values.

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

Parameters:
tags A list of tags.
Returns:
A reference to this updated object so that method calls can be chained together.
    public CreateEventSubscriptionRequest withTags(Tag... tags) {
        if (getTags() == nullsetTags(new java.util.ArrayList<Tag>(tags.length));
        for (Tag value : tags) {
            getTags().add(value);
        }
        return this;
    }
    
    
A list of tags.

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

Parameters:
tags A list of tags.
Returns:
A reference to this updated object so that method calls can be chained together.
        if (tags == null) {
            this. = null;
        } else {
            tagsCopy.addAll(tags);
            this. = tagsCopy;
        }
        return this;
    }

    
Returns a string representation of this object; useful for testing and debugging.

Returns:
A string representation of this object.
See also:
java.lang.Object.toString()
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getSubscriptionName() != nullsb.append("SubscriptionName: " + getSubscriptionName() + ",");
        if (getSnsTopicArn() != nullsb.append("SnsTopicArn: " + getSnsTopicArn() + ",");
        if (getSourceType() != nullsb.append("SourceType: " + getSourceType() + ",");
        if (getEventCategories() != nullsb.append("EventCategories: " + getEventCategories() + ",");
        if (getSourceIds() != nullsb.append("SourceIds: " + getSourceIds() + ",");
        if (isEnabled() != nullsb.append("Enabled: " + isEnabled() + ",");
        if (getTags() != nullsb.append("Tags: " + getTags() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getSubscriptionName() == null) ? 0 : getSubscriptionName().hashCode()); 
        hashCode = prime * hashCode + ((getSnsTopicArn() == null) ? 0 : getSnsTopicArn().hashCode()); 
        hashCode = prime * hashCode + ((getSourceType() == null) ? 0 : getSourceType().hashCode()); 
        hashCode = prime * hashCode + ((getEventCategories() == null) ? 0 : getEventCategories().hashCode()); 
        hashCode = prime * hashCode + ((getSourceIds() == null) ? 0 : getSourceIds().hashCode()); 
        hashCode = prime * hashCode + ((isEnabled() == null) ? 0 : isEnabled().hashCode()); 
        hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof CreateEventSubscriptionRequest == falsereturn false;
        
        if (other.getSubscriptionName() == null ^ this.getSubscriptionName() == nullreturn false;
        if (other.getSubscriptionName() != null && other.getSubscriptionName().equals(this.getSubscriptionName()) == falsereturn false
        if (other.getSnsTopicArn() == null ^ this.getSnsTopicArn() == nullreturn false;
        if (other.getSnsTopicArn() != null && other.getSnsTopicArn().equals(this.getSnsTopicArn()) == falsereturn false
        if (other.getSourceType() == null ^ this.getSourceType() == nullreturn false;
        if (other.getSourceType() != null && other.getSourceType().equals(this.getSourceType()) == falsereturn false
        if (other.getEventCategories() == null ^ this.getEventCategories() == nullreturn false;
        if (other.getEventCategories() != null && other.getEventCategories().equals(this.getEventCategories()) == falsereturn false
        if (other.getSourceIds() == null ^ this.getSourceIds() == nullreturn false;
        if (other.getSourceIds() != null && other.getSourceIds().equals(this.getSourceIds()) == falsereturn false
        if (other.isEnabled() == null ^ this.isEnabled() == nullreturn false;
        if (other.isEnabled() != null && other.isEnabled().equals(this.isEnabled()) == falsereturn false
        if (other.getTags() == null ^ this.getTags() == nullreturn false;
        if (other.getTags() != null && other.getTags().equals(this.getTags()) == falsereturn false
        return true;
    }
    
    @Override
        
            return (CreateEventSubscriptionRequestsuper.clone();
    }
}
    
New to GrepCode? Check out our FAQ X