/* * Copyright 2018-2023 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 com.amazonaws.services.imagebuilder.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** *

* Defines block device mappings for the instance used to configure your image. *

* * @see AWS API Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class InstanceBlockDeviceMapping implements Serializable, Cloneable, StructuredPojo { /** *

* The device to which these mappings apply. *

*/ private String deviceName; /** *

* Use to manage Amazon EBS-specific configuration for this mapping. *

*/ private EbsInstanceBlockDeviceSpecification ebs; /** *

* Use to manage instance ephemeral devices. *

*/ private String virtualName; /** *

* Use to remove a mapping from the base image. *

*/ private String noDevice; /** *

* The device to which these mappings apply. *

* * @param deviceName * The device to which these mappings apply. */ public void setDeviceName(String deviceName) { this.deviceName = deviceName; } /** *

* The device to which these mappings apply. *

* * @return The device to which these mappings apply. */ public String getDeviceName() { return this.deviceName; } /** *

* The device to which these mappings apply. *

* * @param deviceName * The device to which these mappings apply. * @return Returns a reference to this object so that method calls can be chained together. */ public InstanceBlockDeviceMapping withDeviceName(String deviceName) { setDeviceName(deviceName); return this; } /** *

* Use to manage Amazon EBS-specific configuration for this mapping. *

* * @param ebs * Use to manage Amazon EBS-specific configuration for this mapping. */ public void setEbs(EbsInstanceBlockDeviceSpecification ebs) { this.ebs = ebs; } /** *

* Use to manage Amazon EBS-specific configuration for this mapping. *

* * @return Use to manage Amazon EBS-specific configuration for this mapping. */ public EbsInstanceBlockDeviceSpecification getEbs() { return this.ebs; } /** *

* Use to manage Amazon EBS-specific configuration for this mapping. *

* * @param ebs * Use to manage Amazon EBS-specific configuration for this mapping. * @return Returns a reference to this object so that method calls can be chained together. */ public InstanceBlockDeviceMapping withEbs(EbsInstanceBlockDeviceSpecification ebs) { setEbs(ebs); return this; } /** *

* Use to manage instance ephemeral devices. *

* * @param virtualName * Use to manage instance ephemeral devices. */ public void setVirtualName(String virtualName) { this.virtualName = virtualName; } /** *

* Use to manage instance ephemeral devices. *

* * @return Use to manage instance ephemeral devices. */ public String getVirtualName() { return this.virtualName; } /** *

* Use to manage instance ephemeral devices. *

* * @param virtualName * Use to manage instance ephemeral devices. * @return Returns a reference to this object so that method calls can be chained together. */ public InstanceBlockDeviceMapping withVirtualName(String virtualName) { setVirtualName(virtualName); return this; } /** *

* Use to remove a mapping from the base image. *

* * @param noDevice * Use to remove a mapping from the base image. */ public void setNoDevice(String noDevice) { this.noDevice = noDevice; } /** *

* Use to remove a mapping from the base image. *

* * @return Use to remove a mapping from the base image. */ public String getNoDevice() { return this.noDevice; } /** *

* Use to remove a mapping from the base image. *

* * @param noDevice * Use to remove a mapping from the base image. * @return Returns a reference to this object so that method calls can be chained together. */ public InstanceBlockDeviceMapping withNoDevice(String noDevice) { setNoDevice(noDevice); return this; } /** * 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. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getDeviceName() != null) sb.append("DeviceName: ").append(getDeviceName()).append(","); if (getEbs() != null) sb.append("Ebs: ").append(getEbs()).append(","); if (getVirtualName() != null) sb.append("VirtualName: ").append(getVirtualName()).append(","); if (getNoDevice() != null) sb.append("NoDevice: ").append(getNoDevice()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof InstanceBlockDeviceMapping == false) return false; InstanceBlockDeviceMapping other = (InstanceBlockDeviceMapping) obj; if (other.getDeviceName() == null ^ this.getDeviceName() == null) return false; if (other.getDeviceName() != null && other.getDeviceName().equals(this.getDeviceName()) == false) return false; if (other.getEbs() == null ^ this.getEbs() == null) return false; if (other.getEbs() != null && other.getEbs().equals(this.getEbs()) == false) return false; if (other.getVirtualName() == null ^ this.getVirtualName() == null) return false; if (other.getVirtualName() != null && other.getVirtualName().equals(this.getVirtualName()) == false) return false; if (other.getNoDevice() == null ^ this.getNoDevice() == null) return false; if (other.getNoDevice() != null && other.getNoDevice().equals(this.getNoDevice()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getDeviceName() == null) ? 0 : getDeviceName().hashCode()); hashCode = prime * hashCode + ((getEbs() == null) ? 0 : getEbs().hashCode()); hashCode = prime * hashCode + ((getVirtualName() == null) ? 0 : getVirtualName().hashCode()); hashCode = prime * hashCode + ((getNoDevice() == null) ? 0 : getNoDevice().hashCode()); return hashCode; } @Override public InstanceBlockDeviceMapping clone() { try { return (InstanceBlockDeviceMapping) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } @com.amazonaws.annotation.SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { com.amazonaws.services.imagebuilder.model.transform.InstanceBlockDeviceMappingMarshaller.getInstance().marshall(this, protocolMarshaller); } }