package org.twonote.rgwadmin4j.model;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

/**
 * Represents the key associated with a user or sub-user.
 *
 * <p>Note that the key may represents a S3 access key pair (Composed of access key and secret key)
 * or a Swift secret. In case of Swift, the secret will be available in the access key field.
 */
public class Key {
  /**
   * user : rgwAdmin4jTest-69211f2b-d1c1-47e2-ade1-c0c6386db1a7 accessKey : 22742PSMHVP83QQM1232
   * secretKey : KtgjPrNUu4uPRArJPJGmYYF07jlE966coQyvJ7pl
   */
  @SerializedName("user")
  @Expose
  private String user;

  @SerializedName("access_key")
  @Expose
  private String accessKey;

  @SerializedName("secret_key")
  @Expose
  private String secretKey;

  public String getUser() {
    return user;
  }

  public void setUser(String user) {
    this.user = user;
  }

  public String getAccessKey() {
    return accessKey;
  }

  public void setAccessKey(String accessKey) {
    this.accessKey = accessKey;
  }

  public String getSecretKey() {
    return secretKey;
  }

  public void setSecretKey(String secretKey) {
    this.secretKey = secretKey;
  }
}

@@ -149,19 +149,26 @@
 nts the 
-key
+credential
  associa
@@ -247,26 +247,78 @@
  S3 
-access key pair (C
+or a Swift credential, and have different forms.%0A * S3 credential is c
 ompo
@@ -353,107 +353,113 @@
  key
-)%0A * or a
+. On the other hand,
  Swift 
-se
 cre
-t. In case of Swift, the secret will be available in the access key field.%0A */
+dential is a username/password pair.%0A */%0A// TODO: divided into swift/s3 key
 %0Apub
@@ -843,16 +843,120 @@
 etKey;%0A%0A
+  /**%0A   * Retrieve S3 user ID or Swift username.%0A   *%0A   * @return S3 user ID or Swift username.%0A   */%0A
   public
@@ -1053,32 +1053,142 @@
 er = user;%0A  %7D%0A%0A
+  /**%0A   * Retrieve S3 access key or Swift password.%0A   *%0A   * @return S3 access key or Swift password.%0A   */%0A
   public String 
@@ -1321,59 +1321,612 @@
 %0A%0A  
-public String getSecretKey() %7B%0A    return secretKey
+/**%0A   * Retrieve S3 secret key.%0A   *%0A   * %3Cp%3EIf the object represents swift credential, this field will be null.%0A   *%0A   * @return S3 secret key.%0A   */%0A  public String getSecretKey() %7B%0A    return secretKey;%0A  %7D%0A%0A  /**%0A   * Determine the key represents S3 or swift credential.%0A   *%0A   * @return True if the key is swift credential. Vice versa.%0A   */%0A  public boolean isSwiftKey() %7B%0A    return secretKey == null;%0A  %7D%0A%0A  /**%0A   * Determine the key represents S3 or swift credential.%0A   *%0A   * @return True if the key is S3 credential. Vice versa.%0A   */%0A  public boolean isS3Key() %7B%0A    return !isSwiftKey()
 ;%0A  

Improve the Key model