software.amazon.awssdk.services.databasemigration.model.EventSubscription Maven / Gradle / Ivy
Show all versions of dms Show documentation
/*
* Copyright 2013-2018 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 software.amazon.awssdk.services.databasemigration.model;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.core.protocol.ProtocolMarshaller;
import software.amazon.awssdk.core.protocol.StructuredPojo;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.services.databasemigration.transform.EventSubscriptionMarshaller;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class EventSubscription implements StructuredPojo, ToCopyableBuilder {
private final String customerAwsId;
private final String custSubscriptionId;
private final String snsTopicArn;
private final String status;
private final String subscriptionCreationTime;
private final String sourceType;
private final List sourceIdsList;
private final List eventCategoriesList;
private final Boolean enabled;
private EventSubscription(BuilderImpl builder) {
this.customerAwsId = builder.customerAwsId;
this.custSubscriptionId = builder.custSubscriptionId;
this.snsTopicArn = builder.snsTopicArn;
this.status = builder.status;
this.subscriptionCreationTime = builder.subscriptionCreationTime;
this.sourceType = builder.sourceType;
this.sourceIdsList = builder.sourceIdsList;
this.eventCategoriesList = builder.eventCategoriesList;
this.enabled = builder.enabled;
}
/**
*
* The AWS customer account associated with the AWS DMS event notification subscription.
*
*
* @return The AWS customer account associated with the AWS DMS event notification subscription.
*/
public String customerAwsId() {
return customerAwsId;
}
/**
*
* The AWS DMS event notification subscription Id.
*
*
* @return The AWS DMS event notification subscription Id.
*/
public String custSubscriptionId() {
return custSubscriptionId;
}
/**
*
* The topic ARN of the AWS DMS event notification subscription.
*
*
* @return The topic ARN of the AWS DMS event notification subscription.
*/
public String snsTopicArn() {
return snsTopicArn;
}
/**
*
* The status of the AWS DMS event notification subscription.
*
*
* Constraints:
*
*
* Can be one of the following: creating | modifying | deleting | active | no-permission | topic-not-exist
*
*
* The status "no-permission" indicates that AWS DMS no longer has permission to post to the SNS topic. The status
* "topic-not-exist" indicates that the topic was deleted after the subscription was created.
*
*
* @return The status of the AWS DMS event notification subscription.
*
* Constraints:
*
*
* Can be one of the following: creating | modifying | deleting | active | no-permission | topic-not-exist
*
*
* The status "no-permission" indicates that AWS DMS no longer has permission to post to the SNS topic. The
* status "topic-not-exist" indicates that the topic was deleted after the subscription was created.
*/
public String status() {
return status;
}
/**
*
* The time the RDS event notification subscription was created.
*
*
* @return The time the RDS event notification subscription was created.
*/
public String subscriptionCreationTime() {
return subscriptionCreationTime;
}
/**
*
* The type of AWS DMS resource that generates events.
*
*
* Valid values: replication-instance | replication-server | security-group | migration-task
*
*
* @return The type of AWS DMS resource that generates events.
*
* Valid values: replication-instance | replication-server | security-group | migration-task
*/
public String sourceType() {
return sourceType;
}
/**
*
* A list of source Ids for the event subscription.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return A list of source Ids for the event subscription.
*/
public List sourceIdsList() {
return sourceIdsList;
}
/**
*
* A lists of event categories.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return A lists of event categories.
*/
public List eventCategoriesList() {
return eventCategoriesList;
}
/**
*
* Boolean value that indicates if the event subscription is enabled.
*
*
* @return Boolean value that indicates if the event subscription is enabled.
*/
public Boolean enabled() {
return enabled;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(customerAwsId());
hashCode = 31 * hashCode + Objects.hashCode(custSubscriptionId());
hashCode = 31 * hashCode + Objects.hashCode(snsTopicArn());
hashCode = 31 * hashCode + Objects.hashCode(status());
hashCode = 31 * hashCode + Objects.hashCode(subscriptionCreationTime());
hashCode = 31 * hashCode + Objects.hashCode(sourceType());
hashCode = 31 * hashCode + Objects.hashCode(sourceIdsList());
hashCode = 31 * hashCode + Objects.hashCode(eventCategoriesList());
hashCode = 31 * hashCode + Objects.hashCode(enabled());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof EventSubscription)) {
return false;
}
EventSubscription other = (EventSubscription) obj;
return Objects.equals(customerAwsId(), other.customerAwsId())
&& Objects.equals(custSubscriptionId(), other.custSubscriptionId())
&& Objects.equals(snsTopicArn(), other.snsTopicArn()) && Objects.equals(status(), other.status())
&& Objects.equals(subscriptionCreationTime(), other.subscriptionCreationTime())
&& Objects.equals(sourceType(), other.sourceType()) && Objects.equals(sourceIdsList(), other.sourceIdsList())
&& Objects.equals(eventCategoriesList(), other.eventCategoriesList())
&& Objects.equals(enabled(), other.enabled());
}
@Override
public String toString() {
return ToString.builder("EventSubscription").add("CustomerAwsId", customerAwsId())
.add("CustSubscriptionId", custSubscriptionId()).add("SnsTopicArn", snsTopicArn()).add("Status", status())
.add("SubscriptionCreationTime", subscriptionCreationTime()).add("SourceType", sourceType())
.add("SourceIdsList", sourceIdsList()).add("EventCategoriesList", eventCategoriesList())
.add("Enabled", enabled()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "CustomerAwsId":
return Optional.ofNullable(clazz.cast(customerAwsId()));
case "CustSubscriptionId":
return Optional.ofNullable(clazz.cast(custSubscriptionId()));
case "SnsTopicArn":
return Optional.ofNullable(clazz.cast(snsTopicArn()));
case "Status":
return Optional.ofNullable(clazz.cast(status()));
case "SubscriptionCreationTime":
return Optional.ofNullable(clazz.cast(subscriptionCreationTime()));
case "SourceType":
return Optional.ofNullable(clazz.cast(sourceType()));
case "SourceIdsList":
return Optional.ofNullable(clazz.cast(sourceIdsList()));
case "EventCategoriesList":
return Optional.ofNullable(clazz.cast(eventCategoriesList()));
case "Enabled":
return Optional.ofNullable(clazz.cast(enabled()));
default:
return Optional.empty();
}
}
@SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
EventSubscriptionMarshaller.getInstance().marshall(this, protocolMarshaller);
}
public interface Builder extends CopyableBuilder {
/**
*
* The AWS customer account associated with the AWS DMS event notification subscription.
*
*
* @param customerAwsId
* The AWS customer account associated with the AWS DMS event notification subscription.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder customerAwsId(String customerAwsId);
/**
*
* The AWS DMS event notification subscription Id.
*
*
* @param custSubscriptionId
* The AWS DMS event notification subscription Id.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder custSubscriptionId(String custSubscriptionId);
/**
*
* The topic ARN of the AWS DMS event notification subscription.
*
*
* @param snsTopicArn
* The topic ARN of the AWS DMS event notification subscription.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder snsTopicArn(String snsTopicArn);
/**
*
* The status of the AWS DMS event notification subscription.
*
*
* Constraints:
*
*
* Can be one of the following: creating | modifying | deleting | active | no-permission | topic-not-exist
*
*
* The status "no-permission" indicates that AWS DMS no longer has permission to post to the SNS topic. The
* status "topic-not-exist" indicates that the topic was deleted after the subscription was created.
*
*
* @param status
* The status of the AWS DMS event notification subscription.
*
* Constraints:
*
*
* Can be one of the following: creating | modifying | deleting | active | no-permission |
* topic-not-exist
*
*
* The status "no-permission" indicates that AWS DMS no longer has permission to post to the SNS topic.
* The status "topic-not-exist" indicates that the topic was deleted after the subscription was created.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder status(String status);
/**
*
* The time the RDS event notification subscription was created.
*
*
* @param subscriptionCreationTime
* The time the RDS event notification subscription was created.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder subscriptionCreationTime(String subscriptionCreationTime);
/**
*
* The type of AWS DMS resource that generates events.
*
*
* Valid values: replication-instance | replication-server | security-group | migration-task
*
*
* @param sourceType
* The type of AWS DMS resource that generates events.
*
* Valid values: replication-instance | replication-server | security-group | migration-task
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder sourceType(String sourceType);
/**
*
* A list of source Ids for the event subscription.
*
*
* @param sourceIdsList
* A list of source Ids for the event subscription.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder sourceIdsList(Collection sourceIdsList);
/**
*
* A list of source Ids for the event subscription.
*
*
* @param sourceIdsList
* A list of source Ids for the event subscription.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder sourceIdsList(String... sourceIdsList);
/**
*
* A lists of event categories.
*
*
* @param eventCategoriesList
* A lists of event categories.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder eventCategoriesList(Collection eventCategoriesList);
/**
*
* A lists of event categories.
*
*
* @param eventCategoriesList
* A lists of event categories.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder eventCategoriesList(String... eventCategoriesList);
/**
*
* Boolean value that indicates if the event subscription is enabled.
*
*
* @param enabled
* Boolean value that indicates if the event subscription is enabled.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder enabled(Boolean enabled);
}
static final class BuilderImpl implements Builder {
private String customerAwsId;
private String custSubscriptionId;
private String snsTopicArn;
private String status;
private String subscriptionCreationTime;
private String sourceType;
private List sourceIdsList = DefaultSdkAutoConstructList.getInstance();
private List eventCategoriesList = DefaultSdkAutoConstructList.getInstance();
private Boolean enabled;
private BuilderImpl() {
}
private BuilderImpl(EventSubscription model) {
customerAwsId(model.customerAwsId);
custSubscriptionId(model.custSubscriptionId);
snsTopicArn(model.snsTopicArn);
status(model.status);
subscriptionCreationTime(model.subscriptionCreationTime);
sourceType(model.sourceType);
sourceIdsList(model.sourceIdsList);
eventCategoriesList(model.eventCategoriesList);
enabled(model.enabled);
}
public final String getCustomerAwsId() {
return customerAwsId;
}
@Override
public final Builder customerAwsId(String customerAwsId) {
this.customerAwsId = customerAwsId;
return this;
}
public final void setCustomerAwsId(String customerAwsId) {
this.customerAwsId = customerAwsId;
}
public final String getCustSubscriptionId() {
return custSubscriptionId;
}
@Override
public final Builder custSubscriptionId(String custSubscriptionId) {
this.custSubscriptionId = custSubscriptionId;
return this;
}
public final void setCustSubscriptionId(String custSubscriptionId) {
this.custSubscriptionId = custSubscriptionId;
}
public final String getSnsTopicArn() {
return snsTopicArn;
}
@Override
public final Builder snsTopicArn(String snsTopicArn) {
this.snsTopicArn = snsTopicArn;
return this;
}
public final void setSnsTopicArn(String snsTopicArn) {
this.snsTopicArn = snsTopicArn;
}
public final String getStatus() {
return status;
}
@Override
public final Builder status(String status) {
this.status = status;
return this;
}
public final void setStatus(String status) {
this.status = status;
}
public final String getSubscriptionCreationTime() {
return subscriptionCreationTime;
}
@Override
public final Builder subscriptionCreationTime(String subscriptionCreationTime) {
this.subscriptionCreationTime = subscriptionCreationTime;
return this;
}
public final void setSubscriptionCreationTime(String subscriptionCreationTime) {
this.subscriptionCreationTime = subscriptionCreationTime;
}
public final String getSourceType() {
return sourceType;
}
@Override
public final Builder sourceType(String sourceType) {
this.sourceType = sourceType;
return this;
}
public final void setSourceType(String sourceType) {
this.sourceType = sourceType;
}
public final Collection getSourceIdsList() {
return sourceIdsList;
}
@Override
public final Builder sourceIdsList(Collection sourceIdsList) {
this.sourceIdsList = SourceIdsListCopier.copy(sourceIdsList);
return this;
}
@Override
@SafeVarargs
public final Builder sourceIdsList(String... sourceIdsList) {
sourceIdsList(Arrays.asList(sourceIdsList));
return this;
}
public final void setSourceIdsList(Collection sourceIdsList) {
this.sourceIdsList = SourceIdsListCopier.copy(sourceIdsList);
}
public final Collection getEventCategoriesList() {
return eventCategoriesList;
}
@Override
public final Builder eventCategoriesList(Collection eventCategoriesList) {
this.eventCategoriesList = EventCategoriesListCopier.copy(eventCategoriesList);
return this;
}
@Override
@SafeVarargs
public final Builder eventCategoriesList(String... eventCategoriesList) {
eventCategoriesList(Arrays.asList(eventCategoriesList));
return this;
}
public final void setEventCategoriesList(Collection eventCategoriesList) {
this.eventCategoriesList = EventCategoriesListCopier.copy(eventCategoriesList);
}
public final Boolean getEnabled() {
return enabled;
}
@Override
public final Builder enabled(Boolean enabled) {
this.enabled = enabled;
return this;
}
public final void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
@Override
public EventSubscription build() {
return new EventSubscription(this);
}
}
}