Skip to content

Commit 38acfdd

Browse files
author
awstools
committed
feat(client-workdocs): Added 2 new document related operations, DeleteDocumentVersion and RestoreDocumentVersions.
1 parent 0963adb commit 38acfdd

File tree

9 files changed

+774
-88
lines changed

9 files changed

+774
-88
lines changed

clients/client-workdocs/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,32 @@ set in the IAM policy). This includes, but is not limited to, the ability to mod
4242
permissions and upload any file to any user. This allows developers to perform the three
4343
use cases above, as well as give users the ability to grant access on a selective basis
4444
using the IAM model.</p>
45+
<note>
46+
<p>The pricing for Amazon WorkDocs APIs varies depending on the API call type for these actions:</p>
47+
<ul>
48+
<li>
49+
<p>
50+
<code>READ (Get*)</code>
51+
</p>
52+
</li>
53+
<li>
54+
<p>
55+
<code>WRITE (Activate*, Add*, Create*, Deactivate*, Initiate*, Update*)</code>
56+
</p>
57+
</li>
58+
<li>
59+
<p>
60+
<code>LIST (Describe*)</code>
61+
</p>
62+
</li>
63+
<li>
64+
<p>
65+
<code>DELETE*, CANCEL</code>
66+
</p>
67+
</li>
68+
</ul>
69+
<p>For information about Amazon WorkDocs API pricing, see <a href="https://aws.amazon.com/workdocs/pricing/">Amazon WorkDocs Pricing</a>.</p>
70+
</note>
4571

4672
## Installing
4773

clients/client-workdocs/src/WorkDocs.ts

Lines changed: 101 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ import {
6262
DeleteDocumentCommandInput,
6363
DeleteDocumentCommandOutput,
6464
} from "./commands/DeleteDocumentCommand";
65+
import {
66+
DeleteDocumentVersionCommand,
67+
DeleteDocumentVersionCommandInput,
68+
DeleteDocumentVersionCommandOutput,
69+
} from "./commands/DeleteDocumentVersionCommand";
6570
import {
6671
DeleteFolderCommand,
6772
DeleteFolderCommandInput,
@@ -170,6 +175,11 @@ import {
170175
RemoveResourcePermissionCommandInput,
171176
RemoveResourcePermissionCommandOutput,
172177
} from "./commands/RemoveResourcePermissionCommand";
178+
import {
179+
RestoreDocumentVersionsCommand,
180+
RestoreDocumentVersionsCommandInput,
181+
RestoreDocumentVersionsCommandOutput,
182+
} from "./commands/RestoreDocumentVersionsCommand";
173183
import {
174184
UpdateDocumentCommand,
175185
UpdateDocumentCommandInput,
@@ -222,6 +232,32 @@ import { WorkDocsClient } from "./WorkDocsClient";
222232
* permissions and upload any file to any user. This allows developers to perform the three
223233
* use cases above, as well as give users the ability to grant access on a selective basis
224234
* using the IAM model.</p>
235+
* <note>
236+
* <p>The pricing for Amazon WorkDocs APIs varies depending on the API call type for these actions:</p>
237+
* <ul>
238+
* <li>
239+
* <p>
240+
* <code>READ (Get*)</code>
241+
* </p>
242+
* </li>
243+
* <li>
244+
* <p>
245+
* <code>WRITE (Activate*, Add*, Create*, Deactivate*, Initiate*, Update*)</code>
246+
* </p>
247+
* </li>
248+
* <li>
249+
* <p>
250+
* <code>LIST (Describe*)</code>
251+
* </p>
252+
* </li>
253+
* <li>
254+
* <p>
255+
* <code>DELETE*, CANCEL</code>
256+
* </p>
257+
* </li>
258+
* </ul>
259+
* <p>For information about Amazon WorkDocs API pricing, see <a href="https://aws.amazon.com/workdocs/pricing/">Amazon WorkDocs Pricing</a>.</p>
260+
* </note>
225261
*/
226262
export class WorkDocs extends WorkDocsClient {
227263
/**
@@ -450,8 +486,7 @@ export class WorkDocs extends WorkDocsClient {
450486
/**
451487
* <p>Configure Amazon WorkDocs to use Amazon SNS notifications. The endpoint receives a
452488
* confirmation message, and must confirm the subscription.</p>
453-
* <p>For more information, see <a href="https://docs.aws.amazon.com/workdocs/latest/developerguide/subscribe-notifications.html">Subscribe to
454-
* Notifications</a> in the <i>Amazon WorkDocs Developer
489+
* <p>For more information, see <a href="https://docs.aws.amazon.com/workdocs/latest/developerguide/manage-notifications.html">Setting up notifications for an IAM user or role</a> in the <i>Amazon WorkDocs Developer
455490
* Guide</i>.</p>
456491
*/
457492
public createNotificationSubscription(
@@ -639,6 +674,38 @@ export class WorkDocs extends WorkDocsClient {
639674
}
640675
}
641676

677+
/**
678+
* <p>Deletes a version of an Amazon WorkDocs document. Use the <code>DeletePriorVersions</code> parameter to delete prior versions.</p>
679+
*/
680+
public deleteDocumentVersion(
681+
args: DeleteDocumentVersionCommandInput,
682+
options?: __HttpHandlerOptions
683+
): Promise<DeleteDocumentVersionCommandOutput>;
684+
public deleteDocumentVersion(
685+
args: DeleteDocumentVersionCommandInput,
686+
cb: (err: any, data?: DeleteDocumentVersionCommandOutput) => void
687+
): void;
688+
public deleteDocumentVersion(
689+
args: DeleteDocumentVersionCommandInput,
690+
options: __HttpHandlerOptions,
691+
cb: (err: any, data?: DeleteDocumentVersionCommandOutput) => void
692+
): void;
693+
public deleteDocumentVersion(
694+
args: DeleteDocumentVersionCommandInput,
695+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: DeleteDocumentVersionCommandOutput) => void),
696+
cb?: (err: any, data?: DeleteDocumentVersionCommandOutput) => void
697+
): Promise<DeleteDocumentVersionCommandOutput> | void {
698+
const command = new DeleteDocumentVersionCommand(args);
699+
if (typeof optionsOrCb === "function") {
700+
this.send(command, optionsOrCb);
701+
} else if (typeof cb === "function") {
702+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
703+
this.send(command, optionsOrCb || {}, cb);
704+
} else {
705+
return this.send(command, optionsOrCb);
706+
}
707+
}
708+
642709
/**
643710
* <p>Permanently deletes the specified folder and its contents.</p>
644711
*/
@@ -1422,6 +1489,38 @@ export class WorkDocs extends WorkDocsClient {
14221489
}
14231490
}
14241491

