Skip to content

Commit

Permalink
feat: add client-kinesis-video-signaling
Browse files Browse the repository at this point in the history
  • Loading branch information
trivikr committed Jan 24, 2020
1 parent 8baa8a7 commit 4bf0168
Show file tree
Hide file tree
Showing 18 changed files with 1,695 additions and 0 deletions.
14 changes: 14 additions & 0 deletions clients/client-kinesis-video-signaling/.gitignore
Original file line number Diff line number Diff line change
@@ -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-kinesis-video-signaling/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/coverage/
/docs/
tsconfig.test.json
*.tsbuildinfo
107 changes: 107 additions & 0 deletions clients/client-kinesis-video-signaling/KinesisVideoSignaling.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import { KinesisVideoSignalingClient } from "./KinesisVideoSignalingClient";
import {
GetIceServerConfigCommand,
GetIceServerConfigCommandInput,
GetIceServerConfigCommandOutput
} from "./commands/GetIceServerConfigCommand";
import {
SendAlexaOfferToMasterCommand,
SendAlexaOfferToMasterCommandInput,
SendAlexaOfferToMasterCommandOutput
} from "./commands/SendAlexaOfferToMasterCommand";
import { HttpHandlerOptions as __HttpHandlerOptions } from "@aws-sdk/types";

/**
* <p>Kinesis Video Streams Signaling Service is a intermediate service that establishes a
* communication channel for discovering peers, transmitting offers and answers in order to
* establish peer-to-peer connection in webRTC technology.</p>
*/
export class KinesisVideoSignaling extends KinesisVideoSignalingClient {
/**
* <p>Gets the Interactive Connectivity Establishment (ICE) server configuration
* information, including URIs, username, and password which can be used to configure the
* WebRTC connection. The ICE component uses this configuration information to setup the
* WebRTC connection, including authenticating with the Traversal Using Relays around NAT
* (TURN) relay server. </p>
* <p>TURN is a protocol that is used to improve the connectivity of peer-to-peer
* applications. By providing a cloud-based relay service, TURN ensures that a connection
* can be established even when one or more peers are incapable of a direct peer-to-peer
* connection. For more information, see <a href="https://tools.ietf.org/html/draft-uberti-rtcweb-turn-rest-00">A REST API For
* Access To TURN Services</a>.</p>
* <p> You can invoke this API to establish a fallback mechanism in case either of the peers
* is unable to establish a direct peer-to-peer connection over a signaling channel. You
* must specify either a signaling channel ARN or the client ID in order to invoke this
* API.</p>
*/
public getIceServerConfig(
args: GetIceServerConfigCommandInput,
options?: __HttpHandlerOptions
): Promise<GetIceServerConfigCommandOutput>;
public getIceServerConfig(
args: GetIceServerConfigCommandInput,
cb: (err: any, data?: GetIceServerConfigCommandOutput) => void
): void;
public getIceServerConfig(
args: GetIceServerConfigCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: GetIceServerConfigCommandOutput) => void
): void;
public getIceServerConfig(
args: GetIceServerConfigCommandInput,
optionsOrCb?:
| __HttpHandlerOptions
| ((err: any, data?: GetIceServerConfigCommandOutput) => void),
cb?: (err: any, data?: GetIceServerConfigCommandOutput) => void
): Promise<GetIceServerConfigCommandOutput> | void {
const command = new GetIceServerConfigCommand(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);
}
}

/**
* <p>This API allows you to connect WebRTC-enabled devices with Alexa display devices. When
* invoked, it sends the Alexa Session Description Protocol (SDP) offer to the master peer.
* The offer is delivered as soon as the master is connected to the specified signaling
* channel. This API returns the SDP answer from the connected master. If the master is not
* connected to the signaling channel, redelivery requests are made until the message
* expires.</p>
*/
public sendAlexaOfferToMaster(
args: SendAlexaOfferToMasterCommandInput,
options?: __HttpHandlerOptions
): Promise<SendAlexaOfferToMasterCommandOutput>;
public sendAlexaOfferToMaster(
args: SendAlexaOfferToMasterCommandInput,
cb: (err: any, data?: SendAlexaOfferToMasterCommandOutput) => void
): void;
public sendAlexaOfferToMaster(
args: SendAlexaOfferToMasterCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: SendAlexaOfferToMasterCommandOutput) => void
): void;
public sendAlexaOfferToMaster(
args: SendAlexaOfferToMasterCommandInput,
optionsOrCb?:
| __HttpHandlerOptions
| ((err: any, data?: SendAlexaOfferToMasterCommandOutput) => void),
cb?: (err: any, data?: SendAlexaOfferToMasterCommandOutput) => void
): Promise<SendAlexaOfferToMasterCommandOutput> | void {
const command = new SendAlexaOfferToMasterCommand(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);
}
}
}
208 changes: 208 additions & 0 deletions clients/client-kinesis-video-signaling/KinesisVideoSignalingClient.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
import {
GetIceServerConfigRequest,
GetIceServerConfigResponse,
SendAlexaOfferToMasterRequest,
SendAlexaOfferToMasterResponse
} 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 =
| GetIceServerConfigRequest
| SendAlexaOfferToMasterRequest;

export type ServiceOutputTypes =
| GetIceServerConfigResponse
| SendAlexaOfferToMasterResponse;

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;

/**
* Disable dyanamically changing the endpoint of the client based on the hostPrefix
* trait of an operation.
*/
disableHostPrefix?: boolean;

/**
* 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 KinesisVideoSignalingClientConfig = Partial<
__SmithyConfiguration<__HttpHandlerOptions>
> &
ClientDefaults &
RegionInputConfig &
EndpointsInputConfig &
AwsAuthInputConfig &
RetryInputConfig &
UserAgentInputConfig &
HostHeaderInputConfig;

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

/**
* <p>Kinesis Video Streams Signaling Service is a intermediate service that establishes a
* communication channel for discovering peers, transmitting offers and answers in order to
* establish peer-to-peer connection in webRTC technology.</p>
*/
export class KinesisVideoSignalingClient extends __Client<
__HttpHandlerOptions,
ServiceInputTypes,
ServiceOutputTypes,
KinesisVideoSignalingClientResolvedConfig
> {
readonly config: KinesisVideoSignalingClientResolvedConfig;

constructor(configuration: KinesisVideoSignalingClientConfig) {
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 4bf0168

Please sign in to comment.