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.redshift.model;
 
 
Container for the parameters to the CreateEventSubscription operation.

Creates an Amazon Redshift event notification subscription. This action requires an ARN (Amazon Resource Name) of an Amazon SNS topic created by either the Amazon Redshift console, the Amazon SNS console, or the Amazon SNS API. To obtain an ARN with Amazon 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 source type, and lists of Amazon Redshift source IDs, event categories, and event severities. Notifications will be sent for all events you want that match those criteria. For example, you can specify source type = cluster, source ID = my-cluster-1 and mycluster2, event categories = Availability, Backup, and severity = ERROR. The subscription will only send notifications for those ERROR events in the Availability and Backup categories for the specified clusters.

If you specify both the source type and source IDs, such as source type = cluster and source identifier = my-cluster-1, notifications will be sent for all the cluster events for my-cluster-1. If you specify a source type but do not specify a source identifier, you will receive notice of the events for the objects of that type in your AWS account. If you do not specify either the SourceType nor the SourceIdentifier, you will be notified of events generated from all Amazon Redshift sources belonging to your AWS account. You must specify a source type if you specify a source ID.

 
 public class CreateEventSubscriptionRequest extends AmazonWebServiceRequest implements SerializableCloneable {

    
The name of the event subscription to be created.

Constraints:

  • Cannot be null, empty, or blank.
  • Must contain from 1 to 255 alphanumeric characters or hyphens.
  • First character must be a letter.
  • Cannot end with a hyphen or contain two consecutive hyphens.
 
     private String subscriptionName;

    
The Amazon Resource Name (ARN) of the Amazon SNS topic used to transmit the event notifications. 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 cluster, you would set this parameter to cluster. If this value is not specified, events are returned for all Amazon Redshift objects in your AWS account. You must specify a source type in order to specify source IDs.

Valid values: cluster, cluster-parameter-group, cluster-security-group, and cluster-snapshot.

 
     private String sourceType;

    
A list of one or more identifiers of Amazon Redshift source objects. All of the objects must be of the same type as was specified in the source type parameter. The event subscription will return only events generated by the specified objects. If not specified, then events are returned for all objects within the source type specified.

Example: my-cluster-1, my-cluster-2

Example: my-snapshot-20131010

 
Specifies the Amazon Redshift event categories to be published by the event notification subscription.

Values: Configuration, Management, Monitoring, Security

 
Specifies the Amazon Redshift event severity to be published by the event notification subscription.

Values: ERROR, INFO

    private String severity;

    
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 tag instances.
The name of the event subscription to be created.

Constraints:

  • Cannot be null, empty, or blank.
  • Must contain from 1 to 255 alphanumeric characters or hyphens.
  • First character must be a letter.
  • Cannot end with a hyphen or contain two consecutive hyphens.

Returns:
The name of the event subscription to be created.

Constraints:

  • Cannot be null, empty, or blank.
  • Must contain from 1 to 255 alphanumeric characters or hyphens.
  • First character must be a letter.
  • Cannot end with a hyphen or contain two consecutive hyphens.
    public String getSubscriptionName() {
        return ;
    }
    
    
The name of the event subscription to be created.

Constraints:

  • Cannot be null, empty, or blank.
  • Must contain from 1 to 255 alphanumeric characters or hyphens.
  • First character must be a letter.
  • Cannot end with a hyphen or contain two consecutive hyphens.

Parameters:
subscriptionName The name of the event subscription to be created.

Constraints:

  • Cannot be null, empty, or blank.
  • Must contain from 1 to 255 alphanumeric characters or hyphens.
  • First character must be a letter.
  • Cannot end with a hyphen or contain two consecutive hyphens.
    public void setSubscriptionName(String subscriptionName) {
        this. = subscriptionName;
    }
    
    
The name of the event subscription to be created.

Constraints:

  • Cannot be null, empty, or blank.
  • Must contain from 1 to 255 alphanumeric characters or hyphens.
  • First character must be a letter.
  • Cannot end with a hyphen or contain two consecutive hyphens.

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

Parameters:
subscriptionName The name of the event subscription to be created.

Constraints:

  • Cannot be null, empty, or blank.
  • Must contain from 1 to 255 alphanumeric characters or hyphens.
  • First character must be a letter.
  • Cannot end with a hyphen or contain two consecutive hyphens.
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 Amazon SNS topic used to transmit the event notifications. The ARN is created by Amazon SNS when you create a topic and subscribe to it.

Returns:
The Amazon Resource Name (ARN) of the Amazon SNS topic used to transmit the event notifications. 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 Amazon SNS topic used to transmit the event notifications. 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 Amazon SNS topic used to transmit the event notifications. 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 Amazon SNS topic used to transmit the event notifications. 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 Amazon SNS topic used to transmit the event notifications. 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 cluster, you would set this parameter to cluster. If this value is not specified, events are returned for all Amazon Redshift objects in your AWS account. You must specify a source type in order to specify source IDs.

Valid values: cluster, cluster-parameter-group, cluster-security-group, and cluster-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 cluster, you would set this parameter to cluster. If this value is not specified, events are returned for all Amazon Redshift objects in your AWS account. You must specify a source type in order to specify source IDs.

Valid values: cluster, cluster-parameter-group, cluster-security-group, and cluster-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 cluster, you would set this parameter to cluster. If this value is not specified, events are returned for all Amazon Redshift objects in your AWS account. You must specify a source type in order to specify source IDs.

Valid values: cluster, cluster-parameter-group, cluster-security-group, and cluster-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 cluster, you would set this parameter to cluster. If this value is not specified, events are returned for all Amazon Redshift objects in your AWS account. You must specify a source type in order to specify source IDs.

Valid values: cluster, cluster-parameter-group, cluster-security-group, and cluster-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 cluster, you would set this parameter to cluster. If this value is not specified, events are returned for all Amazon Redshift objects in your AWS account. You must specify a source type in order to specify source IDs.

Valid values: cluster, cluster-parameter-group, cluster-security-group, and cluster-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 cluster, you would set this parameter to cluster. If this value is not specified, events are returned for all Amazon Redshift objects in your AWS account. You must specify a source type in order to specify source IDs.

Valid values: cluster, cluster-parameter-group, cluster-security-group, and cluster-snapshot.

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

    
A list of one or more identifiers of Amazon Redshift source objects. All of the objects must be of the same type as was specified in the source type parameter. The event subscription will return only events generated by the specified objects. If not specified, then events are returned for all objects within the source type specified.

Example: my-cluster-1, my-cluster-2

Example: my-snapshot-20131010

Returns:
A list of one or more identifiers of Amazon Redshift source objects. All of the objects must be of the same type as was specified in the source type parameter. The event subscription will return only events generated by the specified objects. If not specified, then events are returned for all objects within the source type specified.

Example: my-cluster-1, my-cluster-2

Example: my-snapshot-20131010

    public java.util.List<StringgetSourceIds() {
        if ( == null) {
               = new com.amazonaws.internal.ListWithAutoConstructFlag<String>();
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
A list of one or more identifiers of Amazon Redshift source objects. All of the objects must be of the same type as was specified in the source type parameter. The event subscription will return only events generated by the specified objects. If not specified, then events are returned for all objects within the source type specified.

Example: my-cluster-1, my-cluster-2

Example: my-snapshot-20131010

Parameters:
sourceIds A list of one or more identifiers of Amazon Redshift source objects. All of the objects must be of the same type as was specified in the source type parameter. The event subscription will return only events generated by the specified objects. If not specified, then events are returned for all objects within the source type specified.

Example: my-cluster-1, my-cluster-2

Example: my-snapshot-20131010

    public void setSourceIds(java.util.Collection<StringsourceIds) {
        if (sourceIds == null) {
            this. = null;
            return;
        }
        sourceIdsCopy.addAll(sourceIds);
        this. = sourceIdsCopy;
    }
    
    
A list of one or more identifiers of Amazon Redshift source objects. All of the objects must be of the same type as was specified in the source type parameter. The event subscription will return only events generated by the specified objects. If not specified, then events are returned for all objects within the source type specified.

Example: my-cluster-1, my-cluster-2

Example: my-snapshot-20131010

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 A list of one or more identifiers of Amazon Redshift source objects. All of the objects must be of the same type as was specified in the source type parameter. The event subscription will return only events generated by the specified objects. If not specified, then events are returned for all objects within the source type specified.

Example: my-cluster-1, my-cluster-2

Example: my-snapshot-20131010

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;
    }
    
    
A list of one or more identifiers of Amazon Redshift source objects. All of the objects must be of the same type as was specified in the source type parameter. The event subscription will return only events generated by the specified objects. If not specified, then events are returned for all objects within the source type specified.

Example: my-cluster-1, my-cluster-2

Example: my-snapshot-20131010

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

Parameters:
sourceIds A list of one or more identifiers of Amazon Redshift source objects. All of the objects must be of the same type as was specified in the source type parameter. The event subscription will return only events generated by the specified objects. If not specified, then events are returned for all objects within the source type specified.

Example: my-cluster-1, my-cluster-2

Example: my-snapshot-20131010

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;
    }

    
Specifies the Amazon Redshift event categories to be published by the event notification subscription.

Values: Configuration, Management, Monitoring, Security

Returns:
Specifies the Amazon Redshift event categories to be published by the event notification subscription.

Values: Configuration, Management, Monitoring, Security

    public java.util.List<StringgetEventCategories() {
        if ( == null) {
               = new com.amazonaws.internal.ListWithAutoConstructFlag<String>();
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
Specifies the Amazon Redshift event categories to be published by the event notification subscription.

Values: Configuration, Management, Monitoring, Security

Parameters:
eventCategories Specifies the Amazon Redshift event categories to be published by the event notification subscription.

Values: Configuration, Management, Monitoring, Security

    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;
    }
    
    
Specifies the Amazon Redshift event categories to be published by the event notification subscription.

Values: Configuration, Management, Monitoring, Security

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 Specifies the Amazon Redshift event categories to be published by the event notification subscription.

Values: Configuration, Management, Monitoring, Security

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;
    }
    
    
Specifies the Amazon Redshift event categories to be published by the event notification subscription.

Values: Configuration, Management, Monitoring, Security

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

Parameters:
eventCategories Specifies the Amazon Redshift event categories to be published by the event notification subscription.

Values: Configuration, Management, Monitoring, Security

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;
    }

    
