@ibm-cloud/platform-services
Version:
Node.js client library for IBM Cloud Platform Services
703 lines • 38 kB
JavaScript
/**
* (C) Copyright IBM Corp. 2025.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
/**
* IBM OpenAPI SDK Code Generator Version: 3.105.0-3c13b041-20250605-193116
*/
var extend = require("extend");
var ibm_cloud_sdk_core_1 = require("ibm-cloud-sdk-core");
var common_1 = require("../lib/common");
/**
* Manage your tags with the Tagging API in IBM Cloud. You can attach, detach, delete, or list all of the tags in your
* billing account with the Tagging API. The tag name must be unique within a billing account. You can create tags in
* two formats: `key:value` or `label`. The tagging API supports three types of tag: `user` `service`, and `access`
* tags. `service` tags cannot be attached to IMS resources. `service` tags must be in the form
* `service_prefix:tag_label` where `service_prefix` identifies the Service owning the tag. `access` tags cannot be
* attached to IMS resources. They must be in the form `key:value`. You can replace all resource's tags using the
* `replace` query parameter in the attach operation. You can update the `value` of a resource's tag in the format
* `key:value`, using the `update` query parameter in the attach operation.
*
* API Version: 1.2.0
*/
var GlobalTaggingV1 = /** @class */ (function (_super) {
__extends(GlobalTaggingV1, _super);
/**
* Construct a GlobalTaggingV1 object.
*
* @param {Object} options - Options for the service.
* @param {string} [options.serviceUrl] - The base URL for the service
* @param {OutgoingHttpHeaders} [options.headers] - Default headers that shall be included with every request to the service.
* @param {Authenticator} options.authenticator - The Authenticator object used to authenticate requests to the service
* @constructor
* @returns {GlobalTaggingV1}
*/
function GlobalTaggingV1(options) {
var _this = this;
options = options || {};
_this = _super.call(this, options) || this;
if (options.serviceUrl) {
_this.setServiceUrl(options.serviceUrl);
}
else {
_this.setServiceUrl(GlobalTaggingV1.DEFAULT_SERVICE_URL);
}
return _this;
}
/*************************
* Factory method
************************/
/**
* Constructs an instance of GlobalTaggingV1 with passed in options and external configuration.
*
* @param {UserOptions} [options] - The parameters to send to the service.
* @param {string} [options.serviceName] - The name of the service to configure
* @param {Authenticator} [options.authenticator] - The Authenticator object used to authenticate requests to the service
* @param {string} [options.serviceUrl] - The base URL for the service
* @returns {GlobalTaggingV1}
*/
GlobalTaggingV1.newInstance = function (options) {
options = options || {};
if (!options.serviceName) {
options.serviceName = this.DEFAULT_SERVICE_NAME;
}
if (!options.authenticator) {
options.authenticator = (0, ibm_cloud_sdk_core_1.getAuthenticatorFromEnvironment)(options.serviceName);
}
var service = new GlobalTaggingV1(options);
service.configureService(options.serviceName);
if (options.serviceUrl) {
service.setServiceUrl(options.serviceUrl);
}
return service;
};
/*************************
* tags
************************/
/**
* Get all tags.
*
* Lists all tags that are in a billing account. Use the `attached_to` parameter to return the list of tags that are
* attached to the specified resource.
*
* @param {Object} [params] - The parameters to send to the service.
* @param {string} [params.xRequestId] - An alphanumeric string that is used to trace the request. The value may
* include ASCII alphanumerics and any of following segment separators: space ( ), comma (,), hyphen, (-), and
* underscore (_) and may have a length up to 1024 bytes. The value is considered invalid and must be ignored if that
* value includes any other character or is longer than 1024 bytes or is fewer than 8 characters. If not specified or
* invalid, it is automatically replaced by a random (version 4) UUID.
* @param {string} [params.xCorrelationId] - An alphanumeric string that is used to trace the request as a part of a
* larger context: the same value is used for downstream requests and retries of those requests. The value may include
* ASCII alphanumerics and any of following segment separators: space ( ), comma (,), hyphen, (-), and underscore (_)
* and may have a length up to 1024 bytes. The value is considered invalid and must be ignored if that value includes
* any other character or is longer than 1024 bytes or is fewer than 8 characters. If not specified or invalid, it is
* automatically replaced by a random (version 4) UUID.
* @param {string} [params.accountId] - The ID of the billing account to list the tags for. If it is not set, then it
* is taken from the authorization token. This parameter is required if `tag_type` is set to `service`.
* @param {string} [params.tagType] - The type of the tag you want to list. Supported values are `user`, `service` and
* `access`.
* @param {boolean} [params.fullData] - If set to `true`, this query returns the provider, `ghost`, `ims` or
* `ghost,ims`, where the tag exists and the number of attached resources.
* @param {string[]} [params.providers] - Select a provider. Supported values are `ghost` and `ims`. To list both
* Global Search and Tagging tags and infrastructure tags, use `ghost,ims`. `service` and `access` tags can only be
* attached to resources that are onboarded to Global Search and Tagging, so you should not set this parameter to list
* them.
* @param {string} [params.attachedTo] - If you want to return only the list of tags that are attached to a specified
* resource, pass the ID of the resource on this parameter. For resources that are onboarded to Global Search and
* Tagging, the resource ID is the CRN; for IMS resources, it is the IMS ID. When using this parameter, you must
* specify the appropriate provider (`ims` or `ghost`).
* @param {number} [params.offset] - The offset is the index of the item from which you want to start returning data
* from.
* @param {number} [params.limit] - The number of tags to return.
* @param {number} [params.timeout] - The timeout in milliseconds, bounds the request to run within the specified time
* value. It returns the accumulated results until time runs out.
* @param {string} [params.orderByName] - Order the output by tag name.
* @param {boolean} [params.attachedOnly] - Filter on attached tags. If `true`, it returns only tags that are attached
* to one or more resources. If `false`, it returns all tags.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<GlobalTaggingV1.Response<GlobalTaggingV1.TagList>>}
*/
GlobalTaggingV1.prototype.listTags = function (params) {
var _params = __assign({}, params);
var _requiredParams = [];
var _validParams = [
'xRequestId',
'xCorrelationId',
'accountId',
'tagType',
'fullData',
'providers',
'attachedTo',
'offset',
'limit',
'timeout',
'orderByName',
'attachedOnly',
'signal',
'headers',
];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'account_id': _params.accountId,
'tag_type': _params.tagType,
'full_data': _params.fullData,
'providers': _params.providers,
'attached_to': _params.attachedTo,
'offset': _params.offset,
'limit': _params.limit,
'timeout': _params.timeout,
'order_by_name': _params.orderByName,
'attached_only': _params.attachedOnly,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(GlobalTaggingV1.DEFAULT_SERVICE_NAME, 'v1', 'listTags');
var parameters = {
options: {
url: '/v3/tags',
method: 'GET',
qs: query,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, this.baseOptions.headers, {
'Accept': 'application/json',
'x-request-id': _params.xRequestId,
'x-correlation-id': _params.xCorrelationId,
}, _params.headers),
axiosOptions: {
signal: _params.signal,
},
}),
};
return this.createRequest(parameters);
};
/**
* Create an access management tag.
*
* Create an access management tag. To create an `access` tag, you must have the access listed in the [Granting users
* access to tag resources](https://cloud.ibm.com/docs/account?topic=account-access) documentation. `service` and
* `user` tags cannot be created upfront. They are created when they are attached for the first time to a resource.
*
* @param {Object} params - The parameters to send to the service.
* @param {string[]} params.tagNames - An array of tag names to create.
* @param {string} [params.xRequestId] - An alphanumeric string that is used to trace the request. The value may
* include ASCII alphanumerics and any of following segment separators: space ( ), comma (,), hyphen, (-), and
* underscore (_) and may have a length up to 1024 bytes. The value is considered invalid and must be ignored if that
* value includes any other character or is longer than 1024 bytes or is fewer than 8 characters. If not specified or
* invalid, it is automatically replaced by a random (version 4) UUID.
* @param {string} [params.xCorrelationId] - An alphanumeric string that is used to trace the request as a part of a
* larger context: the same value is used for downstream requests and retries of those requests. The value may include
* ASCII alphanumerics and any of following segment separators: space ( ), comma (,), hyphen, (-), and underscore (_)
* and may have a length up to 1024 bytes. The value is considered invalid and must be ignored if that value includes
* any other character or is longer than 1024 bytes or is fewer than 8 characters. If not specified or invalid, it is
* automatically replaced by a random (version 4) UUID.
* @param {string} [params.accountId] - The ID of the billing account where the tag must be created.
* @param {string} [params.tagType] - The type of the tags you want to create. The only allowed value is `access`.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<GlobalTaggingV1.Response<GlobalTaggingV1.CreateTagResults>>}
*/
GlobalTaggingV1.prototype.createTag = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['tagNames'];
var _validParams = [
'tagNames',
'xRequestId',
'xCorrelationId',
'accountId',
'tagType',
'signal',
'headers',
];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var body = {
'tag_names': _params.tagNames,
};
var query = {
'account_id': _params.accountId,
'tag_type': _params.tagType,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(GlobalTaggingV1.DEFAULT_SERVICE_NAME, 'v1', 'createTag');
var parameters = {
options: {
url: '/v3/tags',
method: 'POST',
body: body,
qs: query,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, this.baseOptions.headers, {
'Accept': 'application/json',
'Content-Type': 'application/json',
'x-request-id': _params.xRequestId,
'x-correlation-id': _params.xCorrelationId,
}, _params.headers),
axiosOptions: {
signal: _params.signal,
},
}),
};
return this.createRequest(parameters);
};
/**
* Delete all unused tags.
*
* Delete the tags that are not attached to any resource.
*
* @param {Object} [params] - The parameters to send to the service.
* @param {string} [params.xRequestId] - An alphanumeric string that is used to trace the request. The value may
* include ASCII alphanumerics and any of following segment separators: space ( ), comma (,), hyphen, (-), and
* underscore (_) and may have a length up to 1024 bytes. The value is considered invalid and must be ignored if that
* value includes any other character or is longer than 1024 bytes or is fewer than 8 characters. If not specified or
* invalid, it is automatically replaced by a random (version 4) UUID.
* @param {string} [params.xCorrelationId] - An alphanumeric string that is used to trace the request as a part of a
* larger context: the same value is used for downstream requests and retries of those requests. The value may include
* ASCII alphanumerics and any of following segment separators: space ( ), comma (,), hyphen, (-), and underscore (_)
* and may have a length up to 1024 bytes. The value is considered invalid and must be ignored if that value includes
* any other character or is longer than 1024 bytes or is fewer than 8 characters. If not specified or invalid, it is
* automatically replaced by a random (version 4) UUID.
* @param {string} [params.providers] - Select a provider. Supported values are `ghost` and `ims`.
* @param {string} [params.accountId] - The ID of the billing account to delete the tags for. If it is not set, then
* it is taken from the authorization token. It is a required parameter if `tag_type` is set to `service`.
* @param {string} [params.tagType] - The type of the tag. Supported values are `user`, `service` and `access`.
* `service` and `access` are not supported for IMS resources (`providers` parameter set to `ims`).
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<GlobalTaggingV1.Response<GlobalTaggingV1.DeleteTagsResult>>}
*/
GlobalTaggingV1.prototype.deleteTagAll = function (params) {
var _params = __assign({}, params);
var _requiredParams = [];
var _validParams = [
'xRequestId',
'xCorrelationId',
'providers',
'accountId',
'tagType',
'signal',
'headers',
];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'providers': _params.providers,
'account_id': _params.accountId,
'tag_type': _params.tagType,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(GlobalTaggingV1.DEFAULT_SERVICE_NAME, 'v1', 'deleteTagAll');
var parameters = {
options: {
url: '/v3/tags',
method: 'DELETE',
qs: query,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, this.baseOptions.headers, {
'Accept': 'application/json',
'x-request-id': _params.xRequestId,
'x-correlation-id': _params.xCorrelationId,
}, _params.headers),
axiosOptions: {
signal: _params.signal,
},
}),
};
return this.createRequest(parameters);
};
/**
* Delete an unused tag.
*
* Delete an existing tag. A tag can be deleted only if it is not attached to any resource.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.tagName - The name of tag to be deleted.
* @param {string} [params.xRequestId] - An alphanumeric string that is used to trace the request. The value may
* include ASCII alphanumerics and any of following segment separators: space ( ), comma (,), hyphen, (-), and
* underscore (_) and may have a length up to 1024 bytes. The value is considered invalid and must be ignored if that
* value includes any other character or is longer than 1024 bytes or is fewer than 8 characters. If not specified or
* invalid, it is automatically replaced by a random (version 4) UUID.
* @param {string} [params.xCorrelationId] - An alphanumeric string that is used to trace the request as a part of a
* larger context: the same value is used for downstream requests and retries of those requests. The value may include
* ASCII alphanumerics and any of following segment separators: space ( ), comma (,), hyphen, (-), and underscore (_)
* and may have a length up to 1024 bytes. The value is considered invalid and must be ignored if that value includes
* any other character or is longer than 1024 bytes or is fewer than 8 characters. If not specified or invalid, it is
* automatically replaced by a random (version 4) UUID.
* @param {string[]} [params.providers] - Select a provider. Supported values are `ghost` and `ims`. To delete tags
* both in Global Search and Tagging and in IMS, use `ghost,ims`.
* @param {string} [params.accountId] - The ID of the billing account to delete the tag for. It is a required
* parameter if `tag_type` is set to `service`, otherwise it is inferred from the authorization IAM token.
* @param {string} [params.tagType] - The type of the tag. Supported values are `user`, `service` and `access`.
* `service` and `access` are not supported for IMS resources (`providers` parameter set to `ims`).
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<GlobalTaggingV1.Response<GlobalTaggingV1.DeleteTagResults>>}
*/
GlobalTaggingV1.prototype.deleteTag = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['tagName'];
var _validParams = [
'tagName',
'xRequestId',
'xCorrelationId',
'providers',
'accountId',
'tagType',
'signal',
'headers',
];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'providers': _params.providers,
'account_id': _params.accountId,
'tag_type': _params.tagType,
};
var path = {
'tag_name': _params.tagName,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(GlobalTaggingV1.DEFAULT_SERVICE_NAME, 'v1', 'deleteTag');
var parameters = {
options: {
url: '/v3/tags/{tag_name}',
method: 'DELETE',
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, this.baseOptions.headers, {
'Accept': 'application/json',
'x-request-id': _params.xRequestId,
'x-correlation-id': _params.xCorrelationId,
}, _params.headers),
axiosOptions: {
signal: _params.signal,
},
}),
};
return this.createRequest(parameters);
};
/**
* Attach tags.
*
* Attaches one or more tags to one or more resources. Each resource can have no more than 1000 tags per each 'user'
* and 'service' type, and no more than 250 'access' tags (which is the account limit).
*
* @param {Object} [params] - The parameters to send to the service.
* @param {string} [params.tagName] - The name of the tag to attach.
* @param {string[]} [params.tagNames] - An array of tag names to attach.
* @param {Resource[]} [params.resources] - List of resources on which the tagging operation operates on.
* @param {QueryString} [params.query] - A valid Global Search string.
* @param {string} [params.xRequestId] - An alphanumeric string that is used to trace the request. The value may
* include ASCII alphanumerics and any of following segment separators: space ( ), comma (,), hyphen, (-), and
* underscore (_) and may have a length up to 1024 bytes. The value is considered invalid and must be ignored if that
* value includes any other character or is longer than 1024 bytes or is fewer than 8 characters. If not specified or
* invalid, it is automatically replaced by a random (version 4) UUID.
* @param {string} [params.xCorrelationId] - An alphanumeric string that is used to trace the request as a part of a
* larger context: the same value is used for downstream requests and retries of those requests. The value may include
* ASCII alphanumerics and any of following segment separators: space ( ), comma (,), hyphen, (-), and underscore (_)
* and may have a length up to 1024 bytes. The value is considered invalid and must be ignored if that value includes
* any other character or is longer than 1024 bytes or is fewer than 8 characters. If not specified or invalid, it is
* automatically replaced by a random (version 4) UUID.
* @param {string} [params.accountId] - The ID of the billing account of the tagged resource. It is a required
* parameter if `tag_type` is set to `service`. Otherwise, it is inferred from the authorization IAM token.
* @param {string} [params.tagType] - The type of the tag. Supported values are `user`, `service` and `access`.
* `service` and `access` are not supported for IMS resources.
* @param {boolean} [params.replace] - Flag to request replacement of all attached tags. Set `true` if you want to
* replace all tags attached to the resource with the current ones. Default value is false.
* @param {boolean} [params.update] - Flag to request update of attached tags in the format `key:value`. Here's how it
* works for each tag in the request body: If the tag to attach is in the format `key:value`, the System will
* atomically detach all existing tags starting with `key:` and attach the new `key:value` tag. If no such tags exist,
* a new `key:value` tag will be attached. If the tag is not in the `key:value` format (e.g., a simple label), the
* System will attach the label as usual. The update query parameter is available for user and access management tags,
* but not for service tags.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<GlobalTaggingV1.Response<GlobalTaggingV1.TagResults>>}
*/
GlobalTaggingV1.prototype.attachTag = function (params) {
var _params = __assign({}, params);
var _requiredParams = [];
var _validParams = [
'tagName',
'tagNames',
'resources',
'query',
'xRequestId',
'xCorrelationId',
'accountId',
'tagType',
'replace',
'update',
'signal',
'headers',
];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var body = {
'tag_name': _params.tagName,
'tag_names': _params.tagNames,
'resources': _params.resources,
'query': _params.query,
};
var query = {
'account_id': _params.accountId,
'tag_type': _params.tagType,
'replace': _params.replace,
'update': _params.update,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(GlobalTaggingV1.DEFAULT_SERVICE_NAME, 'v1', 'attachTag');
var parameters = {
options: {
url: '/v3/tags/attach',
method: 'POST',
body: body,
qs: query,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, this.baseOptions.headers, {
'Accept': 'application/json',
'Content-Type': 'application/json',
'x-request-id': _params.xRequestId,
'x-correlation-id': _params.xCorrelationId,
}, _params.headers),
axiosOptions: {
signal: _params.signal,
},
}),
};
return this.createRequest(parameters);
};
/**
* Detach tags.
*
* Detaches one or more tags from one or more resources.
*
* @param {Object} [params] - The parameters to send to the service.
* @param {string} [params.tagName] - The name of the tag to detach.
* @param {string[]} [params.tagNames] - An array of tag names to detach.
* @param {Resource[]} [params.resources] - List of resources on which the tagging operation operates on.
* @param {QueryString} [params.query] - A valid Global Search string.
* @param {string} [params.xRequestId] - An alphanumeric string that is used to trace the request. The value may
* include ASCII alphanumerics and any of following segment separators: space ( ), comma (,), hyphen, (-), and
* underscore (_) and may have a length up to 1024 bytes. The value is considered invalid and must be ignored if that
* value includes any other character or is longer than 1024 bytes or is fewer than 8 characters. If not specified or
* invalid, it is automatically replaced by a random (version 4) UUID.
* @param {string} [params.xCorrelationId] - An alphanumeric string that is used to trace the request as a part of a
* larger context: the same value is used for downstream requests and retries of those requests. The value may include
* ASCII alphanumerics and any of following segment separators: space ( ), comma (,), hyphen, (-), and underscore (_)
* and may have a length up to 1024 bytes. The value is considered invalid and must be ignored if that value includes
* any other character or is longer than 1024 bytes or is fewer than 8 characters. If not specified or invalid, it is
* automatically replaced by a random (version 4) UUID.
* @param {string} [params.accountId] - The ID of the billing account of the untagged resource. It is a required
* parameter if `tag_type` is set to `service`, otherwise it is inferred from the authorization IAM token.
* @param {string} [params.tagType] - The type of the tag. Supported values are `user`, `service` and `access`.
* `service` and `access` are not supported for IMS resources.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<GlobalTaggingV1.Response<GlobalTaggingV1.TagResults>>}
*/
GlobalTaggingV1.prototype.detachTag = function (params) {
var _params = __assign({}, params);
var _requiredParams = [];
var _validParams = [
'tagName',
'tagNames',
'resources',
'query',
'xRequestId',
'xCorrelationId',
'accountId',
'tagType',
'signal',
'headers',
];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var body = {
'tag_name': _params.tagName,
'tag_names': _params.tagNames,
'resources': _params.resources,
'query': _params.query,
};
var query = {
'account_id': _params.accountId,
'tag_type': _params.tagType,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(GlobalTaggingV1.DEFAULT_SERVICE_NAME, 'v1', 'detachTag');
var parameters = {
options: {
url: '/v3/tags/detach',
method: 'POST',
body: body,
qs: query,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, this.baseOptions.headers, {
'Accept': 'application/json',
'Content-Type': 'application/json',
'x-request-id': _params.xRequestId,
'x-correlation-id': _params.xCorrelationId,
}, _params.headers),
axiosOptions: {
signal: _params.signal,
},
}),
};
return this.createRequest(parameters);
};
GlobalTaggingV1.DEFAULT_SERVICE_URL = 'https://tags.global-search-tagging.cloud.ibm.com';
GlobalTaggingV1.DEFAULT_SERVICE_NAME = 'global_tagging';
return GlobalTaggingV1;
}(ibm_cloud_sdk_core_1.BaseService));
/*************************
* interfaces
************************/
(function (GlobalTaggingV1) {
/** Constants for the `listTags` operation. */
var ListTagsConstants;
(function (ListTagsConstants) {
/** The type of the tag you want to list. Supported values are `user`, `service` and `access`. */
var TagType;
(function (TagType) {
TagType["USER"] = "user";
TagType["SERVICE"] = "service";
TagType["ACCESS"] = "access";
})(TagType = ListTagsConstants.TagType || (ListTagsConstants.TagType = {}));
/** Select a provider. Supported values are `ghost` and `ims`. To list both Global Search and Tagging tags and infrastructure tags, use `ghost,ims`. `service` and `access` tags can only be attached to resources that are onboarded to Global Search and Tagging, so you should not set this parameter to list them. */
var Providers;
(function (Providers) {
Providers["GHOST"] = "ghost";
Providers["IMS"] = "ims";
})(Providers = ListTagsConstants.Providers || (ListTagsConstants.Providers = {}));
/** Order the output by tag name. */
var OrderByName;
(function (OrderByName) {
OrderByName["ASC"] = "asc";
OrderByName["DESC"] = "desc";
})(OrderByName = ListTagsConstants.OrderByName || (ListTagsConstants.OrderByName = {}));
})(ListTagsConstants = GlobalTaggingV1.ListTagsConstants || (GlobalTaggingV1.ListTagsConstants = {}));
/** Constants for the `createTag` operation. */
var CreateTagConstants;
(function (CreateTagConstants) {
/** The type of the tags you want to create. The only allowed value is `access`. */
var TagType;
(function (TagType) {
TagType["ACCESS"] = "access";
})(TagType = CreateTagConstants.TagType || (CreateTagConstants.TagType = {}));
})(CreateTagConstants = GlobalTaggingV1.CreateTagConstants || (GlobalTaggingV1.CreateTagConstants = {}));
/** Constants for the `deleteTagAll` operation. */
var DeleteTagAllConstants;
(function (DeleteTagAllConstants) {
/** Select a provider. Supported values are `ghost` and `ims`. */
var Providers;
(function (Providers) {
Providers["GHOST"] = "ghost";
Providers["IMS"] = "ims";
})(Providers = DeleteTagAllConstants.Providers || (DeleteTagAllConstants.Providers = {}));
/** The type of the tag. Supported values are `user`, `service` and `access`. `service` and `access` are not supported for IMS resources (`providers` parameter set to `ims`). */
var TagType;
(function (TagType) {
TagType["USER"] = "user";
TagType["SERVICE"] = "service";
TagType["ACCESS"] = "access";
})(TagType = DeleteTagAllConstants.TagType || (DeleteTagAllConstants.TagType = {}));
})(DeleteTagAllConstants = GlobalTaggingV1.DeleteTagAllConstants || (GlobalTaggingV1.DeleteTagAllConstants = {}));
/** Constants for the `deleteTag` operation. */
var DeleteTagConstants;
(function (DeleteTagConstants) {
/** Select a provider. Supported values are `ghost` and `ims`. To delete tags both in Global Search and Tagging and in IMS, use `ghost,ims`. */
var Providers;
(function (Providers) {
Providers["GHOST"] = "ghost";
Providers["IMS"] = "ims";
})(Providers = DeleteTagConstants.Providers || (DeleteTagConstants.Providers = {}));
/** The type of the tag. Supported values are `user`, `service` and `access`. `service` and `access` are not supported for IMS resources (`providers` parameter set to `ims`). */
var TagType;
(function (TagType) {
TagType["USER"] = "user";
TagType["SERVICE"] = "service";
TagType["ACCESS"] = "access";
})(TagType = DeleteTagConstants.TagType || (DeleteTagConstants.TagType = {}));
})(DeleteTagConstants = GlobalTaggingV1.DeleteTagConstants || (GlobalTaggingV1.DeleteTagConstants = {}));
/** Constants for the `attachTag` operation. */
var AttachTagConstants;
(function (AttachTagConstants) {
/** The type of the tag. Supported values are `user`, `service` and `access`. `service` and `access` are not supported for IMS resources. */
var TagType;
(function (TagType) {
TagType["USER"] = "user";
TagType["SERVICE"] = "service";
TagType["ACCESS"] = "access";
})(TagType = AttachTagConstants.TagType || (AttachTagConstants.TagType = {}));
})(AttachTagConstants = GlobalTaggingV1.AttachTagConstants || (GlobalTaggingV1.AttachTagConstants = {}));
/** Constants for the `detachTag` operation. */
var DetachTagConstants;
(function (DetachTagConstants) {
/** The type of the tag. Supported values are `user`, `service` and `access`. `service` and `access` are not supported for IMS resources. */
var TagType;
(function (TagType) {
TagType["USER"] = "user";
TagType["SERVICE"] = "service";
TagType["ACCESS"] = "access";
})(TagType = DetachTagConstants.TagType || (DetachTagConstants.TagType = {}));
})(DetachTagConstants = GlobalTaggingV1.DetachTagConstants || (GlobalTaggingV1.DetachTagConstants = {}));
var DeleteTagResultsItem;
(function (DeleteTagResultsItem) {
var Constants;
(function (Constants) {
/** The provider of the tag. */
var Provider;
(function (Provider) {
Provider["GHOST"] = "ghost";
Provider["IMS"] = "ims";
})(Provider = Constants.Provider || (Constants.Provider = {}));
})(Constants = DeleteTagResultsItem.Constants || (DeleteTagResultsItem.Constants = {}));
})(DeleteTagResultsItem = GlobalTaggingV1.DeleteTagResultsItem || (GlobalTaggingV1.DeleteTagResultsItem = {}));
})(GlobalTaggingV1 || (GlobalTaggingV1 = {}));
module.exports = GlobalTaggingV1;
//# sourceMappingURL=v1.js.map
;