@ibm-cloud/platform-services
Version:
Node.js client library for IBM Cloud Platform Services
1,044 lines (1,043 loc) • 58.3 kB
JavaScript
"use strict";
/**
* (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.106.0-09823488-20250707-071701
*/
var extend = require("extend");
var ibm_cloud_sdk_core_1 = require("ibm-cloud-sdk-core");
var common_1 = require("../lib/common");
/**
* The catalog service manages offerings across geographies as the system of record. The catalog supports a RESTful API
* where users can retrieve information about existing offerings and create, manage, and delete their offerings. Start
* with the base URL and use the endpoints to retrieve metadata about services in the catalog and manage service
* visbility. Depending on the kind of object, the metadata can include information about pricing, provisioning,
* regions, and more. For more information, see the [catalog
* documentation](https://cloud.ibm.com/docs/overview/catalog.html#global-catalog-overview).
*
* API Version: 1.0.3
*/
var GlobalCatalogV1 = /** @class */ (function (_super) {
__extends(GlobalCatalogV1, _super);
/**
* Construct a GlobalCatalogV1 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 {GlobalCatalogV1}
*/
function GlobalCatalogV1(options) {
var _this = this;
options = options || {};
_this = _super.call(this, options) || this;
if (options.serviceUrl) {
_this.setServiceUrl(options.serviceUrl);
}
else {
_this.setServiceUrl(GlobalCatalogV1.DEFAULT_SERVICE_URL);
}
return _this;
}
/*************************
* Factory method
************************/
/**
* Constructs an instance of GlobalCatalogV1 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 {GlobalCatalogV1}
*/
GlobalCatalogV1.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 GlobalCatalogV1(options);
service.configureService(options.serviceName);
if (options.serviceUrl) {
service.setServiceUrl(options.serviceUrl);
}
return service;
};
/*************************
* object
************************/
/**
* Returns parent catalog entries.
*
* Includes key information, such as ID, name, kind, CRN, tags, and provider. This endpoint is ETag enabled.
*
* @param {Object} [params] - The parameters to send to the service.
* @param {string} [params.account] - This changes the scope of the request regardless of the authorization header.
* Example scopes are `account` and `global`. `account=global` is reqired if operating with a service ID that has a
* global admin policy, for example `GET /?account=global`.
* @param {string} [params.include] - A GET call by default returns a basic set of properties. To include other
* properties, you must add this parameter. A wildcard (`*`) includes all properties for an object, for example `GET
* /?include=*`. To include specific metadata fields, separate each field with a colon (:), for example `GET
* /?include=metadata.ui:metadata.pricing`.
* @param {string} [params.q] - Searches the catalog entries for keywords. Add filters to refine your search. A query
* filter, for example, `q=kind:iaas service_name rc:true`, filters entries of kind iaas with
* metadata.service.rc_compatible set to true and have a service name is in their name, display name, or description.
* Valid tags are **kind**:<string>, **tag**:<strging>, **rc**:[true|false], **iam**:[true|false],
* **active**:[true|false], **geo**:<string>, and **price**:<string>.
* @param {string} [params.sortBy] - The field on which the output is sorted. Sorts by default by **name** property.
* Available fields are **name**, **displayname** (overview_ui.display_name), **kind**, **provider** (provider.name),
* **sbsindex** (metadata.ui.side_by_side_index), and the time **created**, and **updated**.
* @param {string} [params.descending] - Sets the sort order. The default is false, which is ascending.
* @param {string} [params.languages] - Return the data strings in a specified language. By default, the strings
* returned are of the language preferred by your browser through the Accept-Language header, which allows an override
* of the header. Languages are specified in standard form, such as `en-us`. To include all languages use a wildcard
* (*).
* @param {boolean} [params.catalog] - Checks to see if a catalog's object is visible, or if it's filtered by service,
* plan, deployment, or region. Use the value `?catalog=true`. If a `200` code is returned, the object is visible. If
* a `403` code is returned, the object is not visible for the user.
* @param {boolean} [params.complete] - Returns all available fields for all languages. Use the value `?complete=true`
* as shortcut for ?include=*&languages=*.
* @param {number} [params.offset] - Useful for pagination, specifies index (origin 0) of first item to return in
* response.
* @param {number} [params.limit] - Useful for pagination, specifies the maximum number of items to return in the
* response.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<GlobalCatalogV1.Response<GlobalCatalogV1.EntrySearchResult>>}
*/
GlobalCatalogV1.prototype.listCatalogEntries = function (params) {
var _params = __assign({}, params);
var _requiredParams = [];
var _validParams = [
'account',
'include',
'q',
'sortBy',
'descending',
'languages',
'catalog',
'complete',
'offset',
'limit',
'signal',
'headers',
];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'account': _params.account,
'include': _params.include,
'q': _params.q,
'sort-by': _params.sortBy,
'descending': _params.descending,
'languages': _params.languages,
'catalog': _params.catalog,
'complete': _params.complete,
'_offset': _params.offset,
'_limit': _params.limit,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(GlobalCatalogV1.DEFAULT_SERVICE_NAME, 'v1', 'listCatalogEntries');
var parameters = {
options: {
url: '/',
method: 'GET',
qs: query,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, this.baseOptions.headers, {
'Accept': 'application/json',
}, _params.headers),
axiosOptions: {
signal: _params.signal,
},
}),
};
return this.createRequest(parameters);
};
/**
* Create a catalog entry.
*
* The created catalog entry is restricted by default. You must have an administrator or editor role in the scope of
* the provided token. This API will return an ETag that can be used for standard ETag processing, except when depth
* query is used.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.name - Programmatic name for this catalog entry, which must be formatted like a CRN segment.
* See the display name in OverviewUI for a user-readable name.
* @param {string} params.kind - The type of catalog entry which determines the type and shape of the object. Valid GC
* types are buildpack, cname, dataset, geography, iaas, platform_service, runtime, service, template, ui-dashboard.
* @param {JsonObject} params.overviewUi - Overview is nested in the top level. The key value pair is
* `[_language_]overview_ui`.
* @param {Image} params.images - Image annotation for this catalog entry. The image is a URL.
* @param {boolean} params.disabled - Boolean value that determines the global visibility for the catalog entry, and
* its children. If it is not enabled, all plans are disabled.
* @param {string[]} params.tags - A searchable list of tags. For example, IBM, 3rd Party, Beta, GA, and Single
* Tenant. Valid values found at https://globalcatalog.test.cloud.ibm.com/search.
* @param {Provider} params.provider - Information related to the provider associated with a catalog entry.
* @param {string} params.id - Catalog entry's unique ID. It's the same across all catalog instances.
* @param {string} [params.parentId] - The ID of the parent catalog entry if it exists.
* @param {boolean} [params.group] - Boolean value that determines whether the catalog entry is a group.
* @param {boolean} [params.active] - Boolean value that describes whether the service is active.
* @param {string} [params.url] - Url of the object.
* @param {ObjectMetadataSet} [params.metadata] - Model used to describe metadata object that can be set.
* @param {string} [params.account] - This changes the scope of the request regardless of the authorization header.
* Example scopes are `account` and `global`. `account=global` is reqired if operating with a service ID that has a
* global admin policy, for example `GET /?account=global`.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<GlobalCatalogV1.Response<GlobalCatalogV1.CatalogEntry>>}
*/
GlobalCatalogV1.prototype.createCatalogEntry = function (params) {
var _params = __assign({}, params);
var _requiredParams = [
'name',
'kind',
'overviewUi',
'images',
'disabled',
'tags',
'provider',
'id',
];
var _validParams = [
'name',
'kind',
'overviewUi',
'images',
'disabled',
'tags',
'provider',
'id',
'parentId',
'group',
'active',
'url',
'metadata',
'account',
'signal',
'headers',
];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var body = {
'name': _params.name,
'kind': _params.kind,
'overview_ui': _params.overviewUi,
'images': _params.images,
'disabled': _params.disabled,
'tags': _params.tags,
'provider': _params.provider,
'id': _params.id,
'parent_id': _params.parentId,
'group': _params.group,
'active': _params.active,
'url': _params.url,
'metadata': _params.metadata,
};
var query = {
'account': _params.account,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(GlobalCatalogV1.DEFAULT_SERVICE_NAME, 'v1', 'createCatalogEntry');
var parameters = {
options: {
url: '/',
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',
}, _params.headers),
axiosOptions: {
signal: _params.signal,
},
}),
};
return this.createRequest(parameters);
};
/**
* Get a specific catalog object.
*
* This endpoint returns a specific catalog entry using the object's unique identifier, for example
* `/_*service_name*?complete=true`. This endpoint is ETag enabled. This can be used by an unauthenticated user for
* publicly available services.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.id - The catalog entry's unique ID.
* @param {string} [params.account] - This changes the scope of the request regardless of the authorization header.
* Example scopes are `account` and `global`. `account=global` is reqired if operating with a service ID that has a
* global admin policy, for example `GET /?account=global`.
* @param {string} [params.include] - A GET call by default returns a basic set of properties. To include other
* properties, you must add this parameter. A wildcard (`*`) includes all properties for an object, for example `GET
* /id?include=*`. To include specific metadata fields, separate each field with a colon (:), for example `GET
* /id?include=metadata.ui:metadata.pricing`.
* @param {string} [params.languages] - Return the data strings in the specified language. By default the strings
* returned are of the language preferred by your browser through the Accept-Language header, which allows an override
* of the header. Languages are specified in standard form, such as `en-us`. To include all languages use a wildcard
* (*).
* @param {boolean} [params.complete] - Returns all available fields for all languages. Use the value `?complete=true`
* as shortcut for ?include=*&languages=*.
* @param {number} [params.depth] - Return the children down to the requested depth. Use * to include the entire
* children tree. If there are more children than the maximum permitted an error will be returned. Be judicious with
* this as it can cause a large number of database accesses and can result in a large amount of data returned.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<GlobalCatalogV1.Response<GlobalCatalogV1.CatalogEntry>>}
*/
GlobalCatalogV1.prototype.getCatalogEntry = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['id'];
var _validParams = [
'id',
'account',
'include',
'languages',
'complete',
'depth',
'signal',
'headers',
];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'account': _params.account,
'include': _params.include,
'languages': _params.languages,
'complete': _params.complete,
'depth': _params.depth,
};
var path = {
'id': _params.id,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(GlobalCatalogV1.DEFAULT_SERVICE_NAME, 'v1', 'getCatalogEntry');
var parameters = {
options: {
url: '/{id}',
method: 'GET',
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, this.baseOptions.headers, {
'Accept': 'application/json',
}, _params.headers),
axiosOptions: {
signal: _params.signal,
},
}),
};
return this.createRequest(parameters);
};
/**
* Update a catalog entry.
*
* Update a catalog entry. The visibility of the catalog entry cannot be modified with this endpoint. You must be an
* administrator or editor in the scope of the provided token. This endpoint is ETag enabled.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.id - The object's unique ID.
* @param {string} params.name - Programmatic name for this catalog entry, which must be formatted like a CRN segment.
* See the display name in OverviewUI for a user-readable name.
* @param {string} params.kind - The type of catalog entry which determines the type and shape of the object. Valid GC
* types are buildpack, cname, dataset, geography, iaas, platform_service, runtime, service, template, ui-dashboard.
* @param {JsonObject} params.overviewUi - Overview is nested in the top level. The key value pair is
* `[_language_]overview_ui`.
* @param {Image} params.images - Image annotation for this catalog entry. The image is a URL.
* @param {boolean} params.disabled - Boolean value that determines the global visibility for the catalog entry, and
* its children. If it is not enabled, all plans are disabled.
* @param {string[]} params.tags - A searchable list of tags. For example, IBM, 3rd Party, Beta, GA, and Single
* Tenant. Valid values found at https://globalcatalog.test.cloud.ibm.com/search.
* @param {Provider} params.provider - Information related to the provider associated with a catalog entry.
* @param {string} [params.parentId] - The ID of the parent catalog entry if it exists.
* @param {boolean} [params.group] - Boolean value that determines whether the catalog entry is a group.
* @param {boolean} [params.active] - Boolean value that describes whether the service is active.
* @param {string} [params.url] - Url of the object.
* @param {ObjectMetadataSet} [params.metadata] - Model used to describe metadata object that can be set.
* @param {string} [params.account] - This changes the scope of the request regardless of the authorization header.
* Example scopes are `account` and `global`. `account=global` is reqired if operating with a service ID that has a
* global admin policy, for example `GET /?account=global`.
* @param {string} [params.move] - Reparenting object. In the body set the parent_id to a different parent. Or remove
* the parent_id field to reparent to the root of the catalog. If this is not set to 'true' then changing the
* parent_id in the body of the request will not be permitted. If this is 'true' and no change to parent_id then this
* is also error. This is to prevent accidental changing of parent.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<GlobalCatalogV1.Response<GlobalCatalogV1.CatalogEntry>>}
*/
GlobalCatalogV1.prototype.updateCatalogEntry = function (params) {
var _params = __assign({}, params);
var _requiredParams = [
'id',
'name',
'kind',
'overviewUi',
'images',
'disabled',
'tags',
'provider',
];
var _validParams = [
'id',
'name',
'kind',
'overviewUi',
'images',
'disabled',
'tags',
'provider',
'parentId',
'group',
'active',
'url',
'metadata',
'account',
'move',
'signal',
'headers',
];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var body = {
'name': _params.name,
'kind': _params.kind,
'overview_ui': _params.overviewUi,
'images': _params.images,
'disabled': _params.disabled,
'tags': _params.tags,
'provider': _params.provider,
'parent_id': _params.parentId,
'group': _params.group,
'active': _params.active,
'url': _params.url,
'metadata': _params.metadata,
};
var query = {
'account': _params.account,
'move': _params.move,
};
var path = {
'id': _params.id,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(GlobalCatalogV1.DEFAULT_SERVICE_NAME, 'v1', 'updateCatalogEntry');
var parameters = {
options: {
url: '/{id}',
method: 'PUT',
body: body,
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, this.baseOptions.headers, {
'Accept': 'application/json',
'Content-Type': 'application/json',
}, _params.headers),
axiosOptions: {
signal: _params.signal,
},
}),
};
return this.createRequest(parameters);
};
/**
* Delete a catalog entry.
*
* Delete a catalog entry. This will archive the catalog entry for a minimum of two weeks. While archived, it can be
* restored using the PUT restore API. After two weeks, it will be deleted and cannot be restored. You must have
* administrator role in the scope of the provided token to modify it. This endpoint is ETag enabled.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.id - The object's unique ID.
* @param {string} [params.account] - This changes the scope of the request regardless of the authorization header.
* Example scopes are `account` and `global`. `account=global` is reqired if operating with a service ID that has a
* global admin policy, for example `GET /?account=global`.
* @param {boolean} [params.force] - This will cause entry to be deleted fully. By default it is archived for two
* weeks, so that it can be restored if necessary.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<GlobalCatalogV1.Response<GlobalCatalogV1.EmptyObject>>}
*/
GlobalCatalogV1.prototype.deleteCatalogEntry = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['id'];
var _validParams = ['id', 'account', 'force', 'signal', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'account': _params.account,
'force': _params.force,
};
var path = {
'id': _params.id,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(GlobalCatalogV1.DEFAULT_SERVICE_NAME, 'v1', 'deleteCatalogEntry');
var parameters = {
options: {
url: '/{id}',
method: 'DELETE',
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, this.baseOptions.headers, {}, _params.headers),
axiosOptions: {
signal: _params.signal,
},
}),
};
return this.createRequest(parameters);
};
/**
* Get child catalog entries of a specific kind.
*
* Fetch child catalog entries for a catalog entry with a specific id. This endpoint is ETag enabled. This can be used
* by an unauthenticated user for publicly available services.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.id - The parent catalog entry's ID.
* @param {string} params.kind - The **kind** of child catalog entries to search for. A wildcard (*) includes all
* child catalog entries for all kinds, for example `GET /service_name/_*`.
* @param {string} [params.account] - This changes the scope of the request regardless of the authorization header.
* Example scopes are `account` and `global`. `account=global` is reqired if operating with a service ID that has a
* global admin policy, for example `GET /?account=global`.
* @param {string} [params.include] - A colon (:) separated list of properties to include. A GET call by defaults
* return a limited set of properties. To include other properties, you must add the include parameter. A wildcard
* (*) includes all properties.
* @param {string} [params.q] - A query filter, for example, `q=kind:iaas IBM` will filter on entries of **kind**
* iaas that has `IBM` in their name, display name, or description.
* @param {string} [params.sortBy] - The field on which to sort the output. By default by name. Available fields are
* **name**, **kind**, and **provider**.
* @param {string} [params.descending] - The sort order. The default is false, which is ascending.
* @param {string} [params.languages] - Return the data strings in the specified language. By default the strings
* returned are of the language preferred by your browser through the Accept-Language header. This allows an override
* of the header. Languages are specified in standard form, such as `en-us`. To include all languages use the wildcard
* (*).
* @param {boolean} [params.complete] - Use the value `?complete=true` as shortcut for ?include=*&languages=*.
* @param {number} [params.offset] - Useful for pagination, specifies index (origin 0) of first item to return in
* response.
* @param {number} [params.limit] - Useful for pagination, specifies the maximum number of items to return in the
* response.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<GlobalCatalogV1.Response<GlobalCatalogV1.EntrySearchResult>>}
*/
GlobalCatalogV1.prototype.getChildObjects = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['id', 'kind'];
var _validParams = [
'id',
'kind',
'account',
'include',
'q',
'sortBy',
'descending',
'languages',
'complete',
'offset',
'limit',
'signal',
'headers',
];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'account': _params.account,
'include': _params.include,
'q': _params.q,
'sort-by': _params.sortBy,
'descending': _params.descending,
'languages': _params.languages,
'complete': _params.complete,
'_offset': _params.offset,
'_limit': _params.limit,
};
var path = {
'id': _params.id,
'kind': _params.kind,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(GlobalCatalogV1.DEFAULT_SERVICE_NAME, 'v1', 'getChildObjects');
var parameters = {
options: {
url: '/{id}/{kind}',
method: 'GET',
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, this.baseOptions.headers, {
'Accept': 'application/json',
}, _params.headers),
axiosOptions: {
signal: _params.signal,
},
}),
};
return this.createRequest(parameters);
};
/**
* Restore archived catalog entry.
*
* Restore an archived catalog entry. You must have an administrator role in the scope of the provided token.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.id - The catalog entry's unique ID.
* @param {string} [params.account] - This changes the scope of the request regardless of the authorization header.
* Example scopes are `account` and `global`. `account=global` is reqired if operating with a service ID that has a
* global admin policy, for example `GET /?account=global`.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<GlobalCatalogV1.Response<GlobalCatalogV1.EmptyObject>>}
*/
GlobalCatalogV1.prototype.restoreCatalogEntry = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['id'];
var _validParams = ['id', 'account', 'signal', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'account': _params.account,
};
var path = {
'id': _params.id,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(GlobalCatalogV1.DEFAULT_SERVICE_NAME, 'v1', 'restoreCatalogEntry');
var parameters = {
options: {
url: '/{id}/restore',
method: 'PUT',
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, this.baseOptions.headers, {}, _params.headers),
axiosOptions: {
signal: _params.signal,
},
}),
};
return this.createRequest(parameters);
};
/*************************
* visibility
************************/
/**
* Get the visibility constraints for an object.
*
* This endpoint returns the visibility rules for this object. Overall visibility is determined by the parent objects
* and any further restrictions on this object. You must have an administrator role in the scope of the provided
* token. This endpoint is ETag enabled.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.id - The object's unique ID.
* @param {string} [params.account] - This changes the scope of the request regardless of the authorization header.
* Example scopes are `account` and `global`. `account=global` is reqired if operating with a service ID that has a
* global admin policy, for example `GET /?account=global`.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<GlobalCatalogV1.Response<GlobalCatalogV1.Visibility>>}
*/
GlobalCatalogV1.prototype.getVisibility = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['id'];
var _validParams = ['id', 'account', 'signal', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'account': _params.account,
};
var path = {
'id': _params.id,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(GlobalCatalogV1.DEFAULT_SERVICE_NAME, 'v1', 'getVisibility');
var parameters = {
options: {
url: '/{id}/visibility',
method: 'GET',
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, this.baseOptions.headers, {
'Accept': 'application/json',
}, _params.headers),
axiosOptions: {
signal: _params.signal,
},
}),
};
return this.createRequest(parameters);
};
/**
* Update visibility.
*
* Update an Object's Visibility. You must have an administrator role in the scope of the provided token. This
* endpoint is ETag enabled.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.id - The object's unique ID.
* @param {string} [params.restrictions] - This controls the overall visibility. It is an enum of *public*,
* *nonibm_only*, *ibm_only*, and *private*. public means it is visible to all. nonibm_only means it is visible to all
* except IBM unless their account is explicitly included, ibm_only means it is visible to all IBM unless their
* account is explicitly excluded. private means it is visible only to the included accounts.
* @param {boolean} [params.extendable] - Allows the visibility to be extendable.
* @param {VisibilityDetail} [params.include] - Visibility details related to a catalog entry.
* @param {VisibilityDetail} [params.exclude] - Visibility details related to a catalog entry.
* @param {string} [params.account] - This changes the scope of the request regardless of the authorization header.
* Example scopes are `account` and `global`. `account=global` is reqired if operating with a service ID that has a
* global admin policy, for example `GET /?account=global`.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<GlobalCatalogV1.Response<GlobalCatalogV1.EmptyObject>>}
*/
GlobalCatalogV1.prototype.updateVisibility = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['id'];
var _validParams = [
'id',
'restrictions',
'extendable',
'include',
'exclude',
'account',
'signal',
'headers',
];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var body = {
'restrictions': _params.restrictions,
'extendable': _params.extendable,
'include': _params.include,
'exclude': _params.exclude,
};
var query = {
'account': _params.account,
};
var path = {
'id': _params.id,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(GlobalCatalogV1.DEFAULT_SERVICE_NAME, 'v1', 'updateVisibility');
var parameters = {
options: {
url: '/{id}/visibility',
method: 'PUT',
body: body,
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, this.baseOptions.headers, {
'Content-Type': 'application/json',
}, _params.headers),
axiosOptions: {
signal: _params.signal,
},
}),
};
return this.createRequest(parameters);
};
/*************************
* pricing
************************/
/**
* Get the pricing for an object.
*
* This endpoint returns the pricing for an object. Static pricing is defined in the catalog. Dynamic pricing is
* stored in IBM Cloud Pricing Catalog. This can be used by an unauthenticated user for publicly available services.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.id - The object's unique ID.
* @param {string} [params.account] - This changes the scope of the request regardless of the authorization header.
* Example scopes are `account` and `global`. `account=global` is reqired if operating with a service ID that has a
* global admin policy, for example `GET /?account=global`.
* @param {string} [params.deploymentRegion] - Specify a region to retrieve plan pricing for a global deployment. The
* value must match an entry in the `deployment_regions` list.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<GlobalCatalogV1.Response<GlobalCatalogV1.PricingGet>>}
*/
GlobalCatalogV1.prototype.getPricing = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['id'];
var _validParams = ['id', 'account', 'deploymentRegion', 'signal', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'account': _params.account,
'deployment_region': _params.deploymentRegion,
};
var path = {
'id': _params.id,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(GlobalCatalogV1.DEFAULT_SERVICE_NAME, 'v1', 'getPricing');
var parameters = {
options: {
url: '/{id}/pricing',
method: 'GET',
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, this.baseOptions.headers, {
'Accept': 'application/json',
}, _params.headers),
axiosOptions: {
signal: _params.signal,
},
}),
};
return this.createRequest(parameters);
};
/**
* Get the pricing deployments for a plan.
*
* This endpoint returns the deployment pricing for a plan. For a plan it returns a pricing for each visible child
* deployment object. Static pricing is defined in the catalog. Dynamic pricing is stored in IBM Cloud Pricing
* Catalog. This can be used by an unauthenticated user for publicly available services.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.id - The object's unique ID.
* @param {string} [params.account] - This changes the scope of the request regardless of the authorization header.
* Example scopes are `account` and `global`. `account=global` is reqired if operating with a service ID that has a
* global admin policy, for example `GET /?account=global`.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<GlobalCatalogV1.Response<GlobalCatalogV1.PricingSearchResult>>}
*/
GlobalCatalogV1.prototype.getPricingDeployments = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['id'];
var _validParams = ['id', 'account', 'signal', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'account': _params.account,
};
var path = {
'id': _params.id,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(GlobalCatalogV1.DEFAULT_SERVICE_NAME, 'v1', 'getPricingDeployments');
var parameters = {
options: {
url: '/{id}/pricing/deployment',
method: 'GET',
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, this.baseOptions.headers, {
'Accept': 'application/json',
}, _params.headers),
axiosOptions: {
signal: _params.signal,
},
}),
};
return this.createRequest(parameters);
};
/*************************
* audit
************************/
/**
* Get the audit logs for an object.
*
* This endpoint returns the audit logs for an object. Only administrators and editors can get logs.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.id - The object's unique ID.
* @param {string} [params.account] - This changes the scope of the request regardless of the authorization header.
* Example scopes are `account` and `global`. `account=global` is reqired if operating with a service ID that has a
* global admin policy, for example `GET /?account=global`.
* @param {string} [params.ascending] - Sets the sort order. False is descending.
* @param {string} [params.startat] - Starting time for the logs. If it's descending then the entries will be equal or
* earlier. The default is latest. For ascending it will entries equal or later. The default is earliest. It can be
* either a number or a string. If a number then it is in the format of Unix timestamps. If it is a string then it is
* a date in the format YYYY-MM-DDTHH:MM:SSZ and the time is UTC. The T and the Z are required. For example:
* 2017-12-24T12:00:00Z for Noon UTC on Dec 24, 2017.
* @param {number} [params.offset] - Count of number of log entries to skip before returning logs. The default is
* zero.
* @param {number} [params.limit] - Count of number of entries to return. The default is fifty. The maximum value is
* two hundred.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<GlobalCatalogV1.Response<GlobalCatalogV1.AuditSearchResult>>}
*/
GlobalCatalogV1.prototype.getAuditLogs = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['id'];
var _validParams = [
'id',
'account',
'ascending',
'startat',
'offset',
'limit',
'signal',
'headers',
];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'account': _params.account,
'ascending': _params.ascending,
'startat': _params.startat,
'_offset': _params.offset,
'_limit': _params.limit,
};
var path = {
'id': _params.id,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(GlobalCatalogV1.DEFAULT_SERVICE_NAME, 'v1', 'getAuditLogs');
var parameters = {
options: {
url: '/{id}/logs',
method: 'GET',
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, this.baseOptions.headers, {
'Accept': 'application/json',
}, _params.headers),
axiosOptions: {
signal: _params.signal,
},
}),
};
return this.createRequest(parameters);
};
/*************************
* artifact
************************/
/**
* Get artifacts.
*
* This endpoint returns a list of artifacts for an object.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.objectId - The object's unique ID.
* @param {string} [params.account] - This changes the scope of the request regardless of the authorization header.
* Example scopes are `account` and `global`. `account=global` is reqired if operating with a service ID that has a
* global admin policy, for example `GET /?account=global`.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<GlobalCatalogV1.Response<GlobalCatalogV1.Artifacts>>}
*/
GlobalCatalogV1.prototype.listArtifacts = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['objectId'];
var _validParams = ['objectId', 'account', 'signal', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'account': _params.account,
};
var path = {
'object_id': _params.objectId,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(GlobalCatalogV1.DEFAULT_SERVICE_NAME, 'v1', 'listArtifacts');
var parameters = {
options: {
url: '/{object_id}/artifacts',
method: 'GET',
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, this.baseOptions.headers, {
'Accept': 'application/json',
}, _params.headers),
axiosOptions: {
signal: _params.signal,
},
}),
};
return this.createRequest(parameters);
};
/**
* Get artifact.
*
* This endpoint returns the binary of an artifact.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.objectId - The object's unique ID.
* @param {string} params.artifactId - The artifact's ID.
* @param {string} [params.accept] - The type of the response: *_/_*.
* @param {string} [params.account] - This changes the scope of the request regardless of the authorization header.
* Example scopes are `account` and `global`. `account=global` is reqired if operating with a service ID that has a
* global admin policy, for example `GET /?account=global`.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<GlobalCatalogV1.Response<NodeJS.ReadableStream>>}
*/
GlobalCatalogV1.prototype.getArtifact = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['objectId', 'artifactId'];
var _validParams = ['objectId', 'artifactId', 'accept', 'account', 'signal', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'account': _params.account,
};
var path = {