@c8y/client
Version:
Client application programming interface to access the Cumulocity IoT-Platform REST services.
144 lines • 4.92 kB
TypeScript
import { Service, IResultList, IResult, IIdentified } from '../core/index.js';
import { ITenantOption } from './ITenantOption.js';
import { ITenantOptionDetailParams } from './ITenantOptionDetailParams.js';
/**
* @description
* This service allows for managing tenant's options.
*/
export declare class TenantOptionsService extends Service<ITenantOption> {
protected baseUrl: string;
protected listUrl: string;
protected propertyName: string;
private securityOptionsCategories;
private securityOptionsListUrl;
private systemOptions;
/**
* Get a representation of a tenant's option.
*
* @param entity Tenant option object.
* @param params Additional query parameters.
*
* @returns Returns promise object that is resolved with
* the ITenantOption wrapped by IResult.
*
* **Example**
* ```typescript
* const option: ITenantOption = {
* category: 'access.control',
* key: 'allow.origin'
* };
* const params: ITenantOptionDetailParams = {
* evaluate: 'inherited'
* };
* (async () => {
* const { data, res } = await tenantService.detail(option);
* console.log('value inherited from parent tenant:', data.value);
* })();
* ```
*
* Required role: ROLE_OPTION_MANAGEMENT_READ
*/
detail(entity: ITenantOption, params?: ITenantOptionDetailParams): Promise<IResult<ITenantOption>>;
/**
* Creates a new tenant's option.
*
* @param {ITenantOption} entity Tenant's Option object.
*
* @returns {IResult<IIdentified>} Returns promise object that is resolved with
* the details of newly created tenant option.
*
* **Example**
* ```typescript
*
* const tenantObject = {
* id: "sample_tenant",
* company: "sample_company",
* domain: "sample_domain.com",
* contactName: "Mr. Doe",
* ...
* };
*
* (async () => {
* const {data, res} = await tenantService.create(tenantObject);
* })();
* ```
*
* Required role: ROLE_OPTION_MANAGEMENT_ADMIN<br><br>
* Options are category-key-value tuples, storing tenant configuration.Some categories of options
* allow creation of new one, other are limited to predefined set of keys.<br><br>
* Any option of any tenant can be defined as "non-editable" by "management" tenant. Afterwards, any PUT or DELETE
* requests made on that option by the owner tenant, will result in 403 error (Unauthorized).
*/
create(entity: ITenantOption): Promise<IResult<ITenantOption>>;
/**
* Updates tenant's option data.
*
* @param {ITenantOption} entity Tenant option is partially updatable.
*
* @returns {IResult<ITenantOption>} Returns promise object that is resolved with the saved tenant option object.
*
* **Example**
* ```typescript
*
* const partialUpdateObject: IIdentified = {
* value : "http://developer.cumulocity.com"
* ...
* }
*
* (async () => {
* const {data, res} = await tenantOptionsService.update(partialUpdateObject);
* })();
* ```
*
* Required role: ROLE_OPTION_MANAGEMENT_ADMIN
*/
update(entity: ITenantOption): Promise<IResult<ITenantOption>>;
/**
* Gets the list of tenant's options filtered by parameters.
*
* @param {object} filter Object containing filters for querying tenant options.
*
* @returns {IResultList<ITenantOption>} Returns promise object that is resolved
* with the ITenantOption wrapped by IResultList.
*
* **Example**
* ```typescript
*
* const filter: object = {
* severity: Severity.MAJOR,
* pageSize: 100,
* withTotalPages: true
* };
*
* (async () => {
* const {data, res, paging} = await tenantOptionsService.list(filter);
* })();
* ```
*
* Required role: ROLE_OPTION_MANAGEMENT_READ
*/
list(filter?: object): Promise<IResultList<ITenantOption>>;
/**
* Delete a representation of a tenant's option.
*
* @param {string|number|IIdentified} entityOrId Tenant's option id or tenant's option object.
*
* @returns Returns promise object that is resolved with the IResult.
*
* **Example**
* ```typescript
*
* const tenantOptionId: string = "uniqueTenantId";
*
* (async () => {
* const {data, res} = await tenantOptionsService.delete(tenantOptionId);
* })();
* ```
*
* Required role: ROLE_TENANT_MANAGEMENT_ADMIN
*/
delete(entityOrId: string | number | IIdentified): Promise<IResult<null>>;
protected getDetailUrl(entity: ITenantOption): string;
protected onBeforeCreate(obj: ITenantOption): any;
}
//# sourceMappingURL=TenantOptionsService.d.ts.map