
software.amazon.awssdk.services.inspector2.model.AwsEcrContainerAggregation 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.inspector2.model;
import java.io.Serializable;
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;
/**
*
* An aggregation of information about Amazon ECR containers.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class AwsEcrContainerAggregation implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField> ARCHITECTURES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("architectures")
.getter(getter(AwsEcrContainerAggregation::architectures))
.setter(setter(Builder::architectures))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("architectures").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(StringFilter::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> IMAGE_SHAS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("imageShas")
.getter(getter(AwsEcrContainerAggregation::imageShas))
.setter(setter(Builder::imageShas))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("imageShas").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(StringFilter::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> IMAGE_TAGS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("imageTags")
.getter(getter(AwsEcrContainerAggregation::imageTags))
.setter(setter(Builder::imageTags))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("imageTags").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(StringFilter::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> REPOSITORIES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("repositories")
.getter(getter(AwsEcrContainerAggregation::repositories))
.setter(setter(Builder::repositories))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("repositories").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(StringFilter::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> RESOURCE_IDS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("resourceIds")
.getter(getter(AwsEcrContainerAggregation::resourceIds))
.setter(setter(Builder::resourceIds))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("resourceIds").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(StringFilter::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField SORT_BY_FIELD = SdkField. builder(MarshallingType.STRING).memberName("sortBy")
.getter(getter(AwsEcrContainerAggregation::sortByAsString)).setter(setter(Builder::sortBy))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("sortBy").build()).build();
private static final SdkField SORT_ORDER_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("sortOrder").getter(getter(AwsEcrContainerAggregation::sortOrderAsString))
.setter(setter(Builder::sortOrder))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("sortOrder").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ARCHITECTURES_FIELD,
IMAGE_SHAS_FIELD, IMAGE_TAGS_FIELD, REPOSITORIES_FIELD, RESOURCE_IDS_FIELD, SORT_BY_FIELD, SORT_ORDER_FIELD));
private static final long serialVersionUID = 1L;
private final List architectures;
private final List imageShas;
private final List imageTags;
private final List repositories;
private final List resourceIds;
private final String sortBy;
private final String sortOrder;
private AwsEcrContainerAggregation(BuilderImpl builder) {
this.architectures = builder.architectures;
this.imageShas = builder.imageShas;
this.imageTags = builder.imageTags;
this.repositories = builder.repositories;
this.resourceIds = builder.resourceIds;
this.sortBy = builder.sortBy;
this.sortOrder = builder.sortOrder;
}
/**
* For responses, this returns true if the service returned a value for the Architectures 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 hasArchitectures() {
return architectures != null && !(architectures instanceof SdkAutoConstructList);
}
/**
*
* The architecture of the containers.
*
*
* 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 #hasArchitectures} method.
*
*
* @return The architecture of the containers.
*/
public final List architectures() {
return architectures;
}
/**
* For responses, this returns true if the service returned a value for the ImageShas 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 hasImageShas() {
return imageShas != null && !(imageShas instanceof SdkAutoConstructList);
}
/**
*
* The image SHA values.
*
*
* 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 #hasImageShas} method.
*
*
* @return The image SHA values.
*/
public final List imageShas() {
return imageShas;
}
/**
* For responses, this returns true if the service returned a value for the ImageTags 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 hasImageTags() {
return imageTags != null && !(imageTags instanceof SdkAutoConstructList);
}
/**
*
* The image tags.
*
*
* 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 #hasImageTags} method.
*
*
* @return The image tags.
*/
public final List imageTags() {
return imageTags;
}
/**
* For responses, this returns true if the service returned a value for the Repositories 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 hasRepositories() {
return repositories != null && !(repositories instanceof SdkAutoConstructList);
}
/**
*
* The container repositories.
*
*
* 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 #hasRepositories} method.
*
*
* @return The container repositories.
*/
public final List repositories() {
return repositories;
}
/**
* For responses, this returns true if the service returned a value for the ResourceIds 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 hasResourceIds() {
return resourceIds != null && !(resourceIds instanceof SdkAutoConstructList);
}
/**
*
* The container resource IDs.
*
*
* 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 #hasResourceIds} method.
*
*
* @return The container resource IDs.
*/
public final List resourceIds() {
return resourceIds;
}
/**
*
* The value to sort by.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #sortBy} will
* return {@link AwsEcrContainerSortBy#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #sortByAsString}.
*
*
* @return The value to sort by.
* @see AwsEcrContainerSortBy
*/
public final AwsEcrContainerSortBy sortBy() {
return AwsEcrContainerSortBy.fromValue(sortBy);
}
/**
*
* The value to sort by.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #sortBy} will
* return {@link AwsEcrContainerSortBy#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #sortByAsString}.
*
*
* @return The value to sort by.
* @see AwsEcrContainerSortBy
*/
public final String sortByAsString() {
return sortBy;
}
/**
*
* The sort order (ascending or descending).
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #sortOrder} will
* return {@link SortOrder#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #sortOrderAsString}.
*
*
* @return The sort order (ascending or descending).
* @see SortOrder
*/
public final SortOrder sortOrder() {
return SortOrder.fromValue(sortOrder);
}
/**
*
* The sort order (ascending or descending).
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #sortOrder} will
* return {@link SortOrder#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #sortOrderAsString}.
*
*
* @return The sort order (ascending or descending).
* @see SortOrder
*/
public final String sortOrderAsString() {
return sortOrder;
}
@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(hasArchitectures() ? architectures() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasImageShas() ? imageShas() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasImageTags() ? imageTags() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasRepositories() ? repositories() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasResourceIds() ? resourceIds() : null);
hashCode = 31 * hashCode + Objects.hashCode(sortByAsString());
hashCode = 31 * hashCode + Objects.hashCode(sortOrderAsString());
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 AwsEcrContainerAggregation)) {
return false;
}
AwsEcrContainerAggregation other = (AwsEcrContainerAggregation) obj;
return hasArchitectures() == other.hasArchitectures() && Objects.equals(architectures(), other.architectures())
&& hasImageShas() == other.hasImageShas() && Objects.equals(imageShas(), other.imageShas())
&& hasImageTags() == other.hasImageTags() && Objects.equals(imageTags(), other.imageTags())
&& hasRepositories() == other.hasRepositories() && Objects.equals(repositories(), other.repositories())
&& hasResourceIds() == other.hasResourceIds() && Objects.equals(resourceIds(), other.resourceIds())
&& Objects.equals(sortByAsString(), other.sortByAsString())
&& Objects.equals(sortOrderAsString(), other.sortOrderAsString());
}
/**
* 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("AwsEcrContainerAggregation").add("Architectures", hasArchitectures() ? architectures() : null)
.add("ImageShas", hasImageShas() ? imageShas() : null).add("ImageTags", hasImageTags() ? imageTags() : null)
.add("Repositories", hasRepositories() ? repositories() : null)
.add("ResourceIds", hasResourceIds() ? resourceIds() : null).add("SortBy", sortByAsString())
.add("SortOrder", sortOrderAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "architectures":
return Optional.ofNullable(clazz.cast(architectures()));
case "imageShas":
return Optional.ofNullable(clazz.cast(imageShas()));
case "imageTags":
return Optional.ofNullable(clazz.cast(imageTags()));
case "repositories":
return Optional.ofNullable(clazz.cast(repositories()));
case "resourceIds":
return Optional.ofNullable(clazz.cast(resourceIds()));
case "sortBy":
return Optional.ofNullable(clazz.cast(sortByAsString()));
case "sortOrder":
return Optional.ofNullable(clazz.cast(sortOrderAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function