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.ec2.model;
 
 
Container for the parameters to the CreateFlowLogs operation.

Creates one or more flow logs to capture IP traffic for a specific network interface, subnet, or VPC. Flow logs are delivered to a specified log group in Amazon CloudWatch Logs. If you specify a VPC or subnet in the request, a log stream is created in CloudWatch Logs for each network interface in the subnet or VPC. Log streams can include information about accepted and rejected traffic to a network interface. You can view the data in your log streams using Amazon CloudWatch Logs.

In your request, you must also specify an IAM role that has permission to publish logs to CloudWatch Logs.

 
 public class CreateFlowLogsRequest extends AmazonWebServiceRequest implements SerializableCloneable {

    
One or more subnet, network interface, or VPC IDs.
 
The type of resource on which to create the flow log.

Constraints:
Allowed Values: VPC, Subnet, NetworkInterface

 
     private String resourceType;

    
The type of traffic to log.

Constraints:
Allowed Values: ACCEPT, REJECT, ALL

 
     private String trafficType;

    
The name of the CloudWatch log group.
 
     private String logGroupName;

    
The ARN for the IAM role that's used to post flow logs to a CloudWatch Logs log group.
 
     private String deliverLogsPermissionArn;

    
Unique, case-sensitive identifier you provide to ensure the idempotency of the request. For more information, see How to Ensure Idempotency.
 
     private String clientToken;

    
One or more subnet, network interface, or VPC IDs.

Returns:
One or more subnet, network interface, or VPC IDs.
 
     public java.util.List<StringgetResourceIds() {
         if ( == null) {
                = new com.amazonaws.internal.ListWithAutoConstructFlag<String>();
               .setAutoConstruct(true);
         }
         return ;
     }
    
    
One or more subnet, network interface, or VPC IDs.

Parameters:
resourceIds One or more subnet, network interface, or VPC IDs.
 
    public void setResourceIds(java.util.Collection<StringresourceIds) {
        if (resourceIds == null) {
            this. = null;
            return;
        }
        resourceIdsCopy.addAll(resourceIds);
        this. = resourceIdsCopy;
    }
    
    
One or more subnet, network interface, or VPC IDs.

NOTE: This method appends the values to the existing list (if any). Use setResourceIds(java.util.Collection) or withResourceIds(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:
resourceIds One or more subnet, network interface, or VPC IDs.
Returns:
A reference to this updated object so that method calls can be chained together.
    public CreateFlowLogsRequest withResourceIds(String... resourceIds) {
        if (getResourceIds() == nullsetResourceIds(new java.util.ArrayList<String>(resourceIds.length));
        for (String value : resourceIds) {
            getResourceIds().add(value);
        }
        return this;
    }
    
    
One or more subnet, network interface, or VPC IDs.

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

Parameters:
resourceIds One or more subnet, network interface, or VPC IDs.
Returns:
A reference to this updated object so that method calls can be chained together.
        if (resourceIds == null) {
            this. = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<StringresourceIdsCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(resourceIds.size());
            resourceIdsCopy.addAll(resourceIds);
            this. = resourceIdsCopy;
        }
        return this;
    }

    
The type of resource on which to create the flow log.

Constraints:
Allowed Values: VPC, Subnet, NetworkInterface

Returns:
The type of resource on which to create the flow log.
See also:
FlowLogsResourceType
    public String getResourceType() {
        return ;
    }
    
    
The type of resource on which to create the flow log.

Constraints:
Allowed Values: VPC, Subnet, NetworkInterface

Parameters:
resourceType The type of resource on which to create the flow log.
See also:
FlowLogsResourceType
    public void setResourceType(String resourceType) {
        this. = resourceType;
    }
    
    
The type of resource on which to create the flow log.

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

Constraints:
Allowed Values: VPC, Subnet, NetworkInterface

Parameters:
resourceType The type of resource on which to create the flow log.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
FlowLogsResourceType
    public CreateFlowLogsRequest withResourceType(String resourceType) {
        this. = resourceType;
        return this;
    }

    
The type of resource on which to create the flow log.

Constraints:
Allowed Values: VPC, Subnet, NetworkInterface

Parameters:
resourceType The type of resource on which to create the flow log.
See also:
FlowLogsResourceType
    public void setResourceType(FlowLogsResourceType resourceType) {
        this. = resourceType.toString();
    }
    
    
The type of resource on which to create the flow log.

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

Constraints:
Allowed Values: VPC, Subnet, NetworkInterface

Parameters:
resourceType The type of resource on which to create the flow log.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
FlowLogsResourceType
        this. = resourceType.toString();
        return this;
    }

    
The type of traffic to log.

Constraints:
Allowed Values: ACCEPT, REJECT, ALL

Returns:
The type of traffic to log.
See also:
TrafficType
    public String getTrafficType() {
        return ;
    }
    
    
The type of traffic to log.

Constraints:
Allowed Values: ACCEPT, REJECT, ALL

Parameters:
trafficType The type of traffic to log.
See also:
TrafficType
    public void setTrafficType(String trafficType) {
        this. = trafficType;
    }
    
    
The type of traffic to log.

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

Constraints:
Allowed Values: ACCEPT, REJECT, ALL

Parameters:
trafficType The type of traffic to log.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
TrafficType
    public CreateFlowLogsRequest withTrafficType(String trafficType) {
        this. = trafficType;
        return this;
    }

    
The type of traffic to log.

Constraints:
Allowed Values: ACCEPT, REJECT, ALL

Parameters:
trafficType The type of traffic to log.
See also:
TrafficType
    public void setTrafficType(TrafficType trafficType) {
        this. = trafficType.toString();
    }
    
    
The type of traffic to log.

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

Constraints:
Allowed Values: ACCEPT, REJECT, ALL

Parameters:
trafficType The type of traffic to log.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
TrafficType
    public CreateFlowLogsRequest withTrafficType(TrafficType trafficType) {
        this. = trafficType.toString();
        return this;
    }

    
The name of the CloudWatch log group.

Returns:
The name of the CloudWatch log group.
    public String getLogGroupName() {
        return ;
    }
    
    
The name of the CloudWatch log group.

Parameters:
logGroupName The name of the CloudWatch log group.
    public void setLogGroupName(String logGroupName) {
        this. = logGroupName;
    }
    
    
The name of the CloudWatch log group.

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

Parameters:
logGroupName The name of the CloudWatch log group.
Returns:
A reference to this updated object so that method calls can be chained together.
    public CreateFlowLogsRequest withLogGroupName(String logGroupName) {
        this. = logGroupName;
        return this;
    }

    
The ARN for the IAM role that's used to post flow logs to a CloudWatch Logs log group.

Returns:
The ARN for the IAM role that's used to post flow logs to a CloudWatch Logs log group.
        return ;
    }
    
    
