# @dynatrace-sdk/client-platform-management-service

[![npm](https://img.shields.io/badge/npm-v1.9.1-blue)](https://www.npmjs.com/package/@dynatrace-sdk/client-platform-management-service/v/1.9.1)
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

<h1>Overview</h1> Basic read-only information about the currently logged-in environment


## Installation

```bash
npm install @dynatrace-sdk/client-platform-management-service
```


## Getting help

- Visit [SDK for Typescript](https://developer.dynatrace.com/reference/sdks/) guide in the [Dynatrace Developer](https://developer.dynatrace.com/)
- Ask a question in the [Dynatrace Community](https://community.dynatrace.com/)


## License

This SDK is distributed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0), see LICENSE for more information.


# API reference

Full API reference for the latest version of the SDK is also available at the [Dynatrace Developer](https://developer.dynatrace.com/reference/sdks/client-platform-management-service/).

## effectivePermissionsClient

```js
import { effectivePermissionsClient } from '@dynatrace-sdk/client-platform-management-service';
```


<a name="resolveeffectivepermissions"></a>
### resolveEffectivePermissions

<div class="padding-bottom--md">
<strong>effectivePermissionsClient.resolveEffectivePermissions(config): Promise&lt;<a href="#effectivepermissions">EffectivePermissions</a>&gt;</strong>

<div class="padding-left--md">

Get the effective permissions of the calling user in the environment

**One of the following scopes is required:**
+ app-engine:apps:run
+ app-engine:functions:run
+ platform-management:effective-permissions:resolve



This endpoint resolves whether the caller (based on the provided OAuth token when calling this endpoint) has the requested permissions (see [IAM policy reference](https://dt-url.net/ut02qdv) for a list of permissions and their conditions). It resolves the permission via IAM and uses the optional context to evaluate conditional results. The provided context consists of key-value pairs where the `key` must correspond to the name of a supported condition of the requested permission and the `value` is the value that it this condition is evaluated against given a user&apos;s policies.

For each requested permission the response indicates whether the user has the requested permission (`"granted": "true"`), does not have it (`"granted": "false"`) or only has it conditionally (`"granted": "condition"`), meaning that the provided values for conditions in the context are not sufficient to decide whether the caller has the permission.

For environment API v2 scopes (i.e. scopes starting with environment-api:) roles on the environment and management zone level will also be considered.

&gt; ℹ️ **Settings permission** requests for scopes `settings:schemas:read`, `settings:objects:read`, and `settings:objects:write` will always result in a result with `"granted": "condition"`. You can use the dedicated effective permissions endpoint for settings instead.

&gt; ℹ️ Apps must list all permissions they check in the list of `scopes` in their app configuration.

You can learn more about querying user permissions on [Dynatrace Developer](https://dt-url.net/query-user-permissions).



</div>


#### Parameters

| Name | Type |
| --- | --- |
|config.body<sup>*required</sup>|<a href="#resolutionrequest" target="_blank" rel="noopener noreferrer">ResolutionRequest</a>|





#### Throws

| Error Type | Error Message |
|---|---|
|DefaultErrorResponse|Unexpected error|


<details>
<summary>
Code example
</summary>

```ts
import { effectivePermissionsClient } from "@dynatrace-sdk/client-platform-management-service";

const data =
  await effectivePermissionsClient.resolveEffectivePermissions(
    {
      body: {
        permissions: [
          { permission: "state:app-states:write" },
        ],
      },
    },
  );
```

</details>



</div>

## environmentInformationClient

```js
import { environmentInformationClient } from '@dynatrace-sdk/client-platform-management-service';
```


<a name="getenvironmentinformation"></a>
### getEnvironmentInformation

<div class="padding-bottom--md">
<strong>environmentInformationClient.getEnvironmentInformation(config): Promise&lt;<a href="#environmentinfo">EnvironmentInfo</a>&gt;</strong>

<div class="padding-left--md">

Get basic environment information

**One of the following scopes is required:**
+ app-engine:apps:run
+ app-engine:functions:run
+ platform-management:environments:read



Get basic information about the current environment.



</div>



#### Returns

| Return type | Status code | Description |
|---|---|---|
|[EnvironmentInfo](#environmentinfo)|200|Info about the requested environment.|


#### Throws

| Error Type | Error Message |
|---|---|
|BadRequest|Bad request|
|Unauthorized|Authentication failed|
|NotFound|Resource not found|
|ServiceUnavailable|There is a temporary problem in the backend.|
|DefaultErrorResponse|Unexpected error|


<details>
<summary>
Code example
</summary>

```ts
import { environmentInformationClient } from "@dynatrace-sdk/client-platform-management-service";

const data =
  await environmentInformationClient.getEnvironmentInformation();
```

</details>



</div>

## environmentSettingsClient

```js
import { environmentSettingsClient } from '@dynatrace-sdk/client-platform-management-service';
```


<a name="getenvironmentsettings"></a>
### getEnvironmentSettings

<div class="padding-bottom--md">
<strong>environmentSettingsClient.getEnvironmentSettings(config): Promise&lt;<a href="#settingsresponse" target="_blank" rel="noopener noreferrer">SettingsResponse</a>&gt;</strong>

<div class="padding-left--md">

Get settings for the environment

**One of the following scopes is required:**
+ app-engine:apps:run
+ app-engine:functions:run
+ platform-management:environments:read



Gets settings for environment.



</div>



#### Returns

| Return type | Status code | Description |
|---|---|---|
|[SettingsResponse](#settingsresponse)|200|The settings for the requested environment|


#### Throws

| Error Type | Error Message |
|---|---|
|BadRequest|Bad request|
|Unauthorized|Authentication failed|
|NotFound|Resource not found|
|ServiceUnavailable|There is a temporary problem in the backend.|
|DefaultErrorResponse|Unexpected error|


<details>
<summary>
Code example
</summary>

```ts
import { environmentSettingsClient } from "@dynatrace-sdk/client-platform-management-service";

const data =
  await environmentSettingsClient.getEnvironmentSettings();
```

</details>



</div>

## licenseInformationClient

```js
import { licenseInformationClient } from '@dynatrace-sdk/client-platform-management-service';
```


<a name="getlicense"></a>
### getLicense

<div class="padding-bottom--md">
<strong>licenseInformationClient.getLicense(config): Promise&lt;<a href="#license">License</a>&gt;</strong>

<div class="padding-left--md">

Get basic license information

**One of the following scopes is required:**
+ app-engine:apps:run
+ app-engine:functions:run
+ platform-management:environments:read



Get basic license information about the current environment.



</div>



#### Returns

| Return type | Status code | Description |
|---|---|---|
|[License](#license)|200|The license info of the requested environment.|


#### Throws

| Error Type | Error Message |
|---|---|
|BadRequest|Bad request|
|Unauthorized|Authentication failed|
|NotFound|Resource not found|
|ServiceUnavailable|There is a temporary problem in the backend.|
|DefaultErrorResponse|Unexpected error|


<details>
<summary>
Code example
</summary>

```ts
import { licenseInformationClient } from "@dynatrace-sdk/client-platform-management-service";

const data = await licenseInformationClient.getLicense();
```

</details>



</div>


<a name="getlicensesettings"></a>
### getLicenseSettings

<div class="padding-bottom--md">
<strong>licenseInformationClient.getLicenseSettings(config): Promise&lt;<a href="#licensesettingsresponse" target="_blank" rel="noopener noreferrer">LicenseSettingsResponse</a>&gt;</strong>

<div class="padding-left--md">

Get basic license settings information

**One of the following scopes is required:**
+ app-engine:apps:run
+ app-engine:functions:run
+ platform-management:environments:read



Get basic license settings information about the current environment



</div>


#### Parameters

| Name | Type | Description |
| --- | --- | --- |
|config.keys|Array&lt;[string](https://developer.mozilla.org/en-US/docs/Glossary/String)&gt;|optional array of key(s) for filtering<br/><br/><strong>Example:</strong> <code>[]</code>|




#### Returns

| Return type | Status code | Description |
|---|---|---|
|[LicenseSettingsResponse](#licensesettingsresponse)|200|The license settings info of the requested environment.|


#### Throws

| Error Type | Error Message |
|---|---|
|BadRequest|Bad request|
|Unauthorized|Authentication failed|
|NotFound|Resource not found|
|ServiceUnavailable|There is a temporary problem in the backend.|
|DefaultErrorResponse|Unexpected error|


<details>
<summary>
Code example
</summary>

```ts
import { licenseInformationClient } from "@dynatrace-sdk/client-platform-management-service";

const data =
  await licenseInformationClient.getLicenseSettings();
```

</details>



</div>

## Types

### EffectivePermission

| Name | Type | Description |
| --- | --- | --- |
|context|Array&lt;<a href="#permissioncontext">PermissionContext</a>&gt;||
|granted<sup>*required</sup>|"true" &#124; "false" &#124; "condition"|true: The caller has the permission false: The caller does not have the permission condition: The caller conditionally has the permission or in case of scopes starting with 'environment-api:' the caller only has the permission for specific management zones.<br/><br/><strong>Example:</strong> <code>true</code>|
|permission<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|<strong>Example:</strong> <code>state:app-states:write</code>|

### EffectivePermissions

**type**: Array&lt;<a href="#effectivepermission" target="_blank" rel="noopener noreferrer">EffectivePermission</a>&gt;

### EnvironmentInfo

| Name | Type |
| --- | --- |
|blockTime|Date|
|createTime<sup>*required</sup>|Date|
|environmentId<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|
|state<sup>*required</sup>|"BEING_CREATED" &#124; "CREATED_NOT_INITIALIZED" &#124; "ACTIVE" &#124; "DEACTIVATED" &#124; "BEING_DELETED" &#124; "BLOCKED" &#124; "DELETION_FAILED" &#124; "PRE_ALLOCATED"|
|type<sup>*required</sup>|"INTERNAL" &#124; "CUSTOMER" &#124; "SELF_MONITORING"|

### Error

Standard error response

| Name | Type | Description |
| --- | --- | --- |
|code<sup>*required</sup>|[number](https://developer.mozilla.org/en-US/docs/Glossary/Number)|<strong>Example:</strong> <code>500</code>|
|details|<a href="#errordetails">ErrorDetails</a>||
|message<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|<strong>Example:</strong> <code>Internal server error</code>|

### ErrorDetails

| Name | Type |
| --- | --- |
|missingPermissions|Array&lt;[string](https://developer.mozilla.org/en-US/docs/Glossary/String)&gt;|
|missingScopes|Array&lt;[string](https://developer.mozilla.org/en-US/docs/Glossary/String)&gt;|

### ErrorEnvelope

| Name | Type | Description |
| --- | --- | --- |
|error<sup>*required</sup>|<a href="#error" target="_blank" rel="noopener noreferrer">Error</a>|Standard error response|

### License

| Name | Type |
| --- | --- |
|platformSubscription<sup>*required</sup>|[boolean](https://developer.mozilla.org/en-US/docs/Glossary/Boolean)|
|trial<sup>*required</sup>|[boolean](https://developer.mozilla.org/en-US/docs/Glossary/Boolean)|

### LicenseSetting

| Name | Type |
| --- | --- |
|key<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|
|value<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|

### LicenseSettingsResponse

| Name | Type |
| --- | --- |
|settings<sup>*required</sup>|Array&lt;<a href="#licensesetting">LicenseSetting</a>&gt;|

### PermissionContext

| Name | Type | Description |
| --- | --- | --- |
|key<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|<strong>Example:</strong> <code>shared:app-id</code>|
|value<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|<strong>Example:</strong> <code>dynatrace.notebooks</code>|

### ResolutionRequest

| Name | Type |
| --- | --- |
|permissions<sup>*required</sup>|Array&lt;<a href="#singlepermissionrequest" target="_blank" rel="noopener noreferrer">SinglePermissionRequest</a>&gt;|

### SettingsResponse

| Name | Type | Description |
| --- | --- | --- |
|activeTrialSubscriptionEndDate|Date|Date when the trial period ends.<br/><br/><strong>Example:</strong> <code>2025-04-25T10:08:09.193592Z</code>|
|chatEnabled<sup>*required</sup>|[boolean](https://developer.mozilla.org/en-US/docs/Glossary/Boolean)||
|countryCode|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|ISO3166-1 alpha-2 two letter country code. See: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2<br/><br/><strong>Example:</strong> <code>ES</code>|

### SinglePermissionRequest

Optional generic set of context data

| Name | Type | Description |
| --- | --- | --- |
|context|null &#124; Array&lt;<a href="#permissioncontext">PermissionContext</a>&gt;||
|permission<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|<strong>Example:</strong> <code>state:app-states:write</code>|

## Enums

<a name="effectivepermissiongranted"></a>
### ~~EffectivePermissionGranted~~

> ⚠️ **Deprecated**
> Use literal values.

<div class="padding-left--md">

true: The caller has the permission false: The caller does not have the permission condition: The caller conditionally has the permission or in case of scopes starting with &apos;environment-api:&apos; the caller only has the permission for specific management zones.

#### Enum keys

<div class="padding-left--md">

`Condition` | `False` | `True`

</div>


</div>

<a name="environmentinfotype"></a>
### ~~EnvironmentInfoType~~

> ⚠️ **Deprecated**
> Use literal values.

<div class="padding-left--md">



#### Enum keys

<div class="padding-left--md">

`Customer` | `Internal` | `SelfMonitoring`

</div>


</div>

<a name="environmentstate"></a>
### ~~EnvironmentState~~

> ⚠️ **Deprecated**
> Use literal values.

<div class="padding-left--md">



#### Enum keys

<div class="padding-left--md">

`Active` | `BeingCreated` | `BeingDeleted` | `Blocked` | `CreatedNotInitialized` | `Deactivated` | `DeletionFailed` | `PreAllocated`

</div>


</div>
