software.amazon.awssdk.services.devopsguru.model.NotificationChannelConfig Maven / Gradle / Ivy
Show all versions of devopsguru Show documentation
/*
* Copyright 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.devopsguru.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Information about notification channels you have configured with DevOps Guru. The one supported notification channel
* is Amazon Simple Notification Service (Amazon SNS).
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class NotificationChannelConfig implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField SNS_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("Sns").getter(getter(NotificationChannelConfig::sns)).setter(setter(Builder::sns))
.constructor(SnsChannelConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Sns").build()).build();
private static final SdkField FILTERS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("Filters")
.getter(getter(NotificationChannelConfig::filters)).setter(setter(Builder::filters))
.constructor(NotificationFilterConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Filters").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(SNS_FIELD, FILTERS_FIELD));
private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();
private static final long serialVersionUID = 1L;
private final SnsChannelConfig sns;
private final NotificationFilterConfig filters;
private NotificationChannelConfig(BuilderImpl builder) {
this.sns = builder.sns;
this.filters = builder.filters;
}
/**
*
* Information about a notification channel configured in DevOps Guru to send notifications when insights are
* created.
*
*
* If you use an Amazon SNS topic in another account, you must attach a policy to it that grants DevOps Guru
* permission to send it notifications. DevOps Guru adds the required policy on your behalf to send notifications
* using Amazon SNS in your account. DevOps Guru only supports standard SNS topics. For more information, see Permissions for
* Amazon SNS topics.
*
*
* If you use an Amazon SNS topic that is encrypted by an Amazon Web Services Key Management Service
* customer-managed key (CMK), then you must add permissions to the CMK. For more information, see Permissions for Amazon
* Web Services KMS–encrypted Amazon SNS topics.
*
*
* @return Information about a notification channel configured in DevOps Guru to send notifications when insights
* are created.
*
* If you use an Amazon SNS topic in another account, you must attach a policy to it that grants DevOps Guru
* permission to send it notifications. DevOps Guru adds the required policy on your behalf to send
* notifications using Amazon SNS in your account. DevOps Guru only supports standard SNS topics. For more
* information, see Permissions
* for Amazon SNS topics.
*
*
* If you use an Amazon SNS topic that is encrypted by an Amazon Web Services Key Management Service
* customer-managed key (CMK), then you must add permissions to the CMK. For more information, see Permissions for
* Amazon Web Services KMS–encrypted Amazon SNS topics.
*/
public final SnsChannelConfig sns() {
return sns;
}
/**
*
* The filter configurations for the Amazon SNS notification topic you use with DevOps Guru. If you do not provide
* filter configurations, the default configurations are to receive notifications for all message types of
* High
or Medium
severity.
*
*
* @return The filter configurations for the Amazon SNS notification topic you use with DevOps Guru. If you do not
* provide filter configurations, the default configurations are to receive notifications for all message
* types of High
or Medium
severity.
*/
public final NotificationFilterConfig filters() {
return filters;
}
@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 final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(sns());
hashCode = 31 * hashCode + Objects.hashCode(filters());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof NotificationChannelConfig)) {
return false;
}
NotificationChannelConfig other = (NotificationChannelConfig) obj;
return Objects.equals(sns(), other.sns()) && Objects.equals(filters(), other.filters());
}
/**
* 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.
*/
@Override
public final String toString() {
return ToString.builder("NotificationChannelConfig").add("Sns", sns()).add("Filters", filters()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Sns":
return Optional.ofNullable(clazz.cast(sns()));
case "Filters":
return Optional.ofNullable(clazz.cast(filters()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Map> memberNameToFieldInitializer() {
Map> map = new HashMap<>();
map.put("Sns", SNS_FIELD);
map.put("Filters", FILTERS_FIELD);
return Collections.unmodifiableMap(map);
}
private static Function