Skip to content

Commit

Permalink
feat(client-workdocs): This release adds a new API, SearchResources, …
Browse files Browse the repository at this point in the history
…which enable users to search through metadata and content of folders, documents, document versions and comments in a WorkDocs site.
  • Loading branch information
awstools committed Mar 20, 2023
1 parent 56a152d commit e1674aa
Show file tree
Hide file tree
Showing 20 changed files with 2,705 additions and 447 deletions.
8 changes: 8 additions & 0 deletions clients/client-workdocs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,14 @@ RestoreDocumentVersions

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-workdocs/classes/restoredocumentversionscommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-workdocs/interfaces/restoredocumentversionscommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-workdocs/interfaces/restoredocumentversionscommandoutput.html)

</details>
<details>
<summary>
SearchResources
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-workdocs/classes/searchresourcescommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-workdocs/interfaces/searchresourcescommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-workdocs/interfaces/searchresourcescommandoutput.html)

</details>
<details>
<summary>
Expand Down
20 changes: 4 additions & 16 deletions clients/client-workdocs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,27 +64,15 @@
"typedoc": "0.23.23",
"typescript": "~4.9.5"
},
"engines": {
"node": ">=14.0.0"
},
"typesVersions": {
"<4.0": {
"dist-types/*": [
"dist-types/ts3.4/*"
]
}
},
"files": [
"dist-*"
],
"engines": { "node": ">=14.0.0" },
"typesVersions": { "<4.0": { "dist-types/*": ["dist-types/ts3.4/*"] } },
"files": ["dist-*"],
"author": {
"name": "AWS SDK for JavaScript Team",
"url": "https://aws.amazon.com/javascript/"
},
"license": "Apache-2.0",
"browser": {
"./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser"
},
"browser": { "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser" },
"react-native": {
"./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native"
},
Expand Down
37 changes: 37 additions & 0 deletions clients/client-workdocs/src/WorkDocs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@ import {
RestoreDocumentVersionsCommandInput,
RestoreDocumentVersionsCommandOutput,
} from "./commands/RestoreDocumentVersionsCommand";
import {
SearchResourcesCommand,
SearchResourcesCommandInput,
SearchResourcesCommandOutput,
} from "./commands/SearchResourcesCommand";
import {
UpdateDocumentCommand,
UpdateDocumentCommandInput,
Expand Down Expand Up @@ -1524,6 +1529,38 @@ export class WorkDocs extends WorkDocsClient {
}
}

