"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CreateInstanceEventWindowCommand = void 0;
const models_0_1 = require("../models/models_0");
const Aws_ec2_1 = require("../protocols/Aws_ec2");
const middleware_serde_1 = require("@aws-sdk/middleware-serde");
const smithy_client_1 = require("@aws-sdk/smithy-client");
/**
 * <p>Creates an event window in which scheduled events for the associated Amazon EC2 instances can
 *          run.</p>
 *          <p>You can define either a set of time ranges or a cron expression when creating the event
 *          window, but not both. All event window times are in UTC.</p>
 *          <p>You can create up to 200 event windows per Amazon Web Services Region.</p>
 *          <p>When you create the event window, targets (instance IDs, Dedicated Host IDs, or tags)
 *          are not yet associated with it. To ensure that the event window can be used, you must
 *          associate one or more targets with it by using the <a>AssociateInstanceEventWindow</a> API.</p>
 *
 *          <important>
 *             <p>Event windows are applicable only for scheduled events that stop, reboot, or
 *             terminate instances.</p>
 *             <p>Event windows are <i>not</i> applicable for:</p>
 *             <ul>
 *                <li>
 *                   <p>Expedited scheduled events and network maintenance events. </p>
 *                </li>
 *                <li>
 *                            <p>Unscheduled maintenance such as AutoRecovery and unplanned reboots.</p>
 *                </li>
 *             </ul>
 *          </important>
 *
 *          <p>For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/event-windows.html">Define event windows for scheduled
 *             events</a> in the <i>Amazon EC2 User Guide</i>.</p>
 * @example
 * Use a bare-bones client and the command you need to make an API call.
 * ```javascript
 * import { EC2Client, CreateInstanceEventWindowCommand } from "@aws-sdk/client-ec2"; // ES Modules import
 * // const { EC2Client, CreateInstanceEventWindowCommand } = require("@aws-sdk/client-ec2"); // CommonJS import
 * const client = new EC2Client(config);
 * const command = new CreateInstanceEventWindowCommand(input);
 * const response = await client.send(command);
 * ```
 *
 * @see {@link CreateInstanceEventWindowCommandInput} for command's `input` shape.
 * @see {@link CreateInstanceEventWindowCommandOutput} for command's `response` shape.
 * @see {@link EC2ClientResolvedConfig | config} for command's `input` shape.
 *
 */
class CreateInstanceEventWindowCommand extends smithy_client_1.Command {
    // Start section: command_properties
    // End section: command_properties
    constructor(input) {
        // Start section: command_constructor
        super();
        this.input = input;
        // End section: command_constructor
    }
    /**
     * @internal
     */
    resolveMiddleware(clientStack, configuration, options) {
        this.middlewareStack.use(middleware_serde_1.getSerdePlugin(configuration, this.serialize, this.deserialize));
        const stack = clientStack.concat(this.middlewareStack);
        const { logger } = configuration;
        const clientName = "EC2Client";
        const commandName = "CreateInstanceEventWindowCommand";
        const handlerExecutionContext = {
            logger,
            clientName,
            commandName,
            inputFilterSensitiveLog: models_0_1.CreateInstanceEventWindowRequest.filterSensitiveLog,
            outputFilterSensitiveLog: models_0_1.CreateInstanceEventWindowResult.filterSensitiveLog,
        };
        const { requestHandler } = configuration;
        return stack.resolve((request) => requestHandler.handle(request.request, options || {}), handlerExecutionContext);
    }
    serialize(input, context) {
        return Aws_ec2_1.serializeAws_ec2CreateInstanceEventWindowCommand(input, context);
    }
    deserialize(output, context) {
        return Aws_ec2_1.deserializeAws_ec2CreateInstanceEventWindowCommand(output, context);
    }
}
exports.CreateInstanceEventWindowCommand = CreateInstanceEventWindowCommand;
//# sourceMappingURL=CreateInstanceEventWindowCommand.js.map