
software.amazon.awssdk.services.serverlessapplicationrepository.model.ApplicationSummary 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.serverlessapplicationrepository.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.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.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;
/**
*
* Summary of details about the application.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ApplicationSummary implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField APPLICATION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ApplicationId").getter(getter(ApplicationSummary::applicationId)).setter(setter(Builder::applicationId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("applicationId").build()).build();
private static final SdkField AUTHOR_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Author")
.getter(getter(ApplicationSummary::author)).setter(setter(Builder::author))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("author").build()).build();
private static final SdkField CREATION_TIME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CreationTime").getter(getter(ApplicationSummary::creationTime)).setter(setter(Builder::creationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("creationTime").build()).build();
private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Description").getter(getter(ApplicationSummary::description)).setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("description").build()).build();
private static final SdkField HOME_PAGE_URL_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("HomePageUrl").getter(getter(ApplicationSummary::homePageUrl)).setter(setter(Builder::homePageUrl))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("homePageUrl").build()).build();
private static final SdkField> LABELS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Labels")
.getter(getter(ApplicationSummary::labels))
.setter(setter(Builder::labels))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("labels").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name")
.getter(getter(ApplicationSummary::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("name").build()).build();
private static final SdkField SPDX_LICENSE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SpdxLicenseId").getter(getter(ApplicationSummary::spdxLicenseId)).setter(setter(Builder::spdxLicenseId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("spdxLicenseId").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(APPLICATION_ID_FIELD,
AUTHOR_FIELD, CREATION_TIME_FIELD, DESCRIPTION_FIELD, HOME_PAGE_URL_FIELD, LABELS_FIELD, NAME_FIELD,
SPDX_LICENSE_ID_FIELD));
private static final long serialVersionUID = 1L;
private final String applicationId;
private final String author;
private final String creationTime;
private final String description;
private final String homePageUrl;
private final List labels;
private final String name;
private final String spdxLicenseId;
private ApplicationSummary(BuilderImpl builder) {
this.applicationId = builder.applicationId;
this.author = builder.author;
this.creationTime = builder.creationTime;
this.description = builder.description;
this.homePageUrl = builder.homePageUrl;
this.labels = builder.labels;
this.name = builder.name;
this.spdxLicenseId = builder.spdxLicenseId;
}
/**
*
* The application Amazon Resource Name (ARN).
*
*
* @return The application Amazon Resource Name (ARN).
*/
public final String applicationId() {
return applicationId;
}
/**
*
* The name of the author publishing the app.
*
*
* Minimum length=1. Maximum length=127.
*
*
* Pattern "^[a-z0-9](([a-z0-9]|-(?!-))*[a-z0-9])?$";
*
*
* @return The name of the author publishing the app.
*
* Minimum length=1. Maximum length=127.
*
*
* Pattern "^[a-z0-9](([a-z0-9]|-(?!-))*[a-z0-9])?$";
*/
public final String author() {
return author;
}
/**
*
* The date and time this resource was created.
*
*
* @return The date and time this resource was created.
*/
public final String creationTime() {
return creationTime;
}
/**
*
* The description of the application.
*
*
* Minimum length=1. Maximum length=256
*
*
* @return The description of the application.
*
* Minimum length=1. Maximum length=256
*/
public final String description() {
return description;
}
/**
*
* A URL with more information about the application, for example the location of your GitHub repository for the
* application.
*
*
* @return A URL with more information about the application, for example the location of your GitHub repository for
* the application.
*/
public final String homePageUrl() {
return homePageUrl;
}
/**
* For responses, this returns true if the service returned a value for the Labels 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 hasLabels() {
return labels != null && !(labels instanceof SdkAutoConstructList);
}
/**
*
* Labels to improve discovery of apps in search results.
*
*
* Minimum length=1. Maximum length=127. Maximum number of labels: 10
*
*
* Pattern: "^[a-zA-Z0-9+\\-_:\\/@]+$";
*
*
* 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 #hasLabels} method.
*
*
* @return Labels to improve discovery of apps in search results.
*
* Minimum length=1. Maximum length=127. Maximum number of labels: 10
*
*
* Pattern: "^[a-zA-Z0-9+\\-_:\\/@]+$";
*/
public final List labels() {
return labels;
}
/**
*
* The name of the application.
*
*
* Minimum length=1. Maximum length=140
*
*
* Pattern: "[a-zA-Z0-9\\-]+";
*
*
* @return The name of the application.
*
* Minimum length=1. Maximum length=140
*
*
* Pattern: "[a-zA-Z0-9\\-]+";
*/
public final String name() {
return name;
}
/**
*
* A valid identifier from https://spdx.org/licenses/.
*
*
* @return A valid identifier from https://spdx.org/licenses/.
*/
public final String spdxLicenseId() {
return spdxLicenseId;
}
@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(applicationId());
hashCode = 31 * hashCode + Objects.hashCode(author());
hashCode = 31 * hashCode + Objects.hashCode(creationTime());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(homePageUrl());
hashCode = 31 * hashCode + Objects.hashCode(hasLabels() ? labels() : null);
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(spdxLicenseId());
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 ApplicationSummary)) {
return false;
}
ApplicationSummary other = (ApplicationSummary) obj;
return Objects.equals(applicationId(), other.applicationId()) && Objects.equals(author(), other.author())
&& Objects.equals(creationTime(), other.creationTime()) && Objects.equals(description(), other.description())
&& Objects.equals(homePageUrl(), other.homePageUrl()) && hasLabels() == other.hasLabels()
&& Objects.equals(labels(), other.labels()) && Objects.equals(name(), other.name())
&& Objects.equals(spdxLicenseId(), other.spdxLicenseId());
}
/**
* 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("ApplicationSummary").add("ApplicationId", applicationId()).add("Author", author())
.add("CreationTime", creationTime()).add("Description", description()).add("HomePageUrl", homePageUrl())
.add("Labels", hasLabels() ? labels() : null).add("Name", name()).add("SpdxLicenseId", spdxLicenseId()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ApplicationId":
return Optional.ofNullable(clazz.cast(applicationId()));
case "Author":
return Optional.ofNullable(clazz.cast(author()));
case "CreationTime":
return Optional.ofNullable(clazz.cast(creationTime()));
case "Description":
return Optional.ofNullable(clazz.cast(description()));
case "HomePageUrl":
return Optional.ofNullable(clazz.cast(homePageUrl()));
case "Labels":
return Optional.ofNullable(clazz.cast(labels()));
case "Name":
return Optional.ofNullable(clazz.cast(name()));
case "SpdxLicenseId":
return Optional.ofNullable(clazz.cast(spdxLicenseId()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function