Skip to content

Commit

Permalink
feat: add client-ec2-instance-connect (#656)
Browse files Browse the repository at this point in the history
  • Loading branch information
trivikr committed Jan 7, 2020
1 parent ea452ed commit 77a19fc
Show file tree
Hide file tree
Showing 17 changed files with 1,327 additions and 0 deletions.
14 changes: 14 additions & 0 deletions clients/client-ec2-instance-connect/.gitignore
@@ -0,0 +1,14 @@
/node_modules/
/build/
/coverage/
/docs/
/types/
/dist/
*.tsbuildinfo
*.tgz
*.log
package-lock.json

*.d.ts
*.js
*.js.map
4 changes: 4 additions & 0 deletions clients/client-ec2-instance-connect/.npmignore
@@ -0,0 +1,4 @@
/coverage/
/docs/
tsconfig.test.json
*.tsbuildinfo
53 changes: 53 additions & 0 deletions clients/client-ec2-instance-connect/EC2InstanceConnect.ts
@@ -0,0 +1,53 @@
import { EC2InstanceConnectClient } from "./EC2InstanceConnectClient";
import {
SendSSHPublicKeyCommand,
SendSSHPublicKeyCommandInput,
SendSSHPublicKeyCommandOutput
} from "./commands/SendSSHPublicKeyCommand";
import { HttpHandlerOptions as __HttpHandlerOptions } from "@aws-sdk/types";

/**
*
* <p>AWS EC2 Connect Service is a service that enables system administrators to publish
* temporary SSH keys to their EC2 instances in order to establish connections to their
* instances without leaving a permanent authentication option.</p>
*
*/
export class EC2InstanceConnect extends EC2InstanceConnectClient {
/**
*
* <p>Pushes an SSH public key to a particular OS user on a given EC2 instance for 60 seconds.</p>
*
*/
public sendSSHPublicKey(
args: SendSSHPublicKeyCommandInput,
options?: __HttpHandlerOptions
): Promise<SendSSHPublicKeyCommandOutput>;
public sendSSHPublicKey(
args: SendSSHPublicKeyCommandInput,
cb: (err: any, data?: SendSSHPublicKeyCommandOutput) => void
): void;
public sendSSHPublicKey(
args: SendSSHPublicKeyCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: SendSSHPublicKeyCommandOutput) => void
): void;
public sendSSHPublicKey(
args: SendSSHPublicKeyCommandInput,
optionsOrCb?:
| __HttpHandlerOptions
| ((err: any, data?: SendSSHPublicKeyCommandOutput) => void),
cb?: (err: any, data?: SendSSHPublicKeyCommandOutput) => void
): Promise<SendSSHPublicKeyCommandOutput> | void {
const command = new SendSSHPublicKeyCommand(args);
if (typeof optionsOrCb === "function") {
this.send(command, optionsOrCb);
} else if (typeof cb === "function") {
if (typeof optionsOrCb !== "object")
throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
this.send(command, optionsOrCb || {}, cb);
} else {
return this.send(command, optionsOrCb);
}
}
}
198 changes: 198 additions & 0 deletions clients/client-ec2-instance-connect/EC2InstanceConnectClient.ts
@@ -0,0 +1,198 @@
import {
SendSSHPublicKeyRequest,
SendSSHPublicKeyResponse
} from "./models/index";
import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig";
import {
EndpointsInputConfig,
EndpointsResolvedConfig,
RegionInputConfig,
RegionResolvedConfig,
resolveEndpointsConfig,
resolveRegionConfig
} from "@aws-sdk/config-resolver";
import { getContentLengthPlugin } from "@aws-sdk/middleware-content-length";
import {
HostHeaderInputConfig,
HostHeaderResolvedConfig,
getHostHeaderPlugin,
resolveHostHeaderConfig
} from "@aws-sdk/middleware-host-header";
import {
RetryInputConfig,
RetryResolvedConfig,
getRetryPlugin,
resolveRetryConfig
} from "@aws-sdk/middleware-retry";
import {
AwsAuthInputConfig,
AwsAuthResolvedConfig,
getAwsAuthPlugin,
resolveAwsAuthConfig
} from "@aws-sdk/middleware-signing";
import {
UserAgentInputConfig,
UserAgentResolvedConfig,
getUserAgentPlugin,
resolveUserAgentConfig
} from "@aws-sdk/middleware-user-agent";
import { HttpHandler as __HttpHandler } from "@aws-sdk/protocol-http";
import {
Client as __Client,
SmithyConfiguration as __SmithyConfiguration,
SmithyResolvedConfiguration as __SmithyResolvedConfiguration
} from "@aws-sdk/smithy-client";
import {
RegionInfoProvider,
Credentials as __Credentials,
Decoder as __Decoder,
Encoder as __Encoder,
HashConstructor as __HashConstructor,
HttpHandlerOptions as __HttpHandlerOptions,
Provider as __Provider,
StreamCollector as __StreamCollector,
UrlParser as __UrlParser
} from "@aws-sdk/types";