/**
* <p>Searches metadata and the content of folders, documents, document versions, and comments.</p>
*/
public searchResources(
args: SearchResourcesCommandInput,
options?: __HttpHandlerOptions
): Promise<SearchResourcesCommandOutput>;
public searchResources(
args: SearchResourcesCommandInput,
cb: (err: any, data?: SearchResourcesCommandOutput) => void
): void;
public searchResources(
args: SearchResourcesCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: SearchResourcesCommandOutput) => void
): void;
public searchResources(
args: SearchResourcesCommandInput,
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: SearchResourcesCommandOutput) => void),
cb?: (err: any, data?: SearchResourcesCommandOutput) => void
): Promise<SearchResourcesCommandOutput> | void {
const command = new SearchResourcesCommand(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>Updates the specified attributes of a document. The user must have access to both
* the document and its parent folder, if applicable.</p>
Expand Down
3 changes: 3 additions & 0 deletions clients/client-workdocs/src/WorkDocsClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ import {
RestoreDocumentVersionsCommandInput,
RestoreDocumentVersionsCommandOutput,
} from "./commands/RestoreDocumentVersionsCommand";
import { SearchResourcesCommandInput, SearchResourcesCommandOutput } from "./commands/SearchResourcesCommand";
import { UpdateDocumentCommandInput, UpdateDocumentCommandOutput } from "./commands/UpdateDocumentCommand";
import {
UpdateDocumentVersionCommandInput,
Expand Down Expand Up @@ -194,6 +195,7 @@ export type ServiceInputTypes =
| RemoveAllResourcePermissionsCommandInput
| RemoveResourcePermissionCommandInput
| RestoreDocumentVersionsCommandInput
| SearchResourcesCommandInput
| UpdateDocumentCommandInput
| UpdateDocumentVersionCommandInput
| UpdateFolderCommandInput
Expand Down Expand Up @@ -239,6 +241,7 @@ export type ServiceOutputTypes =
| RemoveAllResourcePermissionsCommandOutput
| RemoveResourcePermissionCommandOutput
| RestoreDocumentVersionsCommandOutput
| SearchResourcesCommandOutput
| UpdateDocumentCommandOutput
| UpdateDocumentVersionCommandOutput
| UpdateFolderCommandOutput
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ export interface InitiateDocumentVersionUploadCommandOutput
* under the control of the organization is failing, such as a connected Active
* Directory.</p>
*
* @throws {@link InvalidArgumentException} (client fault)
* <p>The pagination marker or limit fields are not valid.</p>
*
* @throws {@link InvalidPasswordException} (client fault)
* <p>The password is invalid.</p>
*
Expand Down
133 changes: 133 additions & 0 deletions clients/client-workdocs/src/commands/SearchResourcesCommand.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
// smithy-typescript generated code
import { EndpointParameterInstructions, getEndpointPlugin } from "@aws-sdk/middleware-endpoint";
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
import { Command as $Command } from "@aws-sdk/smithy-client";
import {
FinalizeHandlerArguments,
Handler,
HandlerExecutionContext,
HttpHandlerOptions as __HttpHandlerOptions,
MetadataBearer as __MetadataBearer,
MiddlewareStack,
SerdeContext as __SerdeContext,
} from "@aws-sdk/types";

import {
SearchResourcesRequest,
SearchResourcesRequestFilterSensitiveLog,
SearchResourcesResponse,
SearchResourcesResponseFilterSensitiveLog,
} from "../models/models_0";
import {
deserializeAws_restJson1SearchResourcesCommand,
serializeAws_restJson1SearchResourcesCommand,
} from "../protocols/Aws_restJson1";
import { ServiceInputTypes, ServiceOutputTypes, WorkDocsClientResolvedConfig } from "../WorkDocsClient";

/**
* The input for {@link SearchResourcesCommand}.
*/
export interface SearchResourcesCommandInput extends SearchResourcesRequest {}
/**
* The output of {@link SearchResourcesCommand}.
*/
export interface SearchResourcesCommandOutput extends SearchResourcesResponse, __MetadataBearer {}

/**
* <p>Searches metadata and the content of folders, documents, document versions, and comments.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { WorkDocsClient, SearchResourcesCommand } from "@aws-sdk/client-workdocs"; // ES Modules import
* // const { WorkDocsClient, SearchResourcesCommand } = require("@aws-sdk/client-workdocs"); // CommonJS import
* const client = new WorkDocsClient(config);
* const command = new SearchResourcesCommand(input);
* const response = await client.send(command);
* ```
*
* @see {@link SearchResourcesCommandInput} for command's `input` shape.
* @see {@link SearchResourcesCommandOutput} for command's `response` shape.
* @see {@link WorkDocsClientResolvedConfig | config} for WorkDocsClient's `config` shape.
*
* @throws {@link InvalidArgumentException} (client fault)
* <p>The pagination marker or limit fields are not valid.</p>
*
* @throws {@link ServiceUnavailableException} (server fault)
* <p>One or more of the dependencies is unavailable.</p>
*
* @throws {@link UnauthorizedOperationException} (client fault)
* <p>The operation is not permitted.</p>
*
* @throws {@link UnauthorizedResourceAccessException} (client fault)
* <p>The caller does not have access to perform the action on the resource.</p>
*
*
*/
export class SearchResourcesCommand extends $Command<
SearchResourcesCommandInput,
SearchResourcesCommandOutput,
WorkDocsClientResolvedConfig
> {
// Start section: command_properties
// End section: command_properties

public static getEndpointParameterInstructions(): EndpointParameterInstructions {
return {
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
Endpoint: { type: "builtInParams", name: "endpoint" },
Region: { type: "builtInParams", name: "region" },
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
};
}

constructor(readonly input: SearchResourcesCommandInput) {
// Start section: command_constructor
super();
// End section: command_constructor
}

/**
* @internal
*/
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: WorkDocsClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<SearchResourcesCommandInput, SearchResourcesCommandOutput> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
this.middlewareStack.use(
getEndpointPlugin(configuration, SearchResourcesCommand.getEndpointParameterInstructions())
);

const stack = clientStack.concat(this.middlewareStack);

const { logger } = configuration;
const clientName = "WorkDocsClient";
const commandName = "SearchResourcesCommand";
const handlerExecutionContext: HandlerExecutionContext = {
logger,
clientName,
commandName,
inputFilterSensitiveLog: SearchResourcesRequestFilterSensitiveLog,
outputFilterSensitiveLog: SearchResourcesResponseFilterSensitiveLog,
};
const { requestHandler } = configuration;
return stack.resolve(
(request: FinalizeHandlerArguments<any>) =>
requestHandler.handle(request.request as __HttpRequest, options || {}),
handlerExecutionContext
);
}

private serialize(input: SearchResourcesCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
return serializeAws_restJson1SearchResourcesCommand(input, context);
}

private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<SearchResourcesCommandOutput> {
return deserializeAws_restJson1SearchResourcesCommand(output, context);
}

// Start section: command_body_extra
// End section: command_body_extra
}
1 change: 1 addition & 0 deletions clients/client-workdocs/src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export * from "./InitiateDocumentVersionUploadCommand";
export * from "./RemoveAllResourcePermissionsCommand";
export * from "./RemoveResourcePermissionCommand";
export * from "./RestoreDocumentVersionsCommand";
export * from "./SearchResourcesCommand";
export * from "./UpdateDocumentCommand";
export * from "./UpdateDocumentVersionCommand";
export * from "./UpdateFolderCommand";
Expand Down
2 changes: 1 addition & 1 deletion clients/client-workdocs/src/endpoint/EndpointParameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const resolveClientEndpointParameters = <T>(
};

export interface EndpointParameters extends __EndpointParameters {
Region: string;
Region?: string;
UseDualStack?: boolean;
UseFIPS?: boolean;
Endpoint?: string;
Expand Down
39 changes: 20 additions & 19 deletions clients/client-workdocs/src/endpoint/ruleset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,25 @@ import { RuleSetObject } from "@aws-sdk/util-endpoints";
or see "smithy.rules#endpointRuleSet"
in codegen/sdk-codegen/aws-models/workdocs.json */

const q="fn",
r="argv",
s="ref";
const a=true,
b=false,
c="String",
d="PartitionResult",
e="tree",
f="error",
g="endpoint",
h={"required":true,"default":false,"type":"Boolean"},
i={[s]:"Endpoint"},
j={[q]:"booleanEquals",[r]:[{[s]:"UseFIPS"},true]},
k={[q]:"booleanEquals",[r]:[{[s]:"UseDualStack"},true]},
l={},
m={[q]:"booleanEquals",[r]:[true,{[q]:"getAttr",[r]:[{[s]:d},"supportsFIPS"]}]},
n={[q]:"booleanEquals",[r]:[true,{[q]:"getAttr",[r]:[{[s]:d},"supportsDualStack"]}]},
const q="required",
r="fn",
s="argv",
t="ref";
const a="isSet",
b="tree",
c="error",
d="endpoint",
e="PartitionResult",
f={[q]:false,"type":"String"},
g={[q]:true,"default":false,"type":"Boolean"},
h={[t]:"Endpoint"},
i={[r]:"booleanEquals",[s]:[{[t]:"UseFIPS"},true]},
j={[r]:"booleanEquals",[s]:[{[t]:"UseDualStack"},true]},
k={},
l={[r]:"booleanEquals",[s]:[true,{[r]:"getAttr",[s]:[{[t]:e},"supportsFIPS"]}]},
m={[r]:"booleanEquals",[s]:[true,{[r]:"getAttr",[s]:[{[t]:e},"supportsDualStack"]}]},
n=[i],
o=[j],
p=[k];
const _data={version:"1.0",parameters:{Region:{required:a,type:c},UseDualStack:h,UseFIPS:h,Endpoint:{required:b,type:c}},rules:[{conditions:[{[q]:"aws.partition",[r]:[{[s]:"Region"}],assign:d}],type:e,rules:[{conditions:[{[q]:"isSet",[r]:[i]}],type:e,rules:[{conditions:o,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:f},{type:e,rules:[{conditions:p,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:f},{endpoint:{url:i,properties:l,headers:l},type:g}]}]},{conditions:[j,k],type:e,rules:[{conditions:[m,n],type:e,rules:[{type:e,rules:[{endpoint:{url:"https://workdocs-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:l,headers:l},type:g}]}]},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:f}]},{conditions:o,type:e,rules:[{conditions:[m],type:e,rules:[{type:e,rules:[{endpoint:{url:"https://workdocs-fips.{Region}.{PartitionResult#dnsSuffix}",properties:l,headers:l},type:g}]}]},{error:"FIPS is enabled but this partition does not support FIPS",type:f}]},{conditions:p,type:e,rules:[{conditions:[n],type:e,rules:[{type:e,rules:[{endpoint:{url:"https://workdocs.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:l,headers:l},type:g}]}]},{error:"DualStack is enabled but this partition does not support DualStack",type:f}]},{type:e,rules:[{endpoint:{url:"https://workdocs.{Region}.{PartitionResult#dnsSuffix}",properties:l,headers:l},type:g}]}]}]};
p=[{[t]:"Region"}];
const _data={version:"1.0",parameters:{Region:f,UseDualStack:g,UseFIPS:g,Endpoint:f},rules:[{conditions:[{[r]:a,[s]:[h]}],type:b,rules:[{conditions:n,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:c},{type:b,rules:[{conditions:o,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:c},{endpoint:{url:h,properties:k,headers:k},type:d}]}]},{type:b,rules:[{conditions:[{[r]:a,[s]:p}],type:b,rules:[{conditions:[{[r]:"aws.partition",[s]:p,assign:e}],type:b,rules:[{conditions:[i,j],type:b,rules:[{conditions:[l,m],type:b,rules:[{type:b,rules:[{endpoint:{url:"https://workdocs-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:k,headers:k},type:d}]}]},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:c}]},{conditions:n,type:b,rules:[{conditions:[l],type:b,rules:[{type:b,rules:[{endpoint:{url:"https://workdocs-fips.{Region}.{PartitionResult#dnsSuffix}",properties:k,headers:k},type:d}]}]},{error:"FIPS is enabled but this partition does not support FIPS",type:c}]},{conditions:o,type:b,rules:[{conditions:[m],type:b,rules:[{type:b,rules:[{endpoint:{url:"https://workdocs.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:k,headers:k},type:d}]}]},{error:"DualStack is enabled but this partition does not support DualStack",type:c}]},{type:b,rules:[{endpoint:{url:"https://workdocs.{Region}.{PartitionResult#dnsSuffix}",properties:k,headers:k},type:d}]}]}]},{error:"Invalid Configuration: Missing Region",type:c}]}]};
export const ruleSet: RuleSetObject = _data;
Loading

0 comments on commit e1674aa

Please sign in to comment.