
software.amazon.awssdk.services.datasync.model.DescribeLocationFsxWindowsResponse 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.datasync.model;
import java.time.Instant;
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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class DescribeLocationFsxWindowsResponse extends DataSyncResponse implements
ToCopyableBuilder {
private static final SdkField LOCATION_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("LocationArn").getter(getter(DescribeLocationFsxWindowsResponse::locationArn))
.setter(setter(Builder::locationArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LocationArn").build()).build();
private static final SdkField LOCATION_URI_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("LocationUri").getter(getter(DescribeLocationFsxWindowsResponse::locationUri))
.setter(setter(Builder::locationUri))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LocationUri").build()).build();
private static final SdkField> SECURITY_GROUP_ARNS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("SecurityGroupArns")
.getter(getter(DescribeLocationFsxWindowsResponse::securityGroupArns))
.setter(setter(Builder::securityGroupArns))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SecurityGroupArns").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 CREATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreationTime").getter(getter(DescribeLocationFsxWindowsResponse::creationTime))
.setter(setter(Builder::creationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreationTime").build()).build();
private static final SdkField USER_FIELD = SdkField. builder(MarshallingType.STRING).memberName("User")
.getter(getter(DescribeLocationFsxWindowsResponse::user)).setter(setter(Builder::user))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("User").build()).build();
private static final SdkField DOMAIN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Domain")
.getter(getter(DescribeLocationFsxWindowsResponse::domain)).setter(setter(Builder::domain))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Domain").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(LOCATION_ARN_FIELD,
LOCATION_URI_FIELD, SECURITY_GROUP_ARNS_FIELD, CREATION_TIME_FIELD, USER_FIELD, DOMAIN_FIELD));
private final String locationArn;
private final String locationUri;
private final List securityGroupArns;
private final Instant creationTime;
private final String user;
private final String domain;
private DescribeLocationFsxWindowsResponse(BuilderImpl builder) {
super(builder);
this.locationArn = builder.locationArn;
this.locationUri = builder.locationUri;
this.securityGroupArns = builder.securityGroupArns;
this.creationTime = builder.creationTime;
this.user = builder.user;
this.domain = builder.domain;
}
/**
*
* The Amazon Resource Name (ARN) of the FSx for Windows File Server location that was described.
*
*
* @return The Amazon Resource Name (ARN) of the FSx for Windows File Server location that was described.
*/
public final String locationArn() {
return locationArn;
}
/**
*
* The URL of the FSx for Windows File Server location that was described.
*
*
* @return The URL of the FSx for Windows File Server location that was described.
*/
public final String locationUri() {
return locationUri;
}
/**
* For responses, this returns true if the service returned a value for the SecurityGroupArns 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 hasSecurityGroupArns() {
return securityGroupArns != null && !(securityGroupArns instanceof SdkAutoConstructList);
}
/**
*
* The Amazon Resource Names (ARNs) of the security groups that are configured for the FSx for Windows File Server
* file 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 #hasSecurityGroupArns} method.
*
*
* @return The Amazon Resource Names (ARNs) of the security groups that are configured for the FSx for Windows File
* Server file system.
*/
public final List securityGroupArns() {
return securityGroupArns;
}
/**
*
* The time that the FSx for Windows File Server location was created.
*
*
* @return The time that the FSx for Windows File Server location was created.
*/
public final Instant creationTime() {
return creationTime;
}
/**
*
* The user who has the permissions to access files and folders in the FSx for Windows File Server file system.
*
*
* @return The user who has the permissions to access files and folders in the FSx for Windows File Server file
* system.
*/
public final String user() {
return user;
}
/**
*
* The name of the Windows domain that the FSx for Windows File Server belongs to.
*
*
* @return The name of the Windows domain that the FSx for Windows File Server belongs to.
*/
public final String domain() {
return domain;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(locationArn());
hashCode = 31 * hashCode + Objects.hashCode(locationUri());
hashCode = 31 * hashCode + Objects.hashCode(hasSecurityGroupArns() ? securityGroupArns() : null);
hashCode = 31 * hashCode + Objects.hashCode(creationTime());
hashCode = 31 * hashCode + Objects.hashCode(user());
hashCode = 31 * hashCode + Objects.hashCode(domain());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof DescribeLocationFsxWindowsResponse)) {
return false;
}
DescribeLocationFsxWindowsResponse other = (DescribeLocationFsxWindowsResponse) obj;
return Objects.equals(locationArn(), other.locationArn()) && Objects.equals(locationUri(), other.locationUri())
&& hasSecurityGroupArns() == other.hasSecurityGroupArns()
&& Objects.equals(securityGroupArns(), other.securityGroupArns())
&& Objects.equals(creationTime(), other.creationTime()) && Objects.equals(user(), other.user())
&& Objects.equals(domain(), other.domain());
}
/**
* 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("DescribeLocationFsxWindowsResponse").add("LocationArn", locationArn())
.add("LocationUri", locationUri()).add("SecurityGroupArns", hasSecurityGroupArns() ? securityGroupArns() : null)
.add("CreationTime", creationTime()).add("User", user()).add("Domain", domain()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "LocationArn":
return Optional.ofNullable(clazz.cast(locationArn()));
case "LocationUri":
return Optional.ofNullable(clazz.cast(locationUri()));
case "SecurityGroupArns":
return Optional.ofNullable(clazz.cast(securityGroupArns()));
case "CreationTime":
return Optional.ofNullable(clazz.cast(creationTime()));
case "User":
return Optional.ofNullable(clazz.cast(user()));
case "Domain":
return Optional.ofNullable(clazz.cast(domain()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function