software.amazon.awssdk.services.iot.model.PackageVersionSummary Maven / Gradle / Ivy
Show all versions of iot 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.iot.model;
import java.io.Serializable;
import java.time.Instant;
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.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;
/**
*
* A summary of information about a package version.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class PackageVersionSummary implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField PACKAGE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("packageName").getter(getter(PackageVersionSummary::packageName)).setter(setter(Builder::packageName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("packageName").build()).build();
private static final SdkField VERSION_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("versionName").getter(getter(PackageVersionSummary::versionName)).setter(setter(Builder::versionName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("versionName").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("status")
.getter(getter(PackageVersionSummary::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("status").build()).build();
private static final SdkField CREATION_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("creationDate").getter(getter(PackageVersionSummary::creationDate)).setter(setter(Builder::creationDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("creationDate").build()).build();
private static final SdkField LAST_MODIFIED_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("lastModifiedDate").getter(getter(PackageVersionSummary::lastModifiedDate))
.setter(setter(Builder::lastModifiedDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("lastModifiedDate").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(PACKAGE_NAME_FIELD,
VERSION_NAME_FIELD, STATUS_FIELD, CREATION_DATE_FIELD, LAST_MODIFIED_DATE_FIELD));
private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();
private static final long serialVersionUID = 1L;
private final String packageName;
private final String versionName;
private final String status;
private final Instant creationDate;
private final Instant lastModifiedDate;
private PackageVersionSummary(BuilderImpl builder) {
this.packageName = builder.packageName;
this.versionName = builder.versionName;
this.status = builder.status;
this.creationDate = builder.creationDate;
this.lastModifiedDate = builder.lastModifiedDate;
}
/**
*
* The name of the associated software package.
*
*
* @return The name of the associated software package.
*/
public final String packageName() {
return packageName;
}
/**
*
* The name of the target package version.
*
*
* @return The name of the target package version.
*/
public final String versionName() {
return versionName;
}
/**
*
* The status of the package version. For more information, see Package version lifecycle.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link PackageVersionStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #statusAsString}.
*
*
* @return The status of the package version. For more information, see Package version lifecycle.
* @see PackageVersionStatus
*/
public final PackageVersionStatus status() {
return PackageVersionStatus.fromValue(status);
}
/**
*
* The status of the package version. For more information, see Package version lifecycle.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link PackageVersionStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #statusAsString}.
*
*
* @return The status of the package version. For more information, see Package version lifecycle.
* @see PackageVersionStatus
*/
public final String statusAsString() {
return status;
}
/**
*
* The date that the package version was created.
*
*
* @return The date that the package version was created.
*/
public final Instant creationDate() {
return creationDate;
}
/**
*
* The date that the package version was last updated.
*
*
* @return The date that the package version was last updated.
*/
public final Instant lastModifiedDate() {
return lastModifiedDate;
}
@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(packageName());
hashCode = 31 * hashCode + Objects.hashCode(versionName());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(creationDate());
hashCode = 31 * hashCode + Objects.hashCode(lastModifiedDate());
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 PackageVersionSummary)) {
return false;
}
PackageVersionSummary other = (PackageVersionSummary) obj;
return Objects.equals(packageName(), other.packageName()) && Objects.equals(versionName(), other.versionName())
&& Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(creationDate(), other.creationDate())
&& Objects.equals(lastModifiedDate(), other.lastModifiedDate());
}
/**
* 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("PackageVersionSummary").add("PackageName", packageName()).add("VersionName", versionName())
.add("Status", statusAsString()).add("CreationDate", creationDate()).add("LastModifiedDate", lastModifiedDate())
.build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "packageName":
return Optional.ofNullable(clazz.cast(packageName()));
case "versionName":
return Optional.ofNullable(clazz.cast(versionName()));
case "status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "creationDate":
return Optional.ofNullable(clazz.cast(creationDate()));
case "lastModifiedDate":
return Optional.ofNullable(clazz.cast(lastModifiedDate()));
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("packageName", PACKAGE_NAME_FIELD);
map.put("versionName", VERSION_NAME_FIELD);
map.put("status", STATUS_FIELD);
map.put("creationDate", CREATION_DATE_FIELD);
map.put("lastModifiedDate", LAST_MODIFIED_DATE_FIELD);
return Collections.unmodifiableMap(map);
}
private static Function