Skip to content

Commit

Permalink
feat(client-verifiedpermissions): Adds Cedar JSON format support for …
Browse files Browse the repository at this point in the history
…entities and context data in authorization requests
  • Loading branch information
awstools committed Jan 30, 2025
1 parent 0f29c7b commit 46d4d66
Show file tree
Hide file tree
Showing 7 changed files with 207 additions and 110 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export interface BatchIsAuthorizedCommandOutput extends BatchIsAuthorizedOutput,
* ],
* },
* ],
* cedarJson: "STRING_VALUE",
* },
* requests: [ // BatchIsAuthorizedInputList // required
* { // BatchIsAuthorizedInputItem
Expand All @@ -123,6 +124,7 @@ export interface BatchIsAuthorizedCommandOutput extends BatchIsAuthorizedOutput,
* contextMap: { // ContextMap
* "<keys>": "<AttributeValue>",
* },
* cedarJson: "STRING_VALUE",
* },
* },
* ],
Expand Down Expand Up @@ -178,6 +180,7 @@ export interface BatchIsAuthorizedCommandOutput extends BatchIsAuthorizedOutput,
* // decimal: "STRING_VALUE",
* // },
* // },
* // cedarJson: "STRING_VALUE",
* // },
* // },
* // decision: "ALLOW" || "DENY", // required
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export interface BatchIsAuthorizedWithTokenCommandOutput extends BatchIsAuthoriz
* ],
* },
* ],
* cedarJson: "STRING_VALUE",
* },
* requests: [ // BatchIsAuthorizedWithTokenInputList // required
* { // BatchIsAuthorizedWithTokenInputItem
Expand All @@ -122,6 +123,7 @@ export interface BatchIsAuthorizedWithTokenCommandOutput extends BatchIsAuthoriz
* contextMap: { // ContextMap
* "<keys>": "<AttributeValue>",
* },
* cedarJson: "STRING_VALUE",
* },
* },
* ],
Expand Down Expand Up @@ -174,6 +176,7 @@ export interface BatchIsAuthorizedWithTokenCommandOutput extends BatchIsAuthoriz
* // decimal: "STRING_VALUE",
* // },
* // },
* // cedarJson: "STRING_VALUE",
* // },
* // },
* // decision: "ALLOW" || "DENY", // required
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export interface IsAuthorizedCommandOutput extends IsAuthorizedOutput, __Metadat
* decimal: "STRING_VALUE",
* },
* },
* cedarJson: "STRING_VALUE",
* },
* entities: { // EntitiesDefinition Union: only one key present
* entityList: [ // EntityList
Expand All @@ -109,6 +110,7 @@ export interface IsAuthorizedCommandOutput extends IsAuthorizedOutput, __Metadat
* ],
* },
* ],
* cedarJson: "STRING_VALUE",
* },
* };
* const command = new IsAuthorizedCommand(input);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export interface IsAuthorizedWithTokenCommandOutput extends IsAuthorizedWithToke
* decimal: "STRING_VALUE",
* },
* },
* cedarJson: "STRING_VALUE",
* },
* entities: { // EntitiesDefinition Union: only one key present
* entityList: [ // EntityList
Expand All @@ -115,6 +116,7 @@ export interface IsAuthorizedWithTokenCommandOutput extends IsAuthorizedWithToke
* ],
* },
* ],
* cedarJson: "STRING_VALUE",
* },
* };
* const command = new IsAuthorizedWithTokenCommand(input);
Expand Down
202 changes: 133 additions & 69 deletions clients/client-verifiedpermissions/src/models/models_0.ts

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -1334,6 +1334,7 @@ const se_BatchIsAuthorizedWithTokenInputList = (
*/
const se_ContextDefinition = (input: ContextDefinition, context: __SerdeContext): any => {
return ContextDefinition.visit(input, {
cedarJson: (value) => ({ cedarJson: value }),
contextMap: (value) => ({ contextMap: se_ContextMap(value, context) }),
_: (name, value) => ({ name: value } as any),
});
Expand Down Expand Up @@ -1411,6 +1412,7 @@ const se_CreatePolicyTemplateInput = (input: CreatePolicyTemplateInput, context:
*/
const se_EntitiesDefinition = (input: EntitiesDefinition, context: __SerdeContext): any => {
return EntitiesDefinition.visit(input, {
cedarJson: (value) => ({ cedarJson: value }),
entityList: (value) => ({ entityList: se_EntityList(value, context) }),
_: (name, value) => ({ name: value } as any),
});
Expand Down Expand Up @@ -1791,6 +1793,9 @@ const de_BatchIsAuthorizedWithTokenOutputList = (
* deserializeAws_json1_0ContextDefinition
*/
const de_ContextDefinition = (output: any, context: __SerdeContext): ContextDefinition => {
if (__expectString(output.cedarJson) !== undefined) {
return { cedarJson: __expectString(output.cedarJson) as any };
}
if (output.contextMap != null) {
return {
contextMap: de_ContextMap(output.contextMap, context),
Expand Down
Loading

0 comments on commit 46d4d66

Please sign in to comment.