
software.amazon.awssdk.services.imagebuilder.model.S3ExportConfiguration 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.imagebuilder.model;
import java.io.Serializable;
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;
/**
*
* Properties that configure export from your build instance to a compatible file format for your VM.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class S3ExportConfiguration implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField ROLE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("roleName").getter(getter(S3ExportConfiguration::roleName)).setter(setter(Builder::roleName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("roleName").build()).build();
private static final SdkField DISK_IMAGE_FORMAT_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("diskImageFormat").getter(getter(S3ExportConfiguration::diskImageFormatAsString))
.setter(setter(Builder::diskImageFormat))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("diskImageFormat").build()).build();
private static final SdkField S3_BUCKET_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("s3Bucket").getter(getter(S3ExportConfiguration::s3Bucket)).setter(setter(Builder::s3Bucket))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("s3Bucket").build()).build();
private static final SdkField S3_PREFIX_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("s3Prefix").getter(getter(S3ExportConfiguration::s3Prefix)).setter(setter(Builder::s3Prefix))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("s3Prefix").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ROLE_NAME_FIELD,
DISK_IMAGE_FORMAT_FIELD, S3_BUCKET_FIELD, S3_PREFIX_FIELD));
private static final long serialVersionUID = 1L;
private final String roleName;
private final String diskImageFormat;
private final String s3Bucket;
private final String s3Prefix;
private S3ExportConfiguration(BuilderImpl builder) {
this.roleName = builder.roleName;
this.diskImageFormat = builder.diskImageFormat;
this.s3Bucket = builder.s3Bucket;
this.s3Prefix = builder.s3Prefix;
}
/**
*
* The name of the role that grants VM Import/Export permission to export images to your S3 bucket.
*
*
* @return The name of the role that grants VM Import/Export permission to export images to your S3 bucket.
*/
public final String roleName() {
return roleName;
}
/**
*
* Export the updated image to one of the following supported disk image formats:
*
*
* -
*
* Virtual Hard Disk (VHD) – Compatible with Citrix Xen and Microsoft Hyper-V virtualization products.
*
*
* -
*
* Stream-optimized ESX Virtual Machine Disk (VMDK) – Compatible with VMware ESX and VMware vSphere versions
* 4, 5, and 6.
*
*
* -
*
* Raw – Raw format.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #diskImageFormat}
* will return {@link DiskImageFormat#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #diskImageFormatAsString}.
*
*
* @return Export the updated image to one of the following supported disk image formats:
*
* -
*
* Virtual Hard Disk (VHD) – Compatible with Citrix Xen and Microsoft Hyper-V virtualization
* products.
*
*
* -
*
* Stream-optimized ESX Virtual Machine Disk (VMDK) – Compatible with VMware ESX and VMware vSphere
* versions 4, 5, and 6.
*
*
* -
*
* Raw – Raw format.
*
*
* @see DiskImageFormat
*/
public final DiskImageFormat diskImageFormat() {
return DiskImageFormat.fromValue(diskImageFormat);
}
/**
*
* Export the updated image to one of the following supported disk image formats:
*
*
* -
*
* Virtual Hard Disk (VHD) – Compatible with Citrix Xen and Microsoft Hyper-V virtualization products.
*
*
* -
*
* Stream-optimized ESX Virtual Machine Disk (VMDK) – Compatible with VMware ESX and VMware vSphere versions
* 4, 5, and 6.
*
*
* -
*
* Raw – Raw format.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #diskImageFormat}
* will return {@link DiskImageFormat#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #diskImageFormatAsString}.
*
*
* @return Export the updated image to one of the following supported disk image formats:
*
* -
*
* Virtual Hard Disk (VHD) – Compatible with Citrix Xen and Microsoft Hyper-V virtualization
* products.
*
*
* -
*
* Stream-optimized ESX Virtual Machine Disk (VMDK) – Compatible with VMware ESX and VMware vSphere
* versions 4, 5, and 6.
*
*
* -
*
* Raw – Raw format.
*
*
* @see DiskImageFormat
*/
public final String diskImageFormatAsString() {
return diskImageFormat;
}
/**
*
* The S3 bucket in which to store the output disk images for your VM.
*
*
* @return The S3 bucket in which to store the output disk images for your VM.
*/
public final String s3Bucket() {
return s3Bucket;
}
/**
*
* The Amazon S3 path for the bucket where the output disk images for your VM are stored.
*
*
* @return The Amazon S3 path for the bucket where the output disk images for your VM are stored.
*/
public final String s3Prefix() {
return s3Prefix;
}
@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(roleName());
hashCode = 31 * hashCode + Objects.hashCode(diskImageFormatAsString());
hashCode = 31 * hashCode + Objects.hashCode(s3Bucket());
hashCode = 31 * hashCode + Objects.hashCode(s3Prefix());
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 S3ExportConfiguration)) {
return false;
}
S3ExportConfiguration other = (S3ExportConfiguration) obj;
return Objects.equals(roleName(), other.roleName())
&& Objects.equals(diskImageFormatAsString(), other.diskImageFormatAsString())
&& Objects.equals(s3Bucket(), other.s3Bucket()) && Objects.equals(s3Prefix(), other.s3Prefix());
}
/**
* 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("S3ExportConfiguration").add("RoleName", roleName())
.add("DiskImageFormat", diskImageFormatAsString()).add("S3Bucket", s3Bucket()).add("S3Prefix", s3Prefix())
.build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "roleName":
return Optional.ofNullable(clazz.cast(roleName()));
case "diskImageFormat":
return Optional.ofNullable(clazz.cast(diskImageFormatAsString()));
case "s3Bucket":
return Optional.ofNullable(clazz.cast(s3Bucket()));
case "s3Prefix":
return Optional.ofNullable(clazz.cast(s3Prefix()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function