Start line:  
End line:  

Snippet Preview

Snippet HTML Code

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

Contains information about an event that was returned by a lookup request. The result includes a representation of a CloudTrail event.

 
 public class Event implements SerializableCloneable {

    
The CloudTrail ID of the event returned.
 
     private String eventId;

    
The name of the event returned.
 
     private String eventName;

    
The date and time of the event returned.
 
     private java.util.Date eventTime;

    
A user name or role name of the requester that called the API in the event returned.
 
     private String username;

    
A list of resources referenced by the event returned.
 
A JSON string that contains a representation of the event returned.
 
     private String cloudTrailEvent;

    
The CloudTrail ID of the event returned.

Returns:
The CloudTrail ID of the event returned.
 
     public String getEventId() {
         return ;
     }
    
    
The CloudTrail ID of the event returned.

Parameters:
eventId The CloudTrail ID of the event returned.
 
     public void setEventId(String eventId) {
         this. = eventId;
     }
    
    
The CloudTrail ID of the event returned.

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

Parameters:
eventId The CloudTrail ID of the event returned.
Returns:
A reference to this updated object so that method calls can be chained together.
 
     public Event withEventId(String eventId) {
         this. = eventId;
         return this;
     }

    
The name of the event returned.

Returns:
The name of the event returned.
 
     public String getEventName() {
         return ;
     }
    
    
The name of the event returned.

Parameters:
eventName The name of the event returned.
    public void setEventName(String eventName) {
        this. = eventName;
    }
    
    
The name of the event returned.

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

Parameters:
eventName The name of the event returned.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Event withEventName(String eventName) {
        this. = eventName;
        return this;
    }

    
The date and time of the event returned.

Returns:
The date and time of the event returned.
    public java.util.Date getEventTime() {
        return ;
    }
    
    
The date and time of the event returned.

Parameters:
eventTime The date and time of the event returned.
    public void setEventTime(java.util.Date eventTime) {
        this. = eventTime;
    }
    
    
The date and time of the event returned.

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

Parameters:
eventTime The date and time of the event returned.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Event withEventTime(java.util.Date eventTime) {
        this. = eventTime;
        return this;
    }

    
A user name or role name of the requester that called the API in the event returned.

Returns:
A user name or role name of the requester that called the API in the event returned.
    public String getUsername() {
        return ;
    }
    
    
A user name or role name of the requester that called the API in the event returned.

Parameters:
username A user name or role name of the requester that called the API in the event returned.
    public void setUsername(String username) {
        this. = username;
    }
    
    
A user name or role name of the requester that called the API in the event returned.

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

Parameters:
username A user name or role name of the requester that called the API in the event returned.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Event withUsername(String username) {
        this. = username;
        return this;
    }

    
A list of resources referenced by the event returned.

Returns:
A list of resources referenced by the event returned.
    public java.util.List<ResourcegetResources() {
        if ( == null) {
               = new com.amazonaws.internal.ListWithAutoConstructFlag<Resource>();
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
A list of resources referenced by the event returned.

Parameters:
resources A list of resources referenced by the event returned.
    public void setResources(java.util.Collection<Resourceresources) {
        if (resources == null) {
            this. = null;
            return;
        }
        resourcesCopy.addAll(resources);
        this. = resourcesCopy;
    }
    
    
A list of resources referenced by the event returned.

NOTE: This method appends the values to the existing list (if any). Use setResources(java.util.Collection) or withResources(java.util.Collection) if you want to override the existing values.

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

Parameters:
resources A list of resources referenced by the event returned.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Event withResources(Resource... resources) {
        if (getResources() == nullsetResources(new java.util.ArrayList<Resource>(resources.length));
        for (Resource value : resources) {
            getResources().add(value);
        }
        return this;
    }
    
    
A list of resources referenced by the event returned.

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

Parameters:
resources A list of resources referenced by the event returned.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Event withResources(java.util.Collection<Resourceresources) {
        if (resources == null) {
            this. = null;
        } else {
            resourcesCopy.addAll(resources);
            this. = resourcesCopy;
        }
        return this;
    }

    
A JSON string that contains a representation of the event returned.

Returns:
A JSON string that contains a representation of the event returned.
    public String getCloudTrailEvent() {
        return ;
    }
    
    
A JSON string that contains a representation of the event returned.

Parameters:
cloudTrailEvent A JSON string that contains a representation of the event returned.
    public void setCloudTrailEvent(String cloudTrailEvent) {
        this. = cloudTrailEvent;
    }
    
    
A JSON string that contains a representation of the event returned.

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

Parameters:
cloudTrailEvent A JSON string that contains a representation of the event returned.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Event withCloudTrailEvent(String cloudTrailEvent) {
        this. = cloudTrailEvent;
        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 (getEventId() != nullsb.append("EventId: " + getEventId() + ",");
        if (getEventName() != nullsb.append("EventName: " + getEventName() + ",");
        if (getEventTime() != nullsb.append("EventTime: " + getEventTime() + ",");
        if (getUsername() != nullsb.append("Username: " + getUsername() + ",");
        if (getResources() != nullsb.append("Resources: " + getResources() + ",");
        if (getCloudTrailEvent() != nullsb.append("CloudTrailEvent: " + getCloudTrailEvent() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getEventId() == null) ? 0 : getEventId().hashCode()); 
        hashCode = prime * hashCode + ((getEventName() == null) ? 0 : getEventName().hashCode()); 
        hashCode = prime * hashCode + ((getEventTime() == null) ? 0 : getEventTime().hashCode()); 
        hashCode = prime * hashCode + ((getUsername() == null) ? 0 : getUsername().hashCode()); 
        hashCode = prime * hashCode + ((getResources() == null) ? 0 : getResources().hashCode()); 
        hashCode = prime * hashCode + ((getCloudTrailEvent() == null) ? 0 : getCloudTrailEvent().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof Event == falsereturn false;
        Event other = (Event)obj;
        
        if (other.getEventId() == null ^ this.getEventId() == nullreturn false;
        if (other.getEventId() != null && other.getEventId().equals(this.getEventId()) == falsereturn false
        if (other.getEventName() == null ^ this.getEventName() == nullreturn false;
        if (other.getEventName() != null && other.getEventName().equals(this.getEventName()) == falsereturn false
        if (other.getEventTime() == null ^ this.getEventTime() == nullreturn false;
        if (other.getEventTime() != null && other.getEventTime().equals(this.getEventTime()) == falsereturn false
        if (other.getUsername() == null ^ this.getUsername() == nullreturn false;
        if (other.getUsername() != null && other.getUsername().equals(this.getUsername()) == falsereturn false
        if (other.getResources() == null ^ this.getResources() == nullreturn false;
        if (other.getResources() != null && other.getResources().equals(this.getResources()) == falsereturn false
        if (other.getCloudTrailEvent() == null ^ this.getCloudTrailEvent() == nullreturn false;
        if (other.getCloudTrailEvent() != null && other.getCloudTrailEvent().equals(this.getCloudTrailEvent()) == falsereturn false
        return true;
    }
    
    @Override
    public Event clone() {
        try {
            return (Eventsuper.clone();
        
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException(
                    "Got a CloneNotSupportedException from Object.clone() "
                    + "even though we're Cloneable!",
                    e);
        }
        
    }
}
    
New to GrepCode? Check out our FAQ X