clients/client-directory-service/src/commands/RestoreFromSnapshotCommand.ts (44 lines of code) (raw):
// smithy-typescript generated code
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
import { getSerdePlugin } from "@smithy/middleware-serde";
import { Command as $Command } from "@smithy/smithy-client";
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
import { DirectoryServiceClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../DirectoryServiceClient";
import { commonParams } from "../endpoint/EndpointParameters";
import { RestoreFromSnapshotRequest, RestoreFromSnapshotResult } from "../models/models_0";
import { de_RestoreFromSnapshotCommand, se_RestoreFromSnapshotCommand } from "../protocols/Aws_json1_1";
/**
* @public
*/
export type { __MetadataBearer };
export { $Command };
/**
* @public
*
* The input for {@link RestoreFromSnapshotCommand}.
*/
export interface RestoreFromSnapshotCommandInput extends RestoreFromSnapshotRequest {}
/**
* @public
*
* The output of {@link RestoreFromSnapshotCommand}.
*/
export interface RestoreFromSnapshotCommandOutput extends RestoreFromSnapshotResult, __MetadataBearer {}
/**
* <p>Restores a directory using an existing directory snapshot.</p>
* <p>When you restore a directory from a snapshot, any changes made to the directory after the snapshot date are overwritten.</p>
* <p>This action returns as soon as the restore operation is initiated. You can monitor the
* progress of the restore operation by calling the <a>DescribeDirectories</a> operation with
* the directory identifier. When the <b>DirectoryDescription.Stage</b> value changes to
* <code>Active</code>, the restore operation is complete.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { DirectoryServiceClient, RestoreFromSnapshotCommand } from "@aws-sdk/client-directory-service"; // ES Modules import
* // const { DirectoryServiceClient, RestoreFromSnapshotCommand } = require("@aws-sdk/client-directory-service"); // CommonJS import
* const client = new DirectoryServiceClient(config);
* const input = { // RestoreFromSnapshotRequest
* SnapshotId: "STRING_VALUE", // required
* };
* const command = new RestoreFromSnapshotCommand(input);
* const response = await client.send(command);
* // {};
*
* ```
*
* @param RestoreFromSnapshotCommandInput - {@link RestoreFromSnapshotCommandInput}
* @returns {@link RestoreFromSnapshotCommandOutput}
* @see {@link RestoreFromSnapshotCommandInput} for command's `input` shape.
* @see {@link RestoreFromSnapshotCommandOutput} for command's `response` shape.
* @see {@link DirectoryServiceClientResolvedConfig | config} for DirectoryServiceClient's `config` shape.
*
* @throws {@link ClientException} (client fault)
* <p>A client exception has occurred.</p>
*
* @throws {@link EntityDoesNotExistException} (client fault)
* <p>The specified entity could not be found.</p>
*
* @throws {@link InvalidParameterException} (client fault)
* <p>One or more parameters are not valid.</p>
*
* @throws {@link ServiceException} (server fault)
* <p>An exception has occurred in Directory Service.</p>
*
* @throws {@link DirectoryServiceServiceException}
* <p>Base exception class for all service exceptions from DirectoryService service.</p>
*
*
* @example To restore a snapshot
* ```javascript
* // The following example restores a directory using an existing directory snapshot.
* const input = {
* SnapshotId: "s-9267f6da4e"
* };
* const command = new RestoreFromSnapshotCommand(input);
* const response = await client.send(command);
* /* response is
* { /* empty *\/ }
* *\/
* ```
*
* @public
*/
export class RestoreFromSnapshotCommand extends $Command
.classBuilder<
RestoreFromSnapshotCommandInput,
RestoreFromSnapshotCommandOutput,
DirectoryServiceClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes
>()
.ep(commonParams)
.m(function (this: any, Command: any, cs: any, config: DirectoryServiceClientResolvedConfig, o: any) {
return [
getSerdePlugin(config, this.serialize, this.deserialize),
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
];
})
.s("DirectoryService_20150416", "RestoreFromSnapshot", {})
.n("DirectoryServiceClient", "RestoreFromSnapshotCommand")
.f(void 0, void 0)
.ser(se_RestoreFromSnapshotCommand)
.de(de_RestoreFromSnapshotCommand)
.build() {
/** @internal type navigation helper, not in runtime. */
protected declare static __types: {
api: {
input: RestoreFromSnapshotRequest;
output: {};
};
sdk: {
input: RestoreFromSnapshotCommandInput;
output: RestoreFromSnapshotCommandOutput;
};
};
}