The ARN for the IAM role that's used to post flow logs to a CloudWatch Logs log group.

Parameters:
deliverLogsPermissionArn The ARN for the IAM role that's used to post flow logs to a CloudWatch Logs log group.
    public void setDeliverLogsPermissionArn(String deliverLogsPermissionArn) {
        this. = deliverLogsPermissionArn;
    }
    
    
The ARN for the IAM role that's used to post flow logs to a CloudWatch Logs log group.

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

Parameters:
deliverLogsPermissionArn The ARN for the IAM role that's used to post flow logs to a CloudWatch Logs log group.
Returns:
A reference to this updated object so that method calls can be chained together.
    public CreateFlowLogsRequest withDeliverLogsPermissionArn(String deliverLogsPermissionArn) {
        this. = deliverLogsPermissionArn;
        return this;
    }

    
Unique, case-sensitive identifier you provide to ensure the idempotency of the request. For more information, see How to Ensure Idempotency.

Returns:
Unique, case-sensitive identifier you provide to ensure the idempotency of the request. For more information, see How to Ensure Idempotency.
    public String getClientToken() {
        return ;
    }
    
    
Unique, case-sensitive identifier you provide to ensure the idempotency of the request. For more information, see How to Ensure Idempotency.

Parameters:
clientToken Unique, case-sensitive identifier you provide to ensure the idempotency of the request. For more information, see How to Ensure Idempotency.
    public void setClientToken(String clientToken) {
        this. = clientToken;
    }
    
    
