@@ -67,6 +67,7 @@ public static CloudKMS createAuthorizedClient() throws IOException {
67
67
.build ();
68
68
}
69
69
70
+ // [START kms_create_keyring]
70
71
/**
71
72
* Creates a new key ring with the given id.
72
73
*/
@@ -86,7 +87,9 @@ public static KeyRing createKeyRing(String projectId, String ringId) throws IOEx
86
87
System .out .println (keyring );
87
88
return keyring ;
88
89
}
90
+ // [END kms_create_keyring]
89
91
92
+ // [START kms_create_cryptokey]
90
93
/**
91
94
* Creates a new crypto key with the given id.
92
95
*/
@@ -114,7 +117,9 @@ public static CryptoKey createCryptoKey(String projectId, String ringId, String
114
117
System .out .println (createdKey );
115
118
return createdKey ;
116
119
}
120
+ // [END kms_create_cryptokey]
117
121
122
+ // [START kms_create_cryptokey_version]
118
123
/**
119
124
* Creates a new crypto key version for the given id.
120
125
*/
@@ -138,7 +143,9 @@ public static void createCryptoKeyVersion(
138
143
139
144
System .out .println (newVersion );
140
145
}
146
+ // [END kms_create_cryptokey_version]
141
147
148
+ // [START kms_disable_cryptokey_version]
142
149
/**
143
150
* Disables the given version of the crypto key.
144
151
*/
@@ -166,7 +173,9 @@ public static CryptoKeyVersion disableCryptoKeyVersion(
166
173
System .out .println (response );
167
174
return response ;
168
175
}
176
+ // [END kms_disable_cryptokey_version]
169
177
178
+ // [START kms_destroy_cryptokey_version]
170
179
/**
171
180
* Marks the given version of a crypto key to be destroyed at a scheduled future point.
172
181
*/
@@ -192,7 +201,9 @@ public static CryptoKeyVersion destroyCryptoKeyVersion(
192
201
System .out .println (destroyed );
193
202
return destroyed ;
194
203
}
204
+ // [END kms_destroy_cryptokey_version]
195
205
206
+ // [START kms_get_cryptokey_policy]
196
207
/**
197
208
* Retrieves the IAM policy for the given crypto key.
198
209
*/
@@ -215,7 +226,9 @@ public static Policy getCryptoKeyPolicy(String projectId, String ringId, String
215
226
System .out .println (iamPolicy .getBindings ());
216
227
return iamPolicy ;
217
228
}
229
+ // [END kms_get_cryptokey_policy]
218
230
231
+ // [START kms_get_keyring_policy]
219
232
/**
220
233
* Retrieves the IAM policy for the given crypto key.
221
234
*/
@@ -237,7 +250,9 @@ public static Policy getKeyRingPolicy(String projectId, String ringId) throws IO
237
250
System .out .println (iamPolicy .getBindings ());
238
251
return iamPolicy ;
239
252
}
253
+ // [END kms_get_keyring_policy]
240
254
255
+ // [START kms_add_member_to_cryptokey_policy]
241
256
/**
242
257
* Adds the given member to the given key, with the given role.
243
258
*
@@ -296,7 +311,9 @@ public static Policy addMemberToCryptoKeyPolicy(
296
311
System .out .println ("Response: " + newIamPolicy );
297
312
return newIamPolicy ;
298
313
}
314
+ // [END kms_add_member_to_cryptokey_policy]
299
315
316
+ // [START kms_add_member_to_keyring_policy]
300
317
/**
301
318
* Adds the given member to the given keyring, with the given role.
302
319
*
@@ -354,7 +371,9 @@ public static Policy addMemberToKeyRingPolicy(
354
371
System .out .println ("Response: " + newIamPolicy );
355
372
return newIamPolicy ;
356
373
}
374
+ // [END kms_add_member_to_keyring_policy]
357
375
376
+ // [START kms_remove_member_from_cryptokey_policy]
358
377
/**
359
378
* Removes the given member from the given policy.
360
379
*/
@@ -395,7 +414,9 @@ public static Policy removeMemberFromCryptoKeyPolicy(
395
414
System .out .println ("Response: " + newIamPolicy );
396
415
return newIamPolicy ;
397
416
}
417
+ // [END kms_remove_member_from_cryptokey_policy]
398
418
419
+ // [START kms_remove_member_from_keyring_policy]
399
420
/**
400
421
* Removes the given member from the given policy.
401
422
*/
@@ -431,6 +452,7 @@ public static Policy removeMemberFromKeyRingPolicy(
431
452
System .out .println ("Response: " + newIamPolicy );
432
453
return newIamPolicy ;
433
454
}
455
+ // [END kms_remove_member_from_keyring_policy]
434
456
435
457
/**
436
458
* Prints all the keyrings in the given project.
0 commit comments