software.amazon.awssdk.services.rolesanywhere.model.NotificationSettingDetail Maven / Gradle / Ivy
Show all versions of rolesanywhere 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.rolesanywhere.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
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;
/**
*
* The state of a notification setting.
*
*
* A notification setting includes information such as event name, threshold, status of the notification setting, and
* the channel to notify.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class NotificationSettingDetail implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField CHANNEL_FIELD = SdkField. builder(MarshallingType.STRING).memberName("channel")
.getter(getter(NotificationSettingDetail::channelAsString)).setter(setter(Builder::channel))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("channel").build()).build();
private static final SdkField CONFIGURED_BY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("configuredBy").getter(getter(NotificationSettingDetail::configuredBy))
.setter(setter(Builder::configuredBy))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("configuredBy").build()).build();
private static final SdkField ENABLED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("enabled").getter(getter(NotificationSettingDetail::enabled)).setter(setter(Builder::enabled))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("enabled").build()).build();
private static final SdkField EVENT_FIELD = SdkField. builder(MarshallingType.STRING).memberName("event")
.getter(getter(NotificationSettingDetail::eventAsString)).setter(setter(Builder::event))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("event").build()).build();
private static final SdkField THRESHOLD_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("threshold").getter(getter(NotificationSettingDetail::threshold)).setter(setter(Builder::threshold))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("threshold").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CHANNEL_FIELD,
CONFIGURED_BY_FIELD, ENABLED_FIELD, EVENT_FIELD, THRESHOLD_FIELD));
private static final long serialVersionUID = 1L;
private final String channel;
private final String configuredBy;
private final Boolean enabled;
private final String event;
private final Integer threshold;
private NotificationSettingDetail(BuilderImpl builder) {
this.channel = builder.channel;
this.configuredBy = builder.configuredBy;
this.enabled = builder.enabled;
this.event = builder.event;
this.threshold = builder.threshold;
}
/**
*
* The specified channel of notification. IAM Roles Anywhere uses CloudWatch metrics, EventBridge, and Health
* Dashboard to notify for an event.
*
*
*
* In the absence of a specific channel, IAM Roles Anywhere applies this setting to 'ALL' channels.
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #channel} will
* return {@link NotificationChannel#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #channelAsString}.
*
*
* @return The specified channel of notification. IAM Roles Anywhere uses CloudWatch metrics, EventBridge, and
* Health Dashboard to notify for an event.
*
* In the absence of a specific channel, IAM Roles Anywhere applies this setting to 'ALL' channels.
*
* @see NotificationChannel
*/
public final NotificationChannel channel() {
return NotificationChannel.fromValue(channel);
}
/**
*
* The specified channel of notification. IAM Roles Anywhere uses CloudWatch metrics, EventBridge, and Health
* Dashboard to notify for an event.
*
*
*
* In the absence of a specific channel, IAM Roles Anywhere applies this setting to 'ALL' channels.
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #channel} will
* return {@link NotificationChannel#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #channelAsString}.
*
*
* @return The specified channel of notification. IAM Roles Anywhere uses CloudWatch metrics, EventBridge, and
* Health Dashboard to notify for an event.
*
* In the absence of a specific channel, IAM Roles Anywhere applies this setting to 'ALL' channels.
*
* @see NotificationChannel
*/
public final String channelAsString() {
return channel;
}
/**
*
* The principal that configured the notification setting. For default settings configured by IAM Roles Anywhere,
* the value is rolesanywhere.amazonaws.com
, and for customized notifications settings, it is the
* respective account ID.
*
*
* @return The principal that configured the notification setting. For default settings configured by IAM Roles
* Anywhere, the value is rolesanywhere.amazonaws.com
, and for customized notifications
* settings, it is the respective account ID.
*/
public final String configuredBy() {
return configuredBy;
}
/**
*
* Indicates whether the notification setting is enabled.
*
*
* @return Indicates whether the notification setting is enabled.
*/
public final Boolean enabled() {
return enabled;
}
/**
*
* The event to which this notification setting is applied.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #event} will return
* {@link NotificationEvent#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #eventAsString}.
*
*
* @return The event to which this notification setting is applied.
* @see NotificationEvent
*/
public final NotificationEvent event() {
return NotificationEvent.fromValue(event);
}
/**
*
* The event to which this notification setting is applied.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #event} will return
* {@link NotificationEvent#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #eventAsString}.
*
*
* @return The event to which this notification setting is applied.
* @see NotificationEvent
*/
public final String eventAsString() {
return event;
}
/**
*
* The number of days before a notification event.
*
*
* @return The number of days before a notification event.
*/
public final Integer threshold() {
return threshold;
}
@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(channelAsString());
hashCode = 31 * hashCode + Objects.hashCode(configuredBy());
hashCode = 31 * hashCode + Objects.hashCode(enabled());
hashCode = 31 * hashCode + Objects.hashCode(eventAsString());
hashCode = 31 * hashCode + Objects.hashCode(threshold());
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 NotificationSettingDetail)) {
return false;
}
NotificationSettingDetail other = (NotificationSettingDetail) obj;
return Objects.equals(channelAsString(), other.channelAsString()) && Objects.equals(configuredBy(), other.configuredBy())
&& Objects.equals(enabled(), other.enabled()) && Objects.equals(eventAsString(), other.eventAsString())
&& Objects.equals(threshold(), other.threshold());
}
/**
* 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("NotificationSettingDetail").add("Channel", channelAsString())
.add("ConfiguredBy", configuredBy()).add("Enabled", enabled()).add("Event", eventAsString())
.add("Threshold", threshold()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "channel":
return Optional.ofNullable(clazz.cast(channelAsString()));
case "configuredBy":
return Optional.ofNullable(clazz.cast(configuredBy()));
case "enabled":
return Optional.ofNullable(clazz.cast(enabled()));
case "event":
return Optional.ofNullable(clazz.cast(eventAsString()));
case "threshold":
return Optional.ofNullable(clazz.cast(threshold()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function