1492+
/**
1493+
* <p>Recovers a deleted version of an Amazon WorkDocs document.</p>
1494+
*/
1495+
public restoreDocumentVersions(
1496+
args: RestoreDocumentVersionsCommandInput,
1497+
options?: __HttpHandlerOptions
1498+
): Promise<RestoreDocumentVersionsCommandOutput>;
1499+
public restoreDocumentVersions(
1500+
args: RestoreDocumentVersionsCommandInput,
1501+
cb: (err: any, data?: RestoreDocumentVersionsCommandOutput) => void
1502+
): void;
1503+
public restoreDocumentVersions(
1504+
args: RestoreDocumentVersionsCommandInput,
1505+
options: __HttpHandlerOptions,
1506+
cb: (err: any, data?: RestoreDocumentVersionsCommandOutput) => void
1507+
): void;
1508+
public restoreDocumentVersions(
1509+
args: RestoreDocumentVersionsCommandInput,
1510+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: RestoreDocumentVersionsCommandOutput) => void),
1511+
cb?: (err: any, data?: RestoreDocumentVersionsCommandOutput) => void
1512+
): Promise<RestoreDocumentVersionsCommandOutput> | void {
1513+
const command = new RestoreDocumentVersionsCommand(args);
1514+
if (typeof optionsOrCb === "function") {
1515+
this.send(command, optionsOrCb);
1516+
} else if (typeof cb === "function") {
1517+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
1518+
this.send(command, optionsOrCb || {}, cb);
1519+
} else {
1520+
return this.send(command, optionsOrCb);
1521+
}
1522+
}
1523+
14251524
/**
14261525
* <p>Updates the specified attributes of a document. The user must have access to both
14271526
* the document and its parent folder, if applicable.</p>

clients/client-workdocs/src/WorkDocsClient.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ import {
7575
DeleteCustomMetadataCommandOutput,
7676
} from "./commands/DeleteCustomMetadataCommand";
7777
import { DeleteDocumentCommandInput, DeleteDocumentCommandOutput } from "./commands/DeleteDocumentCommand";
78+
import {
79+
DeleteDocumentVersionCommandInput,
80+
DeleteDocumentVersionCommandOutput,
81+
} from "./commands/DeleteDocumentVersionCommand";
7882
import { DeleteFolderCommandInput, DeleteFolderCommandOutput } from "./commands/DeleteFolderCommand";
7983
import {
8084
DeleteFolderContentsCommandInput,
@@ -129,6 +133,10 @@ import {
129133
RemoveResourcePermissionCommandInput,
130134
RemoveResourcePermissionCommandOutput,
131135
} from "./commands/RemoveResourcePermissionCommand";
136+
import {
137+
RestoreDocumentVersionsCommandInput,
138+
RestoreDocumentVersionsCommandOutput,
139+
} from "./commands/RestoreDocumentVersionsCommand";
132140
import { UpdateDocumentCommandInput, UpdateDocumentCommandOutput } from "./commands/UpdateDocumentCommand";
133141
import {
134142
UpdateDocumentVersionCommandInput,
@@ -158,6 +166,7 @@ export type ServiceInputTypes =
158166
| DeleteCommentCommandInput
159167
| DeleteCustomMetadataCommandInput
160168
| DeleteDocumentCommandInput
169+
| DeleteDocumentVersionCommandInput
161170
| DeleteFolderCommandInput
162171
| DeleteFolderContentsCommandInput
163172
| DeleteLabelsCommandInput
@@ -182,6 +191,7 @@ export type ServiceInputTypes =
182191
| InitiateDocumentVersionUploadCommandInput
183192
| RemoveAllResourcePermissionsCommandInput
184193
| RemoveResourcePermissionCommandInput
194+
| RestoreDocumentVersionsCommandInput
185195
| UpdateDocumentCommandInput
186196
| UpdateDocumentVersionCommandInput
187197
| UpdateFolderCommandInput
@@ -201,6 +211,7 @@ export type ServiceOutputTypes =
201211
| DeleteCommentCommandOutput
202212
| DeleteCustomMetadataCommandOutput
203213
| DeleteDocumentCommandOutput
214+
| DeleteDocumentVersionCommandOutput
204215
| DeleteFolderCommandOutput
205216
| DeleteFolderContentsCommandOutput
206217
| DeleteLabelsCommandOutput
@@ -225,6 +236,7 @@ export type ServiceOutputTypes =
225236
| InitiateDocumentVersionUploadCommandOutput
226237
| RemoveAllResourcePermissionsCommandOutput
227238
| RemoveResourcePermissionCommandOutput
239+
| RestoreDocumentVersionsCommandOutput
228240
| UpdateDocumentCommandOutput
229241
| UpdateDocumentVersionCommandOutput
230242
| UpdateFolderCommandOutput
@@ -413,6 +425,32 @@ export interface WorkDocsClientResolvedConfig extends WorkDocsClientResolvedConf
413425
* permissions and upload any file to any user. This allows developers to perform the three
414426
* use cases above, as well as give users the ability to grant access on a selective basis
415427
* using the IAM model.</p>
428+
* <note>
429+
* <p>The pricing for Amazon WorkDocs APIs varies depending on the API call type for these actions:</p>
430+
* <ul>
431+
* <li>
432+
* <p>
433+
* <code>READ (Get*)</code>
434+
* </p>
435+
* </li>
436+
* <li>
437+
* <p>
438+
* <code>WRITE (Activate*, Add*, Create*, Deactivate*, Initiate*, Update*)</code>
439+
* </p>
440+
* </li>
441+
* <li>
442+
* <p>
443+
* <code>LIST (Describe*)</code>
444+
* </p>
445+
* </li>
446+
* <li>
447+
* <p>
448+
* <code>DELETE*, CANCEL</code>
449+
* </p>
450+
* </li>
451+
* </ul>
452+
* <p>For information about Amazon WorkDocs API pricing, see <a href="https://aws.amazon.com/workdocs/pricing/">Amazon WorkDocs Pricing</a>.</p>
453+
* </note>
416454
*/
417455
export class WorkDocsClient extends __Client<
418456
__HttpHandlerOptions,

