All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.arm.mbed.cloud.sdk.accounts.model.SubtenantApiKey Maven / Gradle / Ivy

// This file was generated by the Pelion SDK foundation code generator.
// This is an autogenerated class. Do not modify its content as modifications will be lost at next code generation.
package com.arm.mbed.cloud.sdk.accounts.model;

import com.arm.mbed.cloud.sdk.annotations.Internal;
import com.arm.mbed.cloud.sdk.annotations.Preamble;
import com.arm.mbed.cloud.sdk.annotations.Required;
import com.arm.mbed.cloud.sdk.common.SdkModel;
import java.util.Date;
import java.util.Objects;

/**
 * Model for a subtenant api key.
 */
@Preamble(description = "Model for a subtenant api key.")
@SuppressWarnings({ "PMD.CyclomaticComplexity", "PMD.AvoidDuplicateLiterals" })
public class SubtenantApiKey implements SdkModel {
    /**
     * Serialisation Id.
     */
    private static final long serialVersionUID = 6644551751921220L;

    /**
     * The ID of the account.
     */
    @Required
    private String accountId;

    /**
     * Creation UTC time RFC3339.
     */
    private final Date createdAt;

    /**
     * The timestamp of the API key creation in the storage, in milliseconds.
     */
    private final long creationTime;

    /**
     * The ID of the API key.
     */
    private String id;

    /**
     * The API key.
     */
    private final String key;

    /**
     * The timestamp of the latest API key usage, in milliseconds.
     */
    private final long lastLoginTime;

    /**
     * The display name for the API key.
     */
    @Required
    private String name;

    /**
     * The owner of this API key, who is the creator by default.
     */
    private String owner;

    /**
     * The status of the API key.
     */
    private SubtenantApiKeyStatus status;

    /**
     * Last update UTC time RFC3339.
     */
    private final Date updatedAt;

