
software.amazon.awssdk.services.guardduty.model.DescribeOrganizationConfigurationResponse Maven / Gradle / Ivy
/*
* 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.guardduty.model;
import java.util.Arrays;
import java.util.Collection;
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.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
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 DescribeOrganizationConfigurationResponse extends GuardDutyResponse implements
ToCopyableBuilder {
private static final SdkField AUTO_ENABLE_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("AutoEnable").getter(getter(DescribeOrganizationConfigurationResponse::autoEnable))
.setter(setter(Builder::autoEnable))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("autoEnable").build()).build();
private static final SdkField MEMBER_ACCOUNT_LIMIT_REACHED_FIELD = SdkField
. builder(MarshallingType.BOOLEAN).memberName("MemberAccountLimitReached")
.getter(getter(DescribeOrganizationConfigurationResponse::memberAccountLimitReached))
.setter(setter(Builder::memberAccountLimitReached))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("memberAccountLimitReached").build())
.build();
private static final SdkField DATA_SOURCES_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("DataSources")
.getter(getter(DescribeOrganizationConfigurationResponse::dataSources)).setter(setter(Builder::dataSources))
.constructor(OrganizationDataSourceConfigurationsResult::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("dataSources").build()).build();
private static final SdkField> FEATURES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Features")
.getter(getter(DescribeOrganizationConfigurationResponse::features))
.setter(setter(Builder::features))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("features").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(OrganizationFeatureConfigurationResult::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField NEXT_TOKEN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("NextToken").getter(getter(DescribeOrganizationConfigurationResponse::nextToken))
.setter(setter(Builder::nextToken))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("nextToken").build()).build();
private static final SdkField AUTO_ENABLE_ORGANIZATION_MEMBERS_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("AutoEnableOrganizationMembers")
.getter(getter(DescribeOrganizationConfigurationResponse::autoEnableOrganizationMembersAsString))
.setter(setter(Builder::autoEnableOrganizationMembers))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("autoEnableOrganizationMembers")
.build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(AUTO_ENABLE_FIELD,
MEMBER_ACCOUNT_LIMIT_REACHED_FIELD, DATA_SOURCES_FIELD, FEATURES_FIELD, NEXT_TOKEN_FIELD,
AUTO_ENABLE_ORGANIZATION_MEMBERS_FIELD));
private final Boolean autoEnable;
private final Boolean memberAccountLimitReached;
private final OrganizationDataSourceConfigurationsResult dataSources;
private final List features;
private final String nextToken;
private final String autoEnableOrganizationMembers;
private DescribeOrganizationConfigurationResponse(BuilderImpl builder) {
super(builder);
this.autoEnable = builder.autoEnable;
this.memberAccountLimitReached = builder.memberAccountLimitReached;
this.dataSources = builder.dataSources;
this.features = builder.features;
this.nextToken = builder.nextToken;
this.autoEnableOrganizationMembers = builder.autoEnableOrganizationMembers;
}
/**
*
* Indicates whether GuardDuty is automatically enabled for accounts added to the organization.
*
*
* Even though this is still supported, we recommend using AutoEnableOrganizationMembers
to achieve the
* similar results.
*
*
* @return Indicates whether GuardDuty is automatically enabled for accounts added to the organization.
*
* Even though this is still supported, we recommend using AutoEnableOrganizationMembers
to
* achieve the similar results.
* @deprecated This field is deprecated, use AutoEnableOrganizationMembers instead
*/
@Deprecated
public final Boolean autoEnable() {
return autoEnable;
}
/**
*
* Indicates whether the maximum number of allowed member accounts are already associated with the delegated
* administrator account for your organization.
*
*
* @return Indicates whether the maximum number of allowed member accounts are already associated with the delegated
* administrator account for your organization.
*/
public final Boolean memberAccountLimitReached() {
return memberAccountLimitReached;
}
/**
*
* Describes which data sources are enabled automatically for member accounts.
*
*
* @return Describes which data sources are enabled automatically for member accounts.
* @deprecated This parameter is deprecated, use Features instead
*/
@Deprecated
public final OrganizationDataSourceConfigurationsResult dataSources() {
return dataSources;
}
/**
* For responses, this returns true if the service returned a value for the Features property. This DOES NOT check
* that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is
* useful because the SDK will never return a null collection or map, but you may need to differentiate between the
* service returning nothing (or null) and the service returning an empty collection or map. For requests, this
* returns true if a value for the property was specified in the request builder, and false if a value was not
* specified.
*/
public final boolean hasFeatures() {
return features != null && !(features instanceof SdkAutoConstructList);
}
/**
*
* A list of features that are configured for this organization.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasFeatures} method.
*
*
* @return A list of features that are configured for this organization.
*/
public final List features() {
return features;
}
/**
*
* The pagination parameter to be used on the next list operation to retrieve more items.
*
*
* @return The pagination parameter to be used on the next list operation to retrieve more items.
*/
public final String nextToken() {
return nextToken;
}
/**
*
* Indicates the auto-enablement configuration of GuardDuty for the member accounts in the organization.
*
*
* -
*
* NEW
: Indicates that when a new account joins the organization, they will have GuardDuty enabled
* automatically.
*
*
* -
*
* ALL
: Indicates that all accounts in the Amazon Web Services Organization have GuardDuty enabled
* automatically. This includes NEW
accounts that join the organization and accounts that may have been
* suspended or removed from the organization in GuardDuty.
*
*
* -
*
* NONE
: Indicates that GuardDuty will not be automatically enabled for any accounts in the
* organization. GuardDuty must be managed for each account individually by the administrator.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #autoEnableOrganizationMembers} will return {@link AutoEnableMembers#UNKNOWN_TO_SDK_VERSION}. The raw
* value returned by the service is available from {@link #autoEnableOrganizationMembersAsString}.
*
*
* @return Indicates the auto-enablement configuration of GuardDuty for the member accounts in the organization.
*
* -
*
* NEW
: Indicates that when a new account joins the organization, they will have GuardDuty
* enabled automatically.
*
*
* -
*
* ALL
: Indicates that all accounts in the Amazon Web Services Organization have GuardDuty
* enabled automatically. This includes NEW
accounts that join the organization and accounts
* that may have been suspended or removed from the organization in GuardDuty.
*
*
* -
*
* NONE
: Indicates that GuardDuty will not be automatically enabled for any accounts in the
* organization. GuardDuty must be managed for each account individually by the administrator.
*
*
* @see AutoEnableMembers
*/
public final AutoEnableMembers autoEnableOrganizationMembers() {
return AutoEnableMembers.fromValue(autoEnableOrganizationMembers);
}
/**
*
* Indicates the auto-enablement configuration of GuardDuty for the member accounts in the organization.
*
*
* -
*
* NEW
: Indicates that when a new account joins the organization, they will have GuardDuty enabled
* automatically.
*
*
* -
*
* ALL
: Indicates that all accounts in the Amazon Web Services Organization have GuardDuty enabled
* automatically. This includes NEW
accounts that join the organization and accounts that may have been
* suspended or removed from the organization in GuardDuty.
*
*
* -
*
* NONE
: Indicates that GuardDuty will not be automatically enabled for any accounts in the
* organization. GuardDuty must be managed for each account individually by the administrator.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #autoEnableOrganizationMembers} will return {@link AutoEnableMembers#UNKNOWN_TO_SDK_VERSION}. The raw
* value returned by the service is available from {@link #autoEnableOrganizationMembersAsString}.
*
*
* @return Indicates the auto-enablement configuration of GuardDuty for the member accounts in the organization.
*
* -
*
* NEW
: Indicates that when a new account joins the organization, they will have GuardDuty
* enabled automatically.
*
*
* -
*
* ALL
: Indicates that all accounts in the Amazon Web Services Organization have GuardDuty
* enabled automatically. This includes NEW
accounts that join the organization and accounts
* that may have been suspended or removed from the organization in GuardDuty.
*
*
* -
*
* NONE
: Indicates that GuardDuty will not be automatically enabled for any accounts in the
* organization. GuardDuty must be managed for each account individually by the administrator.
*
*
* @see AutoEnableMembers
*/
public final String autoEnableOrganizationMembersAsString() {
return autoEnableOrganizationMembers;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(autoEnable());
hashCode = 31 * hashCode + Objects.hashCode(memberAccountLimitReached());
hashCode = 31 * hashCode + Objects.hashCode(dataSources());
hashCode = 31 * hashCode + Objects.hashCode(hasFeatures() ? features() : null);
hashCode = 31 * hashCode + Objects.hashCode(nextToken());
hashCode = 31 * hashCode + Objects.hashCode(autoEnableOrganizationMembersAsString());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof DescribeOrganizationConfigurationResponse)) {
return false;
}
DescribeOrganizationConfigurationResponse other = (DescribeOrganizationConfigurationResponse) obj;
return Objects.equals(autoEnable(), other.autoEnable())
&& Objects.equals(memberAccountLimitReached(), other.memberAccountLimitReached())
&& Objects.equals(dataSources(), other.dataSources()) && hasFeatures() == other.hasFeatures()
&& Objects.equals(features(), other.features()) && Objects.equals(nextToken(), other.nextToken())
&& Objects.equals(autoEnableOrganizationMembersAsString(), other.autoEnableOrganizationMembersAsString());
}
/**
* 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("DescribeOrganizationConfigurationResponse").add("AutoEnable", autoEnable())
.add("MemberAccountLimitReached", memberAccountLimitReached()).add("DataSources", dataSources())
.add("Features", hasFeatures() ? features() : null).add("NextToken", nextToken())
.add("AutoEnableOrganizationMembers", autoEnableOrganizationMembersAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "AutoEnable":
return Optional.ofNullable(clazz.cast(autoEnable()));
case "MemberAccountLimitReached":
return Optional.ofNullable(clazz.cast(memberAccountLimitReached()));
case "DataSources":
return Optional.ofNullable(clazz.cast(dataSources()));
case "Features":
return Optional.ofNullable(clazz.cast(features()));
case "NextToken":
return Optional.ofNullable(clazz.cast(nextToken()));
case "AutoEnableOrganizationMembers":
return Optional.ofNullable(clazz.cast(autoEnableOrganizationMembersAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function