@@ -170,65 +170,69 @@ private static String randomSecretId() {
170170
171171 private static void createTags () throws IOException {
172172 try (TagKeysClient tagKeysClient = TagKeysClient .create ()) {
173- Random random = new Random ();
174- ProjectName parent = ProjectName .of (PROJECT_ID );
175- CreateTagKeyRequest request =
176- CreateTagKeyRequest .newBuilder ()
177- .setTagKey (
178- TagKey
179- .newBuilder ()
180- .setParent (parent .toString ())
181- .setShortName ("java-" + random .nextLong ())
182- .build ())
183- .build ();
184- OperationFuture <TagKey , CreateTagKeyMetadata > future =
185- tagKeysClient .createTagKeyOperationCallable ().futureCall (request );
186- TagKey response = future .get ();
187- TAG_KEY = response ;
173+ Random random = new Random ();
174+ ProjectName parent = ProjectName .of (PROJECT_ID );
175+ CreateTagKeyRequest request =
176+ CreateTagKeyRequest .newBuilder ()
177+ .setTagKey (
178+ TagKey
179+ .newBuilder ()
180+ .setParent (parent .toString ())
181+ .setShortName ("java-" + random .nextLong ())
182+ .build ())
183+ .build ();
184+ OperationFuture <TagKey , CreateTagKeyMetadata > future =
185+ tagKeysClient .createTagKeyOperationCallable ().futureCall (request );
186+ TagKey response = future .get ();
187+ TAG_KEY = response ;
188188 }catch (Exception e ){
189+ System .out .printf ("Unable to create Tag Key %s\n " , e .toString ());
189190 }
190- try (TagValuesClient tagValuesClient = TagValuesClient .create ()) {
191- Random random = new Random ();
192- CreateTagValueRequest request =
193- CreateTagValueRequest .newBuilder ()
194- .setTagValue (TagValue
195- .newBuilder ()
196- .setParent (TAG_KEY .getName ())
197- .setShortName ("java-" + random .nextLong ())
198- .build ())
199- .build ();
200- OperationFuture <TagValue , CreateTagValueMetadata > future =
201- tagValuesClient .createTagValueOperationCallable ().futureCall (request );
202- TagValue response = future .get ();
203- TAG_VALUE = response ;
204- }catch (Exception e ){
205- }
206191
192+ try (TagValuesClient tagValuesClient = TagValuesClient .create ()) {
193+ Random random = new Random ();
194+ CreateTagValueRequest request =
195+ CreateTagValueRequest .newBuilder ()
196+ .setTagValue (
197+ TagValue
198+ .newBuilder ()
199+ .setParent (TAG_KEY .getName ())
200+ .setShortName ("java-" + random .nextLong ())
201+ .build ())
202+ .build ();
203+ OperationFuture <TagValue , CreateTagValueMetadata > future =
204+ tagValuesClient .createTagValueOperationCallable ().futureCall (request );
205+ TagValue response = future .get ();
206+ TAG_VALUE = response ;
207+ }catch (Exception e ){
208+ System .out .printf ("Unable to create Tag Value %s\n " , e .toString ());
209+ }
207210 }
208211
209212 private static void deleteTags () throws IOException {
210213 try (TagValuesClient tagValuesClient = TagValuesClient .create ()) {
211- DeleteTagValueRequest request =
212- DeleteTagValueRequest .newBuilder ()
213- .setName (TAG_VALUE .getName ())
214- .build ();
215- OperationFuture <TagValue , DeleteTagValueMetadata > future =
216- tagValuesClient .deleteTagValueOperationCallable ().futureCall (request );
217- TagValue response = future .get ();
218- }catch (Exception e ){
219- }
220-
221- try (TagKeysClient tagKeysClient = TagKeysClient .create ()) {
222- DeleteTagKeyRequest request =
223- DeleteTagKeyRequest .newBuilder ()
224- .setName (TAG_KEY .getName ())
225- .build ();
226- OperationFuture <TagKey , DeleteTagKeyMetadata > future =
227- tagKeysClient .deleteTagKeyOperationCallable ().futureCall (request );
228- TagKey response = future .get ();
229- }catch (Exception e ){
230- }
214+ DeleteTagValueRequest request =
215+ DeleteTagValueRequest .newBuilder ()
216+ .setName (TAG_VALUE .getName ())
217+ .build ();
218+ OperationFuture <TagValue , DeleteTagValueMetadata > future =
219+ tagValuesClient .deleteTagValueOperationCallable ().futureCall (request );
220+ TagValue response = future .get ();
221+ }catch (Exception e ){
222+ System .out .printf ("Unable to delete Tag key %s\n " , e .toString ());
223+ }
231224
225+ try (TagKeysClient tagKeysClient = TagKeysClient .create ()) {
226+ DeleteTagKeyRequest request =
227+ DeleteTagKeyRequest .newBuilder ()
228+ .setName (TAG_KEY .getName ())
229+ .build ();
230+ OperationFuture <TagKey , DeleteTagKeyMetadata > future =
231+ tagKeysClient .deleteTagKeyOperationCallable ().futureCall (request );
232+ TagKey response = future .get ();
233+ }catch (Exception e ){
234+ System .out .printf ("Unable to delete Tag Value %s\n " , e .toString ());
235+ }
232236 }
233237
234238 private static Secret createSecret (boolean addAnnotation ) throws IOException {
0 commit comments