Skip to content

Commit 0ab635e

Browse files
author
awstools
committed
feat(client-transfer): Adding new API to support remote directory listing using SFTP connector
1 parent d6fd1a4 commit 0ab635e

File tree

9 files changed

+398
-50
lines changed

9 files changed

+398
-50
lines changed

clients/client-transfer/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,14 @@ SendWorkflowStepState
563563

564564
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/transfer/command/SendWorkflowStepStateCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-transfer/Interface/SendWorkflowStepStateCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-transfer/Interface/SendWorkflowStepStateCommandOutput/)
565565

566+
</details>
567+
<details>
568+
<summary>
569+
StartDirectoryListing
570+
</summary>
571+
572+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/transfer/command/StartDirectoryListingCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-transfer/Interface/StartDirectoryListingCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-transfer/Interface/StartDirectoryListingCommandOutput/)
573+
566574
</details>
567575
<details>
568576
<summary>

clients/client-transfer/src/Transfer.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,11 @@ import {
206206
SendWorkflowStepStateCommandInput,
207207
SendWorkflowStepStateCommandOutput,
208208
} from "./commands/SendWorkflowStepStateCommand";
209+
import {
210+
StartDirectoryListingCommand,
211+
StartDirectoryListingCommandInput,
212+
StartDirectoryListingCommandOutput,
213+
} from "./commands/StartDirectoryListingCommand";
209214
import {
210215
StartFileTransferCommand,
211216
StartFileTransferCommandInput,
@@ -312,6 +317,7 @@ const commands = {
312317
ListUsersCommand,
313318
ListWorkflowsCommand,
314319
SendWorkflowStepStateCommand,
320+
StartDirectoryListingCommand,
315321
StartFileTransferCommand,
316322
StartServerCommand,
317323
StopServerCommand,
@@ -944,6 +950,23 @@ export interface Transfer {
944950
cb: (err: any, data?: SendWorkflowStepStateCommandOutput) => void
945951
): void;
946952

953+
/**
954+
* @see {@link StartDirectoryListingCommand}
955+
*/
956+
startDirectoryListing(
957+
args: StartDirectoryListingCommandInput,
958+
options?: __HttpHandlerOptions
959+
): Promise<StartDirectoryListingCommandOutput>;
960+
startDirectoryListing(
961+
args: StartDirectoryListingCommandInput,
962+
cb: (err: any, data?: StartDirectoryListingCommandOutput) => void
963+
): void;
964+
startDirectoryListing(
965+
args: StartDirectoryListingCommandInput,
966+
options: __HttpHandlerOptions,
967+
cb: (err: any, data?: StartDirectoryListingCommandOutput) => void
968+
): void;
969+
947970
/**
948971
* @see {@link StartFileTransferCommand}
949972
*/

clients/client-transfer/src/TransferClient.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ import {
112112
SendWorkflowStepStateCommandInput,
113113
SendWorkflowStepStateCommandOutput,
114114
} from "./commands/SendWorkflowStepStateCommand";
115+
import {
116+
StartDirectoryListingCommandInput,
117+
StartDirectoryListingCommandOutput,
118+
} from "./commands/StartDirectoryListingCommand";
115119
import { StartFileTransferCommandInput, StartFileTransferCommandOutput } from "./commands/StartFileTransferCommand";
116120
import { StartServerCommandInput, StartServerCommandOutput } from "./commands/StartServerCommand";
117121
import { StopServerCommandInput, StopServerCommandOutput } from "./commands/StopServerCommand";
@@ -189,6 +193,7 @@ export type ServiceInputTypes =
189193
| ListUsersCommandInput
190194
| ListWorkflowsCommandInput
191195
| SendWorkflowStepStateCommandInput
196+
| StartDirectoryListingCommandInput
192197
| StartFileTransferCommandInput
193198
| StartServerCommandInput
194199
| StopServerCommandInput
@@ -253,6 +258,7 @@ export type ServiceOutputTypes =
253258
| ListUsersCommandOutput
254259
| ListWorkflowsCommandOutput
255260
| SendWorkflowStepStateCommandOutput
261+
| StartDirectoryListingCommandOutput
256262
| StartFileTransferCommandOutput
257263
| StartServerCommandOutput
258264
| StopServerCommandOutput
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
// smithy-typescript generated code
2+
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
3+
import { getSerdePlugin } from "@smithy/middleware-serde";
4+
import { Command as $Command } from "@smithy/smithy-client";
5+
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
6+
7+
import { commonParams } from "../endpoint/EndpointParameters";
8+
import { StartDirectoryListingRequest, StartDirectoryListingResponse } from "../models/models_0";
9+
import { de_StartDirectoryListingCommand, se_StartDirectoryListingCommand } from "../protocols/Aws_json1_1";
10+
import { ServiceInputTypes, ServiceOutputTypes, TransferClientResolvedConfig } from "../TransferClient";
11+
12+
/**
13+
* @public
14+
*/
15+
export { __MetadataBearer, $Command };
16+
/**
17+
* @public
18+
*
19+
* The input for {@link StartDirectoryListingCommand}.
20+
*/
21+
export interface StartDirectoryListingCommandInput extends StartDirectoryListingRequest {}
22+
/**
23+
* @public
24+
*
25+
* The output of {@link StartDirectoryListingCommand}.
26+
*/
27+
export interface StartDirectoryListingCommandOutput extends StartDirectoryListingResponse, __MetadataBearer {}
28+
29+
/**
30+
* <p>Retrieves a list of the contents of a directory from a remote SFTP server. You specify the
31+
* connector ID, the output path, and the remote directory path. You can also specify the
32+
* optional <code>MaxItems</code> value to control the maximum number of items that are listed
33+
* from the remote directory. This API returns a list of all files and directories in the remote
34+
* directory (up to the maximum value), but does not return files or folders in sub-directories.
35+
* That is, it only returns a list of files and directories one-level deep.</p>
36+
* <p>After you receive the listing file, you can provide the files that you want to transfer to
37+
* the <code>RetrieveFilePaths</code> parameter of the <code>StartFileTransfer</code> API
38+
* call.</p>
39+
* <p>The naming convention for the output file is
40+
* <code>
41+
* <i>connector-ID</i>-<i>listing-ID</i>.json</code>. The
42+
* output file contains the following information:</p>
43+
* <ul>
44+
* <li>
45+
* <p>
46+
* <code>filePath</code>: the complete path of a remote file, relative to the directory
47+
* of the listing request for your SFTP connector on the remote server.</p>
48+
* </li>
49+
* <li>
50+
* <p>
51+
* <code>modifiedTimestamp</code>: the last time the file was modified, in UTC time
52+
* format. This field is optional. If the remote file attributes don't contain a timestamp,
53+
* it is omitted from the file listing.</p>
54+
* </li>
55+
* <li>
56+
* <p>
57+
* <code>size</code>: the size of the file, in bytes. This field is optional. If the
58+
* remote file attributes don't contain a file size, it is omitted from the file
59+
* listing.</p>
60+
* </li>
61+
* <li>
62+
* <p>
63+
* <code>path</code>: the complete path of a remote directory, relative to the directory
64+
* of the listing request for your SFTP connector on the remote server.</p>
65+
* </li>
66+
* <li>
67+
* <p>
68+
* <code>truncated</code>: a flag indicating whether the list output contains all of the
69+
* items contained in the remote directory or not. If your <code>Truncated</code> output
70+
* value is true, you can increase the value provided in the optional <code>max-items</code>
71+
* input attribute to be able to list more items (up to the maximum allowed list size of
72+
* 10,000 items).</p>
73+
* </li>
74+
* </ul>
75+
* @example
76+
* Use a bare-bones client and the command you need to make an API call.
77+
* ```javascript
78+
* import { TransferClient, StartDirectoryListingCommand } from "@aws-sdk/client-transfer"; // ES Modules import
79+
* // const { TransferClient, StartDirectoryListingCommand } = require("@aws-sdk/client-transfer"); // CommonJS import
80+
* const client = new TransferClient(config);
81+
* const input = { // StartDirectoryListingRequest
82+
* ConnectorId: "STRING_VALUE", // required
83+
* RemoteDirectoryPath: "STRING_VALUE", // required
84+
* MaxItems: Number("int"),
85+
* OutputDirectoryPath: "STRING_VALUE", // required
86+
* };
87+
* const command = new StartDirectoryListingCommand(input);
88+
* const response = await client.send(command);
89+
* // { // StartDirectoryListingResponse
90+
* // ListingId: "STRING_VALUE", // required
91+
* // OutputFileName: "STRING_VALUE", // required
92+
* // };
93+
*
94+
* ```
95+
*
96+
* @param StartDirectoryListingCommandInput - {@link StartDirectoryListingCommandInput}
97+
* @returns {@link StartDirectoryListingCommandOutput}
98+
* @see {@link StartDirectoryListingCommandInput} for command's `input` shape.
99+
* @see {@link StartDirectoryListingCommandOutput} for command's `response` shape.
100+
* @see {@link TransferClientResolvedConfig | config} for TransferClient's `config` shape.
101+
*
102+
* @throws {@link InternalServiceError} (server fault)
103+
* <p>This exception is thrown when an error occurs in the Transfer Family service.</p>
104+
*
105+
* @throws {@link InvalidRequestException} (client fault)
106+
* <p>This exception is thrown when the client submits a malformed request.</p>
107+
*
108+
* @throws {@link ResourceNotFoundException} (client fault)
109+
* <p>This exception is thrown when a resource is not found by the Amazon Web ServicesTransfer Family
110+
* service.</p>
111+
*
112+
* @throws {@link ServiceUnavailableException} (server fault)
113+
* <p>The request has failed because the Amazon Web ServicesTransfer Family service is not available.</p>
114+
*
115+
* @throws {@link ThrottlingException} (client fault)
116+
* <p>The request was denied due to request throttling.</p>
117+
*
118+
* @throws {@link TransferServiceException}
119+
* <p>Base exception class for all service exceptions from Transfer service.</p>
120+
*
121+
* @public
122+
*/
123+
export class StartDirectoryListingCommand extends $Command
124+
.classBuilder<
125+
StartDirectoryListingCommandInput,
126+
StartDirectoryListingCommandOutput,
127+
TransferClientResolvedConfig,
128+
ServiceInputTypes,
129+
ServiceOutputTypes
130+
>()
131+
.ep({
132+
...commonParams,
133+
})
134+
.m(function (this: any, Command: any, cs: any, config: TransferClientResolvedConfig, o: any) {
135+
return [
136+
getSerdePlugin(config, this.serialize, this.deserialize),
137+
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
138+
];
139+
})
140+
.s("TransferService", "StartDirectoryListing", {})
141+
.n("TransferClient", "StartDirectoryListingCommand")
142+
.f(void 0, void 0)
143+
.ser(se_StartDirectoryListingCommand)
144+
.de(de_StartDirectoryListingCommand)
145+
.build() {}

clients/client-transfer/src/commands/StartFileTransferCommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export interface StartFileTransferCommandOutput extends StartFileTransferRespons
4040
* <ul>
4141
* <li>
4242
* <p>If you are transferring file from a partner's SFTP server to Amazon Web Services
43-
* storage, you specify one or more <code>RetreiveFilePaths</code> to identify the files
43+
* storage, you specify one or more <code>RetrieveFilePaths</code> to identify the files
4444
* you want to transfer, and a <code>LocalDirectoryPath</code> to specify the destination
4545
* folder.</p>
4646
* </li>

clients/client-transfer/src/commands/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export * from "./ListTagsForResourceCommand";
4343
export * from "./ListUsersCommand";
4444
export * from "./ListWorkflowsCommand";
4545
export * from "./SendWorkflowStepStateCommand";
46+
export * from "./StartDirectoryListingCommand";
4647
export * from "./StartFileTransferCommand";
4748
export * from "./StartServerCommand";
4849
export * from "./StopServerCommand";

clients/client-transfer/src/models/models_0.ts

Lines changed: 50 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2939,21 +2939,7 @@ export interface DescribedCertificate {
29392939
CertificateId?: string;
29402940

29412941
/**
2942-
* <p>Specifies how this certificate is used. It can be used in the following ways:</p>
2943-
* <ul>
2944-
* <li>
2945-
* <p>
2946-
* <code>SIGNING</code>: For signing AS2 messages</p>
2947-
* </li>
2948-
* <li>
2949-
* <p>
2950-
* <code>ENCRYPTION</code>: For encrypting AS2 messages</p>
2951-
* </li>
2952-
* <li>
2953-
* <p>
2954-
* <code>TLS</code>: For securing AS2 communications sent over HTTPS</p>
2955-
* </li>
2956-
* </ul>
2942+
* <p>Specifies whether this certificate is used for signing or encryption.</p>
29572943
* @public
29582944
*/
29592945
Usage?: CertificateUsageType;
@@ -4383,21 +4369,7 @@ export interface DescribeWorkflowResponse {
43834369
*/
43844370
export interface ImportCertificateRequest {
43854371
/**
4386-
* <p>Specifies how this certificate is used. It can be used in the following ways:</p>
4387-
* <ul>
4388-
* <li>
4389-
* <p>
4390-
* <code>SIGNING</code>: For signing AS2 messages</p>
4391-
* </li>
4392-
* <li>
4393-
* <p>
4394-
* <code>ENCRYPTION</code>: For encrypting AS2 messages</p>
4395-
* </li>
4396-
* <li>
4397-
* <p>
4398-
* <code>TLS</code>: For securing AS2 communications sent over HTTPS</p>
4399-
* </li>
4400-
* </ul>
4372+
* <p>Specifies whether this certificate is used for signing or encryption.</p>
44014373
* @public
44024374
*/
44034375
Usage: CertificateUsageType | undefined;
@@ -4834,21 +4806,7 @@ export interface ListedCertificate {
48344806
CertificateId?: string;
48354807

48364808
/**
4837-
* <p>Specifies how this certificate is used. It can be used in the following ways:</p>
4838-
* <ul>
4839-
* <li>
4840-
* <p>
4841-
* <code>SIGNING</code>: For signing AS2 messages</p>
4842-
* </li>
4843-
* <li>
4844-
* <p>
4845-
* <code>ENCRYPTION</code>: For encrypting AS2 messages</p>
4846-
* </li>
4847-
* <li>
4848-
* <p>
4849-
* <code>TLS</code>: For securing AS2 communications sent over HTTPS</p>
4850-
* </li>
4851-
* </ul>
4809+
* <p>Specifies whether this certificate is used for signing or encryption.</p>
48524810
* @public
48534811
*/
48544812
Usage?: CertificateUsageType;
@@ -5699,6 +5657,53 @@ export interface SendWorkflowStepStateRequest {
56995657
*/
57005658
export interface SendWorkflowStepStateResponse {}
57015659

5660+
/**
5661+
* @public
5662+
*/
5663+
export interface StartDirectoryListingRequest {
5664+
/**
5665+
* <p>The unique identifier for the connector.</p>
5666+
* @public
5667+
*/
5668+
ConnectorId: string | undefined;
5669+
5670+
/**
5671+
* <p>Specifies the directory on the remote SFTP server for which you want to list its contents.</p>
5672+
* @public
5673+
*/
5674+
RemoteDirectoryPath: string | undefined;
5675+
5676+
/**
5677+
* <p>An optional parameter where you can specify the maximum number of file/directory names to
5678+
* retrieve. The default value is 1,000.</p>
5679+
* @public
5680+
*/
5681+
MaxItems?: number;
5682+
5683+
/**
5684+
* <p>Specifies the path (bucket and prefix) in Amazon S3 storage to store the results of the directory listing.</p>
5685+
* @public
5686+
*/
5687+
OutputDirectoryPath: string | undefined;
5688+
}
5689+
5690+
/**
5691+
* @public
5692+
*/
5693+
export interface StartDirectoryListingResponse {
5694+
/**
5695+
* <p>Returns a unique identifier for the directory listing call.</p>
5696+
* @public
5697+
*/
5698+
ListingId: string | undefined;
5699+
5700+
/**
5701+
* <p>Returns the file name where the results are stored. This is a combination of the connector ID and the listing ID: <code>&lt;connector-id&gt;-&lt;listing-id&gt;.json</code>.</p>
5702+
* @public
5703+
*/
5704+
OutputFileName: string | undefined;
5705+
}
5706+
57025707
/**
57035708
* @public
57045709
*/

0 commit comments

Comments
 (0)