12
12
*/
13
13
14
14
/*
15
- * IBM OpenAPI SDK Code Generator Version: 99-SNAPSHOT-cfe3553a-20200914-135527
15
+ * IBM OpenAPI SDK Code Generator Version: 99-SNAPSHOT-9b0d887a-20200923-132457
16
16
*/
17
17
18
18
package com .ibm .cloud .platform_services .global_tagging .v1 ;
43
43
/**
44
44
* Manage your tags with the Tagging API in IBM Cloud. You can attach, detach, delete a tag or list all tags in your
45
45
* billing account with the Tagging API. The tag name must be unique within a billing account. You can create tags in
46
- * two formats: `key:value` or `label`.
46
+ * two formats: `key:value` or `label`. The tagging API supports two types of tag: `user` and `service`. `service` tags
47
+ * cannot be attached to IMS resources (see `providers=ims` query parameter). `service` tags must be in the form
48
+ * `service_prefix:tag_label` where `service_prefix` identifies the Service owning the tag.
47
49
*
48
50
* @version v1
49
51
*/
@@ -108,27 +110,33 @@ public ServiceCall<TagList> listTags(ListTagsOptions listTagsOptions) {
108
110
builder .header (header .getKey (), header .getValue ());
109
111
}
110
112
builder .header ("Accept" , "application/json" );
113
+ if (listTagsOptions .accountId () != null ) {
114
+ builder .query ("account_id" , String .valueOf (listTagsOptions .accountId ()));
115
+ }
116
+ if (listTagsOptions .tagType () != null ) {
117
+ builder .query ("tag_type" , String .valueOf (listTagsOptions .tagType ()));
118
+ }
119
+ if (listTagsOptions .fullData () != null ) {
120
+ builder .query ("full_data" , String .valueOf (listTagsOptions .fullData ()));
121
+ }
111
122
if (listTagsOptions .providers () != null ) {
112
123
builder .query ("providers" , RequestUtils .join (listTagsOptions .providers (), "," ));
113
124
}
114
125
if (listTagsOptions .attachedTo () != null ) {
115
126
builder .query ("attached_to" , String .valueOf (listTagsOptions .attachedTo ()));
116
127
}
117
- if (listTagsOptions .fullData () != null ) {
118
- builder .query ("full_data" , String .valueOf (listTagsOptions .fullData ()));
119
- }
120
128
if (listTagsOptions .offset () != null ) {
121
129
builder .query ("offset" , String .valueOf (listTagsOptions .offset ()));
122
130
}
123
131
if (listTagsOptions .limit () != null ) {
124
132
builder .query ("limit" , String .valueOf (listTagsOptions .limit ()));
125
133
}
126
- if (listTagsOptions .orderByName () != null ) {
127
- builder .query ("order_by_name" , String .valueOf (listTagsOptions .orderByName ()));
128
- }
129
134
if (listTagsOptions .timeout () != null ) {
130
135
builder .query ("timeout" , String .valueOf (listTagsOptions .timeout ()));
131
136
}
137
+ if (listTagsOptions .orderByName () != null ) {
138
+ builder .query ("order_by_name" , String .valueOf (listTagsOptions .orderByName ()));
139
+ }
132
140
if (listTagsOptions .attachedOnly () != null ) {
133
141
builder .query ("attached_only" , String .valueOf (listTagsOptions .attachedOnly ()));
134
142
}
@@ -150,9 +158,9 @@ public ServiceCall<TagList> listTags() {
150
158
}
151
159
152
160
/**
153
- * Delete unused tags.
161
+ * Delete all unused tags.
154
162
*
155
- * Delete the tags that are not attatched to any resource.
163
+ * Delete the tags that are not attached to any resource.
156
164
*
157
165
* @param deleteTagAllOptions the {@link DeleteTagAllOptions} containing the options for the call
158
166
* @return a {@link ServiceCall} with a result of type {@link DeleteTagsResult}
@@ -170,15 +178,21 @@ public ServiceCall<DeleteTagsResult> deleteTagAll(DeleteTagAllOptions deleteTagA
170
178
if (deleteTagAllOptions .providers () != null ) {
171
179
builder .query ("providers" , String .valueOf (deleteTagAllOptions .providers ()));
172
180
}
181
+ if (deleteTagAllOptions .accountId () != null ) {
182
+ builder .query ("account_id" , String .valueOf (deleteTagAllOptions .accountId ()));
183
+ }
184
+ if (deleteTagAllOptions .tagType () != null ) {
185
+ builder .query ("tag_type" , String .valueOf (deleteTagAllOptions .tagType ()));
186
+ }
173
187
ResponseConverter <DeleteTagsResult > responseConverter =
174
188
ResponseConverterUtils .getValue (new com .google .gson .reflect .TypeToken <DeleteTagsResult >() { }.getType ());
175
189
return createServiceCall (builder .build (), responseConverter );
176
190
}
177
191
178
192
/**
179
- * Delete unused tags.
193
+ * Delete all unused tags.
180
194
*
181
- * Delete the tags that are not attatched to any resource.
195
+ * Delete the tags that are not attached to any resource.
182
196
*
183
197
* @return a {@link ServiceCall} with a result of type {@link DeleteTagsResult}
184
198
*/
@@ -187,7 +201,7 @@ public ServiceCall<DeleteTagsResult> deleteTagAll() {
187
201
}
188
202
189
203
/**
190
- * Delete a tag.
204
+ * Delete an unused tag.
191
205
*
192
206
* Delete an existing tag. A tag can be deleted only if it is not attached to any resource.
193
207
*
@@ -208,18 +222,25 @@ public ServiceCall<DeleteTagResults> deleteTag(DeleteTagOptions deleteTagOptions
208
222
if (deleteTagOptions .providers () != null ) {
209
223
builder .query ("providers" , RequestUtils .join (deleteTagOptions .providers (), "," ));
210
224
}
225
+ if (deleteTagOptions .accountId () != null ) {
226
+ builder .query ("account_id" , String .valueOf (deleteTagOptions .accountId ()));
227
+ }
228
+ if (deleteTagOptions .tagType () != null ) {
229
+ builder .query ("tag_type" , String .valueOf (deleteTagOptions .tagType ()));
230
+ }
211
231
ResponseConverter <DeleteTagResults > responseConverter =
212
232
ResponseConverterUtils .getValue (new com .google .gson .reflect .TypeToken <DeleteTagResults >() { }.getType ());
213
233
return createServiceCall (builder .build (), responseConverter );
214
234
}
215
235
216
236
/**
217
- * Attach one or more tags.
237
+ * Attach tags.
218
238
*
219
- * Attaches one or more tags to one or more resources. To attach a tag to a resource managed by the Resource
220
- * Controller, you must be an editor on the resource. To attach a tag to a Cloud Foundry resource, you must have space
221
- * developer role. To attach a tag to IMS resources, depending on the resource, you need either `view hardware
222
- * details`, `view virtual server details` or `manage storage` permission.
239
+ * Attaches one or more tags to one or more resources. To attach a `user` tag on a resource, you must have the access
240
+ * listed in the [Granting users access to tag resources](https://cloud.ibm.com/docs/account?topic=account-access)
241
+ * documentation. To attach a `service` tag, you must be an authorized service. If that is the case, then you can
242
+ * attach a `service` tag with your registered `prefix` to any resource in any account. The account ID must be set
243
+ * through the `account_id` query parameter.
223
244
*
224
245
* @param attachTagOptions the {@link AttachTagOptions} containing the options for the call
225
246
* @return a {@link ServiceCall} with a result of type {@link TagResults}
@@ -233,6 +254,12 @@ public ServiceCall<TagResults> attachTag(AttachTagOptions attachTagOptions) {
233
254
builder .header (header .getKey (), header .getValue ());
234
255
}
235
256
builder .header ("Accept" , "application/json" );
257
+ if (attachTagOptions .accountId () != null ) {
258
+ builder .query ("account_id" , String .valueOf (attachTagOptions .accountId ()));
259
+ }
260
+ if (attachTagOptions .tagType () != null ) {
261
+ builder .query ("tag_type" , String .valueOf (attachTagOptions .tagType ()));
262
+ }
236
263
final JsonObject contentJson = new JsonObject ();
237
264
contentJson .add ("resources" , com .ibm .cloud .sdk .core .util .GsonSingleton .getGson ().toJsonTree (attachTagOptions .resources ()));
238
265
if (attachTagOptions .tagName () != null ) {
@@ -248,13 +275,13 @@ public ServiceCall<TagResults> attachTag(AttachTagOptions attachTagOptions) {
248
275
}
249
276
250
277
/**
251
- * Detach one or more tags.
278
+ * Detach tags.
252
279
*
253
- * Detach one or more tags from one or more resources. To detach a tag from a Resource Controller managed resource,
254
- * you must be an editor on the resource. To detach a tag to a Cloud Foundry resource, you must have `space developer`
255
- * role.
256
- * To detach a tag to IMS resources, depending on the resource, you need either `view hardware details`, `view
257
- * virtual server details` or `storage manage` permission .
280
+ * Detaches one or more tags from one or more resources. To detach a `user` tag on a resource you must have the
281
+ * permissions listed in the [Granting users access to tag
282
+ * resources](https://cloud.ibm.com/docs/account?topic=account-access) documentation. To detach a `service` tag you
283
+ * must be an authorized Service. If that is the case, then you can detach a `service` tag with your registered
284
+ * `prefix` from any resource in any account. The account ID must be set through the `account_id` query parameter .
258
285
*
259
286
* @param detachTagOptions the {@link DetachTagOptions} containing the options for the call
260
287
* @return a {@link ServiceCall} with a result of type {@link TagResults}
@@ -268,6 +295,12 @@ public ServiceCall<TagResults> detachTag(DetachTagOptions detachTagOptions) {
268
295
builder .header (header .getKey (), header .getValue ());
269
296
}
270
297
builder .header ("Accept" , "application/json" );
298
+ if (detachTagOptions .accountId () != null ) {
299
+ builder .query ("account_id" , String .valueOf (detachTagOptions .accountId ()));
300
+ }
301
+ if (detachTagOptions .tagType () != null ) {
302
+ builder .query ("tag_type" , String .valueOf (detachTagOptions .tagType ()));
303
+ }
271
304
final JsonObject contentJson = new JsonObject ();
272
305
contentJson .add ("resources" , com .ibm .cloud .sdk .core .util .GsonSingleton .getGson ().toJsonTree (detachTagOptions .resources ()));
273
306
if (detachTagOptions .tagName () != null ) {
0 commit comments