Skip to content

Commit c089987

Browse files
authored
DOCSP-25572 QE tutorial with KMIP (#1960)
* DOCSP-25572 QE tutorial with KMIP * restore language-id.rst * lang
1 parent 1435894 commit c089987

File tree

8 files changed

+206
-6
lines changed

8 files changed

+206
-6
lines changed

source/core/queryable-encryption/tutorials/kmip/kmip-automatic.txt

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ Before You Get Started
4646

4747
`Complete Java Application <{+sample-app-url-qe+}/java/kmip/reader/>`__
4848

49+
.. tab:: Mongosh
50+
:tabid: shell
51+
52+
`Complete Mongosh Application <{+sample-app-url-qe+}/mongosh/kmip/reader/>`__
53+
4954
.. tab:: Node.js
5055
:tabid: nodejs
5156

@@ -71,7 +76,7 @@ Before You Get Started
7176
Set Up the KMS
7277
--------------
7378

74-
.. include:: /includes/tutorials/language-id.rst
79+
.. include:: /includes/tutorials/language-id-qe.rst
7580

7681
.. procedure::
7782
:style: normal
@@ -111,6 +116,12 @@ your application to see relevant code samples.
111116
To view the complete code for making a {+dek-long+}, see
112117
`our Github repository <{+sample-app-url-qe+}/java/kmip/reader/src/main/java/com/mongodb/qe/MakeDataKey.java>`__.
113118

119+
.. tab::
120+
:tabid: shell
121+
122+
To view the complete code for making a {+dek-long+}, see
123+
`our Github repository <{+sample-app-url-qe+}/mongosh/kmip/reader/make_data_key.js>`__.
124+
114125
.. tab::
115126
:tabid: nodejs
116127

@@ -153,6 +164,12 @@ your application to see relevant code samples.
153164
To view the complete code for inserting an encrypted document, see
154165
`our Github repository <{+sample-app-url-qe+}/java/kmip/reader/src/main/java/com/mongodb/qe/InsertEncryptedDocument.java>`__.
155166

167+
.. tab::
168+
:tabid: shell
169+
170+
To view the complete code for inserting an encrypted document, see
171+
`our Github repository <{+sample-app-url-qe+}/mongosh/kmip/reader/insert_encrypted_document.js>`__.
172+
156173
.. tab::
157174
:tabid: nodejs
158175

@@ -191,6 +208,12 @@ your application to see relevant code samples.
191208
To view the complete code for inserting an encrypted document, see
192209
`our Github repository <{+sample-app-url-qe+}/java/kmip/reader/src/main/java/com/mongodb/qe/InsertEncryptedDocument.java>`__.
193210

211+
.. tab::
212+
:tabid: shell
213+
214+
To view the complete code for inserting an encrypted document, see
215+
`our Github repository <{+sample-app-url-qe+}/mongosh/kmip/reader/insert_encrypted_document.js>`__.
216+
194217
.. tab::
195218
:tabid: nodejs
196219

source/includes/queryable-encryption/tutorials/automatic/kmip/certificates.rst

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ a client certificate that your {+kmip-kms+} accepts:
2121
`kmsProviderSslContextMap <{+java-driver-api+}/mongodb-driver-core/com/mongodb/ClientEncryptionSettings.Builder.html#kmsProviderSslContextMap(java.util.Map)>`__
2222
method.
2323

24+
.. tab::
25+
:tabid: shell
26+
27+
.. literalinclude:: /includes/generated/in-use-encryption/queryable-encryption/mongosh/kmip/reader/make_data_key.js
28+
:start-after: start-create-tls
29+
:end-before: end-create-tls
30+
:language: javascript
31+
:dedent:
32+
:caption: make_data_key.js
33+
2434
.. tab::
2535
:tabid: nodejs
2636

@@ -75,4 +85,4 @@ a client certificate that your {+kmip-kms+} accepts:
7585

7686
You must use certificates with `ECDSA keys <https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm>`__
7787
when using the Go driver.
78-
88+

source/includes/queryable-encryption/tutorials/automatic/kmip/client.rst

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@
1818
:dedent:
1919
:caption: InsertEncryptedDocument.java
2020

21+
.. tab::
22+
:tabid: shell
23+
24+
.. literalinclude:: /includes/generated/in-use-encryption/queryable-encryption/mongosh/kmip/reader/insert_encrypted_document.js
25+
:start-after: start-key-vault
26+
:end-before: end-key-vault
27+
:language: javascript
28+
:dedent:
29+
:caption: insert_encrypted_document.js
30+
2131
.. tab::
2232
:tabid: nodejs
2333

@@ -75,6 +85,16 @@
7585
:dedent:
7686
:caption: InsertEncryptedDocument.java
7787

88+
.. tab::
89+
:tabid: shell
90+
91+
.. literalinclude:: /includes/generated/in-use-encryption/queryable-encryption/mongosh/kmip/reader/insert_encrypted_document.js
92+
:start-after: start-kmsproviders
93+
:end-before: end-kmsproviders
94+
:language: javascript
95+
:dedent:
96+
:caption: insert_encrypted_document.js
97+
7898
.. tab::
7999
:tabid: nodejs
80100

@@ -120,6 +140,16 @@
120140

121141
.. tabs-drivers::
122142

143+
.. tab::
144+
:tabid: shell
145+
146+
.. literalinclude:: /includes/generated/in-use-encryption/queryable-encryption/mongosh/kmip/reader/insert_encrypted_document.js
147+
:start-after: start-schema
148+
:end-before: end-schema
149+
:language: javascript
150+
:dedent:
151+
:caption: insert_encrypted_document.js
152+
123153
.. tab::
124154
:tabid: nodejs
125155

@@ -169,12 +199,20 @@
169199
:language: csharp
170200
:dedent:
171201
:caption: InsertEncryptedDocument.cs
202+
172203
.. include:: /includes/quick-start/schema/further-reading-note.rst
173204

174205
.. step:: Specify the Location of the {+shared-library+}
175206

176207
.. tabs-drivers::
177208

209+
.. tab::
210+
:tabid: shell
211+
212+
.. code-block:: none
213+
// mongosh does not require you to specify the
214+
// location of the {+shared-library+}
215+
178216
.. tab::
179217
:tabid: nodejs
180218

@@ -242,6 +280,16 @@
242280
:dedent:
243281
:caption: InsertEncryptedDocument.java
244282

283+
.. tab::
284+
:tabid: shell
285+
286+
.. literalinclude:: /includes/generated/in-use-encryption/queryable-encryption/mongosh/kmip/reader/insert_encrypted_document.js
287+
:start-after: start-client
288+
:end-before: end-client
289+
:language: javascript
290+
:dedent:
291+
:caption: insert_encrypted_document.js
292+
245293
.. tab::
246294
:tabid: nodejs
247295

@@ -280,4 +328,4 @@
280328
:end-before: end-client
281329
:language: go
282330
:dedent:
283-
:caption: insert-encrypted-document.go
331+
:caption: insert-encrypted-document.go

source/includes/queryable-encryption/tutorials/automatic/kmip/dek.rst

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@
1717
:dedent:
1818
:caption: MakeDataKey.java
1919

20+
.. tab::
21+
:tabid: shell
22+
23+
.. literalinclude:: /includes/generated/in-use-encryption/queryable-encryption/mongosh/kmip/reader/make_data_key.js
24+
:start-after: start-kmsproviders
25+
:end-before: end-kmsproviders
26+
:language: javascript
27+
:dedent:
28+
:caption: make_data_key.js
29+
2030
.. tab::
2131
:tabid: nodejs
2232

@@ -73,6 +83,16 @@
7383
:dedent:
7484
:caption: MakeDataKey.java
7585

86+
.. tab::
87+
:tabid: shell
88+
89+
.. literalinclude:: /includes/generated/in-use-encryption/queryable-encryption/mongosh/kmip/reader/make_data_key.js
90+
:start-after: start-datakeyopts
91+
:end-before: end-datakeyopts
92+
:language: javascript
93+
:dedent:
94+
:caption: make_data_key.js
95+
7696
.. tab::
7797
:tabid: nodejs
7898

@@ -129,6 +149,16 @@
129149
:dedent:
130150
:caption: MakeDataKey.java
131151

152+
.. tab::
153+
:tabid: shell
154+
155+
.. literalinclude:: /includes/generated/in-use-encryption/queryable-encryption/mongosh/kmip/reader/make_data_key.js
156+
:start-after: start-create-dek
157+
:end-before: end-create-dek
158+
:language: javascript
159+
:dedent:
160+
:caption: make_data_key.js
161+
132162
.. tab::
133163
:tabid: nodejs
134164

@@ -168,4 +198,4 @@
168198
:language: go
169199
:dedent:
170200
:caption: make-data-key.go
171-
201+

source/includes/queryable-encryption/tutorials/automatic/kmip/find.rst

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@ a client that is not configured for automatic {+qe-abbr+}.
1818
:dedent:
1919
:caption: InsertEncryptedDocument.java
2020

21+
.. tab::
22+
:tabid: shell
23+
24+
.. literalinclude:: /includes/generated/in-use-encryption/queryable-encryption/mongosh/kmip/reader/insert_encrypted_document.js
25+
:start-after: start-find
26+
:end-before: end-find
27+
:language: javascript
28+
:dedent:
29+
:caption: insert_encrypted_document.js
30+
2131
.. tab::
2232
:tabid: nodejs
2333

@@ -61,4 +71,4 @@ a client that is not configured for automatic {+qe-abbr+}.
6171
The output of the preceding code snippet should look like this:
6272

6373
.. literalinclude:: /includes/queryable-encryption/quick-start/find-output.out
64-
:language: text
74+
:language: text

source/includes/queryable-encryption/tutorials/automatic/kmip/insert.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ snippet:
1717
:dedent:
1818
:caption: InsertEncryptedDocument.java
1919

20+
.. tab::
21+
:tabid: shell
22+
23+
.. literalinclude:: /includes/generated/in-use-encryption/queryable-encryption/mongosh/kmip/reader/insert_encrypted_document.js
24+
:start-after: start-insert
25+
:end-before: end-insert
26+
:language: javascript
27+
:dedent:
28+
2029
.. tab::
2130
:tabid: nodejs
2231

source/includes/queryable-encryption/tutorials/automatic/kmip/key-vault-index.rst

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@ Create a unique index on the ``keyAltNames`` field in your
1515
:dedent:
1616
:caption: MakeDataKey.java
1717

18+
.. tab::
19+
:tabid: shell
20+
21+
.. literalinclude:: /includes/generated/in-use-encryption/queryable-encryption/mongosh/kmip/reader/make_data_key.js
22+
:start-after: start-create-index
23+
:end-before: end-create-index
24+
:caption: make_data_key.js
25+
:language: javascript
26+
:dedent:
27+
1828
.. tab::
1929
:tabid: nodejs
2030

@@ -54,4 +64,4 @@ Create a unique index on the ``keyAltNames`` field in your
5464
:language: csharp
5565
:caption: MakeDataKey.cs
5666
:dedent:
57-
67+
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
.. tabs-drivers::
2+
3+
.. tab::
4+
:tabid: java-sync
5+
6+
.. code-block:: java
7+
8+
// You are viewing the Java synchronous driver code examples.
9+
// Use the dropdown menu to select a different driver.
10+
11+
.. tab::
12+
:tabid: shell
13+
14+
.. code-block:: javascript
15+
16+
// You are viewing the Mongosh driver code examples.
17+
// Use the dropdown menu to select a different driver.
18+
19+
.. tab::
20+
:tabid: nodejs
21+
22+
.. code-block:: javascript
23+
24+
// You are viewing the Node.js driver code examples.
25+
// Use the dropdown menu to select a different driver.
26+
27+
.. tab::
28+
:tabid: python
29+
30+
.. code-block:: python
31+
32+
# You are viewing the Python driver code examples.
33+
# Use the dropdown menu to select a different driver.
34+
35+
.. tab::
36+
:tabid: csharp
37+
38+
.. code-block:: csharp
39+
40+
// You are viewing the C# driver code examples.
41+
// Use the dropdown menu to select a different driver.
42+
43+
.. tab::
44+
:tabid: go
45+
46+
.. code-block:: go
47+
48+
// You are viewing the Golang driver code examples.
49+
// Use the dropdown menu to select a different driver.
50+
51+
.. important::
52+
53+
When building or running the Golang code in this guide using
54+
``go build`` or ``go run``, always include the ``cse`` build
55+
constraint to enable {+csfle-abbrev+}. See the following shell
56+
command for an example of including the build constraint:
57+
58+
.. code-block:: bash
59+
60+
go run -tags cse insert-encrypted-document.go

0 commit comments

Comments
 (0)