-
Notifications
You must be signed in to change notification settings - Fork 573
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add client-kinesis-video-media (#643)
- Loading branch information
Showing
17 changed files
with
1,529 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/coverage/ | ||
/docs/ | ||
tsconfig.test.json | ||
*.tsbuildinfo |
100 changes: 100 additions & 0 deletions
100
clients/client-kinesis-video-media/KinesisVideoMedia.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
import { KinesisVideoMediaClient } from "./KinesisVideoMediaClient"; | ||
import { | ||
GetMediaCommand, | ||
GetMediaCommandInput, | ||
GetMediaCommandOutput | ||
} from "./commands/GetMediaCommand"; | ||
import { HttpHandlerOptions as __HttpHandlerOptions } from "@aws-sdk/types"; | ||
|
||
/** | ||
* | ||
* <p></p> | ||
* | ||
*/ | ||
export class KinesisVideoMedia extends KinesisVideoMediaClient { | ||
/** | ||
* | ||
* <p> Use this API to retrieve media content from a Kinesis video stream. In the request, | ||
* you identify the stream name or stream Amazon Resource Name (ARN), and the starting chunk. | ||
* Kinesis Video Streams then returns a stream of chunks in order by fragment number.</p> | ||
* <note> | ||
* <p>You must first call the <code>GetDataEndpoint</code> API to get an endpoint. Then | ||
* send the <code>GetMedia</code> requests to this endpoint using the <a href="https://docs.aws.amazon.com/cli/latest/reference/">--endpoint-url parameter</a>. | ||
* </p> | ||
* </note> | ||
* <p>When you put media data (fragments) on a stream, Kinesis Video Streams stores each | ||
* incoming fragment and related metadata in what is called a "chunk." For more information, see | ||
* <a href="https://docs.aws.amazon.com/kinesisvideostreams/latest/dg/API_dataplane_PutMedia.html">PutMedia</a>. The <code>GetMedia</code> API returns a stream of these chunks starting | ||
* from the chunk that you specify in the request. </p> | ||
* <p>The following limits apply when using the <code>GetMedia</code> API:</p> | ||
* <ul> | ||
* <li> | ||
* <p>A client can call <code>GetMedia</code> up to five times per second per stream. | ||
* </p> | ||
* </li> | ||
* <li> | ||
* <p>Kinesis Video Streams sends media data at a rate of up to 25 megabytes per second | ||
* (or 200 megabits per second) during a <code>GetMedia</code> session. </p> | ||
* </li> | ||
* </ul> | ||
* | ||
* <note> | ||
* <p>If an error is thrown after invoking a Kinesis Video Streams media API, in addition to | ||
* the HTTP status code and the response body, it includes the following pieces of information: </p> | ||
* <ul> | ||
* <li> | ||
* <p> | ||
* <code>x-amz-ErrorType</code> HTTP header – contains a more specific error type in | ||
* addition to what the HTTP status code provides. </p> | ||
* </li> | ||
* <li> | ||
* <p> | ||
* <code>x-amz-RequestId</code> HTTP header – if you want to report an issue to AWS, | ||
* the support team can better diagnose the problem if given the Request Id.</p> | ||
* </li> | ||
* </ul> | ||
* <p>Both the HTTP status code and the ErrorType header can be utilized to make programmatic | ||
* decisions about whether errors are retry-able and under what conditions, as well as provide | ||
* information on what actions the client programmer might need to take in order to | ||
* successfully try again.</p> | ||
* <p>For more information, see the <b>Errors</b> section at the | ||
* bottom of this topic, as well as <a href="https://docs.aws.amazon.com/kinesisvideostreams/latest/dg/CommonErrors.html">Common Errors</a>. </p> | ||
* </note> | ||
* | ||
* | ||
* | ||
* | ||
* | ||
*/ | ||
public getMedia( | ||
args: GetMediaCommandInput, | ||
options?: __HttpHandlerOptions | ||
): Promise<GetMediaCommandOutput>; | ||
public getMedia( | ||
args: GetMediaCommandInput, | ||
cb: (err: any, data?: GetMediaCommandOutput) => void | ||
): void; | ||
public getMedia( | ||
args: GetMediaCommandInput, | ||
options: __HttpHandlerOptions, | ||
cb: (err: any, data?: GetMediaCommandOutput) => void | ||
): void; | ||
public getMedia( | ||
args: GetMediaCommandInput, | ||
optionsOrCb?: | ||
| __HttpHandlerOptions | ||
| ((err: any, data?: GetMediaCommandOutput) => void), | ||
cb?: (err: any, data?: GetMediaCommandOutput) => void | ||
): Promise<GetMediaCommandOutput> | void { | ||
const command = new GetMediaCommand(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); | ||
} | ||
} | ||
} |
193 changes: 193 additions & 0 deletions
193
clients/client-kinesis-video-media/KinesisVideoMediaClient.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,193 @@ | ||
import { GetMediaInput, GetMediaOutput } 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 = GetMediaInput; | ||
|
||
export type ServiceOutputTypes = GetMediaOutput; | ||
|
||
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 KinesisVideoMediaClientConfig = Partial< | ||
__SmithyConfiguration<__HttpHandlerOptions> | ||
> & | ||
ClientDefaults & | ||
RegionInputConfig & | ||
EndpointsInputConfig & | ||
AwsAuthInputConfig & | ||
RetryInputConfig & | ||
UserAgentInputConfig & | ||
HostHeaderInputConfig; | ||
|
||
export type KinesisVideoMediaClientResolvedConfig = __SmithyResolvedConfiguration< | ||
__HttpHandlerOptions | ||
> & | ||
Required<ClientDefaults> & | ||
RegionResolvedConfig & | ||
EndpointsResolvedConfig & | ||
AwsAuthResolvedConfig & | ||
RetryResolvedConfig & | ||
UserAgentResolvedConfig & | ||
HostHeaderResolvedConfig; | ||
|
||
/** | ||
* | ||
* <p></p> | ||
* | ||
*/ | ||
export class KinesisVideoMediaClient extends __Client< | ||
__HttpHandlerOptions, | ||
ServiceInputTypes, | ||
ServiceOutputTypes, | ||
KinesisVideoMediaClientResolvedConfig | ||
> { | ||
readonly config: KinesisVideoMediaClientResolvedConfig; | ||
|
||
constructor(configuration: KinesisVideoMediaClientConfig) { | ||
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 {} | ||
} |
Oops, something went wrong.