forked from SamVerschueren/dynongo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
109 additions
and
1 deletion.
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,35 @@ | ||
import { | ||
DescribeTimeToLiveCommand, | ||
DescribeTimeToLiveCommandOutput, | ||
} from "@aws-sdk/client-dynamodb"; | ||
import { Method } from "./method"; | ||
import { Executable } from "./executable"; | ||
import { DynamoDB } from "../dynamodb"; | ||
import { Table } from "../table"; | ||
|
||
export class DescribeTimeToLive extends Method implements Executable { | ||
constructor(table: Table, dynamodb: DynamoDB) { | ||
super(table, dynamodb); | ||
} | ||
|
||
buildRawQuery() { | ||
return {}; | ||
} | ||
|
||
/** | ||
* This method will execute the delete table request that was built up. | ||
*/ | ||
async exec(): Promise<DescribeTimeToLiveCommandOutput> { | ||
const client = this.dynamodb.client; | ||
|
||
if (!client) { | ||
throw new Error("Call .connect() before executing queries."); | ||
} | ||
|
||
return this.runQuery(() => | ||
client.send( | ||
new DescribeTimeToLiveCommand({ TableName: this.table!.name }) | ||
) | ||
); | ||
} | ||
} |
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
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,52 @@ | ||
import { | ||
UpdateTimeToLiveCommand, | ||
UpdateTimeToLiveInput, | ||
UpdateTimeToLiveCommandOutput, | ||
} from "@aws-sdk/client-dynamodb"; | ||
import { Method } from "./method"; | ||
import { Executable } from "./executable"; | ||
import { DynamoDB } from "../dynamodb"; | ||
import { Table } from "../table"; | ||
|
||
export class UpdateTimeToLive extends Method implements Executable { | ||
private input: Omit<UpdateTimeToLiveInput, "TableName"> | undefined; | ||
|
||
constructor(table: Table, dynamodb: DynamoDB) { | ||
super(table, dynamodb); | ||
} | ||
|
||
/** | ||
* Initialize the `UpdateTableConfig` object. | ||
* | ||
* @param schema The schema of the table. | ||
*/ | ||
initialize(_input: Omit<UpdateTimeToLiveInput, "TableName">) { | ||
// Set the schema as params object | ||
this.input = _input; | ||
|
||
// Return the object so that it can be chained | ||
return this; | ||
} | ||
|
||
buildRawQuery(): UpdateTimeToLiveInput { | ||
return { | ||
...this.input, | ||
TableName: this.table!.name, | ||
}; | ||
} | ||
|
||
/** | ||
* This method will execute the delete table request that was built up. | ||
*/ | ||
async exec(): Promise<UpdateTimeToLiveCommandOutput> { | ||
const client = this.dynamodb.client; | ||
|
||
if (!client) { | ||
throw new Error("Call .connect() before executing queries."); | ||
} | ||
|
||
return this.runQuery(() => | ||
client.send(new UpdateTimeToLiveCommand(this.buildRawQuery())) | ||
); | ||
} | ||
} |
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