com.amazonaws.services.ec2.model.CreateFlowLogsRequest Maven / Gradle / Ivy
/*
* Copyright 2013-2018 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;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.AmazonWebServiceRequest;
import com.amazonaws.Request;
import com.amazonaws.services.ec2.model.transform.CreateFlowLogsRequestMarshaller;
/**
*
* Contains the parameters for CreateFlowLogs.
*
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class CreateFlowLogsRequest extends AmazonWebServiceRequest implements Serializable, Cloneable, DryRunSupportedRequest {
/**
*
* Unique, case-sensitive identifier you provide to ensure the idempotency of the request. For more information, see
* How to Ensure
* Idempotency.
*
*/
private String clientToken;
/**
*
* The ARN for the IAM role that's used to post flow logs to a CloudWatch Logs log group.
*
*/
private String deliverLogsPermissionArn;
/**
*
* The name of the CloudWatch log group.
*
*/
private String logGroupName;
/**
*
* One or more subnet, network interface, or VPC IDs.
*
*
* Constraints: Maximum of 1000 resources
*
*/
private com.amazonaws.internal.SdkInternalList resourceIds;
/**
*
* The type of resource on which to create the flow log.
*
*/
private String resourceType;
/**
*
* The type of traffic to log.
*
*/
private String trafficType;
/**
*
* Unique, case-sensitive identifier you provide to ensure the idempotency of the request. For more information, see
* How to Ensure
* Idempotency.
*
*
* @param 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 = clientToken;
}
/**
*
* Unique, case-sensitive identifier you provide to ensure the idempotency of the request. For more information, see
* How to Ensure
* Idempotency.
*
*
* @return 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 this.clientToken;
}
/**
*
* Unique, case-sensitive identifier you provide to ensure the idempotency of the request. For more information, see
* How to Ensure
* Idempotency.
*
*
* @param clientToken
* Unique, case-sensitive identifier you provide to ensure the idempotency of the request. For more
* information, see How to Ensure
* Idempotency.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateFlowLogsRequest withClientToken(String clientToken) {
setClientToken(clientToken);
return this;
}
/**
*
* The ARN for the IAM role that's used to post flow logs to a CloudWatch Logs log group.
*
*
* @param 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 = deliverLogsPermissionArn;
}
/**
*
* 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.
*/
public String getDeliverLogsPermissionArn() {
return this.deliverLogsPermissionArn;
}
/**
*
* The ARN for the IAM role that's used to post flow logs to a CloudWatch Logs log group.
*
*
* @param deliverLogsPermissionArn
* The ARN for the IAM role that's used to post flow logs to a CloudWatch Logs log group.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateFlowLogsRequest withDeliverLogsPermissionArn(String deliverLogsPermissionArn) {
setDeliverLogsPermissionArn(deliverLogsPermissionArn);
return this;
}
/**
*
* The name of the CloudWatch log group.
*
*
* @param logGroupName
* The name of the CloudWatch log group.
*/
public void setLogGroupName(String logGroupName) {
this.logGroupName = logGroupName;
}
/**
*
* The name of the CloudWatch log group.
*
*
* @return The name of the CloudWatch log group.
*/
public String getLogGroupName() {
return this.logGroupName;
}
/**
*
* The name of the CloudWatch log group.
*
*
* @param logGroupName
* The name of the CloudWatch log group.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateFlowLogsRequest withLogGroupName(String logGroupName) {
setLogGroupName(logGroupName);
return this;
}
/**
*
* One or more subnet, network interface, or VPC IDs.
*
*
* Constraints: Maximum of 1000 resources
*
*
* @return One or more subnet, network interface, or VPC IDs.
*
* Constraints: Maximum of 1000 resources
*/
public java.util.List getResourceIds() {
if (resourceIds == null) {
resourceIds = new com.amazonaws.internal.SdkInternalList();
}
return resourceIds;
}
/**
*
* One or more subnet, network interface, or VPC IDs.
*
*
* Constraints: Maximum of 1000 resources
*
*
* @param resourceIds
* One or more subnet, network interface, or VPC IDs.
*
* Constraints: Maximum of 1000 resources
*/
public void setResourceIds(java.util.Collection resourceIds) {
if (resourceIds == null) {
this.resourceIds = null;
return;
}
this.resourceIds = new com.amazonaws.internal.SdkInternalList(resourceIds);
}
/**
*
* One or more subnet, network interface, or VPC IDs.
*
*
* Constraints: Maximum of 1000 resources
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setResourceIds(java.util.Collection)} or {@link #withResourceIds(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param resourceIds
* One or more subnet, network interface, or VPC IDs.
*
* Constraints: Maximum of 1000 resources
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateFlowLogsRequest withResourceIds(String... resourceIds) {
if (this.resourceIds == null) {
setResourceIds(new com.amazonaws.internal.SdkInternalList(resourceIds.length));
}
for (String ele : resourceIds) {
this.resourceIds.add(ele);
}
return this;
}
/**
*
* One or more subnet, network interface, or VPC IDs.
*
*
* Constraints: Maximum of 1000 resources
*
*
* @param resourceIds
* One or more subnet, network interface, or VPC IDs.
*
* Constraints: Maximum of 1000 resources
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreateFlowLogsRequest withResourceIds(java.util.Collection resourceIds) {
setResourceIds(resourceIds);
return this;
}
/**
*
* The type of resource on which to create the flow log.
*
*
* @param resourceType
* The type of resource on which to create the flow log.
* @see FlowLogsResourceType
*/
public void setResourceType(String resourceType) {
this.resourceType = resourceType;
}
/**
*
* The type of resource on which to create the flow log.
*
*
* @return The type of resource on which to create the flow log.
* @see FlowLogsResourceType
*/
public String getResourceType() {
return this.resourceType;
}
/**
*
* The type of resource on which to create the flow log.
*
*
* @param resourceType
* The type of resource on which to create the flow log.
* @return Returns a reference to this object so that method calls can be chained together.
* @see FlowLogsResourceType
*/
public CreateFlowLogsRequest withResourceType(String resourceType) {
setResourceType(resourceType);
return this;
}
/**
*
* The type of resource on which to create the flow log.
*
*
* @param resourceType
* The type of resource on which to create the flow log.
* @see FlowLogsResourceType
*/
public void setResourceType(FlowLogsResourceType resourceType) {
withResourceType(resourceType);
}
/**
*
* The type of resource on which to create the flow log.
*
*
* @param resourceType
* The type of resource on which to create the flow log.
* @return Returns a reference to this object so that method calls can be chained together.
* @see FlowLogsResourceType
*/
public CreateFlowLogsRequest withResourceType(FlowLogsResourceType resourceType) {
this.resourceType = resourceType.toString();
return this;
}
/**
*
* The type of traffic to log.
*
*
* @param trafficType
* The type of traffic to log.
* @see TrafficType
*/
public void setTrafficType(String trafficType) {
this.trafficType = trafficType;
}
/**
*
* The type of traffic to log.
*
*
* @return The type of traffic to log.
* @see TrafficType
*/
public String getTrafficType() {
return this.trafficType;
}
/**
*
* The type of traffic to log.
*
*
* @param trafficType
* The type of traffic to log.
* @return Returns a reference to this object so that method calls can be chained together.
* @see TrafficType
*/
public CreateFlowLogsRequest withTrafficType(String trafficType) {
setTrafficType(trafficType);
return this;
}
/**
*
* The type of traffic to log.
*
*
* @param trafficType
* The type of traffic to log.
* @see TrafficType
*/
public void setTrafficType(TrafficType trafficType) {
withTrafficType(trafficType);
}
/**
*
* The type of traffic to log.
*
*
* @param trafficType
* The type of traffic to log.
* @return Returns a reference to this object so that method calls can be chained together.
* @see TrafficType
*/
public CreateFlowLogsRequest withTrafficType(TrafficType trafficType) {
this.trafficType = trafficType.toString();
return this;
}
/**
* This method is intended for internal use only. Returns the marshaled request configured with additional
* parameters to enable operation dry-run.
*/
@Override
public Request getDryRunRequest() {
Request request = new CreateFlowLogsRequestMarshaller().marshall(this);
request.addParameter("DryRun", Boolean.toString(true));
return request;
}
/**
* Returns a string representation of this object; useful for testing and debugging.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getClientToken() != null)
sb.append("ClientToken: ").append(getClientToken()).append(",");
if (getDeliverLogsPermissionArn() != null)
sb.append("DeliverLogsPermissionArn: ").append(getDeliverLogsPermissionArn()).append(",");
if (getLogGroupName() != null)
sb.append("LogGroupName: ").append(getLogGroupName()).append(",");
if (getResourceIds() != null)
sb.append("ResourceIds: ").append(getResourceIds()).append(",");
if (getResourceType() != null)
sb.append("ResourceType: ").append(getResourceType()).append(",");
if (getTrafficType() != null)
sb.append("TrafficType: ").append(getTrafficType());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof CreateFlowLogsRequest == false)
return false;
CreateFlowLogsRequest other = (CreateFlowLogsRequest) obj;
if (other.getClientToken() == null ^ this.getClientToken() == null)
return false;
if (other.getClientToken() != null && other.getClientToken().equals(this.getClientToken()) == false)
return false;
if (other.getDeliverLogsPermissionArn() == null ^ this.getDeliverLogsPermissionArn() == null)
return false;
if (other.getDeliverLogsPermissionArn() != null && other.getDeliverLogsPermissionArn().equals(this.getDeliverLogsPermissionArn()) == false)
return false;
if (other.getLogGroupName() == null ^ this.getLogGroupName() == null)
return false;
if (other.getLogGroupName() != null && other.getLogGroupName().equals(this.getLogGroupName()) == false)
return false;
if (other.getResourceIds() == null ^ this.getResourceIds() == null)
return false;
if (other.getResourceIds() != null && other.getResourceIds().equals(this.getResourceIds()) == false)
return false;
if (other.getResourceType() == null ^ this.getResourceType() == null)
return false;
if (other.getResourceType() != null && other.getResourceType().equals(this.getResourceType()) == false)
return false;
if (other.getTrafficType() == null ^ this.getTrafficType() == null)
return false;
if (other.getTrafficType() != null && other.getTrafficType().equals(this.getTrafficType()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getClientToken() == null) ? 0 : getClientToken().hashCode());
hashCode = prime * hashCode + ((getDeliverLogsPermissionArn() == null) ? 0 : getDeliverLogsPermissionArn().hashCode());
hashCode = prime * hashCode + ((getLogGroupName() == null) ? 0 : getLogGroupName().hashCode());
hashCode = prime * hashCode + ((getResourceIds() == null) ? 0 : getResourceIds().hashCode());
hashCode = prime * hashCode + ((getResourceType() == null) ? 0 : getResourceType().hashCode());
hashCode = prime * hashCode + ((getTrafficType() == null) ? 0 : getTrafficType().hashCode());
return hashCode;
}
@Override
public CreateFlowLogsRequest clone() {
return (CreateFlowLogsRequest) super.clone();
}
}