
software.amazon.awssdk.services.opsworks.model.OperatingSystem Maven / Gradle / Ivy
/*
* Copyright 2014-2019 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.opsworks.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.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Describes supported operating systems in AWS OpsWorks Stacks.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class OperatingSystem implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(OperatingSystem::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build();
private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(OperatingSystem::id)).setter(setter(Builder::id))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Id").build()).build();
private static final SdkField TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(OperatingSystem::type)).setter(setter(Builder::type))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Type").build()).build();
private static final SdkField> CONFIGURATION_MANAGERS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.getter(getter(OperatingSystem::configurationManagers))
.setter(setter(Builder::configurationManagers))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ConfigurationManagers").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(OperatingSystemConfigurationManager::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField REPORTED_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(OperatingSystem::reportedName)).setter(setter(Builder::reportedName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ReportedName").build()).build();
private static final SdkField REPORTED_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(OperatingSystem::reportedVersion)).setter(setter(Builder::reportedVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ReportedVersion").build()).build();
private static final SdkField SUPPORTED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.getter(getter(OperatingSystem::supported)).setter(setter(Builder::supported))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Supported").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(NAME_FIELD, ID_FIELD,
TYPE_FIELD, CONFIGURATION_MANAGERS_FIELD, REPORTED_NAME_FIELD, REPORTED_VERSION_FIELD, SUPPORTED_FIELD));
private static final long serialVersionUID = 1L;
private final String name;
private final String id;
private final String type;
private final List configurationManagers;
private final String reportedName;
private final String reportedVersion;
private final Boolean supported;
private OperatingSystem(BuilderImpl builder) {
this.name = builder.name;
this.id = builder.id;
this.type = builder.type;
this.configurationManagers = builder.configurationManagers;
this.reportedName = builder.reportedName;
this.reportedVersion = builder.reportedVersion;
this.supported = builder.supported;
}
/**
*
* The name of the operating system, such as Amazon Linux 2017.09
.
*
*
* @return The name of the operating system, such as Amazon Linux 2017.09
.
*/
public String name() {
return name;
}
/**
*
* The ID of a supported operating system, such as Amazon Linux 2017.09
.
*
*
* @return The ID of a supported operating system, such as Amazon Linux 2017.09
.
*/
public String id() {
return id;
}
/**
*
* The type of a supported operating system, either Linux
or Windows
.
*
*
* @return The type of a supported operating system, either Linux
or Windows
.
*/
public String type() {
return type;
}
/**
*
* Supported configuration manager name and versions for an AWS OpsWorks Stacks operating system.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return Supported configuration manager name and versions for an AWS OpsWorks Stacks operating system.
*/
public List configurationManagers() {
return configurationManagers;
}
/**
*
* A short name for the operating system manufacturer.
*
*
* @return A short name for the operating system manufacturer.
*/
public String reportedName() {
return reportedName;
}
/**
*
* The version of the operating system, including the release and edition, if applicable.
*
*
* @return The version of the operating system, including the release and edition, if applicable.
*/
public String reportedVersion() {
return reportedVersion;
}
/**
*
* Indicates that an operating system is not supported for new instances.
*
*
* @return Indicates that an operating system is not supported for new instances.
*/
public Boolean supported() {
return supported;
}
@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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(id());
hashCode = 31 * hashCode + Objects.hashCode(type());
hashCode = 31 * hashCode + Objects.hashCode(configurationManagers());
hashCode = 31 * hashCode + Objects.hashCode(reportedName());
hashCode = 31 * hashCode + Objects.hashCode(reportedVersion());
hashCode = 31 * hashCode + Objects.hashCode(supported());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof OperatingSystem)) {
return false;
}
OperatingSystem other = (OperatingSystem) obj;
return Objects.equals(name(), other.name()) && Objects.equals(id(), other.id()) && Objects.equals(type(), other.type())
&& Objects.equals(configurationManagers(), other.configurationManagers())
&& Objects.equals(reportedName(), other.reportedName())
&& Objects.equals(reportedVersion(), other.reportedVersion()) && Objects.equals(supported(), other.supported());
}
/**
* 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 String toString() {
return ToString.builder("OperatingSystem").add("Name", name()).add("Id", id()).add("Type", type())
.add("ConfigurationManagers", configurationManagers()).add("ReportedName", reportedName())
.add("ReportedVersion", reportedVersion()).add("Supported", supported()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Name":
return Optional.ofNullable(clazz.cast(name()));
case "Id":
return Optional.ofNullable(clazz.cast(id()));
case "Type":
return Optional.ofNullable(clazz.cast(type()));
case "ConfigurationManagers":
return Optional.ofNullable(clazz.cast(configurationManagers()));
case "ReportedName":
return Optional.ofNullable(clazz.cast(reportedName()));
case "ReportedVersion":
return Optional.ofNullable(clazz.cast(reportedVersion()));
case "Supported":
return Optional.ofNullable(clazz.cast(supported()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function