/* * Copyright 2010-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.iot.model; import java.io.Serializable; /** *

* Describes a file to be associated with an OTA update. *

*/ public class OTAUpdateFile implements Serializable { /** *

* The name of the file. *

*/ private String fileName; /** *

* An integer value you can include in the job document to allow your * devices to identify the type of file received from the cloud. *

*

* Constraints:
* Range: 0 - 255
*/ private Integer fileType; /** *

* The file version. *

*/ private String fileVersion; /** *

* The location of the updated firmware. *

*/ private FileLocation fileLocation; /** *

* The code signing method of the file. *

*/ private CodeSigning codeSigning; /** *

* A list of name/attribute pairs. *

*/ private java.util.Map attributes; /** *

* The name of the file. *

* * @return

* The name of the file. *

*/ public String getFileName() { return fileName; } /** *

* The name of the file. *

* * @param fileName

* The name of the file. *

*/ public void setFileName(String fileName) { this.fileName = fileName; } /** *

* The name of the file. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param fileName

* The name of the file. *

* @return A reference to this updated object so that method calls can be * chained together. */ public OTAUpdateFile withFileName(String fileName) { this.fileName = fileName; return this; } /** *

* An integer value you can include in the job document to allow your * devices to identify the type of file received from the cloud. *

*

* Constraints:
* Range: 0 - 255
* * @return

* An integer value you can include in the job document to allow * your devices to identify the type of file received from the * cloud. *

*/ public Integer getFileType() { return fileType; } /** *

* An integer value you can include in the job document to allow your * devices to identify the type of file received from the cloud. *

*

* Constraints:
* Range: 0 - 255
* * @param fileType

* An integer value you can include in the job document to allow * your devices to identify the type of file received from the * cloud. *

*/ public void setFileType(Integer fileType) { this.fileType = fileType; } /** *

* An integer value you can include in the job document to allow your * devices to identify the type of file received from the cloud. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Range: 0 - 255
* * @param fileType

* An integer value you can include in the job document to allow * your devices to identify the type of file received from the * cloud. *

* @return A reference to this updated object so that method calls can be * chained together. */ public OTAUpdateFile withFileType(Integer fileType) { this.fileType = fileType; return this; } /** *

* The file version. *

* * @return

* The file version. *

*/ public String getFileVersion() { return fileVersion; } /** *

* The file version. *

* * @param fileVersion

* The file version. *

*/ public void setFileVersion(String fileVersion) { this.fileVersion = fileVersion; } /** *

* The file version. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param fileVersion

* The file version. *

* @return A reference to this updated object so that method calls can be * chained together. */ public OTAUpdateFile withFileVersion(String fileVersion) { this.fileVersion = fileVersion; return this; } /** *

* The location of the updated firmware. *

* * @return

* The location of the updated firmware. *

*/ public FileLocation getFileLocation() { return fileLocation; } /** *

* The location of the updated firmware. *

* * @param fileLocation

* The location of the updated firmware. *

*/ public void setFileLocation(FileLocation fileLocation) { this.fileLocation = fileLocation; } /** *

* The location of the updated firmware. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param fileLocation

* The location of the updated firmware. *

* @return A reference to this updated object so that method calls can be * chained together. */ public OTAUpdateFile withFileLocation(FileLocation fileLocation) { this.fileLocation = fileLocation; return this; } /** *

* The code signing method of the file. *

* * @return

* The code signing method of the file. *

*/ public CodeSigning getCodeSigning() { return codeSigning; } /** *

* The code signing method of the file. *

* * @param codeSigning

* The code signing method of the file. *

*/ public void setCodeSigning(CodeSigning codeSigning) { this.codeSigning = codeSigning; } /** *

* The code signing method of the file. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param codeSigning

* The code signing method of the file. *

* @return A reference to this updated object so that method calls can be * chained together. */ public OTAUpdateFile withCodeSigning(CodeSigning codeSigning) { this.codeSigning = codeSigning; return this; } /** *

* A list of name/attribute pairs. *

* * @return

* A list of name/attribute pairs. *

*/ public java.util.Map getAttributes() { return attributes; } /** *

* A list of name/attribute pairs. *

* * @param attributes

* A list of name/attribute pairs. *

*/ public void setAttributes(java.util.Map attributes) { this.attributes = attributes; } /** *

* A list of name/attribute pairs. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param attributes

* A list of name/attribute pairs. *

* @return A reference to this updated object so that method calls can be * chained together. */ public OTAUpdateFile withAttributes(java.util.Map attributes) { this.attributes = attributes; return this; } /** *

* A list of name/attribute pairs. *

*

* The method adds a new key-value pair into attributes parameter, and * returns a reference to this object so that method calls can be chained * together. * * @param key The key of the entry to be added into attributes. * @param value The corresponding value of the entry to be added into * attributes. * @return A reference to this updated object so that method calls can be * chained together. */ public OTAUpdateFile addattributesEntry(String key, String value) { if (null == this.attributes) { this.attributes = new java.util.HashMap(); } if (this.attributes.containsKey(key)) throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided."); this.attributes.put(key, value); return this; } /** * Removes all the entries added into attributes. *

* Returns a reference to this object so that method calls can be chained * together. */ public OTAUpdateFile clearattributesEntries() { this.attributes = null; return this; } /** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getFileName() != null) sb.append("fileName: " + getFileName() + ","); if (getFileType() != null) sb.append("fileType: " + getFileType() + ","); if (getFileVersion() != null) sb.append("fileVersion: " + getFileVersion() + ","); if (getFileLocation() != null) sb.append("fileLocation: " + getFileLocation() + ","); if (getCodeSigning() != null) sb.append("codeSigning: " + getCodeSigning() + ","); if (getAttributes() != null) sb.append("attributes: " + getAttributes()); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getFileName() == null) ? 0 : getFileName().hashCode()); hashCode = prime * hashCode + ((getFileType() == null) ? 0 : getFileType().hashCode()); hashCode = prime * hashCode + ((getFileVersion() == null) ? 0 : getFileVersion().hashCode()); hashCode = prime * hashCode + ((getFileLocation() == null) ? 0 : getFileLocation().hashCode()); hashCode = prime * hashCode + ((getCodeSigning() == null) ? 0 : getCodeSigning().hashCode()); hashCode = prime * hashCode + ((getAttributes() == null) ? 0 : getAttributes().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof OTAUpdateFile == false) return false; OTAUpdateFile other = (OTAUpdateFile) obj; if (other.getFileName() == null ^ this.getFileName() == null) return false; if (other.getFileName() != null && other.getFileName().equals(this.getFileName()) == false) return false; if (other.getFileType() == null ^ this.getFileType() == null) return false; if (other.getFileType() != null && other.getFileType().equals(this.getFileType()) == false) return false; if (other.getFileVersion() == null ^ this.getFileVersion() == null) return false; if (other.getFileVersion() != null && other.getFileVersion().equals(this.getFileVersion()) == false) return false; if (other.getFileLocation() == null ^ this.getFileLocation() == null) return false; if (other.getFileLocation() != null && other.getFileLocation().equals(this.getFileLocation()) == false) return false; if (other.getCodeSigning() == null ^ this.getCodeSigning() == null) return false; if (other.getCodeSigning() != null && other.getCodeSigning().equals(this.getCodeSigning()) == false) return false; if (other.getAttributes() == null ^ this.getAttributes() == null) return false; if (other.getAttributes() != null && other.getAttributes().equals(this.getAttributes()) == false) return false; return true; } }