Added Kinises to AWS-SDK

This commit is contained in:
Casper Skydt
2016-10-28 13:39:38 +02:00
parent 0500bd3558
commit 737653ccb0
2 changed files with 90 additions and 1 deletions

View File

@@ -381,3 +381,42 @@ dynamoDBDocClient.query(
else console.log(data); // successful response
}
);
var kinesis = new AWS.Kinesis();
var putRecordParam = {
Data: new Buffer('...') || 'STRING_VALUE', /* required */
PartitionKey: 'STRING_VALUE', /* required */
StreamName: 'STRING_VALUE', /* required */
ExplicitHashKey: 'STRING_VALUE',
SequenceNumberForOrdering: 'STRING_VALUE'
};
kinesis.putRecord(putRecordParam, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
var putRecordParams = {
Records: [ /* required */
{
Data: new Buffer('...') || 'STRING_VALUE', /* required */
PartitionKey: 'STRING_VALUE', /* required */
ExplicitHashKey: 'STRING_VALUE'
},
/* more items */
],
StreamName: 'STRING_VALUE' /* required */
};
kinesis.putRecords(putRecordParams, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
var increaseStreamRetentionPeriodParams = {
RetentionPeriodHours: 0, /* required */
StreamName: 'STRING_VALUE' /* required */
};
kinesis.increaseStreamRetentionPeriod(increaseStreamRetentionPeriodParams, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});

52
aws-sdk/index.d.ts vendored
View File

@@ -1,6 +1,6 @@
// Type definitions for aws-sdk
// Project: https://github.com/aws/aws-sdk-js
// Definitions by: midknight41 <https://github.com/midknight41>
// Definitions by: midknight41 <https://github.com/midknight41>, Casper Skydt <https://github.com/CasperSkydt>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Imported from: https://github.com/soywiz/typescript-node-definitions/aws-sdk.d.ts
@@ -335,6 +335,56 @@ export declare class SNS {
publish(request: Sns.PublishRequest, callback: (err: any, data: any) => void): void;
}
export class Kinesis {
constructor(options?: any);
endpoint: Endpoint;
putRecord(params: KINESIS.PutRecordParams, callback: (error: Error, data: KINESIS.PutRecordResult) => void): void;
putRecords(params: KINESIS.PutRecordsParams, callback: (error: Error, data: KINESIS.PutRecordsResult) => void): void;
increaseStreamRetentionPeriod(params: KINESIS.IncreaseStreamRetentionPeriodParams, callback: (error: Error, data: any) => void): void;
}
export module KINESIS {
export interface Record {
Data: Buffer | string | Blob;
PartitionKey: string;
ExplicitHashKey?: string;
}
export interface RecordResult {
SequenceNumber: string;
ShardId: string;
ErrorCode: string;
ErrorMessage: string;
}
export interface PutRecordParams extends Record {
StreamName: string;
SequenceNumberForOrdering?: string;
}
export interface PutRecordResult {
ShardId: string;
SequenceNumber: string;
}
export interface PutRecordsParams {
StreamName: string;
Records: Record[];
}
export interface PutRecordsResult {
FailedRecordCount: number;
Records: RecordResult[]
}
export interface IncreaseStreamRetentionPeriodParams {
RetentionPeriodHours: number;
StreamName: string;
}
}
export declare class SWF {
constructor(options?: any);
endpoint: Endpoint;