    /**
     * Internal constructor.
     *
     * 

* Constructor based on all fields. *

* Note: Should not be used. Use {@link #SubtenantApiKey()} instead. * * @param accountId * The ID of the account. * @param createdAt * Creation UTC time RFC3339. * @param creationTime * The timestamp of the API key creation in the storage, in milliseconds. * @param id * The ID of the API key. * @param key * The API key. * @param lastLoginTime * The timestamp of the latest API key usage, in milliseconds. * @param name * The display name for the API key. * @param owner * The owner of this API key, who is the creator by default. * @param status * The status of the API key. * @param updatedAt * Last update UTC time RFC3339. */ @Internal @SuppressWarnings("PMD.CyclomaticComplexity") public SubtenantApiKey(String accountId, Date createdAt, long creationTime, String id, String key, long lastLoginTime, String name, String owner, SubtenantApiKeyStatus status, Date updatedAt) { super(); this.createdAt = createdAt; this.creationTime = creationTime; this.key = key; this.lastLoginTime = lastLoginTime; this.updatedAt = updatedAt; setAccountId(accountId); setId(id); setName(name); setOwner(owner); setStatus(status); } /** * Internal constructor. * *

* Constructor based on a similar object. *

* Note: Should not be used. Use {@link #SubtenantApiKey()} instead. * * @param subtenantApiKey * a subtenant api key. */ @Internal public SubtenantApiKey(SubtenantApiKey subtenantApiKey) { this(subtenantApiKey == null ? (String) null : subtenantApiKey.accountId, subtenantApiKey == null ? new Date() : subtenantApiKey.createdAt, subtenantApiKey == null ? 0 : subtenantApiKey.creationTime, subtenantApiKey == null ? (String) null : subtenantApiKey.id, subtenantApiKey == null ? (String) null : subtenantApiKey.key, subtenantApiKey == null ? 0 : subtenantApiKey.lastLoginTime, subtenantApiKey == null ? (String) null : subtenantApiKey.name, subtenantApiKey == null ? (String) null : subtenantApiKey.owner, subtenantApiKey == null ? SubtenantApiKeyStatus.getDefault() : subtenantApiKey.status, subtenantApiKey == null ? new Date() : subtenantApiKey.updatedAt); } /** * Constructor. */ public SubtenantApiKey() { this((String) null, new Date(), 0, (String) null, (String) null, 0, (String) null, (String) null, SubtenantApiKeyStatus.getDefault(), new Date()); } /** * Constructor. * *

* Constructor based on object identifier. *

* * @param id * The ID of the API key. */ public SubtenantApiKey(String id) { this(); setId(id); } /** * Internal constructor. * *

* Constructor based on read-only fields. *

* Note: Should not be used. Use {@link #SubtenantApiKey()} instead. * * @param createdAt * Creation UTC time RFC3339. * @param creationTime * The timestamp of the API key creation in the storage, in milliseconds. * @param key * The API key. * @param lastLoginTime * The timestamp of the latest API key usage, in milliseconds. * @param updatedAt * Last update UTC time RFC3339. */ @Internal public SubtenantApiKey(Date createdAt, long creationTime, String key, long lastLoginTime, Date updatedAt) { this((String) null, createdAt, creationTime, (String) null, key, lastLoginTime, (String) null, (String) null, SubtenantApiKeyStatus.getDefault(), updatedAt); } /** * Constructor. * *

* Constructor based on required fields. *

* * @param accountId * The ID of the account. * @param name * The display name for the API key. */ public SubtenantApiKey(String accountId, String name) { this(accountId, new Date(), 0, (String) null, (String) null, 0, name, (String) null, SubtenantApiKeyStatus.getDefault(), new Date()); } /** * Gets the id of the account. * * @return accountId */ public String getAccountId() { return accountId; } /** * Sets the id of the account. * *

* Note: the length of the string has to match {@code /[a-f0-9]{32}/} to be valid * * @param accountId * The ID of the account. */ @Required public void setAccountId(String accountId) { this.accountId = accountId; } /** * Checks whether accountId value is valid. * * @return true if the value is valid; false otherwise. */ @SuppressWarnings("PMD.UselessParentheses") public boolean isAccountIdValid() { return accountId != null && (accountId.matches("[a-f0-9]{32}")); } /** * Gets creation utc time rfc3339. * * @return createdAt */ public Date getCreatedAt() { return createdAt; } /** * Gets the timestamp of the api key creation in the storage, in milliseconds. * * @return creationTime */ public long getCreationTime() { return creationTime; } /** * Gets the id of the api key. * * @return id */ @Override public String getId() { return id; } /** * Sets the id of the api key. * *

* Note: the length of the string has to match {@code /[a-f0-9]{32}/} to be valid * * @param id * The ID of the API key. */ @Override public void setId(String id) { this.id = id; } /** * Sets the id of the api key. * *

* Similar to {@link #setId(String)} *

* Note: the length of the string has to match {@code /[a-f0-9]{32}/} to be valid * * @param subtenantApiKeyId * The ID of the API key. */ @Internal public void setSubtenantApiKeyId(String subtenantApiKeyId) { setId(subtenantApiKeyId); } /** * Checks whether id value is valid. * * @return true if the value is valid; false otherwise. */ @SuppressWarnings("PMD.UselessParentheses") public boolean isIdValid() { return (id == null || id.matches("[a-f0-9]{32}")); } /** * Gets the api key. * * @return key */ public String getKey() { return key; } /** * Gets the timestamp of the latest api key usage, in milliseconds. * * @return lastLoginTime */ public long getLastLoginTime() { return lastLoginTime; } /** * Gets the display name for the api key. * * @return name */ public String getName() { return name; } /** * Sets the display name for the api key. * *

* Note: the length of the string has to be less than or equal to {@code 100} to be valid * * @param name * The display name for the API key. */ @Required public void setName(String name) { this.name = name; } /** * Checks whether name value is valid. * * @return true if the value is valid; false otherwise. */ @SuppressWarnings("PMD.UselessParentheses") public boolean isNameValid() { return name != null && (name.length() <= 100); } /** * Gets the owner of this api key, who is the creator by default. * * @return owner */ public String getOwner() { return owner; } /** * Sets the owner of this api key, who is the creator by default. * *

* Note: the length of the string has to match {@code /[a-f0-9]{32}/} to be valid * * @param owner * The owner of this API key, who is the creator by default. */ public void setOwner(String owner) { this.owner = owner; } /** * Checks whether owner value is valid. * * @return true if the value is valid; false otherwise. */ @SuppressWarnings("PMD.UselessParentheses") public boolean isOwnerValid() { return (owner == null || owner.matches("[a-f0-9]{32}")); } /** * Gets the status of the api key. * * @return status */ public SubtenantApiKeyStatus getStatus() { return status; } /** * Sets the status of the api key. * * @param status * The status of the API key. */ public void setStatus(SubtenantApiKeyStatus status) { this.status = status; } /** * Sets the status of the api key. * *

* Similar to {@link #setStatus(com.arm.mbed.cloud.sdk.accounts.model.SubtenantApiKeyStatus)} * * @param status * The status of the API key. */ @Internal public void setStatus(String status) { this.status = SubtenantApiKeyStatus.getValue(status); } /** * Gets last update utc time rfc3339. * * @return updatedAt */ public Date getUpdatedAt() { return updatedAt; } /** * Returns a string representation of the object. * *

* * @see java.lang.Object#toString() * @return the string representation */ @Override public String toString() { return "SubtenantApiKey [accountId=" + accountId + ", createdAt=" + createdAt + ", creationTime=" + creationTime + ", id=" + id + ", key=" + key + ", lastLoginTime=" + lastLoginTime + ", name=" + name + ", owner=" + owner + ", status=" + status + ", updatedAt=" + updatedAt + "]"; } /** * Calculates the hash code of this instance based on field values. * *

* * @see java.lang.Object#hashCode() * @return hash code */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((accountId == null) ? 0 : accountId.hashCode()); result = prime * result + ((createdAt == null) ? 0 : createdAt.hashCode()); result = prime * result + Objects.hashCode(Long.valueOf(creationTime)); result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + ((key == null) ? 0 : key.hashCode()); result = prime * result + Objects.hashCode(Long.valueOf(lastLoginTime)); result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + ((owner == null) ? 0 : owner.hashCode()); result = prime * result + ((status == null) ? 0 : status.hashCode()); result = prime * result + ((updatedAt == null) ? 0 : updatedAt.hashCode()); return result; } /** * Method to ensure {@link #equals(Object)} is correct. * *

* Note: see this article: canEqual() * * @param other * another object. * @return true if the other object is an instance of the class in which canEqual is (re)defined, false otherwise. */ protected boolean canEqual(Object other) { return other instanceof SubtenantApiKey; } /** * Indicates whether some other object is "equal to" this one. * *

* * @see java.lang.Object#equals(java.lang.Object) * @param obj * an object to compare with this instance. * @return true if this object is the same as the obj argument; false otherwise. */ @Override @SuppressWarnings({ "PMD.ExcessiveMethodLength", "PMD.NcssMethodCount" }) public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof SubtenantApiKey)) { return false; } final SubtenantApiKey other = (SubtenantApiKey) obj; if (!other.canEqual(this)) { return false; } if (accountId == null) { if (other.accountId != null) { return false; } } else if (!accountId.equals(other.accountId)) { return false; } if (createdAt == null) { if (other.createdAt != null) { return false; } } else if (!createdAt.equals(other.createdAt)) { return false; } if (creationTime != other.creationTime) { return false; } if (id == null) { if (other.id != null) { return false; } } else if (!id.equals(other.id)) { return false; } if (key == null) { if (other.key != null) { return false; } } else if (!key.equals(other.key)) { return false; } if (lastLoginTime != other.lastLoginTime) { return false; } if (name == null) { if (other.name != null) { return false; } } else if (!name.equals(other.name)) { return false; } if (owner == null) { if (other.owner != null) { return false; } } else if (!owner.equals(other.owner)) { return false; } if (status != other.status) { return false; } if (updatedAt == null) { if (other.updatedAt != null) { return false; } } else if (!updatedAt.equals(other.updatedAt)) { return false; } return true; } /** * Checks whether the model is valid or not. * *

* * @see SdkModel#isValid() * @return true if the model is valid; false otherwise. */ @Override public boolean isValid() { return isAccountIdValid() && isIdValid() && isNameValid() && isOwnerValid(); } /** * Clones this instance. * *

* * @see java.lang.Object#clone() * @return a cloned instance */ @Override public SubtenantApiKey clone() { return new SubtenantApiKey(this); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy