@@ -30,7 +30,7 @@ class SnippetCommands {
3030 * An interface for a command-line sub-command.
3131 */
3232 interface Command {
33- public void run () throws IOException ;
33+ void run () throws IOException ;
3434 }
3535
3636 // Most of the commands take some subset of the same arguments, so specify groups of arguments
@@ -40,79 +40,84 @@ static class ProjectIdArgs {
4040 String projectId ;
4141 }
4242
43- static class KeyRingArgs extends ProjectIdArgs {
44- @ Argument (metaVar = "ringId" , required = true , index = 0 , usage = "The ring id" )
45- String ringId ;
43+ static class LocationIdArgs extends ProjectIdArgs {
44+ @ Argument (metaVar = "locationId" , required = true , index = 0 , usage = "The location id" )
45+ String locationId ;
46+ }
47+
48+ static class KeyRingArgs extends LocationIdArgs {
49+ @ Argument (metaVar = "keyRingId" , required = true , index = 1 , usage = "The key ring id" )
50+ String keyRingId ;
4651 }
4752
4853 static class KeyArgs extends KeyRingArgs {
49- @ Argument (metaVar = "keyId " , required = true , index = 1 , usage = "The key id" )
50- String keyId ;
54+ @ Argument (metaVar = "cryptoKeyId " , required = true , index = 2 , usage = "The crypto key id" )
55+ String cryptoKeyId ;
5156 }
5257
5358 static class KeyVersionArgs extends KeyArgs {
54- @ Argument (metaVar = "version" , required = true , index = 2 , usage = "The key version" )
59+ @ Argument (metaVar = "version" , required = true , index = 3 , usage = "The key version" )
5560 String version ;
5661 }
5762
5863
5964 public static class CreateKeyRingCommand extends KeyRingArgs implements Command {
6065 public void run () throws IOException {
61- Snippets .createKeyRing (projectId , ringId );
66+ Snippets .createKeyRing (projectId , locationId , keyRingId );
6267 }
6368 }
6469
6570 public static class CreateCryptoKeyCommand extends KeyArgs implements Command {
6671 public void run () throws IOException {
67- Snippets .createCryptoKey (projectId , ringId , keyId );
72+ Snippets .createCryptoKey (projectId , locationId , keyRingId , cryptoKeyId );
6873 }
6974 }
7075
7176 public static class CreateCryptoKeyVersionCommand extends KeyArgs implements Command {
7277 public void run () throws IOException {
73- Snippets .createCryptoKeyVersion (projectId , ringId , keyId );
78+ Snippets .createCryptoKeyVersion (projectId , locationId , keyRingId , cryptoKeyId );
7479 }
7580 }
7681
77- public static class ListKeyRingsCommand extends ProjectIdArgs implements Command {
82+ public static class ListKeyRingsCommand extends LocationIdArgs implements Command {
7883 public void run () throws IOException {
79- Snippets .listKeyRings (projectId );
84+ Snippets .listKeyRings (projectId , locationId );
8085 }
8186 }
8287
8388 public static class ListCryptoKeysCommand extends KeyRingArgs implements Command {
8489 public void run () throws IOException {
85- Snippets .listCryptoKeys (projectId , ringId );
90+ Snippets .listCryptoKeys (projectId , locationId , keyRingId );
8691 }
8792 }
8893
8994 public static class ListCryptoKeyVersionsCommand extends KeyArgs implements Command {
9095 public void run () throws IOException {
91- Snippets .listCryptoKeyVersions (projectId , ringId , keyId );
96+ Snippets .listCryptoKeyVersions (projectId , locationId , keyRingId , cryptoKeyId );
9297 }
9398 }
9499
95100 public static class DisableCryptoKeyVersionCommand extends KeyVersionArgs implements Command {
96101 public void run () throws IOException {
97- Snippets .disableCryptoKeyVersion (projectId , ringId , keyId , version );
102+ Snippets .disableCryptoKeyVersion (projectId , locationId , keyRingId , cryptoKeyId , version );
98103 }
99104 }
100105
101106 public static class DestroyCryptoKeyVersionCommand extends KeyVersionArgs implements Command {
102107 public void run () throws IOException {
103- Snippets .destroyCryptoKeyVersion (projectId , ringId , keyId , version );
108+ Snippets .destroyCryptoKeyVersion (projectId , locationId , keyRingId , cryptoKeyId , version );
104109 }
105110 }
106111
107112 public static class GetKeyRingPolicyCommand extends KeyRingArgs implements Command {
108113 public void run () throws IOException {
109- Snippets .getKeyRingPolicy (projectId , ringId );
114+ Snippets .getKeyRingPolicy (projectId , locationId , keyRingId );
110115 }
111116 }
112117
113118 public static class GetCryptoKeyPolicyCommand extends KeyArgs implements Command {
114119 public void run () throws IOException {
115- Snippets .getCryptoKeyPolicy (projectId , ringId , keyId );
120+ Snippets .getCryptoKeyPolicy (projectId , locationId , keyRingId , cryptoKeyId );
116121 }
117122 }
118123
@@ -128,7 +133,7 @@ public static class AddMemberToKeyRingPolicyCommand extends KeyRingArgs implemen
128133 String role ;
129134
130135 public void run () throws IOException {
131- Snippets .addMemberToKeyRingPolicy (projectId , ringId , member , role );
136+ Snippets .addMemberToKeyRingPolicy (projectId , locationId , keyRingId , member , role );
132137 }
133138 }
134139
@@ -144,7 +149,7 @@ public static class AddMemberToCryptoKeyPolicyCommand extends KeyArgs implements
144149 String role ;
145150
146151 public void run () throws IOException {
147- Snippets .addMemberToCryptoKeyPolicy (projectId , ringId , keyId , member , role );
152+ Snippets .addMemberToCryptoKeyPolicy (projectId , locationId , keyRingId , cryptoKeyId , member , role );
148153 }
149154 }
150155
@@ -160,7 +165,7 @@ public static class RemoveMemberFromKeyRingPolicyCommand extends KeyRingArgs imp
160165 String role ;
161166
162167 public void run () throws IOException {
163- Snippets .removeMemberFromKeyRingPolicy (projectId , ringId , member , role );
168+ Snippets .removeMemberFromKeyRingPolicy (projectId , locationId , keyRingId , member , role );
164169 }
165170 }
166171
@@ -176,7 +181,7 @@ public static class RemoveMemberFromCryptoKeyPolicyCommand extends KeyArgs imple
176181 String role ;
177182
178183 public void run () throws IOException {
179- Snippets .removeMemberFromCryptoKeyPolicy (projectId , ringId , keyId , member , role );
184+ Snippets .removeMemberFromCryptoKeyPolicy (projectId , locationId , keyRingId , cryptoKeyId , member , role );
180185 }
181186 }
182187
0 commit comments