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

com.arm.mbed.cloud.sdk.accountmanagement.model.ApiKey Maven / Gradle / Ivy

Go to download

The Pelion Cloud SDK (formerly known as Mbed Cloud SDK) provides a simplified interface to the Pelion Cloud APIs by exposing functionality using conventions and paradigms familiar to Java developers.

There is a newer version: 2.5.0
Show newest version
package com.arm.mbed.cloud.sdk.accountmanagement.model;

import java.util.Date;
import java.util.List;

import com.arm.mbed.cloud.sdk.annotations.DefaultValue;
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;

@Preamble(description = "This object represents an API key in Arm Mbed Cloud")
public class ApiKey implements SdkModel {
    /**
     * Serialisation Id.
     */
    private static final long serialVersionUID = 6908040952116869470L;
    /**
     * The UUID of the API key.
     */
    private String id;
    /**
     * Display name for the API key.
     */
    @Required
    private String name;
    /**
     * The owner of this API key, who is the creator by default.
     */
    private String ownerId;
    /**
     * A list of group IDs this API key belongs to.
     */
    private final List groups;
    /**
     * The status of the user. INVITED means that the user has not accepted the invitation request. RESET means that the
     * password must be changed immediately.
     */
    private final ApiKeyStatus status;
    /**
     * The API key.
     */
    private final String key;
    /**
     * Creation time.
     */
    @DefaultValue(value = "now()")
    private final Date createdAt;
    /**
     * The timestamp of the API key creation in the storage, in milliseconds.
     */
    private final long creationTime;
    /**
     * The timestamp of the latest API key usage, in milliseconds.
     */
    private final long lastLoginTime;

    /**
     * Internal constructor.
     * 

* Note: Should not be used. Use {@link #ApiKey()} or {@link #ApiKey(String)} instead. * * @param id * id * @param name * name * @param ownerId * owner id * @param groups * groups * @param status * status * @param key * key * @param createdAt * createdAt * @param creationTime * creationTime * @param lastLoginTime * lastLoginTime */ @Internal public ApiKey(String id, String name, String ownerId, List groups, ApiKeyStatus status, String key, Date createdAt, long creationTime, long lastLoginTime) { super(); setId(id); setName(name); setOwnerId(ownerId); this.groups = groups; this.status = status; this.key = key; this.createdAt = createdAt; this.creationTime = creationTime; this.lastLoginTime = lastLoginTime; } /** * Internal constructor. *

* Note: Should not be used. Use {@link #ApiKey()} or {@link #ApiKey(String)} instead. * * @param id * id * @param groups * groups * @param status * status * @param key * key * @param createdAt * createdAt * @param creationTime * creationTime * @param lastLoginTime * lastLoginTime */ @Internal public ApiKey(String id, List groups, ApiKeyStatus status, String key, Date createdAt, long creationTime, long lastLoginTime) { this(id, null, null, groups, status, key, createdAt, creationTime, lastLoginTime); } /** * ApiKey constructor. *

* Other constructors with 'Internal' annotation are for internal usage only. * */ public ApiKey() { this(null, null, ApiKeyStatus.getDefault(), null, new Date(), 0, 0); } /** * ApiKey constructor. *

* Other constructors with 'Internal' annotation are for internal usage only. * * @param name * API key name. */ public ApiKey(String name) { this(); setName(name); } /** * Gets API key id. * * @return the id. */ public String getId() { return id; } /** * Sets API key id. * * @param id * the id to set. */ public void setId(String id) { this.id = id; } /** * Sets the id. *

* Similar to {@link #setId(String)}. * * @param id * the id to set. */ @Internal public void setApiKeyId(String id) { setId(id); } /** * Gets the name. * * @return the name. */ public String getName() { return name; } /** * Sets the name. * * @param name * the name to set. */ @Required public void setName(String name) { this.name = name; } /** * Gets the owner id. * * @return the ownerId. */ public String getOwnerId() { return ownerId; } /** * Sets the owner id. * * @param ownerId * the ownerId to set. */ public void setOwnerId(String ownerId) { this.ownerId = ownerId; } /** * Gets the groups. * * @return the groups. */ public List getGroups() { return groups; } /** * Gets the status. * * @return the status. */ public ApiKeyStatus getStatus() { return status; } /** * Gets the key. * * @return the key. */ public String getKey() { return key; } /** * Gets when the API key was created. * * @return the createdAt. */ public Date getCreatedAt() { return createdAt; } /** * Gets creation time. * * @return the creationTime. */ public long getCreationTime() { return creationTime; } /** * Gets last login time. * * @return the lastLoginTime. */ public long getLastLoginTime() { return lastLoginTime; } /** * Gets a clone. * * @return a clone. * * @see java.lang.Object#clone() */ @Override public ApiKey clone() throws CloneNotSupportedException { return new ApiKey(id, name, ownerId, groups, status, key, createdAt, creationTime, lastLoginTime); } /** * Determines whether all required fields have been set and therefore if the model instance is valid. * * @return true if instance is valid. False otherwise. */ @Override public boolean isValid() { return name != null; } /* * (non-Javadoc) * * @see java.lang.Object#toString() */ @Override public String toString() { return "ApiKey [id=" + id + ", name=" + name + ", ownerId=" + ownerId + ", groups=" + groups + ", status=" + status + ", key=" + key + ", createdAt=" + createdAt + ", creationTime=" + creationTime + ", lastLoginTime=" + lastLoginTime + "]"; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy