Skip to content

Commit 9d13d68

Browse files
author
awstools
committed
feat(client-neptune-graph): Adding a new option "parameters" for data plane api ExecuteQuery to support running parameterized query via SDK.
1 parent d085306 commit 9d13d68

File tree

5 files changed

+80
-13
lines changed

5 files changed

+80
-13
lines changed

clients/client-neptune-graph/src/commands/ExecuteQueryCommand.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,21 @@ export interface ExecuteQueryCommandOutput extends Omit<ExecuteQueryOutput, "pay
3232
* @public
3333
* <p>Execute an openCypher query. Currently, the SDK does not support parameterized queries. If you want to make a
3434
* parameterized query call, you can use an HTTP request. </p>
35+
* <p>
36+
* When invoking this operation in a Neptune Analytics cluster, the IAM user or role making the request must have a policy attached
37+
* that allows one of the following IAM actions in that cluster, depending on the query:
38+
* </p>
39+
* <ul>
40+
* <li>
41+
* <p>neptune-graph:ReadDataViaQuery</p>
42+
* </li>
43+
* <li>
44+
* <p>neptune-graph:WriteDataViaQuery</p>
45+
* </li>
46+
* <li>
47+
* <p>neptune-graph:DeleteDataViaQuery</p>
48+
* </li>
49+
* </ul>
3550
* <note>
3651
* <p>
3752
* Non-parametrized queries are not considered for plan caching. You can force plan caching with
@@ -49,6 +64,9 @@ export interface ExecuteQueryCommandOutput extends Omit<ExecuteQueryOutput, "pay
4964
* graphIdentifier: "STRING_VALUE", // required
5065
* queryString: "STRING_VALUE", // required
5166
* language: "OPEN_CYPHER", // required
67+
* parameters: { // DocumentValuedMap
68+
* "<keys>": "DOCUMENT_VALUE",
69+
* },
5270
* planCache: "ENABLED" || "DISABLED" || "AUTO",
5371
* explainMode: "STATIC" || "DETAILS",
5472
* queryTimeoutMilliseconds: Number("int"),

clients/client-neptune-graph/src/commands/GetQueryCommand.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ export interface GetQueryCommandOutput extends GetQueryOutput, __MetadataBearer
2929
/**
3030
* @public
3131
* <p>Retrieves the status of a specified query.</p>
32+
* <note>
33+
* <p>
34+
* When invoking this operation in a Neptune Analytics cluster, the IAM user or role making the request must have the
35+
* <code>neptune-graph:GetQueryStatus</code> IAM action attached.
36+
* </p>
37+
* </note>
3238
* @example
3339
* Use a bare-bones client and the command you need to make an API call.
3440
* ```javascript

clients/client-neptune-graph/src/models/models_0.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// smithy-typescript generated code
22
import { ExceptionOptionType as __ExceptionOptionType } from "@smithy/smithy-client";
33

4-
import { StreamingBlobTypes } from "@smithy/types";
4+
import { DocumentType as __DocumentType, StreamingBlobTypes } from "@smithy/types";
55

66
import { NeptuneGraphServiceException as __BaseException } from "./NeptuneGraphServiceException";
77

@@ -256,6 +256,12 @@ export interface ExecuteQueryInput {
256256
*/
257257
language: QueryLanguage | undefined;
258258

