|
23 | 23 | import com.google.cloud.resourcemanager.v3.CreateTagKeyRequest; |
24 | 24 | import com.google.cloud.resourcemanager.v3.CreateTagValueMetadata; |
25 | 25 | import com.google.cloud.resourcemanager.v3.CreateTagValueRequest; |
| 26 | +import com.google.cloud.resourcemanager.v3.DeleteTagKeyMetadata; |
| 27 | +import com.google.cloud.resourcemanager.v3.DeleteTagKeyRequest; |
| 28 | +import com.google.cloud.resourcemanager.v3.DeleteTagValueRequest; |
| 29 | +import com.google.cloud.resourcemanager.v3.DeleteTagValueMetadata; |
26 | 30 | import com.google.api.gax.longrunning.OperationFuture; |
27 | 31 | import com.google.cloud.resourcemanager.v3.TagKey; |
28 | 32 | import com.google.cloud.resourcemanager.v3.TagKeysClient; |
@@ -203,6 +207,28 @@ private static void createTags() throws IOException{ |
203 | 207 | } |
204 | 208 |
|
205 | 209 | private static void deleteTags() throws IOException{ |
| 210 | + 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 | + } |
| 231 | + |
206 | 232 | } |
207 | 233 |
|
208 | 234 | private static Secret createSecret(boolean addAnnotation) throws IOException { |
|
0 commit comments