Class EnvironmentsApi

The EnvironmentsApi class provides methods for interacting with Permit Environments.

Hierarchy

  • BasePermitApi
    • EnvironmentsApi

Implements

Constructors

Methods

  • Clones data (creates a copy) from a source specified environment into a different target environment in the same project. The target environment can be a new environment or an existing environment. For existing environments, the user must specify a conflict strategy - meaning what the system should do in case a copied object conflicts with an existing object (with the same key) in the target environment. The system can overwrite all the conflicting objects, or fail (and cancel the copy) when encountering the first conflict.

    Parameters

    • projectKey: string

      The project key.

    • environmentKey: string

      The environment key.

    • copyParams: EnvironmentCopy

      The parameters for copying the environment.

    Returns Promise<EnvironmentRead>

    A promise that resolves to an EnvironmentRead object representing the copied environment.

    Throws

    PermitApiError If the API returns an error HTTP status code.

    Throws

    PermitContextError If the configured ApiContext does not match the required endpoint context.

  • Deletes an environment.

    Parameters

    • projectKey: string

      The project key.

    • environmentKey: string

      The environment key.

    Returns Promise<void>

    A promise that resolves when the environment is successfully deleted.

    Throws

    PermitApiError If the API returns an error HTTP status code.

    Throws

    PermitContextError If the configured ApiContext does not match the required endpoint context.

  • Ensure that the API Key has the necessary permissions to successfully call the API endpoint. Note that this check is not foolproof, and the API may still throw 401.

    Parameters

    • requiredAccessLevel: ApiKeyLevel

      The required API Key Access level for the endpoint.

    Returns Promise<void>

    Throws

    PermitContextError If the currently set API key access level does not match the required access level.

  • Ensure that the API context matches the required endpoint context.

    Parameters

    • requiredContext: ApiContextLevel

      The required API context level for the endpoint.

    Returns Promise<void>

    Throws

    PermitContextError If the currently set API context level does not match the required context level.

  • Retrieves the API key that grants access for an environment (and only the requested environment). Must be requested with an organization-level api key.

    Parameters

    • projectKey: string

      The project key.

    • environmentKey: string

      The environment key.

    Returns Promise<APIKeyRead>

    A promise that resolves to an APIKeyRead object containing the API key and its metadata.

    Throws

    PermitApiError If the API returns an error HTTP status code.

    Throws

    PermitContextError If the configured ApiContext does not match the required endpoint context.

Generated using TypeDoc