Unique, case-sensitive identifier you provide to ensure the idempotency of the request. For more information, see How to Ensure Idempotency.

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

Parameters:
clientToken Unique, case-sensitive identifier you provide to ensure the idempotency of the request. For more information, see How to Ensure Idempotency.
Returns:
A reference to this updated object so that method calls can be chained together.
    public CreateFlowLogsRequest withClientToken(String clientToken) {
        this. = clientToken;
        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 (getResourceIds() != nullsb.append("ResourceIds: " + getResourceIds() + ",");
        if (getResourceType() != nullsb.append("ResourceType: " + getResourceType() + ",");
        if (getTrafficType() != nullsb.append("TrafficType: " + getTrafficType() + ",");
        if (getLogGroupName() != nullsb.append("LogGroupName: " + getLogGroupName() + ",");
        if (getDeliverLogsPermissionArn() != nullsb.append("DeliverLogsPermissionArn: " + getDeliverLogsPermissionArn() + ",");
        if (getClientToken() != nullsb.append("ClientToken: " + getClientToken() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getResourceIds() == null) ? 0 : getResourceIds().hashCode()); 
        hashCode = prime * hashCode + ((getResourceType() == null) ? 0 : getResourceType().hashCode()); 
        hashCode = prime * hashCode + ((getTrafficType() == null) ? 0 : getTrafficType().hashCode()); 
        hashCode = prime * hashCode + ((getLogGroupName() == null) ? 0 : getLogGroupName().hashCode()); 
        hashCode = prime * hashCode + ((getDeliverLogsPermissionArn() == null) ? 0 : getDeliverLogsPermissionArn().hashCode()); 
        hashCode = prime * hashCode + ((getClientToken() == null) ? 0 : getClientToken().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof CreateFlowLogsRequest == falsereturn false;
        CreateFlowLogsRequest other = (CreateFlowLogsRequest)obj;
        
        if (other.getResourceIds() == null ^ this.getResourceIds() == nullreturn false;
        if (other.getResourceIds() != null && other.getResourceIds().equals(this.getResourceIds()) == falsereturn false
        if (other.getResourceType() == null ^ this.getResourceType() == nullreturn false;
        if (other.getResourceType() != null && other.getResourceType().equals(this.getResourceType()) == falsereturn false
        if (other.getTrafficType() == null ^ this.getTrafficType() == nullreturn false;
        if (other.getTrafficType() != null && other.getTrafficType().equals(this.getTrafficType()) == falsereturn false
        if (other.getLogGroupName() == null ^ this.getLogGroupName() == nullreturn false;
        if (other.getLogGroupName() != null && other.getLogGroupName().equals(this.getLogGroupName()) == falsereturn false
        if (other.getDeliverLogsPermissionArn() == null ^ this.getDeliverLogsPermissionArn() == nullreturn false;
        if (other.getDeliverLogsPermissionArn() != null && other.getDeliverLogsPermissionArn().equals(this.getDeliverLogsPermissionArn()) == falsereturn false
        if (other.getClientToken() == null ^ this.getClientToken() == nullreturn false;
        if (other.getClientToken() != null && other.getClientToken().equals(this.getClientToken()) == falsereturn false
        return true;
    }
    
    @Override
    public CreateFlowLogsRequest clone() {
        
            return (CreateFlowLogsRequestsuper.clone();
    }
}
    
New to GrepCode? Check out our FAQ X