clients/client-workdocs/src/commands/CreateNotificationSubscriptionCommand.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ export interface CreateNotificationSubscriptionCommandOutput
3333
/**
3434
* <p>Configure Amazon WorkDocs to use Amazon SNS notifications. The endpoint receives a
3535
* confirmation message, and must confirm the subscription.</p>
36-
* <p>For more information, see <a href="https://docs.aws.amazon.com/workdocs/latest/developerguide/subscribe-notifications.html">Subscribe to
37-
* Notifications</a> in the <i>Amazon WorkDocs Developer
36+
* <p>For more information, see <a href="https://docs.aws.amazon.com/workdocs/latest/developerguide/manage-notifications.html">Setting up notifications for an IAM user or role</a> in the <i>Amazon WorkDocs Developer
3837
* Guide</i>.</p>
3938
* @example
4039
* Use a bare-bones client and the command you need to make an API call.
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
// smithy-typescript generated code
2+
import { EndpointParameterInstructions, getEndpointPlugin } from "@aws-sdk/middleware-endpoint";
3+
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
4+
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
5+
import { Command as $Command } from "@aws-sdk/smithy-client";
6+
import {
7+
FinalizeHandlerArguments,
8+
Handler,
9+
HandlerExecutionContext,
10+
HttpHandlerOptions as __HttpHandlerOptions,
11+
MetadataBearer as __MetadataBearer,
12+
MiddlewareStack,
13+
SerdeContext as __SerdeContext,
14+
} from "@aws-sdk/types";
15+
16+
import { DeleteDocumentVersionRequest, DeleteDocumentVersionRequestFilterSensitiveLog } from "../models/models_0";
17+
import {
18+
deserializeAws_restJson1DeleteDocumentVersionCommand,
19+
serializeAws_restJson1DeleteDocumentVersionCommand,
20+
} from "../protocols/Aws_restJson1";
21+
import { ServiceInputTypes, ServiceOutputTypes, WorkDocsClientResolvedConfig } from "../WorkDocsClient";
22+
23+
export interface DeleteDocumentVersionCommandInput extends DeleteDocumentVersionRequest {}
24+
export interface DeleteDocumentVersionCommandOutput extends __MetadataBearer {}
25+
26+
/**
27+
* <p>Deletes a version of an Amazon WorkDocs document. Use the <code>DeletePriorVersions</code> parameter to delete prior versions.</p>
28+
* @example
29+
* Use a bare-bones client and the command you need to make an API call.
30+
* ```javascript
31+
* import { WorkDocsClient, DeleteDocumentVersionCommand } from "@aws-sdk/client-workdocs"; // ES Modules import
32+
* // const { WorkDocsClient, DeleteDocumentVersionCommand } = require("@aws-sdk/client-workdocs"); // CommonJS import
33+
* const client = new WorkDocsClient(config);
34+
* const command = new DeleteDocumentVersionCommand(input);
35+
* const response = await client.send(command);
36+
* ```
37+
*
38+
* @see {@link DeleteDocumentVersionCommandInput} for command's `input` shape.
39+
* @see {@link DeleteDocumentVersionCommandOutput} for command's `response` shape.
40+
* @see {@link WorkDocsClientResolvedConfig | config} for WorkDocsClient's `config` shape.
41+
*
42+
*/
43+
export class DeleteDocumentVersionCommand extends $Command<
44+
DeleteDocumentVersionCommandInput,
45+
DeleteDocumentVersionCommandOutput,
46+
WorkDocsClientResolvedConfig
47+
> {
48+
// Start section: command_properties
49+
// End section: command_properties
50+
51+
public static getEndpointParameterInstructions(): EndpointParameterInstructions {
52+
return {
53+
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
54+
Endpoint: { type: "builtInParams", name: "endpoint" },
55+
Region: { type: "builtInParams", name: "region" },
56+
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
57+
};
58+
}
59+
60+
constructor(readonly input: DeleteDocumentVersionCommandInput) {
61+
// Start section: command_constructor
62+
super();
63+
// End section: command_constructor
64+
}
65+
66+
/**
67+
* @internal
68+
*/
69+
resolveMiddleware(
70+
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
71+
configuration: WorkDocsClientResolvedConfig,
72+
options?: __HttpHandlerOptions
73+
): Handler<DeleteDocumentVersionCommandInput, DeleteDocumentVersionCommandOutput> {
74+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
75+
this.middlewareStack.use(
76+
getEndpointPlugin(configuration, DeleteDocumentVersionCommand.getEndpointParameterInstructions())
77+
);
78+
79+
const stack = clientStack.concat(this.middlewareStack);
80+
81+
const { logger } = configuration;
82+
const clientName = "WorkDocsClient";
83+
const commandName = "DeleteDocumentVersionCommand";
84+
const handlerExecutionContext: HandlerExecutionContext = {
85+
logger,
86+
clientName,
87+
commandName,
88+
inputFilterSensitiveLog: DeleteDocumentVersionRequestFilterSensitiveLog,
89+
outputFilterSensitiveLog: (output: any) => output,
90+
};
91+
const { requestHandler } = configuration;
92+
return stack.resolve(
93+
(request: FinalizeHandlerArguments<any>) =>
94+
requestHandler.handle(request.request as __HttpRequest, options || {}),
95+
handlerExecutionContext
96+
);
97+
}
98+
99+
private serialize(input: DeleteDocumentVersionCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
100+
return serializeAws_restJson1DeleteDocumentVersionCommand(input, context);
101+
}
102+
103+
private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<DeleteDocumentVersionCommandOutput> {
104+
return deserializeAws_restJson1DeleteDocumentVersionCommand(output, context);
105+
}
106+
107+
// Start section: command_body_extra
108+
// End section: command_body_extra
109+
}

0 commit comments

Comments
 (0)