Skip to content

Commit

Permalink
feat(client-transfer): This release adds support for SFTP Connectors.
Browse files Browse the repository at this point in the history
  • Loading branch information
awstools committed Jul 25, 2023
1 parent 0d803e7 commit e28d57d
Show file tree
Hide file tree
Showing 13 changed files with 641 additions and 42 deletions.
8 changes: 8 additions & 0 deletions clients/client-transfer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,14 @@ TagResource

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-transfer/classes/tagresourcecommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-transfer/interfaces/tagresourcecommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-transfer/interfaces/tagresourcecommandoutput.html)

</details>
<details>
<summary>
TestConnection
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-transfer/classes/testconnectioncommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-transfer/interfaces/testconnectioncommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-transfer/interfaces/testconnectioncommandoutput.html)

</details>
<details>
<summary>
Expand Down
20 changes: 20 additions & 0 deletions clients/client-transfer/src/Transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,11 @@ import {
import { StartServerCommand, StartServerCommandInput, StartServerCommandOutput } from "./commands/StartServerCommand";
import { StopServerCommand, StopServerCommandInput, StopServerCommandOutput } from "./commands/StopServerCommand";
import { TagResourceCommand, TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand";
import {
TestConnectionCommand,
TestConnectionCommandInput,
TestConnectionCommandOutput,
} from "./commands/TestConnectionCommand";
import {
TestIdentityProviderCommand,
TestIdentityProviderCommandInput,
Expand Down Expand Up @@ -311,6 +316,7 @@ const commands = {
StartServerCommand,
StopServerCommand,
TagResourceCommand,
TestConnectionCommand,
TestIdentityProviderCommand,
UntagResourceCommand,
UpdateAccessCommand,
Expand Down Expand Up @@ -981,6 +987,20 @@ export interface Transfer {
cb: (err: any, data?: TagResourceCommandOutput) => void
): void;

/**
* @see {@link TestConnectionCommand}
*/
testConnection(
args: TestConnectionCommandInput,
options?: __HttpHandlerOptions
): Promise<TestConnectionCommandOutput>;
testConnection(args: TestConnectionCommandInput, cb: (err: any, data?: TestConnectionCommandOutput) => void): void;
testConnection(
args: TestConnectionCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: TestConnectionCommandOutput) => void
): void;

/**
* @see {@link TestIdentityProviderCommand}
*/
Expand Down
3 changes: 3 additions & 0 deletions clients/client-transfer/src/TransferClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ import { StartFileTransferCommandInput, StartFileTransferCommandOutput } from ".
import { StartServerCommandInput, StartServerCommandOutput } from "./commands/StartServerCommand";
import { StopServerCommandInput, StopServerCommandOutput } from "./commands/StopServerCommand";
import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand";
import { TestConnectionCommandInput, TestConnectionCommandOutput } from "./commands/TestConnectionCommand";
import {
TestIdentityProviderCommandInput,
TestIdentityProviderCommandOutput,
Expand Down Expand Up @@ -187,6 +188,7 @@ export type ServiceInputTypes =
| StartServerCommandInput
| StopServerCommandInput
| TagResourceCommandInput
| TestConnectionCommandInput
| TestIdentityProviderCommandInput
| UntagResourceCommandInput
| UpdateAccessCommandInput
Expand Down Expand Up @@ -250,6 +252,7 @@ export type ServiceOutputTypes =
| StartServerCommandOutput
| StopServerCommandOutput
| TagResourceCommandOutput
| TestConnectionCommandOutput
| TestIdentityProviderCommandOutput
| UntagResourceCommandOutput
| UpdateAccessCommandOutput
Expand Down
13 changes: 11 additions & 2 deletions clients/client-transfer/src/commands/CreateConnectorCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ export interface CreateConnectorCommandOutput extends CreateConnectorResponse, _
/**
* @public
* <p>Creates the connector, which captures the parameters for an outbound connection for the
* AS2 protocol. The connector is required for sending files to an externally hosted AS2 server.
* For more details about connectors, see <a href="https://docs.aws.amazon.com/transfer/latest/userguide/create-b2b-server.html#configure-as2-connector">Create AS2 connectors</a>.</p>
* AS2 or SFTP protocol. The connector is required for sending files to an externally hosted AS2 or SFTP server.
* For more details about AS2 connectors, see <a href="https://docs.aws.amazon.com/transfer/latest/userguide/create-b2b-server.html#configure-as2-connector">Create AS2 connectors</a>.</p>
* <note>
* <p>You must specify exactly one configuration object: either for AS2 (<code>As2Config</code>) or SFTP (<code>SftpConfig</code>).</p>
* </note>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
Expand Down Expand Up @@ -66,6 +69,12 @@ export interface CreateConnectorCommandOutput extends CreateConnectorResponse, _
* Value: "STRING_VALUE", // required
* },
* ],
* SftpConfig: { // SftpConnectorConfig
* UserSecretId: "STRING_VALUE",
* TrustedHostKeys: [ // SftpConnectorTrustedHostKeyList
* "STRING_VALUE",
* ],
* },
* };
* const command = new CreateConnectorCommand(input);
* const response = await client.send(command);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export interface DeleteConnectorCommandOutput extends __MetadataBearer {}

/**
* @public
* <p>Deletes the agreement that's specified in the provided <code>ConnectorId</code>.</p>
* <p>Deletes the connector that's specified in the provided <code>ConnectorId</code>.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ export interface DescribeConnectorCommandOutput extends DescribeConnectorRespons
* // Value: "STRING_VALUE", // required
* // },
* // ],
* // SftpConfig: { // SftpConnectorConfig
* // UserSecretId: "STRING_VALUE",
* // TrustedHostKeys: [ // SftpConnectorTrustedHostKeyList
* // "STRING_VALUE",
* // ],
* // },
* // },
* // };
*
Expand Down
35 changes: 32 additions & 3 deletions clients/client-transfer/src/commands/StartFileTransferCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,32 @@ export interface StartFileTransferCommandOutput extends StartFileTransferRespons

/**
* @public
* <p>Begins an outbound file transfer to a remote AS2 server. You specify the <code>ConnectorId</code> and the file
* paths for where to send the files. </p>
* <p>Begins a file transfer between local Amazon Web Services storage and a remote AS2 or SFTP server.</p>
* <ul>
* <li>
* <p>For an AS2 connector, you specify the <code>ConnectorId</code> and one or more <code>SendFilePaths</code> to identify the files
* you want to transfer.</p>
* </li>
* <li>
* <p>For an SFTP connector, the file transfer can be either outbound or inbound. In both
* cases, you specify the <code>ConnectorId</code>. Depending on the direction of the transfer,
* you also specify the following items:</p>
* <ul>
* <li>
* <p>If you are transferring file from a partner's SFTP server to a Transfer Family
* server, you specify one or more <code>RetreiveFilePaths</code> to identify the files
* you want to transfer, and a <code>LocalDirectoryPath</code> to specify the destination
* folder.</p>
* </li>
* <li>
* <p>If you are transferring file to a partner's SFTP server from Amazon Web Services
* storage, you specify one or more <code>SendFilePaths</code> to identify the files you
* want to transfer, and a <code>RemoteDirectoryPath</code> to specify the destination
* folder.</p>
* </li>
* </ul>
* </li>
* </ul>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
Expand All @@ -46,9 +70,14 @@ export interface StartFileTransferCommandOutput extends StartFileTransferRespons
* const client = new TransferClient(config);
* const input = { // StartFileTransferRequest
* ConnectorId: "STRING_VALUE", // required
* SendFilePaths: [ // FilePaths // required
* SendFilePaths: [ // FilePaths
* "STRING_VALUE",
* ],
* RetrieveFilePaths: [
* "STRING_VALUE",
* ],
* LocalDirectoryPath: "STRING_VALUE",
* RemoteDirectoryPath: "STRING_VALUE",
* };
* const command = new StartFileTransferCommand(input);
* const response = await client.send(command);
Expand Down
159 changes: 159 additions & 0 deletions clients/client-transfer/src/commands/TestConnectionCommand.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
// smithy-typescript generated code
import { EndpointParameterInstructions, getEndpointPlugin } from "@smithy/middleware-endpoint";
import { getSerdePlugin } from "@smithy/middleware-serde";
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@smithy/protocol-http";
import { Command as $Command } from "@smithy/smithy-client";
import {
FinalizeHandlerArguments,
Handler,
HandlerExecutionContext,
HttpHandlerOptions as __HttpHandlerOptions,
MetadataBearer as __MetadataBearer,
MiddlewareStack,
SerdeContext as __SerdeContext,
} from "@smithy/types";

import { TestConnectionRequest, TestConnectionResponse } from "../models/models_0";
import { de_TestConnectionCommand, se_TestConnectionCommand } from "../protocols/Aws_json1_1";
import { ServiceInputTypes, ServiceOutputTypes, TransferClientResolvedConfig } from "../TransferClient";

/**
* @public
*/
export { __MetadataBearer, $Command };
/**
* @public
*
* The input for {@link TestConnectionCommand}.
*/
export interface TestConnectionCommandInput extends TestConnectionRequest {}
/**
* @public
*
* The output of {@link TestConnectionCommand}.
*/
export interface TestConnectionCommandOutput extends TestConnectionResponse, __MetadataBearer {}

/**
* @public
* <p>Tests whether your SFTP connector is set up successfully. We highly recommend that you call this
* operation to test your ability to transfer files between a Transfer Family server and a trading partner's
* SFTP server.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { TransferClient, TestConnectionCommand } from "@aws-sdk/client-transfer"; // ES Modules import
* // const { TransferClient, TestConnectionCommand } = require("@aws-sdk/client-transfer"); // CommonJS import
* const client = new TransferClient(config);
* const input = { // TestConnectionRequest
* ConnectorId: "STRING_VALUE", // required
* };
* const command = new TestConnectionCommand(input);
* const response = await client.send(command);
* // { // TestConnectionResponse
* // ConnectorId: "STRING_VALUE",
* // Status: "STRING_VALUE",
* // StatusMessage: "STRING_VALUE",
* // };
*
* ```
*
* @param TestConnectionCommandInput - {@link TestConnectionCommandInput}
* @returns {@link TestConnectionCommandOutput}
* @see {@link TestConnectionCommandInput} for command's `input` shape.
* @see {@link TestConnectionCommandOutput} for command's `response` shape.
* @see {@link TransferClientResolvedConfig | config} for TransferClient's `config` shape.
*
* @throws {@link InternalServiceError} (server fault)
* <p>This exception is thrown when an error occurs in the Amazon Web ServicesTransfer Family service.</p>
*
* @throws {@link InvalidRequestException} (client fault)
* <p>This exception is thrown when the client submits a malformed request.</p>
*
* @throws {@link ResourceNotFoundException} (client fault)
* <p>This exception is thrown when a resource is not found by the Amazon Web ServicesTransfer Family
* service.</p>
*
* @throws {@link ServiceUnavailableException} (server fault)
* <p>The request has failed because the Amazon Web ServicesTransfer Family service is not available.</p>
*
* @throws {@link TransferServiceException}
* <p>Base exception class for all service exceptions from Transfer service.</p>
*
*/
export class TestConnectionCommand extends $Command<
TestConnectionCommandInput,
TestConnectionCommandOutput,
TransferClientResolvedConfig
> {
// Start section: command_properties
// End section: command_properties

public static getEndpointParameterInstructions(): EndpointParameterInstructions {
return {
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
Endpoint: { type: "builtInParams", name: "endpoint" },
Region: { type: "builtInParams", name: "region" },
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
};
}

/**
* @public
*/
constructor(readonly input: TestConnectionCommandInput) {
// Start section: command_constructor
super();
// End section: command_constructor
}

/**
* @internal
*/
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: TransferClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<TestConnectionCommandInput, TestConnectionCommandOutput> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
this.middlewareStack.use(
getEndpointPlugin(configuration, TestConnectionCommand.getEndpointParameterInstructions())
);

const stack = clientStack.concat(this.middlewareStack);

const { logger } = configuration;
const clientName = "TransferClient";
const commandName = "TestConnectionCommand";
const handlerExecutionContext: HandlerExecutionContext = {
logger,
clientName,
commandName,
inputFilterSensitiveLog: (_: any) => _,
outputFilterSensitiveLog: (_: any) => _,
};
const { requestHandler } = configuration;
return stack.resolve(
(request: FinalizeHandlerArguments<any>) =>
requestHandler.handle(request.request as __HttpRequest, options || {}),
handlerExecutionContext
);
}

/**
* @internal
*/
private serialize(input: TestConnectionCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
return se_TestConnectionCommand(input, context);
}

/**
* @internal
*/
private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<TestConnectionCommandOutput> {
return de_TestConnectionCommand(output, context);
}

// Start section: command_body_extra
// End section: command_body_extra
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ export interface UpdateConnectorCommandOutput extends UpdateConnectorResponse, _
* },
* AccessRole: "STRING_VALUE",
* LoggingRole: "STRING_VALUE",
* SftpConfig: { // SftpConnectorConfig
* UserSecretId: "STRING_VALUE",
* TrustedHostKeys: [ // SftpConnectorTrustedHostKeyList
* "STRING_VALUE",
* ],
* },
* };
* const command = new UpdateConnectorCommand(input);
* const response = await client.send(command);
Expand Down
1 change: 1 addition & 0 deletions clients/client-transfer/src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export * from "./StartFileTransferCommand";
export * from "./StartServerCommand";
export * from "./StopServerCommand";
export * from "./TagResourceCommand";
export * from "./TestConnectionCommand";
export * from "./TestIdentityProviderCommand";
export * from "./UntagResourceCommand";
export * from "./UpdateAccessCommand";
Expand Down
Loading

0 comments on commit e28d57d

Please sign in to comment.