export type ServiceInputTypes = SendSSHPublicKeyRequest;

export type ServiceOutputTypes = SendSSHPublicKeyResponse;

export interface ClientDefaults
extends Partial<__SmithyResolvedConfiguration<__HttpHandlerOptions>> {
/**
* The HTTP handler to use. Fetch in browser and Https in Nodejs.
*/
requestHandler?: __HttpHandler;

/**
* A constructor for a class implementing the @aws-sdk/types.Hash interface
* that computes the SHA-256 HMAC or checksum of a string or binary buffer.
*/
sha256?: __HashConstructor;

/**
* The function that will be used to convert strings into HTTP endpoints.
*/
urlParser?: __UrlParser;

/**
* A function that can calculate the length of a request body.
*/
bodyLengthChecker?: (body: any) => number | undefined;

/**
* A function that converts a stream into an array of bytes.
*/
streamCollector?: __StreamCollector;

/**
* The function that will be used to convert a base64-encoded string to a byte array
*/
base64Decoder?: __Decoder;

/**
* The function that will be used to convert binary data to a base64-encoded string
*/
base64Encoder?: __Encoder;

/**
* The function that will be used to convert a UTF8-encoded string to a byte array
*/
utf8Decoder?: __Decoder;

/**
* The function that will be used to convert binary data to a UTF-8 encoded string
*/
utf8Encoder?: __Encoder;

/**
* The string that will be used to populate default value in 'User-Agent' header
*/
defaultUserAgent?: string;

/**
* The runtime environment
*/
runtime?: string;

/**
* The service name with which to sign requests.
*/
signingName?: string;

/**
* Default credentials provider; Not available in browser runtime
*/
credentialDefaultProvider?: (input: any) => __Provider<__Credentials>;

/**
* Provider function that return promise of a region string
*/
regionDefaultProvider?: (input: any) => __Provider<string>;

/**
* Fetch related hostname, signing name or signing region with given region.
*/
regionInfoProvider?: RegionInfoProvider;
}

export type EC2InstanceConnectClientConfig = Partial<
__SmithyConfiguration<__HttpHandlerOptions>
> &
ClientDefaults &
RegionInputConfig &
EndpointsInputConfig &
AwsAuthInputConfig &
RetryInputConfig &
UserAgentInputConfig &
HostHeaderInputConfig;

export type EC2InstanceConnectClientResolvedConfig = __SmithyResolvedConfiguration<
__HttpHandlerOptions
> &
Required<ClientDefaults> &
RegionResolvedConfig &
EndpointsResolvedConfig &
AwsAuthResolvedConfig &
RetryResolvedConfig &
UserAgentResolvedConfig &
HostHeaderResolvedConfig;

/**
*
* <p>AWS EC2 Connect Service is a service that enables system administrators to publish
* temporary SSH keys to their EC2 instances in order to establish connections to their
* instances without leaving a permanent authentication option.</p>
*
*/
export class EC2InstanceConnectClient extends __Client<
__HttpHandlerOptions,
ServiceInputTypes,
ServiceOutputTypes,
EC2InstanceConnectClientResolvedConfig
> {
readonly config: EC2InstanceConnectClientResolvedConfig;

constructor(configuration: EC2InstanceConnectClientConfig) {
let _config_0 = {
...__ClientDefaultValues,
...configuration
};
let _config_1 = resolveRegionConfig(_config_0);
let _config_2 = resolveEndpointsConfig(_config_1);
let _config_3 = resolveAwsAuthConfig(_config_2);
let _config_4 = resolveRetryConfig(_config_3);
let _config_5 = resolveUserAgentConfig(_config_4);
let _config_6 = resolveHostHeaderConfig(_config_5);
super(_config_6);
this.config = _config_6;
this.middlewareStack.use(getAwsAuthPlugin(this.config));
this.middlewareStack.use(getRetryPlugin(this.config));
this.middlewareStack.use(getUserAgentPlugin(this.config));
this.middlewareStack.use(getContentLengthPlugin(this.config));
this.middlewareStack.use(getHostHeaderPlugin(this.config));
}

destroy(): void {}
}

0 comments on commit 77a19fc

Please sign in to comment.