259+
/**
260+
* @public
261+
* <p>The data parameters the query can use in JSON format. For example: \{"name": "john", "age": 20\}. (optional) </p>
262+
*/
263+
parameters?: Record<string, __DocumentType>;
264+
259265
/**
260266
* @public
261267
* <p>Query plan cache is a feature that saves the query plan and reuses it on successive executions of the same query.
@@ -624,7 +630,7 @@ export interface CreateGraphInput {
624630

625631
/**
626632
* @public
627-
* <p>Specifies whether or not the graph can be reachable over the internet. All access to graphs IAM authenticated.
633+
* <p>Specifies whether or not the graph can be reachable over the internet. All access to graphs is IAM authenticated.
628634
* (<code>true</code> to enable, or <code>false</code> to disable.</p>
629635
*/
630636
publicConnectivity?: boolean;
@@ -738,7 +744,7 @@ export interface CreateGraphOutput {
738744

739745
/**
740746
* @public
741-
* <p>Specifies whether or not the graph can be reachable over the internet. All access to graphs IAM authenticated.</p>
747+
* <p>Specifies whether or not the graph can be reachable over the internet. All access to graphs is IAM authenticated.</p>
742748
*/
743749
publicConnectivity?: boolean;
744750

@@ -1321,7 +1327,7 @@ export interface RestoreGraphFromSnapshotInput {
13211327

13221328
/**
13231329
* @public
1324-
* <p>Specifies whether or not the graph can be reachable over the internet. All access to graphs IAM authenticated.
1330+
* <p>Specifies whether or not the graph can be reachable over the internet. All access to graphs is IAM authenticated.
13251331
* (<code>true</code> to enable, or <code>false</code> to disable).</p>
13261332
*/
13271333
publicConnectivity?: boolean;
@@ -1434,7 +1440,7 @@ export interface UpdateGraphInput {
14341440

14351441
/**
14361442
* @public
1437-
* <p>Specifies whether or not the graph can be reachable over the internet. All access to graphs IAM authenticated.
1443+
* <p>Specifies whether or not the graph can be reachable over the internet. All access to graphs is IAM authenticated.
14381444
* (<code>true</code> to enable, or <code>false</code> to disable.</p>
14391445
*/
14401446
publicConnectivity?: boolean;
@@ -2443,7 +2449,7 @@ export interface CreateGraphUsingImportTaskInput {
24432449

24442450
/**
24452451
* @public
2446-
* <p>Specifies whether or not the graph can be reachable over the internet. All access to graphs IAM authenticated.
2452+
* <p>Specifies whether or not the graph can be reachable over the internet. All access to graphs is IAM authenticated.
24472453
* (<code>true</code> to enable, or <code>false</code> to disable).</p>
24482454
*/
24492455
publicConnectivity?: boolean;

clients/client-neptune-graph/src/protocols/Aws_restJson1.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {
2626
withBaseException,
2727
} from "@smithy/smithy-client";
2828
import {
29+
DocumentType as __DocumentType,
2930
Endpoint as __Endpoint,
3031
ResponseMetadata as __ResponseMetadata,
3132
SdkStreamSerdeContext as __SdkStreamSerdeContext,
@@ -332,6 +333,7 @@ export const se_ExecuteQueryCommand = async (
332333
take(input, {
333334
explain: [, , `explainMode`],
334335
language: [],
336+
parameters: (_) => se_DocumentValuedMap(_, context),
335337
planCache: [],
336338
query: [, , `queryString`],
337339
queryTimeoutMilliseconds: [],
@@ -1625,6 +1627,19 @@ const de_ValidationExceptionRes = async (parsedOutput: any, context: __SerdeCont
16251627
return __decorateServiceException(exception, parsedOutput.body);
16261628
};
16271629

1630+
/**
1631+
* serializeAws_restJson1DocumentValuedMap
1632+
*/
1633+
const se_DocumentValuedMap = (input: Record<string, __DocumentType>, context: __SerdeContext): any => {
1634+
return Object.entries(input).reduce((acc: Record<string, any>, [key, value]: [string, any]) => {
1635+
if (value === null) {
1636+
return acc;
1637+
}
1638+
acc[key] = se_Document(value, context);
1639+
return acc;
1640+
}, {});
1641+
};
1642+
16281643
// se_ImportOptions omitted.
16291644

16301645
// se_NeptuneImportOptions omitted.
@@ -1637,6 +1652,13 @@ const de_ValidationExceptionRes = async (parsedOutput: any, context: __SerdeCont
16371652

16381653
// se_VectorSearchConfiguration omitted.
16391654

1655+
/**
1656+
* serializeAws_restJson1Document
1657+
*/
1658+
const se_Document = (input: __DocumentType, context: __SerdeContext): any => {
1659+
return input;
1660+
};
1661+
16401662
// de_EdgeLabels omitted.
16411663

16421664
// de_EdgeProperties omitted.

codegen/sdk-codegen/aws-models/neptune-graph.json

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1800,7 +1800,7 @@
18001800
"publicConnectivity": {
18011801
"target": "smithy.api#Boolean",
18021802
"traits": {
1803-
"smithy.api#documentation": "<p>Specifies whether or not the graph can be reachable over the internet. All access to graphs IAM authenticated.\n (<code>true</code> to enable, or <code>false</code> to disable.</p>"
1803+
"smithy.api#documentation": "<p>Specifies whether or not the graph can be reachable over the internet. All access to graphs is IAM authenticated.\n (<code>true</code> to enable, or <code>false</code> to disable.</p>"
18041804
}
18051805
},
18061806
"kmsKeyIdentifier": {
@@ -1896,7 +1896,7 @@
18961896
"publicConnectivity": {
18971897
"target": "smithy.api#Boolean",
18981898
"traits": {
1899-
"smithy.api#documentation": "<p>Specifies whether or not the graph can be reachable over the internet. All access to graphs IAM authenticated.</p>"
1899+
"smithy.api#documentation": "<p>Specifies whether or not the graph can be reachable over the internet. All access to graphs is IAM authenticated.</p>"
19001900
}
19011901
},
19021902
"vectorSearchConfiguration": {
@@ -2123,7 +2123,7 @@
21232123
"publicConnectivity": {
21242124
"target": "smithy.api#Boolean",
21252125
"traits": {
2126-
"smithy.api#documentation": "<p>Specifies whether or not the graph can be reachable over the internet. All access to graphs IAM authenticated.\n (<code>true</code> to enable, or <code>false</code> to disable).</p>"
2126+
"smithy.api#documentation": "<p>Specifies whether or not the graph can be reachable over the internet. All access to graphs is IAM authenticated.\n (<code>true</code> to enable, or <code>false</code> to disable).</p>"
21272127
}
21282128
},
21292129
"kmsKeyIdentifier": {
@@ -2735,6 +2735,15 @@
27352735
"smithy.api#output": {}
27362736
}
27372737
},
2738+
"com.amazonaws.neptunegraph#DocumentValuedMap": {
2739+
"type": "map",
2740+
"key": {
2741+
"target": "smithy.api#String"
2742+
},
2743+
"value": {
2744+
"target": "smithy.api#Document"
2745+
}
2746+
},
27382747
"com.amazonaws.neptunegraph#EdgeLabels": {
27392748
"type": "list",
27402749
"member": {
@@ -2803,7 +2812,7 @@
28032812
],
28042813
"traits": {
28052814
"aws.api#dataPlane": {},
2806-
"smithy.api#documentation": "<p>Execute an openCypher query. Currently, the SDK does not support parameterized queries. If you want to make a \n parameterized query call, you can use an HTTP request. </p>\n <note>\n <p>\n Non-parametrized queries are not considered for plan caching. You can force plan caching with \n <code>planCache=enabled</code>. The plan cache will be reused only for the same exact query. Slight variations \n in the query will not be able to reuse the query plan cache.\n </p>\n </note>",
2815+
"smithy.api#documentation": "<p>Execute an openCypher query. Currently, the SDK does not support parameterized queries. If you want to make a \n parameterized query call, you can use an HTTP request. </p>\n <p>\n When invoking this operation in a Neptune Analytics cluster, the IAM user or role making the request must have a policy attached \n that allows one of the following IAM actions in that cluster, depending on the query:\n </p>\n <ul>\n <li>\n <p>neptune-graph:ReadDataViaQuery</p>\n </li>\n <li>\n <p>neptune-graph:WriteDataViaQuery</p>\n </li>\n <li>\n <p>neptune-graph:DeleteDataViaQuery</p>\n </li>\n </ul>\n <note>\n <p>\n Non-parametrized queries are not considered for plan caching. You can force plan caching with \n <code>planCache=enabled</code>. The plan cache will be reused only for the same exact query. Slight variations \n in the query will not be able to reuse the query plan cache.\n </p>\n </note>",
28072816
"smithy.api#endpoint": {
28082817
"hostPrefix": "{graphIdentifier}."
28092818
},
@@ -2846,6 +2855,12 @@
28462855
"smithy.api#required": {}
28472856
}
28482857
},
2858+
"parameters": {
2859+
"target": "com.amazonaws.neptunegraph#DocumentValuedMap",
2860+
"traits": {
2861+
"smithy.api#documentation": "<p>The data parameters the query can use in JSON format. For example: {\"name\": \"john\", \"age\": 20}. (optional) </p>"
2862+
}
2863+
},
28492864
"planCache": {
28502865
"target": "com.amazonaws.neptunegraph#PlanCacheType",
28512866
"traits": {
@@ -3796,7 +3811,7 @@
37963811
],
37973812
"traits": {
37983813
"aws.api#dataPlane": {},
3799-
"smithy.api#documentation": "<p>Retrieves the status of a specified query.</p>",
3814+
"smithy.api#documentation": "<p>Retrieves the status of a specified query.</p>\n <note>\n <p>\n When invoking this operation in a Neptune Analytics cluster, the IAM user or role making the request must have the \n <code>neptune-graph:GetQueryStatus</code> IAM action attached.\n </p>\n </note>",
38003815
"smithy.api#endpoint": {
38013816
"hostPrefix": "{graphIdentifier}."
38023817
},
@@ -5587,7 +5602,7 @@
55875602
"publicConnectivity": {
55885603
"target": "smithy.api#Boolean",
55895604
"traits": {
5590-
"smithy.api#documentation": "<p>Specifies whether or not the graph can be reachable over the internet. All access to graphs IAM authenticated.\n (<code>true</code> to enable, or <code>false</code> to disable).</p>"
5605+
"smithy.api#documentation": "<p>Specifies whether or not the graph can be reachable over the internet. All access to graphs is IAM authenticated.\n (<code>true</code> to enable, or <code>false</code> to disable).</p>"
55915606
}
55925607
}
55935608
},
@@ -6181,7 +6196,7 @@
61816196
"publicConnectivity": {
61826197
"target": "smithy.api#Boolean",
61836198
"traits": {
6184-
"smithy.api#documentation": "<p>Specifies whether or not the graph can be reachable over the internet. All access to graphs IAM authenticated.\n (<code>true</code> to enable, or <code>false</code> to disable.</p>"
6199+
"smithy.api#documentation": "<p>Specifies whether or not the graph can be reachable over the internet. All access to graphs is IAM authenticated.\n (<code>true</code> to enable, or <code>false</code> to disable.</p>"
61856200
}
61866201
},
61876202
"provisionedMemory": {

0 commit comments

Comments
 (0)