Specifies the Amazon Redshift event severity to be published by the event notification subscription.

Values: ERROR, INFO

Returns:
Specifies the Amazon Redshift event severity to be published by the event notification subscription.

Values: ERROR, INFO

    public String getSeverity() {
        return ;
    }
    
    
Specifies the Amazon Redshift event severity to be published by the event notification subscription.

Values: ERROR, INFO

Parameters:
severity Specifies the Amazon Redshift event severity to be published by the event notification subscription.

Values: ERROR, INFO

    public void setSeverity(String severity) {
        this. = severity;
    }
    
    
Specifies the Amazon Redshift event severity to be published by the event notification subscription.

Values: ERROR, INFO

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

Parameters:
severity Specifies the Amazon Redshift event severity to be published by the event notification subscription.

Values: ERROR, INFO

Returns:
A reference to this updated object so that method calls can be chained together.
        this. = severity;
        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 tag instances.

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

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

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 tag instances.
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 tag instances.

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

Parameters:
tags A list of tag instances.
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 (getSourceIds() != nullsb.append("SourceIds: " + getSourceIds() + ",");
        if (getEventCategories() != nullsb.append("EventCategories: " + getEventCategories() + ",");
        if (getSeverity() != nullsb.append("Severity: " + getSeverity() + ",");
        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 + ((getSourceIds() == null) ? 0 : getSourceIds().hashCode()); 
        hashCode = prime * hashCode + ((getEventCategories() == null) ? 0 : getEventCategories().hashCode()); 
        hashCode = prime * hashCode + ((getSeverity() == null) ? 0 : getSeverity().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.getSourceIds() == null ^ this.getSourceIds() == nullreturn false;
        if (other.getSourceIds() != null && other.getSourceIds().equals(this.getSourceIds()) == falsereturn false
        if (other.getEventCategories() == null ^ this.getEventCategories() == nullreturn false;
        if (other.getEventCategories() != null && other.getEventCategories().equals(this.getEventCategories()) == falsereturn false
        if (other.getSeverity() == null ^ this.getSeverity() == nullreturn false;
        if (other.getSeverity() != null && other.getSeverity().equals(this.getSeverity()) == 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