
software.amazon.awssdk.services.worklink.model.FleetSummary 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.worklink.model;
import java.io.Serializable;
import java.time.Instant;
import java.util.Arrays;
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.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* The summary of the fleet.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class FleetSummary implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField FLEET_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(FleetSummary::fleetArn)).setter(setter(Builder::fleetArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FleetArn").build()).build();
private static final SdkField CREATED_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.getter(getter(FleetSummary::createdTime)).setter(setter(Builder::createdTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatedTime").build()).build();
private static final SdkField LAST_UPDATED_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.getter(getter(FleetSummary::lastUpdatedTime)).setter(setter(Builder::lastUpdatedTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastUpdatedTime").build()).build();
private static final SdkField FLEET_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(FleetSummary::fleetName)).setter(setter(Builder::fleetName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FleetName").build()).build();
private static final SdkField DISPLAY_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(FleetSummary::displayName)).setter(setter(Builder::displayName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DisplayName").build()).build();
private static final SdkField COMPANY_CODE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(FleetSummary::companyCode)).setter(setter(Builder::companyCode))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CompanyCode").build()).build();
private static final SdkField FLEET_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(FleetSummary::fleetStatusAsString)).setter(setter(Builder::fleetStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FleetStatus").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(FLEET_ARN_FIELD,
CREATED_TIME_FIELD, LAST_UPDATED_TIME_FIELD, FLEET_NAME_FIELD, DISPLAY_NAME_FIELD, COMPANY_CODE_FIELD,
FLEET_STATUS_FIELD));
private static final long serialVersionUID = 1L;
private final String fleetArn;
private final Instant createdTime;
private final Instant lastUpdatedTime;
private final String fleetName;
private final String displayName;
private final String companyCode;
private final String fleetStatus;
private FleetSummary(BuilderImpl builder) {
this.fleetArn = builder.fleetArn;
this.createdTime = builder.createdTime;
this.lastUpdatedTime = builder.lastUpdatedTime;
this.fleetName = builder.fleetName;
this.displayName = builder.displayName;
this.companyCode = builder.companyCode;
this.fleetStatus = builder.fleetStatus;
}
/**
*
* The ARN of the fleet.
*
*
* @return The ARN of the fleet.
*/
public String fleetArn() {
return fleetArn;
}
/**
*
* The time when the fleet was created.
*
*
* @return The time when the fleet was created.
*/
public Instant createdTime() {
return createdTime;
}
/**
*
* The time when the fleet was last updated.
*
*
* @return The time when the fleet was last updated.
*/
public Instant lastUpdatedTime() {
return lastUpdatedTime;
}
/**
*
* The name of the fleet.
*
*
* @return The name of the fleet.
*/
public String fleetName() {
return fleetName;
}
/**
*
* The name to display.
*
*
* @return The name to display.
*/
public String displayName() {
return displayName;
}
/**
*
* The identifier used by users to sign into the Amazon WorkLink app.
*
*
* @return The identifier used by users to sign into the Amazon WorkLink app.
*/
public String companyCode() {
return companyCode;
}
/**
*
* The status of the fleet.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #fleetStatus} will
* return {@link FleetStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #fleetStatusAsString}.
*
*
* @return The status of the fleet.
* @see FleetStatus
*/
public FleetStatus fleetStatus() {
return FleetStatus.fromValue(fleetStatus);
}
/**
*
* The status of the fleet.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #fleetStatus} will
* return {@link FleetStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #fleetStatusAsString}.
*
*
* @return The status of the fleet.
* @see FleetStatus
*/
public String fleetStatusAsString() {
return fleetStatus;
}
@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(fleetArn());
hashCode = 31 * hashCode + Objects.hashCode(createdTime());
hashCode = 31 * hashCode + Objects.hashCode(lastUpdatedTime());
hashCode = 31 * hashCode + Objects.hashCode(fleetName());
hashCode = 31 * hashCode + Objects.hashCode(displayName());
hashCode = 31 * hashCode + Objects.hashCode(companyCode());
hashCode = 31 * hashCode + Objects.hashCode(fleetStatusAsString());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof FleetSummary)) {
return false;
}
FleetSummary other = (FleetSummary) obj;
return Objects.equals(fleetArn(), other.fleetArn()) && Objects.equals(createdTime(), other.createdTime())
&& Objects.equals(lastUpdatedTime(), other.lastUpdatedTime()) && Objects.equals(fleetName(), other.fleetName())
&& Objects.equals(displayName(), other.displayName()) && Objects.equals(companyCode(), other.companyCode())
&& Objects.equals(fleetStatusAsString(), other.fleetStatusAsString());
}
/**
* 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("FleetSummary").add("FleetArn", fleetArn()).add("CreatedTime", createdTime())
.add("LastUpdatedTime", lastUpdatedTime()).add("FleetName", fleetName()).add("DisplayName", displayName())
.add("CompanyCode", companyCode()).add("FleetStatus", fleetStatusAsString()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "FleetArn":
return Optional.ofNullable(clazz.cast(fleetArn()));
case "CreatedTime":
return Optional.ofNullable(clazz.cast(createdTime()));
case "LastUpdatedTime":
return Optional.ofNullable(clazz.cast(lastUpdatedTime()));
case "FleetName":
return Optional.ofNullable(clazz.cast(fleetName()));
case "DisplayName":
return Optional.ofNullable(clazz.cast(displayName()));
case "CompanyCode":
return Optional.ofNullable(clazz.cast(companyCode()));
case "FleetStatus":
return Optional.ofNullable(clazz.cast(fleetStatusAsString()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function