Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2014 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.securitytoken.model;
 

AWS credentials for API authentication.

 
 public class Credentials implements Serializable {

    
The access key ID that identifies the temporary security credentials.

Constraints:
Length: 16 - 32
Pattern: [\w]*

 
     private String accessKeyId;

    
The secret access key that can be used to sign requests.
 
     private String secretAccessKey;

    
The token that users must pass to the service API to use the temporary credentials.
 
     private String sessionToken;

    
The date on which the current credentials expire.
 
     private java.util.Date expiration;

    
Default constructor for a new Credentials object. Callers should use the setter or fluent setter (with...) methods to initialize this object after creating it.
 
     public Credentials() {}
    
    
Constructs a new Credentials object. Callers should use the setter or fluent setter (with...) methods to initialize any additional object members.

Parameters:
accessKeyId The access key ID that identifies the temporary security credentials.
secretAccessKey The secret access key that can be used to sign requests.
sessionToken The token that users must pass to the service API to use the temporary credentials.
expiration The date on which the current credentials expire.
 
     public Credentials(String accessKeyIdString secretAccessKeyString sessionTokenjava.util.Date expiration) {
         setAccessKeyId(accessKeyId);
         setSecretAccessKey(secretAccessKey);
         setSessionToken(sessionToken);
         setExpiration(expiration);
     }

    
The access key ID that identifies the temporary security credentials.

Constraints:
Length: 16 - 32
Pattern: [\w]*

Returns:
The access key ID that identifies the temporary security credentials.
 
     public String getAccessKeyId() {
         return ;
     }
    
    
The access key ID that identifies the temporary security credentials.

Constraints:
Length: 16 - 32
Pattern: [\w]*

Parameters:
accessKeyId The access key ID that identifies the temporary security credentials.
 
     public void setAccessKeyId(String accessKeyId) {
        this. = accessKeyId;
    }
    
    
The access key ID that identifies the temporary security credentials.

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

Constraints:
Length: 16 - 32
Pattern: [\w]*

Parameters:
accessKeyId The access key ID that identifies the temporary security credentials.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Credentials withAccessKeyId(String accessKeyId) {
        this. = accessKeyId;
        return this;
    }

    
The secret access key that can be used to sign requests.

Returns:
The secret access key that can be used to sign requests.
    public String getSecretAccessKey() {
        return ;
    }
    
    
The secret access key that can be used to sign requests.

Parameters:
secretAccessKey The secret access key that can be used to sign requests.
    public void setSecretAccessKey(String secretAccessKey) {
        this. = secretAccessKey;
    }
    
    
The secret access key that can be used to sign requests.

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

Parameters:
secretAccessKey The secret access key that can be used to sign requests.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Credentials withSecretAccessKey(String secretAccessKey) {
        this. = secretAccessKey;
        return this;
    }

    
The token that users must pass to the service API to use the temporary credentials.

Returns:
The token that users must pass to the service API to use the temporary credentials.
    public String getSessionToken() {
        return ;
    }
    
    
The token that users must pass to the service API to use the temporary credentials.

Parameters:
sessionToken The token that users must pass to the service API to use the temporary credentials.
    public void setSessionToken(String sessionToken) {
        this. = sessionToken;
    }
    
    
The token that users must pass to the service API to use the temporary credentials.

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

Parameters:
sessionToken The token that users must pass to the service API to use the temporary credentials.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Credentials withSessionToken(String sessionToken) {
        this. = sessionToken;
        return this;
    }

    
The date on which the current credentials expire.

Returns:
The date on which the current credentials expire.
    public java.util.Date getExpiration() {
        return ;
    }
    
    
The date on which the current credentials expire.

Parameters:
expiration The date on which the current credentials expire.
    public void setExpiration(java.util.Date expiration) {
        this. = expiration;
    }
    
    
The date on which the current credentials expire.

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

Parameters:
expiration The date on which the current credentials expire.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Credentials withExpiration(java.util.Date expiration) {
        this. = expiration;
        return this;
    }

    
Returns a string representation of this object; useful for testing and debugging.

Returns:
A string representation of this object.
See also:
java.lang.Object.toString()
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getAccessKeyId() != nullsb.append("AccessKeyId: " + getAccessKeyId() + ",");
        if (getSecretAccessKey() != nullsb.append("SecretAccessKey: " + getSecretAccessKey() + ",");
        if (getSessionToken() != nullsb.append("SessionToken: " + getSessionToken() + ",");
        if (getExpiration() != nullsb.append("Expiration: " + getExpiration() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getAccessKeyId() == null) ? 0 : getAccessKeyId().hashCode()); 
        hashCode = prime * hashCode + ((getSecretAccessKey() == null) ? 0 : getSecretAccessKey().hashCode()); 
        hashCode = prime * hashCode + ((getSessionToken() == null) ? 0 : getSessionToken().hashCode()); 
        hashCode = prime * hashCode + ((getExpiration() == null) ? 0 : getExpiration().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof Credentials == falsereturn false;
        Credentials other = (Credentials)obj;
        
        if (other.getAccessKeyId() == null ^ this.getAccessKeyId() == nullreturn false;
        if (other.getAccessKeyId() != null && other.getAccessKeyId().equals(this.getAccessKeyId()) == falsereturn false
        if (other.getSecretAccessKey() == null ^ this.getSecretAccessKey() == nullreturn false;
        if (other.getSecretAccessKey() != null && other.getSecretAccessKey().equals(this.getSecretAccessKey()) == falsereturn false
        if (other.getSessionToken() == null ^ this.getSessionToken() == nullreturn false;
        if (other.getSessionToken() != null && other.getSessionToken().equals(this.getSessionToken()) == falsereturn false
        if (other.getExpiration() == null ^ this.getExpiration() == nullreturn false;
        if (other.getExpiration() != null && other.getExpiration().equals(this.getExpiration()) == falsereturn false
        return true;
    }
    
}
    
New to GrepCode? Check out our FAQ X