All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.ec2.model.CreateFlowLogsRequest Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon EC2 module holds the client classes that are used for communicating with Amazon EC2 Service

The newest version!
/*
 * Copyright 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 software.amazon.awssdk.services.ec2.model;

import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 */
@Generated("software.amazon.awssdk:codegen")
public final class CreateFlowLogsRequest extends Ec2Request implements
        ToCopyableBuilder {
    private static final SdkField DRY_RUN_FIELD = SdkField
            . builder(MarshallingType.BOOLEAN)
            .memberName("DryRun")
            .getter(getter(CreateFlowLogsRequest::dryRun))
            .setter(setter(Builder::dryRun))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DryRun")
                    .unmarshallLocationName("DryRun").build()).build();

    private static final SdkField CLIENT_TOKEN_FIELD = SdkField
            . builder(MarshallingType.STRING)
            .memberName("ClientToken")
            .getter(getter(CreateFlowLogsRequest::clientToken))
            .setter(setter(Builder::clientToken))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ClientToken")
                    .unmarshallLocationName("ClientToken").build()).build();

    private static final SdkField DELIVER_LOGS_PERMISSION_ARN_FIELD = SdkField
            . builder(MarshallingType.STRING)
            .memberName("DeliverLogsPermissionArn")
            .getter(getter(CreateFlowLogsRequest::deliverLogsPermissionArn))
            .setter(setter(Builder::deliverLogsPermissionArn))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DeliverLogsPermissionArn")
                    .unmarshallLocationName("DeliverLogsPermissionArn").build()).build();

    private static final SdkField DELIVER_CROSS_ACCOUNT_ROLE_FIELD = SdkField
            . builder(MarshallingType.STRING)
            .memberName("DeliverCrossAccountRole")
            .getter(getter(CreateFlowLogsRequest::deliverCrossAccountRole))
            .setter(setter(Builder::deliverCrossAccountRole))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DeliverCrossAccountRole")
                    .unmarshallLocationName("DeliverCrossAccountRole").build()).build();

    private static final SdkField LOG_GROUP_NAME_FIELD = SdkField
            . builder(MarshallingType.STRING)
            .memberName("LogGroupName")
            .getter(getter(CreateFlowLogsRequest::logGroupName))
            .setter(setter(Builder::logGroupName))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LogGroupName")
                    .unmarshallLocationName("LogGroupName").build()).build();

    private static final SdkField> RESOURCE_IDS_FIELD = SdkField
            .> builder(MarshallingType.LIST)
            .memberName("ResourceIds")
            .getter(getter(CreateFlowLogsRequest::resourceIds))
            .setter(setter(Builder::resourceIds))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceId")
                    .unmarshallLocationName("ResourceId").build(),
                    ListTrait
                            .builder()
                            .memberLocationName("item")
                            .memberFieldInfo(
                                    SdkField. builder(MarshallingType.STRING)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("Item").unmarshallLocationName("item").build()).build())
                            .build()).build();

    private static final SdkField RESOURCE_TYPE_FIELD = SdkField
            . builder(MarshallingType.STRING)
            .memberName("ResourceType")
            .getter(getter(CreateFlowLogsRequest::resourceTypeAsString))
            .setter(setter(Builder::resourceType))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceType")
                    .unmarshallLocationName("ResourceType").build()).build();

    private static final SdkField TRAFFIC_TYPE_FIELD = SdkField
            . builder(MarshallingType.STRING)
            .memberName("TrafficType")
            .getter(getter(CreateFlowLogsRequest::trafficTypeAsString))
            .setter(setter(Builder::trafficType))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TrafficType")
                    .unmarshallLocationName("TrafficType").build()).build();

    private static final SdkField LOG_DESTINATION_TYPE_FIELD = SdkField
            . builder(MarshallingType.STRING)
            .memberName("LogDestinationType")
            .getter(getter(CreateFlowLogsRequest::logDestinationTypeAsString))
            .setter(setter(Builder::logDestinationType))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LogDestinationType")
                    .unmarshallLocationName("LogDestinationType").build()).build();

    private static final SdkField LOG_DESTINATION_FIELD = SdkField
            . builder(MarshallingType.STRING)
            .memberName("LogDestination")
            .getter(getter(CreateFlowLogsRequest::logDestination))
            .setter(setter(Builder::logDestination))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LogDestination")
                    .unmarshallLocationName("LogDestination").build()).build();

    private static final SdkField LOG_FORMAT_FIELD = SdkField
            . builder(MarshallingType.STRING)
            .memberName("LogFormat")
            .getter(getter(CreateFlowLogsRequest::logFormat))
            .setter(setter(Builder::logFormat))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LogFormat")
                    .unmarshallLocationName("LogFormat").build()).build();

    private static final SdkField> TAG_SPECIFICATIONS_FIELD = SdkField
            .> builder(MarshallingType.LIST)
            .memberName("TagSpecifications")
            .getter(getter(CreateFlowLogsRequest::tagSpecifications))
            .setter(setter(Builder::tagSpecifications))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TagSpecification")
                    .unmarshallLocationName("TagSpecification").build(),
                    ListTrait
                            .builder()
                            .memberLocationName("item")
                            .memberFieldInfo(
                                    SdkField. builder(MarshallingType.SDK_POJO)
                                            .constructor(TagSpecification::builder)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("Item").unmarshallLocationName("item").build()).build())
                            .build()).build();

    private static final SdkField MAX_AGGREGATION_INTERVAL_FIELD = SdkField
            . builder(MarshallingType.INTEGER)
            .memberName("MaxAggregationInterval")
            .getter(getter(CreateFlowLogsRequest::maxAggregationInterval))
            .setter(setter(Builder::maxAggregationInterval))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MaxAggregationInterval")
                    .unmarshallLocationName("MaxAggregationInterval").build()).build();

    private static final SdkField DESTINATION_OPTIONS_FIELD = SdkField
            . builder(MarshallingType.SDK_POJO)
            .memberName("DestinationOptions")
            .getter(getter(CreateFlowLogsRequest::destinationOptions))
            .setter(setter(Builder::destinationOptions))
            .constructor(DestinationOptionsRequest::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DestinationOptions")
                    .unmarshallLocationName("DestinationOptions").build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DRY_RUN_FIELD,
            CLIENT_TOKEN_FIELD, DELIVER_LOGS_PERMISSION_ARN_FIELD, DELIVER_CROSS_ACCOUNT_ROLE_FIELD, LOG_GROUP_NAME_FIELD,
            RESOURCE_IDS_FIELD, RESOURCE_TYPE_FIELD, TRAFFIC_TYPE_FIELD, LOG_DESTINATION_TYPE_FIELD, LOG_DESTINATION_FIELD,
            LOG_FORMAT_FIELD, TAG_SPECIFICATIONS_FIELD, MAX_AGGREGATION_INTERVAL_FIELD, DESTINATION_OPTIONS_FIELD));

    private static final Map> SDK_NAME_TO_FIELD = Collections
            .unmodifiableMap(new HashMap>() {
                {
                    put("DryRun", DRY_RUN_FIELD);
                    put("ClientToken", CLIENT_TOKEN_FIELD);
                    put("DeliverLogsPermissionArn", DELIVER_LOGS_PERMISSION_ARN_FIELD);
                    put("DeliverCrossAccountRole", DELIVER_CROSS_ACCOUNT_ROLE_FIELD);
                    put("LogGroupName", LOG_GROUP_NAME_FIELD);
                    put("ResourceId", RESOURCE_IDS_FIELD);
                    put("ResourceType", RESOURCE_TYPE_FIELD);
                    put("TrafficType", TRAFFIC_TYPE_FIELD);
                    put("LogDestinationType", LOG_DESTINATION_TYPE_FIELD);
                    put("LogDestination", LOG_DESTINATION_FIELD);
                    put("LogFormat", LOG_FORMAT_FIELD);
                    put("TagSpecification", TAG_SPECIFICATIONS_FIELD);
                    put("MaxAggregationInterval", MAX_AGGREGATION_INTERVAL_FIELD);
                    put("DestinationOptions", DESTINATION_OPTIONS_FIELD);
                }
            });

    private final Boolean dryRun;

    private final String clientToken;

    private final String deliverLogsPermissionArn;

    private final String deliverCrossAccountRole;

    private final String logGroupName;

    private final List resourceIds;

    private final String resourceType;

    private final String trafficType;

    private final String logDestinationType;

    private final String logDestination;

    private final String logFormat;

    private final List tagSpecifications;

    private final Integer maxAggregationInterval;

    private final DestinationOptionsRequest destinationOptions;

    private CreateFlowLogsRequest(BuilderImpl builder) {
        super(builder);
        this.dryRun = builder.dryRun;
        this.clientToken = builder.clientToken;
        this.deliverLogsPermissionArn = builder.deliverLogsPermissionArn;
        this.deliverCrossAccountRole = builder.deliverCrossAccountRole;
        this.logGroupName = builder.logGroupName;
        this.resourceIds = builder.resourceIds;
        this.resourceType = builder.resourceType;
        this.trafficType = builder.trafficType;
        this.logDestinationType = builder.logDestinationType;
        this.logDestination = builder.logDestination;
        this.logFormat = builder.logFormat;
        this.tagSpecifications = builder.tagSpecifications;
        this.maxAggregationInterval = builder.maxAggregationInterval;
        this.destinationOptions = builder.destinationOptions;
    }

    /**
     * 

* Checks whether you have the required permissions for the action, without actually making the request, and * provides an error response. If you have the required permissions, the error response is * DryRunOperation. Otherwise, it is UnauthorizedOperation. *

* * @return Checks whether you have the required permissions for the action, without actually making the request, and * provides an error response. If you have the required permissions, the error response is * DryRunOperation. Otherwise, it is UnauthorizedOperation. */ public final Boolean dryRun() { return dryRun; } /** *

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

* * @return Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more * information, see How * to ensure idempotency. */ public final String clientToken() { return clientToken; } /** *

* The ARN of the IAM role that allows Amazon EC2 to publish flow logs to the log destination. *

*

* This parameter is required if the destination type is cloud-watch-logs, or if the destination type * is kinesis-data-firehose and the delivery stream and the resources to monitor are in different * accounts. *

* * @return The ARN of the IAM role that allows Amazon EC2 to publish flow logs to the log destination.

*

* This parameter is required if the destination type is cloud-watch-logs, or if the * destination type is kinesis-data-firehose and the delivery stream and the resources to * monitor are in different accounts. */ public final String deliverLogsPermissionArn() { return deliverLogsPermissionArn; } /** *

* The ARN of the IAM role that allows Amazon EC2 to publish flow logs across accounts. *

* * @return The ARN of the IAM role that allows Amazon EC2 to publish flow logs across accounts. */ public final String deliverCrossAccountRole() { return deliverCrossAccountRole; } /** *

* The name of a new or existing CloudWatch Logs log group where Amazon EC2 publishes your flow logs. *

*

* This parameter is valid only if the destination type is cloud-watch-logs. *

* * @return The name of a new or existing CloudWatch Logs log group where Amazon EC2 publishes your flow logs.

*

* This parameter is valid only if the destination type is cloud-watch-logs. */ public final String logGroupName() { return logGroupName; } /** * For responses, this returns true if the service returned a value for the ResourceIds property. This DOES NOT * check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). * This is useful because the SDK will never return a null collection or map, but you may need to differentiate * between the service returning nothing (or null) and the service returning an empty collection or map. For * requests, this returns true if a value for the property was specified in the request builder, and false if a * value was not specified. */ public final boolean hasResourceIds() { return resourceIds != null && !(resourceIds instanceof SdkAutoConstructList); } /** *

* The IDs of the resources to monitor. For example, if the resource type is VPC, specify the IDs of * the VPCs. *

*

* Constraints: Maximum of 25 for transit gateway resource types. Maximum of 1000 for the other resource types. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasResourceIds} method. *

* * @return The IDs of the resources to monitor. For example, if the resource type is VPC, specify the * IDs of the VPCs.

*

* Constraints: Maximum of 25 for transit gateway resource types. Maximum of 1000 for the other resource * types. */ public final List resourceIds() { return resourceIds; } /** *

* The type of resource to monitor. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #resourceType} will * return {@link FlowLogsResourceType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #resourceTypeAsString}. *

* * @return The type of resource to monitor. * @see FlowLogsResourceType */ public final FlowLogsResourceType resourceType() { return FlowLogsResourceType.fromValue(resourceType); } /** *

* The type of resource to monitor. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #resourceType} will * return {@link FlowLogsResourceType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #resourceTypeAsString}. *

* * @return The type of resource to monitor. * @see FlowLogsResourceType */ public final String resourceTypeAsString() { return resourceType; } /** *

* The type of traffic to monitor (accepted traffic, rejected traffic, or all traffic). This parameter is not * supported for transit gateway resource types. It is required for the other resource types. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #trafficType} will * return {@link TrafficType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #trafficTypeAsString}. *

* * @return The type of traffic to monitor (accepted traffic, rejected traffic, or all traffic). This parameter is * not supported for transit gateway resource types. It is required for the other resource types. * @see TrafficType */ public final TrafficType trafficType() { return TrafficType.fromValue(trafficType); } /** *

* The type of traffic to monitor (accepted traffic, rejected traffic, or all traffic). This parameter is not * supported for transit gateway resource types. It is required for the other resource types. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #trafficType} will * return {@link TrafficType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #trafficTypeAsString}. *

* * @return The type of traffic to monitor (accepted traffic, rejected traffic, or all traffic). This parameter is * not supported for transit gateway resource types. It is required for the other resource types. * @see TrafficType */ public final String trafficTypeAsString() { return trafficType; } /** *

* The type of destination for the flow log data. *

*

* Default: cloud-watch-logs *

*

* If the service returns an enum value that is not available in the current SDK version, * {@link #logDestinationType} will return {@link LogDestinationType#UNKNOWN_TO_SDK_VERSION}. The raw value returned * by the service is available from {@link #logDestinationTypeAsString}. *

* * @return The type of destination for the flow log data.

*

* Default: cloud-watch-logs * @see LogDestinationType */ public final LogDestinationType logDestinationType() { return LogDestinationType.fromValue(logDestinationType); } /** *

* The type of destination for the flow log data. *

*

* Default: cloud-watch-logs *

*

* If the service returns an enum value that is not available in the current SDK version, * {@link #logDestinationType} will return {@link LogDestinationType#UNKNOWN_TO_SDK_VERSION}. The raw value returned * by the service is available from {@link #logDestinationTypeAsString}. *

* * @return The type of destination for the flow log data.

*

* Default: cloud-watch-logs * @see LogDestinationType */ public final String logDestinationTypeAsString() { return logDestinationType; } /** *

* The destination for the flow log data. The meaning of this parameter depends on the destination type. *

*
    *
  • *

    * If the destination type is cloud-watch-logs, specify the ARN of a CloudWatch Logs log group. For * example: *

    *

    * arn:aws:logs:region:account_id:log-group:my_group *

    *

    * Alternatively, use the LogGroupName parameter. *

    *
  • *
  • *

    * If the destination type is s3, specify the ARN of an S3 bucket. For example: *

    *

    * arn:aws:s3:::my_bucket/my_subfolder/ *

    *

    * The subfolder is optional. Note that you can't use AWSLogs as a subfolder name. *

    *
  • *
  • *

    * If the destination type is kinesis-data-firehose, specify the ARN of a Kinesis Data Firehose * delivery stream. For example: *

    *

    * arn:aws:firehose:region:account_id:deliverystream:my_stream *

    *
  • *
* * @return The destination for the flow log data. The meaning of this parameter depends on the destination type.

*
    *
  • *

    * If the destination type is cloud-watch-logs, specify the ARN of a CloudWatch Logs log group. * For example: *

    *

    * arn:aws:logs:region:account_id:log-group:my_group *

    *

    * Alternatively, use the LogGroupName parameter. *

    *
  • *
  • *

    * If the destination type is s3, specify the ARN of an S3 bucket. For example: *

    *

    * arn:aws:s3:::my_bucket/my_subfolder/ *

    *

    * The subfolder is optional. Note that you can't use AWSLogs as a subfolder name. *

    *
  • *
  • *

    * If the destination type is kinesis-data-firehose, specify the ARN of a Kinesis Data Firehose * delivery stream. For example: *

    *

    * arn:aws:firehose:region:account_id:deliverystream:my_stream *

    *
  • */ public final String logDestination() { return logDestination; } /** *

    * The fields to include in the flow log record. List the fields in the order in which they should appear. If you * omit this parameter, the flow log is created using the default format. If you specify this parameter, you must * include at least one field. For more information about the available fields, see Flow log records in the * Amazon VPC User Guide or Transit Gateway Flow Log * records in the Amazon Web Services Transit Gateway Guide. *

    *

    * Specify the fields using the ${field-id} format, separated by spaces. *

    * * @return The fields to include in the flow log record. List the fields in the order in which they should appear. * If you omit this parameter, the flow log is created using the default format. If you specify this * parameter, you must include at least one field. For more information about the available fields, see Flow log records in the * Amazon VPC User Guide or Transit Gateway * Flow Log records in the Amazon Web Services Transit Gateway Guide.

    *

    * Specify the fields using the ${field-id} format, separated by spaces. */ public final String logFormat() { return logFormat; } /** * For responses, this returns true if the service returned a value for the TagSpecifications property. This DOES * NOT check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). * This is useful because the SDK will never return a null collection or map, but you may need to differentiate * between the service returning nothing (or null) and the service returning an empty collection or map. For * requests, this returns true if a value for the property was specified in the request builder, and false if a * value was not specified. */ public final boolean hasTagSpecifications() { return tagSpecifications != null && !(tagSpecifications instanceof SdkAutoConstructList); } /** *

    * The tags to apply to the flow logs. *

    *

    * Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

    *

    * This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasTagSpecifications} method. *

    * * @return The tags to apply to the flow logs. */ public final List tagSpecifications() { return tagSpecifications; } /** *

    * The maximum interval of time during which a flow of packets is captured and aggregated into a flow log record. * The possible values are 60 seconds (1 minute) or 600 seconds (10 minutes). This parameter must be 60 seconds for * transit gateway resource types. *

    *

    * When a network interface is attached to a Nitro-based instance, * the aggregation interval is always 60 seconds or less, regardless of the value that you specify. *

    *

    * Default: 600 *

    * * @return The maximum interval of time during which a flow of packets is captured and aggregated into a flow log * record. The possible values are 60 seconds (1 minute) or 600 seconds (10 minutes). This parameter must be * 60 seconds for transit gateway resource types.

    *

    * When a network interface is attached to a Nitro-based * instance, the aggregation interval is always 60 seconds or less, regardless of the value that you * specify. *

    *

    * Default: 600 */ public final Integer maxAggregationInterval() { return maxAggregationInterval; } /** *

    * The destination options. *

    * * @return The destination options. */ public final DestinationOptionsRequest destinationOptions() { return destinationOptions; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + super.hashCode(); hashCode = 31 * hashCode + Objects.hashCode(dryRun()); hashCode = 31 * hashCode + Objects.hashCode(clientToken()); hashCode = 31 * hashCode + Objects.hashCode(deliverLogsPermissionArn()); hashCode = 31 * hashCode + Objects.hashCode(deliverCrossAccountRole()); hashCode = 31 * hashCode + Objects.hashCode(logGroupName()); hashCode = 31 * hashCode + Objects.hashCode(hasResourceIds() ? resourceIds() : null); hashCode = 31 * hashCode + Objects.hashCode(resourceTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(trafficTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(logDestinationTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(logDestination()); hashCode = 31 * hashCode + Objects.hashCode(logFormat()); hashCode = 31 * hashCode + Objects.hashCode(hasTagSpecifications() ? tagSpecifications() : null); hashCode = 31 * hashCode + Objects.hashCode(maxAggregationInterval()); hashCode = 31 * hashCode + Objects.hashCode(destinationOptions()); return hashCode; } @Override public final boolean equals(Object obj) { return super.equals(obj) && equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof CreateFlowLogsRequest)) { return false; } CreateFlowLogsRequest other = (CreateFlowLogsRequest) obj; return Objects.equals(dryRun(), other.dryRun()) && Objects.equals(clientToken(), other.clientToken()) && Objects.equals(deliverLogsPermissionArn(), other.deliverLogsPermissionArn()) && Objects.equals(deliverCrossAccountRole(), other.deliverCrossAccountRole()) && Objects.equals(logGroupName(), other.logGroupName()) && hasResourceIds() == other.hasResourceIds() && Objects.equals(resourceIds(), other.resourceIds()) && Objects.equals(resourceTypeAsString(), other.resourceTypeAsString()) && Objects.equals(trafficTypeAsString(), other.trafficTypeAsString()) && Objects.equals(logDestinationTypeAsString(), other.logDestinationTypeAsString()) && Objects.equals(logDestination(), other.logDestination()) && Objects.equals(logFormat(), other.logFormat()) && hasTagSpecifications() == other.hasTagSpecifications() && Objects.equals(tagSpecifications(), other.tagSpecifications()) && Objects.equals(maxAggregationInterval(), other.maxAggregationInterval()) && Objects.equals(destinationOptions(), other.destinationOptions()); } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. */ @Override public final String toString() { return ToString.builder("CreateFlowLogsRequest").add("DryRun", dryRun()).add("ClientToken", clientToken()) .add("DeliverLogsPermissionArn", deliverLogsPermissionArn()) .add("DeliverCrossAccountRole", deliverCrossAccountRole()).add("LogGroupName", logGroupName()) .add("ResourceIds", hasResourceIds() ? resourceIds() : null).add("ResourceType", resourceTypeAsString()) .add("TrafficType", trafficTypeAsString()).add("LogDestinationType", logDestinationTypeAsString()) .add("LogDestination", logDestination()).add("LogFormat", logFormat()) .add("TagSpecifications", hasTagSpecifications() ? tagSpecifications() : null) .add("MaxAggregationInterval", maxAggregationInterval()).add("DestinationOptions", destinationOptions()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "DryRun": return Optional.ofNullable(clazz.cast(dryRun())); case "ClientToken": return Optional.ofNullable(clazz.cast(clientToken())); case "DeliverLogsPermissionArn": return Optional.ofNullable(clazz.cast(deliverLogsPermissionArn())); case "DeliverCrossAccountRole": return Optional.ofNullable(clazz.cast(deliverCrossAccountRole())); case "LogGroupName": return Optional.ofNullable(clazz.cast(logGroupName())); case "ResourceIds": return Optional.ofNullable(clazz.cast(resourceIds())); case "ResourceType": return Optional.ofNullable(clazz.cast(resourceTypeAsString())); case "TrafficType": return Optional.ofNullable(clazz.cast(trafficTypeAsString())); case "LogDestinationType": return Optional.ofNullable(clazz.cast(logDestinationTypeAsString())); case "LogDestination": return Optional.ofNullable(clazz.cast(logDestination())); case "LogFormat": return Optional.ofNullable(clazz.cast(logFormat())); case "TagSpecifications": return Optional.ofNullable(clazz.cast(tagSpecifications())); case "MaxAggregationInterval": return Optional.ofNullable(clazz.cast(maxAggregationInterval())); case "DestinationOptions": return Optional.ofNullable(clazz.cast(destinationOptions())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } @Override public final Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } private static Function getter(Function g) { return obj -> g.apply((CreateFlowLogsRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends Ec2Request.Builder, SdkPojo, CopyableBuilder { /** *

    * Checks whether you have the required permissions for the action, without actually making the request, and * provides an error response. If you have the required permissions, the error response is * DryRunOperation. Otherwise, it is UnauthorizedOperation. *

    * * @param dryRun * Checks whether you have the required permissions for the action, without actually making the request, * and provides an error response. If you have the required permissions, the error response is * DryRunOperation. Otherwise, it is UnauthorizedOperation. * @return Returns a reference to this object so that method calls can be chained together. */ Builder dryRun(Boolean dryRun); /** *

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

    * * @param clientToken * Unique, case-sensitive identifier that 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. */ Builder clientToken(String clientToken); /** *

    * The ARN of the IAM role that allows Amazon EC2 to publish flow logs to the log destination. *

    *

    * This parameter is required if the destination type is cloud-watch-logs, or if the destination * type is kinesis-data-firehose and the delivery stream and the resources to monitor are in * different accounts. *

    * * @param deliverLogsPermissionArn * The ARN of the IAM role that allows Amazon EC2 to publish flow logs to the log destination.

    *

    * This parameter is required if the destination type is cloud-watch-logs, or if the * destination type is kinesis-data-firehose and the delivery stream and the resources to * monitor are in different accounts. * @return Returns a reference to this object so that method calls can be chained together. */ Builder deliverLogsPermissionArn(String deliverLogsPermissionArn); /** *

    * The ARN of the IAM role that allows Amazon EC2 to publish flow logs across accounts. *

    * * @param deliverCrossAccountRole * The ARN of the IAM role that allows Amazon EC2 to publish flow logs across accounts. * @return Returns a reference to this object so that method calls can be chained together. */ Builder deliverCrossAccountRole(String deliverCrossAccountRole); /** *

    * The name of a new or existing CloudWatch Logs log group where Amazon EC2 publishes your flow logs. *

    *

    * This parameter is valid only if the destination type is cloud-watch-logs. *

    * * @param logGroupName * The name of a new or existing CloudWatch Logs log group where Amazon EC2 publishes your flow logs.

    *

    * This parameter is valid only if the destination type is cloud-watch-logs. * @return Returns a reference to this object so that method calls can be chained together. */ Builder logGroupName(String logGroupName); /** *

    * The IDs of the resources to monitor. For example, if the resource type is VPC, specify the IDs * of the VPCs. *

    *

    * Constraints: Maximum of 25 for transit gateway resource types. Maximum of 1000 for the other resource types. *

    * * @param resourceIds * The IDs of the resources to monitor. For example, if the resource type is VPC, specify * the IDs of the VPCs.

    *

    * Constraints: Maximum of 25 for transit gateway resource types. Maximum of 1000 for the other resource * types. * @return Returns a reference to this object so that method calls can be chained together. */ Builder resourceIds(Collection resourceIds); /** *

    * The IDs of the resources to monitor. For example, if the resource type is VPC, specify the IDs * of the VPCs. *

    *

    * Constraints: Maximum of 25 for transit gateway resource types. Maximum of 1000 for the other resource types. *

    * * @param resourceIds * The IDs of the resources to monitor. For example, if the resource type is VPC, specify * the IDs of the VPCs.

    *

    * Constraints: Maximum of 25 for transit gateway resource types. Maximum of 1000 for the other resource * types. * @return Returns a reference to this object so that method calls can be chained together. */ Builder resourceIds(String... resourceIds); /** *

    * The type of resource to monitor. *

    * * @param resourceType * The type of resource to monitor. * @see FlowLogsResourceType * @return Returns a reference to this object so that method calls can be chained together. * @see FlowLogsResourceType */ Builder resourceType(String resourceType); /** *

    * The type of resource to monitor. *

    * * @param resourceType * The type of resource to monitor. * @see FlowLogsResourceType * @return Returns a reference to this object so that method calls can be chained together. * @see FlowLogsResourceType */ Builder resourceType(FlowLogsResourceType resourceType); /** *

    * The type of traffic to monitor (accepted traffic, rejected traffic, or all traffic). This parameter is not * supported for transit gateway resource types. It is required for the other resource types. *

    * * @param trafficType * The type of traffic to monitor (accepted traffic, rejected traffic, or all traffic). This parameter is * not supported for transit gateway resource types. It is required for the other resource types. * @see TrafficType * @return Returns a reference to this object so that method calls can be chained together. * @see TrafficType */ Builder trafficType(String trafficType); /** *

    * The type of traffic to monitor (accepted traffic, rejected traffic, or all traffic). This parameter is not * supported for transit gateway resource types. It is required for the other resource types. *

    * * @param trafficType * The type of traffic to monitor (accepted traffic, rejected traffic, or all traffic). This parameter is * not supported for transit gateway resource types. It is required for the other resource types. * @see TrafficType * @return Returns a reference to this object so that method calls can be chained together. * @see TrafficType */ Builder trafficType(TrafficType trafficType); /** *

    * The type of destination for the flow log data. *

    *

    * Default: cloud-watch-logs *

    * * @param logDestinationType * The type of destination for the flow log data.

    *

    * Default: cloud-watch-logs * @see LogDestinationType * @return Returns a reference to this object so that method calls can be chained together. * @see LogDestinationType */ Builder logDestinationType(String logDestinationType); /** *

    * The type of destination for the flow log data. *

    *

    * Default: cloud-watch-logs *

    * * @param logDestinationType * The type of destination for the flow log data.

    *

    * Default: cloud-watch-logs * @see LogDestinationType * @return Returns a reference to this object so that method calls can be chained together. * @see LogDestinationType */ Builder logDestinationType(LogDestinationType logDestinationType); /** *

    * The destination for the flow log data. The meaning of this parameter depends on the destination type. *

    *
      *
    • *

      * If the destination type is cloud-watch-logs, specify the ARN of a CloudWatch Logs log group. For * example: *

      *

      * arn:aws:logs:region:account_id:log-group:my_group *

      *

      * Alternatively, use the LogGroupName parameter. *

      *
    • *
    • *

      * If the destination type is s3, specify the ARN of an S3 bucket. For example: *

      *

      * arn:aws:s3:::my_bucket/my_subfolder/ *

      *

      * The subfolder is optional. Note that you can't use AWSLogs as a subfolder name. *

      *
    • *
    • *

      * If the destination type is kinesis-data-firehose, specify the ARN of a Kinesis Data Firehose * delivery stream. For example: *

      *

      * arn:aws:firehose:region:account_id:deliverystream:my_stream *

      *
    • *
    * * @param logDestination * The destination for the flow log data. The meaning of this parameter depends on the destination * type.

    *
      *
    • *

      * If the destination type is cloud-watch-logs, specify the ARN of a CloudWatch Logs log * group. For example: *

      *

      * arn:aws:logs:region:account_id:log-group:my_group *

      *

      * Alternatively, use the LogGroupName parameter. *

      *
    • *
    • *

      * If the destination type is s3, specify the ARN of an S3 bucket. For example: *

      *

      * arn:aws:s3:::my_bucket/my_subfolder/ *

      *

      * The subfolder is optional. Note that you can't use AWSLogs as a subfolder name. *

      *
    • *
    • *

      * If the destination type is kinesis-data-firehose, specify the ARN of a Kinesis Data * Firehose delivery stream. For example: *

      *

      * arn:aws:firehose:region:account_id:deliverystream:my_stream *

      *
    • * @return Returns a reference to this object so that method calls can be chained together. */ Builder logDestination(String logDestination); /** *

      * The fields to include in the flow log record. List the fields in the order in which they should appear. If * you omit this parameter, the flow log is created using the default format. If you specify this parameter, you * must include at least one field. For more information about the available fields, see Flow log records in the * Amazon VPC User Guide or Transit Gateway Flow * Log records in the Amazon Web Services Transit Gateway Guide. *

      *

      * Specify the fields using the ${field-id} format, separated by spaces. *

      * * @param logFormat * The fields to include in the flow log record. List the fields in the order in which they should * appear. If you omit this parameter, the flow log is created using the default format. If you specify * this parameter, you must include at least one field. For more information about the available fields, * see Flow log * records in the Amazon VPC User Guide or Transit Gateway * Flow Log records in the Amazon Web Services Transit Gateway Guide.

      *

      * Specify the fields using the ${field-id} format, separated by spaces. * @return Returns a reference to this object so that method calls can be chained together. */ Builder logFormat(String logFormat); /** *

      * The tags to apply to the flow logs. *

      * * @param tagSpecifications * The tags to apply to the flow logs. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tagSpecifications(Collection tagSpecifications); /** *

      * The tags to apply to the flow logs. *

      * * @param tagSpecifications * The tags to apply to the flow logs. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tagSpecifications(TagSpecification... tagSpecifications); /** *

      * The tags to apply to the flow logs. *

      * This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.ec2.model.TagSpecification.Builder} avoiding the need to create one * manually via {@link software.amazon.awssdk.services.ec2.model.TagSpecification#builder()}. * *

      * When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.ec2.model.TagSpecification.Builder#build()} is called immediately and * its result is passed to {@link #tagSpecifications(List)}. * * @param tagSpecifications * a consumer that will call methods on * {@link software.amazon.awssdk.services.ec2.model.TagSpecification.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #tagSpecifications(java.util.Collection) */ Builder tagSpecifications(Consumer... tagSpecifications); /** *

      * The maximum interval of time during which a flow of packets is captured and aggregated into a flow log * record. The possible values are 60 seconds (1 minute) or 600 seconds (10 minutes). This parameter must be 60 * seconds for transit gateway resource types. *

      *

      * When a network interface is attached to a Nitro-based * instance, the aggregation interval is always 60 seconds or less, regardless of the value that you * specify. *

      *

      * Default: 600 *

      * * @param maxAggregationInterval * The maximum interval of time during which a flow of packets is captured and aggregated into a flow log * record. The possible values are 60 seconds (1 minute) or 600 seconds (10 minutes). This parameter must * be 60 seconds for transit gateway resource types.

      *

      * When a network interface is attached to a Nitro-based * instance, the aggregation interval is always 60 seconds or less, regardless of the value that you * specify. *

      *

      * Default: 600 * @return Returns a reference to this object so that method calls can be chained together. */ Builder maxAggregationInterval(Integer maxAggregationInterval); /** *

      * The destination options. *

      * * @param destinationOptions * The destination options. * @return Returns a reference to this object so that method calls can be chained together. */ Builder destinationOptions(DestinationOptionsRequest destinationOptions); /** *

      * The destination options. *

      * This is a convenience method that creates an instance of the {@link DestinationOptionsRequest.Builder} * avoiding the need to create one manually via {@link DestinationOptionsRequest#builder()}. * *

      * When the {@link Consumer} completes, {@link DestinationOptionsRequest.Builder#build()} is called immediately * and its result is passed to {@link #destinationOptions(DestinationOptionsRequest)}. * * @param destinationOptions * a consumer that will call methods on {@link DestinationOptionsRequest.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #destinationOptions(DestinationOptionsRequest) */ default Builder destinationOptions(Consumer destinationOptions) { return destinationOptions(DestinationOptionsRequest.builder().applyMutation(destinationOptions).build()); } @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends Ec2Request.BuilderImpl implements Builder { private Boolean dryRun; private String clientToken; private String deliverLogsPermissionArn; private String deliverCrossAccountRole; private String logGroupName; private List resourceIds = DefaultSdkAutoConstructList.getInstance(); private String resourceType; private String trafficType; private String logDestinationType; private String logDestination; private String logFormat; private List tagSpecifications = DefaultSdkAutoConstructList.getInstance(); private Integer maxAggregationInterval; private DestinationOptionsRequest destinationOptions; private BuilderImpl() { } private BuilderImpl(CreateFlowLogsRequest model) { super(model); dryRun(model.dryRun); clientToken(model.clientToken); deliverLogsPermissionArn(model.deliverLogsPermissionArn); deliverCrossAccountRole(model.deliverCrossAccountRole); logGroupName(model.logGroupName); resourceIds(model.resourceIds); resourceType(model.resourceType); trafficType(model.trafficType); logDestinationType(model.logDestinationType); logDestination(model.logDestination); logFormat(model.logFormat); tagSpecifications(model.tagSpecifications); maxAggregationInterval(model.maxAggregationInterval); destinationOptions(model.destinationOptions); } public final Boolean getDryRun() { return dryRun; } public final void setDryRun(Boolean dryRun) { this.dryRun = dryRun; } @Override public final Builder dryRun(Boolean dryRun) { this.dryRun = dryRun; return this; } public final String getClientToken() { return clientToken; } public final void setClientToken(String clientToken) { this.clientToken = clientToken; } @Override public final Builder clientToken(String clientToken) { this.clientToken = clientToken; return this; } public final String getDeliverLogsPermissionArn() { return deliverLogsPermissionArn; } public final void setDeliverLogsPermissionArn(String deliverLogsPermissionArn) { this.deliverLogsPermissionArn = deliverLogsPermissionArn; } @Override public final Builder deliverLogsPermissionArn(String deliverLogsPermissionArn) { this.deliverLogsPermissionArn = deliverLogsPermissionArn; return this; } public final String getDeliverCrossAccountRole() { return deliverCrossAccountRole; } public final void setDeliverCrossAccountRole(String deliverCrossAccountRole) { this.deliverCrossAccountRole = deliverCrossAccountRole; } @Override public final Builder deliverCrossAccountRole(String deliverCrossAccountRole) { this.deliverCrossAccountRole = deliverCrossAccountRole; return this; } public final String getLogGroupName() { return logGroupName; } public final void setLogGroupName(String logGroupName) { this.logGroupName = logGroupName; } @Override public final Builder logGroupName(String logGroupName) { this.logGroupName = logGroupName; return this; } public final Collection getResourceIds() { if (resourceIds instanceof SdkAutoConstructList) { return null; } return resourceIds; } public final void setResourceIds(Collection resourceIds) { this.resourceIds = FlowLogResourceIdsCopier.copy(resourceIds); } @Override public final Builder resourceIds(Collection resourceIds) { this.resourceIds = FlowLogResourceIdsCopier.copy(resourceIds); return this; } @Override @SafeVarargs public final Builder resourceIds(String... resourceIds) { resourceIds(Arrays.asList(resourceIds)); return this; } public final String getResourceType() { return resourceType; } public final void setResourceType(String resourceType) { this.resourceType = resourceType; } @Override public final Builder resourceType(String resourceType) { this.resourceType = resourceType; return this; } @Override public final Builder resourceType(FlowLogsResourceType resourceType) { this.resourceType(resourceType == null ? null : resourceType.toString()); return this; } public final String getTrafficType() { return trafficType; } public final void setTrafficType(String trafficType) { this.trafficType = trafficType; } @Override public final Builder trafficType(String trafficType) { this.trafficType = trafficType; return this; } @Override public final Builder trafficType(TrafficType trafficType) { this.trafficType(trafficType == null ? null : trafficType.toString()); return this; } public final String getLogDestinationType() { return logDestinationType; } public final void setLogDestinationType(String logDestinationType) { this.logDestinationType = logDestinationType; } @Override public final Builder logDestinationType(String logDestinationType) { this.logDestinationType = logDestinationType; return this; } @Override public final Builder logDestinationType(LogDestinationType logDestinationType) { this.logDestinationType(logDestinationType == null ? null : logDestinationType.toString()); return this; } public final String getLogDestination() { return logDestination; } public final void setLogDestination(String logDestination) { this.logDestination = logDestination; } @Override public final Builder logDestination(String logDestination) { this.logDestination = logDestination; return this; } public final String getLogFormat() { return logFormat; } public final void setLogFormat(String logFormat) { this.logFormat = logFormat; } @Override public final Builder logFormat(String logFormat) { this.logFormat = logFormat; return this; } public final List getTagSpecifications() { List result = TagSpecificationListCopier.copyToBuilder(this.tagSpecifications); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setTagSpecifications(Collection tagSpecifications) { this.tagSpecifications = TagSpecificationListCopier.copyFromBuilder(tagSpecifications); } @Override public final Builder tagSpecifications(Collection tagSpecifications) { this.tagSpecifications = TagSpecificationListCopier.copy(tagSpecifications); return this; } @Override @SafeVarargs public final Builder tagSpecifications(TagSpecification... tagSpecifications) { tagSpecifications(Arrays.asList(tagSpecifications)); return this; } @Override @SafeVarargs public final Builder tagSpecifications(Consumer... tagSpecifications) { tagSpecifications(Stream.of(tagSpecifications).map(c -> TagSpecification.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final Integer getMaxAggregationInterval() { return maxAggregationInterval; } public final void setMaxAggregationInterval(Integer maxAggregationInterval) { this.maxAggregationInterval = maxAggregationInterval; } @Override public final Builder maxAggregationInterval(Integer maxAggregationInterval) { this.maxAggregationInterval = maxAggregationInterval; return this; } public final DestinationOptionsRequest.Builder getDestinationOptions() { return destinationOptions != null ? destinationOptions.toBuilder() : null; } public final void setDestinationOptions(DestinationOptionsRequest.BuilderImpl destinationOptions) { this.destinationOptions = destinationOptions != null ? destinationOptions.build() : null; } @Override public final Builder destinationOptions(DestinationOptionsRequest destinationOptions) { this.destinationOptions = destinationOptions; return this; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public CreateFlowLogsRequest build() { return new CreateFlowLogsRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy