@@ -30,7 +30,7 @@ class SnippetCommands {
30
30
* An interface for a command-line sub-command.
31
31
*/
32
32
interface Command {
33
- public void run () throws IOException ;
33
+ void run () throws IOException ;
34
34
}
35
35
36
36
// Most of the commands take some subset of the same arguments, so specify groups of arguments
@@ -40,79 +40,84 @@ static class ProjectIdArgs {
40
40
String projectId ;
41
41
}
42
42
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 ;
46
51
}
47
52
48
53
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 ;
51
56
}
52
57
53
58
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" )
55
60
String version ;
56
61
}
57
62
58
63
59
64
public static class CreateKeyRingCommand extends KeyRingArgs implements Command {
60
65
public void run () throws IOException {
61
- Snippets .createKeyRing (projectId , ringId );
66
+ Snippets .createKeyRing (projectId , locationId , keyRingId );
62
67
}
63
68
}
64
69
65
70
public static class CreateCryptoKeyCommand extends KeyArgs implements Command {
66
71
public void run () throws IOException {
67
- Snippets .createCryptoKey (projectId , ringId , keyId );
72
+ Snippets .createCryptoKey (projectId , locationId , keyRingId , cryptoKeyId );
68
73
}
69
74
}
70
75
71
76
public static class CreateCryptoKeyVersionCommand extends KeyArgs implements Command {
72
77
public void run () throws IOException {
73
- Snippets .createCryptoKeyVersion (projectId , ringId , keyId );
78
+ Snippets .createCryptoKeyVersion (projectId , locationId , keyRingId , cryptoKeyId );
74
79
}
75
80
}
76
81
77
- public static class ListKeyRingsCommand extends ProjectIdArgs implements Command {
82
+ public static class ListKeyRingsCommand extends LocationIdArgs implements Command {
78
83
public void run () throws IOException {
79
- Snippets .listKeyRings (projectId );
84
+ Snippets .listKeyRings (projectId , locationId );
80
85
}
81
86
}
82
87
83
88
public static class ListCryptoKeysCommand extends KeyRingArgs implements Command {
84
89
public void run () throws IOException {
85
- Snippets .listCryptoKeys (projectId , ringId );
90
+ Snippets .listCryptoKeys (projectId , locationId , keyRingId );
86
91
}
87
92
}
88
93
89
94
public static class ListCryptoKeyVersionsCommand extends KeyArgs implements Command {
90
95
public void run () throws IOException {
91
- Snippets .listCryptoKeyVersions (projectId , ringId , keyId );
96
+ Snippets .listCryptoKeyVersions (projectId , locationId , keyRingId , cryptoKeyId );
92
97
}
93
98
}
94
99
95
100
public static class DisableCryptoKeyVersionCommand extends KeyVersionArgs implements Command {
96
101
public void run () throws IOException {
97
- Snippets .disableCryptoKeyVersion (projectId , ringId , keyId , version );
102
+ Snippets .disableCryptoKeyVersion (projectId , locationId , keyRingId , cryptoKeyId , version );
98
103
}
99
104
}
100
105
101
106
public static class DestroyCryptoKeyVersionCommand extends KeyVersionArgs implements Command {
102
107
public void run () throws IOException {
103
- Snippets .destroyCryptoKeyVersion (projectId , ringId , keyId , version );
108
+ Snippets .destroyCryptoKeyVersion (projectId , locationId , keyRingId , cryptoKeyId , version );
104
109
}
105
110
}
106
111
107
112
public static class GetKeyRingPolicyCommand extends KeyRingArgs implements Command {
108
113
public void run () throws IOException {
109
- Snippets .getKeyRingPolicy (projectId , ringId );
114
+ Snippets .getKeyRingPolicy (projectId , locationId , keyRingId );
110
115
}
111
116
}
112
117
113
118
public static class GetCryptoKeyPolicyCommand extends KeyArgs implements Command {
114
119
public void run () throws IOException {
115
- Snippets .getCryptoKeyPolicy (projectId , ringId , keyId );
120
+ Snippets .getCryptoKeyPolicy (projectId , locationId , keyRingId , cryptoKeyId );
116
121
}
117
122
}
118
123
@@ -128,7 +133,7 @@ public static class AddMemberToKeyRingPolicyCommand extends KeyRingArgs implemen
128
133
String role ;
129
134
130
135
public void run () throws IOException {
131
- Snippets .addMemberToKeyRingPolicy (projectId , ringId , member , role );
136
+ Snippets .addMemberToKeyRingPolicy (projectId , locationId , keyRingId , member , role );
132
137
}
133
138
}
134
139
@@ -144,7 +149,7 @@ public static class AddMemberToCryptoKeyPolicyCommand extends KeyArgs implements
144
149
String role ;
145
150
146
151
public void run () throws IOException {
147
- Snippets .addMemberToCryptoKeyPolicy (projectId , ringId , keyId , member , role );
152
+ Snippets .addMemberToCryptoKeyPolicy (projectId , locationId , keyRingId , cryptoKeyId , member , role );
148
153
}
149
154
}
150
155
@@ -160,7 +165,7 @@ public static class RemoveMemberFromKeyRingPolicyCommand extends KeyRingArgs imp
160
165
String role ;
161
166
162
167
public void run () throws IOException {
163
- Snippets .removeMemberFromKeyRingPolicy (projectId , ringId , member , role );
168
+ Snippets .removeMemberFromKeyRingPolicy (projectId , locationId , keyRingId , member , role );
164
169
}
165
170
}
166
171
@@ -176,7 +181,7 @@ public static class RemoveMemberFromCryptoKeyPolicyCommand extends KeyArgs imple
176
181
String role ;
177
182
178
183
public void run () throws IOException {
179
- Snippets .removeMemberFromCryptoKeyPolicy (projectId , ringId , keyId , member , role );
184
+ Snippets .removeMemberFromCryptoKeyPolicy (projectId , locationId , keyRingId , cryptoKeyId , member , role );
180
185
}
181
186
}
182
187
0 commit comments