All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.opsworks.model.OperatingSystem Maven / Gradle / Ivy

Go to download

The AWS Java SDK for AWS OpsWorks module holds the client classes that are used for communicating with AWS OpsWorks Service

The newest version!
/*
 * 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.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.core.util.SdkAutoConstructList;
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 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).memberName("Name") .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).memberName("Id") .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).memberName("Type") .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) .memberName("ConfigurationManagers") .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) .memberName("ReportedName").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) .memberName("ReportedVersion").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) .memberName("Supported").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 2. *

* * @return The name of the operating system, such as Amazon Linux 2. */ public final String name() { return name; } /** *

* The ID of a supported operating system, such as Amazon Linux 2. *

* * @return The ID of a supported operating system, such as Amazon Linux 2. */ public final 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 final String type() { return type; } /** * For responses, this returns true if the service returned a value for the ConfigurationManagers 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 hasConfigurationManagers() { return configurationManagers != null && !(configurationManagers instanceof SdkAutoConstructList); } /** *

* Supported configuration manager name and versions for an OpsWorks Stacks operating system. *

*

* 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 #hasConfigurationManagers} method. *

* * @return Supported configuration manager name and versions for an OpsWorks Stacks operating system. */ public final List configurationManagers() { return configurationManagers; } /** *

* A short name for the operating system manufacturer. *

* * @return A short name for the operating system manufacturer. */ public final 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 final 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 final Boolean supported() { return supported; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final 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(hasConfigurationManagers() ? configurationManagers() : null); hashCode = 31 * hashCode + Objects.hashCode(reportedName()); hashCode = 31 * hashCode + Objects.hashCode(reportedVersion()); hashCode = 31 * hashCode + Objects.hashCode(supported()); 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 OperatingSystem)) { return false; } OperatingSystem other = (OperatingSystem) obj; return Objects.equals(name(), other.name()) && Objects.equals(id(), other.id()) && Objects.equals(type(), other.type()) && hasConfigurationManagers() == other.hasConfigurationManagers() && 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 final String toString() { return ToString.builder("OperatingSystem").add("Name", name()).add("Id", id()).add("Type", type()) .add("ConfigurationManagers", hasConfigurationManagers() ? configurationManagers() : null) .add("ReportedName", reportedName()).add("ReportedVersion", reportedVersion()).add("Supported", supported()) .build(); } public final 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 final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((OperatingSystem) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The name of the operating system, such as Amazon Linux 2. *

* * @param name * The name of the operating system, such as Amazon Linux 2. * @return Returns a reference to this object so that method calls can be chained together. */ Builder name(String name); /** *

* The ID of a supported operating system, such as Amazon Linux 2. *

* * @param id * The ID of a supported operating system, such as Amazon Linux 2. * @return Returns a reference to this object so that method calls can be chained together. */ Builder id(String id); /** *

* The type of a supported operating system, either Linux or Windows. *

* * @param type * The type of a supported operating system, either Linux or Windows. * @return Returns a reference to this object so that method calls can be chained together. */ Builder type(String type); /** *

* Supported configuration manager name and versions for an OpsWorks Stacks operating system. *

* * @param configurationManagers * Supported configuration manager name and versions for an OpsWorks Stacks operating system. * @return Returns a reference to this object so that method calls can be chained together. */ Builder configurationManagers(Collection configurationManagers); /** *

* Supported configuration manager name and versions for an OpsWorks Stacks operating system. *

* * @param configurationManagers * Supported configuration manager name and versions for an OpsWorks Stacks operating system. * @return Returns a reference to this object so that method calls can be chained together. */ Builder configurationManagers(OperatingSystemConfigurationManager... configurationManagers); /** *

* Supported configuration manager name and versions for an OpsWorks Stacks operating system. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.opsworks.model.OperatingSystemConfigurationManager.Builder} avoiding * the need to create one manually via * {@link software.amazon.awssdk.services.opsworks.model.OperatingSystemConfigurationManager#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.opsworks.model.OperatingSystemConfigurationManager.Builder#build()} is * called immediately and its result is passed to {@link * #configurationManagers(List)}. * * @param configurationManagers * a consumer that will call methods on * {@link software.amazon.awssdk.services.opsworks.model.OperatingSystemConfigurationManager.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #configurationManagers(java.util.Collection) */ Builder configurationManagers(Consumer... configurationManagers); /** *

* A short name for the operating system manufacturer. *

* * @param reportedName * A short name for the operating system manufacturer. * @return Returns a reference to this object so that method calls can be chained together. */ Builder reportedName(String reportedName); /** *

* The version of the operating system, including the release and edition, if applicable. *

* * @param reportedVersion * The version of the operating system, including the release and edition, if applicable. * @return Returns a reference to this object so that method calls can be chained together. */ Builder reportedVersion(String reportedVersion); /** *

* Indicates that an operating system is not supported for new instances. *

* * @param supported * Indicates that an operating system is not supported for new instances. * @return Returns a reference to this object so that method calls can be chained together. */ Builder supported(Boolean supported); } static final class BuilderImpl implements Builder { private String name; private String id; private String type; private List configurationManagers = DefaultSdkAutoConstructList.getInstance(); private String reportedName; private String reportedVersion; private Boolean supported; private BuilderImpl() { } private BuilderImpl(OperatingSystem model) { name(model.name); id(model.id); type(model.type); configurationManagers(model.configurationManagers); reportedName(model.reportedName); reportedVersion(model.reportedVersion); supported(model.supported); } public final String getName() { return name; } public final void setName(String name) { this.name = name; } @Override public final Builder name(String name) { this.name = name; return this; } public final String getId() { return id; } public final void setId(String id) { this.id = id; } @Override public final Builder id(String id) { this.id = id; return this; } public final String getType() { return type; } public final void setType(String type) { this.type = type; } @Override public final Builder type(String type) { this.type = type; return this; } public final List getConfigurationManagers() { List result = OperatingSystemConfigurationManagersCopier .copyToBuilder(this.configurationManagers); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setConfigurationManagers( Collection configurationManagers) { this.configurationManagers = OperatingSystemConfigurationManagersCopier.copyFromBuilder(configurationManagers); } @Override public final Builder configurationManagers(Collection configurationManagers) { this.configurationManagers = OperatingSystemConfigurationManagersCopier.copy(configurationManagers); return this; } @Override @SafeVarargs public final Builder configurationManagers(OperatingSystemConfigurationManager... configurationManagers) { configurationManagers(Arrays.asList(configurationManagers)); return this; } @Override @SafeVarargs public final Builder configurationManagers(Consumer... configurationManagers) { configurationManagers(Stream.of(configurationManagers) .map(c -> OperatingSystemConfigurationManager.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final String getReportedName() { return reportedName; } public final void setReportedName(String reportedName) { this.reportedName = reportedName; } @Override public final Builder reportedName(String reportedName) { this.reportedName = reportedName; return this; } public final String getReportedVersion() { return reportedVersion; } public final void setReportedVersion(String reportedVersion) { this.reportedVersion = reportedVersion; } @Override public final Builder reportedVersion(String reportedVersion) { this.reportedVersion = reportedVersion; return this; } public final Boolean getSupported() { return supported; } public final void setSupported(Boolean supported) { this.supported = supported; } @Override public final Builder supported(Boolean supported) { this.supported = supported; return this; } @Override public OperatingSystem build() { return new OperatingSystem(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy