# coding=utf-8
# *** WARNING: this file was generated by pulumi-language-python. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import builtins as _builtins
import warnings
import sys
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
if sys.version_info >= (3, 11):
    from typing import NotRequired, TypedDict, TypeAlias
else:
    from typing_extensions import NotRequired, TypedDict, TypeAlias
from . import _utilities
from . import outputs
from ._inputs import *

__all__ = ['LibraryArgs', 'Library']

@pulumi.input_type
class LibraryArgs:
    def __init__(__self__, *,
                 cluster_id: pulumi.Input[_builtins.str],
                 cran: Optional[pulumi.Input['LibraryCranArgs']] = None,
                 egg: Optional[pulumi.Input[_builtins.str]] = None,
                 jar: Optional[pulumi.Input[_builtins.str]] = None,
                 library_id: Optional[pulumi.Input[_builtins.str]] = None,
                 maven: Optional[pulumi.Input['LibraryMavenArgs']] = None,
                 provider_config: Optional[pulumi.Input['LibraryProviderConfigArgs']] = None,
                 pypi: Optional[pulumi.Input['LibraryPypiArgs']] = None,
                 requirements: Optional[pulumi.Input[_builtins.str]] = None,
                 whl: Optional[pulumi.Input[_builtins.str]] = None):
        """
        The set of arguments for constructing a Library resource.
        :param pulumi.Input[_builtins.str] cluster_id: ID of the Cluster to install the library on.
               
               You must specify exactly **one** of the following library types:
        :param pulumi.Input['LibraryCranArgs'] cran: Configuration block for a CRAN library. The block consists of the following fields:
        :param pulumi.Input[_builtins.str] egg: Path to the EGG library. Installing Python egg files is deprecated and is not supported in Databricks Runtime 14.0 and above. Use `whl` or `pypi` instead.
        :param pulumi.Input[_builtins.str] jar: Path to the JAR library. Supported URIs include Workspace paths, Unity Catalog Volumes paths, and S3 URIs. For example: `/Workspace/path/to/library.jar`, `/Volumes/path/to/library.jar` or `s3://my-bucket/library.jar`. If S3 is used, make sure the cluster has read access to the library. You may need to launch the cluster with an IAM role to access the S3 URI.
        :param pulumi.Input['LibraryMavenArgs'] maven: Configuration block for a Maven library. The block consists of the following fields:
        :param pulumi.Input['LibraryProviderConfigArgs'] provider_config: Configuration block for management through the account provider. This block consists of the following fields:
        :param pulumi.Input['LibraryPypiArgs'] pypi: Configuration block for a PyPI library. The block consists of the following fields:
        :param pulumi.Input[_builtins.str] requirements: Path to the requirements.txt file. Only Workspace paths and Unity Catalog Volumes paths are supported. For example: `/Workspace/path/to/requirements.txt` or `/Volumes/path/to/requirements.txt`. Requires a cluster with DBR 15.0+.
        :param pulumi.Input[_builtins.str] whl: Path to the wheel library. Supported URIs include Workspace paths, Unity Catalog Volumes paths, and S3 URIs. For example: `/Workspace/path/to/library.whl`, `/Volumes/path/to/library.whl` or `s3://my-bucket/library.whl`. If S3 is used, make sure the cluster has read access to the library. You may need to launch the cluster with an IAM role to access the S3 URI.
        """
        pulumi.set(__self__, "cluster_id", cluster_id)
        if cran is not None:
            pulumi.set(__self__, "cran", cran)
        if egg is not None:
            warnings.warn("""The `egg` library type is deprecated. Please use `whl` or `pypi` instead.""", DeprecationWarning)
            pulumi.log.warn("""egg is deprecated: The `egg` library type is deprecated. Please use `whl` or `pypi` instead.""")
        if egg is not None:
            pulumi.set(__self__, "egg", egg)
        if jar is not None:
            pulumi.set(__self__, "jar", jar)
        if library_id is not None:
            pulumi.set(__self__, "library_id", library_id)
        if maven is not None:
            pulumi.set(__self__, "maven", maven)
        if provider_config is not None:
            pulumi.set(__self__, "provider_config", provider_config)
        if pypi is not None:
            pulumi.set(__self__, "pypi", pypi)
        if requirements is not None:
            pulumi.set(__self__, "requirements", requirements)
        if whl is not None:
            pulumi.set(__self__, "whl", whl)

    @_builtins.property
    @pulumi.getter(name="clusterId")
    def cluster_id(self) -> pulumi.Input[_builtins.str]:
        """
        ID of the Cluster to install the library on.

        You must specify exactly **one** of the following library types:
        """
        return pulumi.get(self, "cluster_id")

    @cluster_id.setter
    def cluster_id(self, value: pulumi.Input[_builtins.str]):
        pulumi.set(self, "cluster_id", value)

    @_builtins.property
    @pulumi.getter
    def cran(self) -> Optional[pulumi.Input['LibraryCranArgs']]:
        """
        Configuration block for a CRAN library. The block consists of the following fields:
        """
        return pulumi.get(self, "cran")

    @cran.setter
    def cran(self, value: Optional[pulumi.Input['LibraryCranArgs']]):
        pulumi.set(self, "cran", value)

    @_builtins.property
    @pulumi.getter
    @_utilities.deprecated("""The `egg` library type is deprecated. Please use `whl` or `pypi` instead.""")
    def egg(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        Path to the EGG library. Installing Python egg files is deprecated and is not supported in Databricks Runtime 14.0 and above. Use `whl` or `pypi` instead.
        """
        return pulumi.get(self, "egg")

    @egg.setter
    def egg(self, value: Optional[pulumi.Input[_builtins.str]]):
        pulumi.set(self, "egg", value)

    @_builtins.property
    @pulumi.getter
    def jar(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        Path to the JAR library. Supported URIs include Workspace paths, Unity Catalog Volumes paths, and S3 URIs. For example: `/Workspace/path/to/library.jar`, `/Volumes/path/to/library.jar` or `s3://my-bucket/library.jar`. If S3 is used, make sure the cluster has read access to the library. You may need to launch the cluster with an IAM role to access the S3 URI.
        """
        return pulumi.get(self, "jar")

    @jar.setter
    def jar(self, value: Optional[pulumi.Input[_builtins.str]]):
        pulumi.set(self, "jar", value)

    @_builtins.property
    @pulumi.getter(name="libraryId")
    def library_id(self) -> Optional[pulumi.Input[_builtins.str]]:
        return pulumi.get(self, "library_id")

    @library_id.setter
    def library_id(self, value: Optional[pulumi.Input[_builtins.str]]):
        pulumi.set(self, "library_id", value)

    @_builtins.property
    @pulumi.getter
    def maven(self) -> Optional[pulumi.Input['LibraryMavenArgs']]:
        """
        Configuration block for a Maven library. The block consists of the following fields:
        """
        return pulumi.get(self, "maven")

    @maven.setter
    def maven(self, value: Optional[pulumi.Input['LibraryMavenArgs']]):
        pulumi.set(self, "maven", value)

    @_builtins.property
    @pulumi.getter(name="providerConfig")
    def provider_config(self) -> Optional[pulumi.Input['LibraryProviderConfigArgs']]:
        """
        Configuration block for management through the account provider. This block consists of the following fields:
        """
        return pulumi.get(self, "provider_config")

    @provider_config.setter
    def provider_config(self, value: Optional[pulumi.Input['LibraryProviderConfigArgs']]):
        pulumi.set(self, "provider_config", value)

    @_builtins.property
    @pulumi.getter
    def pypi(self) -> Optional[pulumi.Input['LibraryPypiArgs']]:
        """
        Configuration block for a PyPI library. The block consists of the following fields:
        """
        return pulumi.get(self, "pypi")

    @pypi.setter
    def pypi(self, value: Optional[pulumi.Input['LibraryPypiArgs']]):
        pulumi.set(self, "pypi", value)

    @_builtins.property
    @pulumi.getter
    def requirements(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        Path to the requirements.txt file. Only Workspace paths and Unity Catalog Volumes paths are supported. For example: `/Workspace/path/to/requirements.txt` or `/Volumes/path/to/requirements.txt`. Requires a cluster with DBR 15.0+.
        """
        return pulumi.get(self, "requirements")

    @requirements.setter
    def requirements(self, value: Optional[pulumi.Input[_builtins.str]]):
        pulumi.set(self, "requirements", value)

    @_builtins.property
    @pulumi.getter
    def whl(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        Path to the wheel library. Supported URIs include Workspace paths, Unity Catalog Volumes paths, and S3 URIs. For example: `/Workspace/path/to/library.whl`, `/Volumes/path/to/library.whl` or `s3://my-bucket/library.whl`. If S3 is used, make sure the cluster has read access to the library. You may need to launch the cluster with an IAM role to access the S3 URI.
        """
        return pulumi.get(self, "whl")

    @whl.setter
    def whl(self, value: Optional[pulumi.Input[_builtins.str]]):
        pulumi.set(self, "whl", value)


@pulumi.input_type
class _LibraryState:
    def __init__(__self__, *,
                 cluster_id: Optional[pulumi.Input[_builtins.str]] = None,
                 cran: Optional[pulumi.Input['LibraryCranArgs']] = None,
                 egg: Optional[pulumi.Input[_builtins.str]] = None,
                 jar: Optional[pulumi.Input[_builtins.str]] = None,
                 library_id: Optional[pulumi.Input[_builtins.str]] = None,
                 maven: Optional[pulumi.Input['LibraryMavenArgs']] = None,
                 provider_config: Optional[pulumi.Input['LibraryProviderConfigArgs']] = None,
                 pypi: Optional[pulumi.Input['LibraryPypiArgs']] = None,
                 requirements: Optional[pulumi.Input[_builtins.str]] = None,
                 whl: Optional[pulumi.Input[_builtins.str]] = None):
        """
        Input properties used for looking up and filtering Library resources.
        :param pulumi.Input[_builtins.str] cluster_id: ID of the Cluster to install the library on.
               
               You must specify exactly **one** of the following library types:
        :param pulumi.Input['LibraryCranArgs'] cran: Configuration block for a CRAN library. The block consists of the following fields:
        :param pulumi.Input[_builtins.str] egg: Path to the EGG library. Installing Python egg files is deprecated and is not supported in Databricks Runtime 14.0 and above. Use `whl` or `pypi` instead.
        :param pulumi.Input[_builtins.str] jar: Path to the JAR library. Supported URIs include Workspace paths, Unity Catalog Volumes paths, and S3 URIs. For example: `/Workspace/path/to/library.jar`, `/Volumes/path/to/library.jar` or `s3://my-bucket/library.jar`. If S3 is used, make sure the cluster has read access to the library. You may need to launch the cluster with an IAM role to access the S3 URI.
        :param pulumi.Input['LibraryMavenArgs'] maven: Configuration block for a Maven library. The block consists of the following fields:
        :param pulumi.Input['LibraryProviderConfigArgs'] provider_config: Configuration block for management through the account provider. This block consists of the following fields:
        :param pulumi.Input['LibraryPypiArgs'] pypi: Configuration block for a PyPI library. The block consists of the following fields:
        :param pulumi.Input[_builtins.str] requirements: Path to the requirements.txt file. Only Workspace paths and Unity Catalog Volumes paths are supported. For example: `/Workspace/path/to/requirements.txt` or `/Volumes/path/to/requirements.txt`. Requires a cluster with DBR 15.0+.
        :param pulumi.Input[_builtins.str] whl: Path to the wheel library. Supported URIs include Workspace paths, Unity Catalog Volumes paths, and S3 URIs. For example: `/Workspace/path/to/library.whl`, `/Volumes/path/to/library.whl` or `s3://my-bucket/library.whl`. If S3 is used, make sure the cluster has read access to the library. You may need to launch the cluster with an IAM role to access the S3 URI.
        """
        if cluster_id is not None:
            pulumi.set(__self__, "cluster_id", cluster_id)
        if cran is not None:
            pulumi.set(__self__, "cran", cran)
        if egg is not None:
            warnings.warn("""The `egg` library type is deprecated. Please use `whl` or `pypi` instead.""", DeprecationWarning)
            pulumi.log.warn("""egg is deprecated: The `egg` library type is deprecated. Please use `whl` or `pypi` instead.""")
        if egg is not None:
            pulumi.set(__self__, "egg", egg)
        if jar is not None:
            pulumi.set(__self__, "jar", jar)
        if library_id is not None:
            pulumi.set(__self__, "library_id", library_id)
        if maven is not None:
            pulumi.set(__self__, "maven", maven)
        if provider_config is not None:
            pulumi.set(__self__, "provider_config", provider_config)
        if pypi is not None:
            pulumi.set(__self__, "pypi", pypi)
        if requirements is not None:
            pulumi.set(__self__, "requirements", requirements)
        if whl is not None:
            pulumi.set(__self__, "whl", whl)

    @_builtins.property
    @pulumi.getter(name="clusterId")
    def cluster_id(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        ID of the Cluster to install the library on.

        You must specify exactly **one** of the following library types:
        """
        return pulumi.get(self, "cluster_id")

    @cluster_id.setter
    def cluster_id(self, value: Optional[pulumi.Input[_builtins.str]]):
        pulumi.set(self, "cluster_id", value)

    @_builtins.property
    @pulumi.getter
    def cran(self) -> Optional[pulumi.Input['LibraryCranArgs']]:
        """
        Configuration block for a CRAN library. The block consists of the following fields:
        """
        return pulumi.get(self, "cran")

    @cran.setter
    def cran(self, value: Optional[pulumi.Input['LibraryCranArgs']]):
        pulumi.set(self, "cran", value)

    @_builtins.property
    @pulumi.getter
    @_utilities.deprecated("""The `egg` library type is deprecated. Please use `whl` or `pypi` instead.""")
    def egg(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        Path to the EGG library. Installing Python egg files is deprecated and is not supported in Databricks Runtime 14.0 and above. Use `whl` or `pypi` instead.
        """
        return pulumi.get(self, "egg")

    @egg.setter
    def egg(self, value: Optional[pulumi.Input[_builtins.str]]):
        pulumi.set(self, "egg", value)

    @_builtins.property
    @pulumi.getter
    def jar(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        Path to the JAR library. Supported URIs include Workspace paths, Unity Catalog Volumes paths, and S3 URIs. For example: `/Workspace/path/to/library.jar`, `/Volumes/path/to/library.jar` or `s3://my-bucket/library.jar`. If S3 is used, make sure the cluster has read access to the library. You may need to launch the cluster with an IAM role to access the S3 URI.
        """
        return pulumi.get(self, "jar")

    @jar.setter
    def jar(self, value: Optional[pulumi.Input[_builtins.str]]):
        pulumi.set(self, "jar", value)

    @_builtins.property
    @pulumi.getter(name="libraryId")
    def library_id(self) -> Optional[pulumi.Input[_builtins.str]]:
        return pulumi.get(self, "library_id")

    @library_id.setter
    def library_id(self, value: Optional[pulumi.Input[_builtins.str]]):
        pulumi.set(self, "library_id", value)

    @_builtins.property
    @pulumi.getter
    def maven(self) -> Optional[pulumi.Input['LibraryMavenArgs']]:
        """
        Configuration block for a Maven library. The block consists of the following fields:
        """
        return pulumi.get(self, "maven")

    @maven.setter
    def maven(self, value: Optional[pulumi.Input['LibraryMavenArgs']]):
        pulumi.set(self, "maven", value)

    @_builtins.property
    @pulumi.getter(name="providerConfig")
    def provider_config(self) -> Optional[pulumi.Input['LibraryProviderConfigArgs']]:
        """
        Configuration block for management through the account provider. This block consists of the following fields:
        """
        return pulumi.get(self, "provider_config")

    @provider_config.setter
    def provider_config(self, value: Optional[pulumi.Input['LibraryProviderConfigArgs']]):
        pulumi.set(self, "provider_config", value)

    @_builtins.property
    @pulumi.getter
    def pypi(self) -> Optional[pulumi.Input['LibraryPypiArgs']]:
        """
        Configuration block for a PyPI library. The block consists of the following fields:
        """
        return pulumi.get(self, "pypi")

    @pypi.setter
    def pypi(self, value: Optional[pulumi.Input['LibraryPypiArgs']]):
        pulumi.set(self, "pypi", value)

    @_builtins.property
    @pulumi.getter
    def requirements(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        Path to the requirements.txt file. Only Workspace paths and Unity Catalog Volumes paths are supported. For example: `/Workspace/path/to/requirements.txt` or `/Volumes/path/to/requirements.txt`. Requires a cluster with DBR 15.0+.
        """
        return pulumi.get(self, "requirements")

    @requirements.setter
    def requirements(self, value: Optional[pulumi.Input[_builtins.str]]):
        pulumi.set(self, "requirements", value)

    @_builtins.property
    @pulumi.getter
    def whl(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        Path to the wheel library. Supported URIs include Workspace paths, Unity Catalog Volumes paths, and S3 URIs. For example: `/Workspace/path/to/library.whl`, `/Volumes/path/to/library.whl` or `s3://my-bucket/library.whl`. If S3 is used, make sure the cluster has read access to the library. You may need to launch the cluster with an IAM role to access the S3 URI.
        """
        return pulumi.get(self, "whl")

    @whl.setter
    def whl(self, value: Optional[pulumi.Input[_builtins.str]]):
        pulumi.set(self, "whl", value)


@pulumi.type_token("databricks:index/library:Library")
class Library(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 cluster_id: Optional[pulumi.Input[_builtins.str]] = None,
                 cran: Optional[pulumi.Input[Union['LibraryCranArgs', 'LibraryCranArgsDict']]] = None,
                 egg: Optional[pulumi.Input[_builtins.str]] = None,
                 jar: Optional[pulumi.Input[_builtins.str]] = None,
                 library_id: Optional[pulumi.Input[_builtins.str]] = None,
                 maven: Optional[pulumi.Input[Union['LibraryMavenArgs', 'LibraryMavenArgsDict']]] = None,
                 provider_config: Optional[pulumi.Input[Union['LibraryProviderConfigArgs', 'LibraryProviderConfigArgsDict']]] = None,
                 pypi: Optional[pulumi.Input[Union['LibraryPypiArgs', 'LibraryPypiArgsDict']]] = None,
                 requirements: Optional[pulumi.Input[_builtins.str]] = None,
                 whl: Optional[pulumi.Input[_builtins.str]] = None,
                 __props__=None):
        """
        Installs a [library](https://docs.databricks.com/libraries/index.html) on databricks_cluster. Each different type of library has a slightly different syntax. It's possible to set only one type of library within one resource. Otherwise, the plan will fail with an error.

        > This resource can only be used with a workspace-level provider!

        > `Library` resource would always start the associated cluster if it's not running, so make sure to have auto-termination configured. It's not possible to atomically change the version of the same library without cluster restart. Libraries are fully removed from the cluster only after restart.

        ## Plugin Framework Migration

        The library resource has been migrated from sdkv2 to plugin framework。 If you encounter any problem with this resource and suspect it is due to the migration, you can fallback to sdkv2 by setting the environment variable in the following way `export USE_SDK_V2_RESOURCES="Library"`.

        ## Installing library on all clusters

        You can install libraries on all clusters with the help of get_clusters data resource:

        ```python
        import pulumi
        import pulumi_databricks as databricks

        all = databricks.get_clusters()
        cli = []
        for range in [{"key": k, "value": v} for [k, v] in enumerate(all.ids)]:
            cli.append(databricks.Library(f"cli-{range['key']}",
                cluster_id=range["key"],
                pypi={
                    "package": "databricks-cli",
                }))
        ```

        ## Java/Scala Maven

        Installing artifacts from Maven repository. You can also optionally specify a `repo` parameter for a custom Maven-style repository, that should be accessible without any authentication. Maven libraries are resolved in Databricks Control Plane, so repo should be accessible from it. It can even be properly configured [maven s3 wagon](https://github.com/seahen/maven-s3-wagon), [AWS CodeArtifact](https://aws.amazon.com/codeartifact/) or [Azure Artifacts](https://azure.microsoft.com/en-us/services/devops/artifacts/).

        ```python
        import pulumi
        import pulumi_databricks as databricks

        deequ = databricks.Library("deequ",
            cluster_id=this["id"],
            maven={
                "coordinates": "com.amazon.deequ:deequ:1.0.4",
                "exclusions": ["org.apache.avro:avro"],
            })
        ```

        ## Python PyPI

        Installing Python PyPI artifacts. You can optionally also specify the `repo` parameter for a custom PyPI mirror, which should be accessible without any authentication for the network that cluster runs in.

        > `repo` host should be accessible from the Internet by Databricks control plane. If connectivity to custom PyPI repositories is required, please modify cluster-node `/etc/pip.conf` through databricks_global_init_script.

        ```python
        import pulumi
        import pulumi_databricks as databricks

        fbprophet = databricks.Library("fbprophet",
            cluster_id=this["id"],
            pypi={
                "package": "fbprophet==0.6",
            })
        ```

        ## Python requirements files

        Installing Python libraries listed in the `requirements.txt` file.  Only Workspace paths and Unity Catalog Volumes paths are supported.  Requires a cluster with DBR 15.0+.

        ```python
        import pulumi
        import pulumi_databricks as databricks

        libraries = databricks.Library("libraries",
            cluster_id=this["id"],
            requirements="/Workspace/path/to/requirements.txt")
        ```

        ## R CRan

        Installing artifacts from CRan. You can also optionally specify a `repo` parameter for a custom cran mirror.

        ```python
        import pulumi
        import pulumi_databricks as databricks

        rkeops = databricks.Library("rkeops",
            cluster_id=this["id"],
            cran={
                "package": "rkeops",
            })
        ```

        ## Related Resources

        The following resources are often used in the same context:

        * End to end workspace management guide.
        * get_clusters data to retrieve a list of Cluster ids.
        * Cluster to create [Databricks Clusters](https://docs.databricks.com/clusters/index.html).
        * ClusterPolicy to create a Cluster policy, which limits the ability to create clusters based on a set of rules.
        * GlobalInitScript to manage [global init scripts](https://docs.databricks.com/clusters/init-scripts.html#global-init-scripts), which are run on all Cluster and databricks_job.
        * Job to manage [Databricks Jobs](https://docs.databricks.com/jobs.html) to run non-interactive code in a databricks_cluster.
        * Pipeline to deploy [Lakeflow Declarative Pipelines](https://docs.databricks.com/aws/en/dlt).
        * Repo to manage [Databricks Repos](https://docs.databricks.com/repos.html).

        ## Import

        !> Importing this resource is not currently supported.

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[_builtins.str] cluster_id: ID of the Cluster to install the library on.
               
               You must specify exactly **one** of the following library types:
        :param pulumi.Input[Union['LibraryCranArgs', 'LibraryCranArgsDict']] cran: Configuration block for a CRAN library. The block consists of the following fields:
        :param pulumi.Input[_builtins.str] egg: Path to the EGG library. Installing Python egg files is deprecated and is not supported in Databricks Runtime 14.0 and above. Use `whl` or `pypi` instead.
        :param pulumi.Input[_builtins.str] jar: Path to the JAR library. Supported URIs include Workspace paths, Unity Catalog Volumes paths, and S3 URIs. For example: `/Workspace/path/to/library.jar`, `/Volumes/path/to/library.jar` or `s3://my-bucket/library.jar`. If S3 is used, make sure the cluster has read access to the library. You may need to launch the cluster with an IAM role to access the S3 URI.
        :param pulumi.Input[Union['LibraryMavenArgs', 'LibraryMavenArgsDict']] maven: Configuration block for a Maven library. The block consists of the following fields:
        :param pulumi.Input[Union['LibraryProviderConfigArgs', 'LibraryProviderConfigArgsDict']] provider_config: Configuration block for management through the account provider. This block consists of the following fields:
        :param pulumi.Input[Union['LibraryPypiArgs', 'LibraryPypiArgsDict']] pypi: Configuration block for a PyPI library. The block consists of the following fields:
        :param pulumi.Input[_builtins.str] requirements: Path to the requirements.txt file. Only Workspace paths and Unity Catalog Volumes paths are supported. For example: `/Workspace/path/to/requirements.txt` or `/Volumes/path/to/requirements.txt`. Requires a cluster with DBR 15.0+.
        :param pulumi.Input[_builtins.str] whl: Path to the wheel library. Supported URIs include Workspace paths, Unity Catalog Volumes paths, and S3 URIs. For example: `/Workspace/path/to/library.whl`, `/Volumes/path/to/library.whl` or `s3://my-bucket/library.whl`. If S3 is used, make sure the cluster has read access to the library. You may need to launch the cluster with an IAM role to access the S3 URI.
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: LibraryArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        Installs a [library](https://docs.databricks.com/libraries/index.html) on databricks_cluster. Each different type of library has a slightly different syntax. It's possible to set only one type of library within one resource. Otherwise, the plan will fail with an error.

        > This resource can only be used with a workspace-level provider!

        > `Library` resource would always start the associated cluster if it's not running, so make sure to have auto-termination configured. It's not possible to atomically change the version of the same library without cluster restart. Libraries are fully removed from the cluster only after restart.

        ## Plugin Framework Migration

        The library resource has been migrated from sdkv2 to plugin framework。 If you encounter any problem with this resource and suspect it is due to the migration, you can fallback to sdkv2 by setting the environment variable in the following way `export USE_SDK_V2_RESOURCES="Library"`.

        ## Installing library on all clusters

        You can install libraries on all clusters with the help of get_clusters data resource:

        ```python
        import pulumi
        import pulumi_databricks as databricks

        all = databricks.get_clusters()
        cli = []
        for range in [{"key": k, "value": v} for [k, v] in enumerate(all.ids)]:
            cli.append(databricks.Library(f"cli-{range['key']}",
                cluster_id=range["key"],
                pypi={
                    "package": "databricks-cli",
                }))
        ```

        ## Java/Scala Maven

        Installing artifacts from Maven repository. You can also optionally specify a `repo` parameter for a custom Maven-style repository, that should be accessible without any authentication. Maven libraries are resolved in Databricks Control Plane, so repo should be accessible from it. It can even be properly configured [maven s3 wagon](https://github.com/seahen/maven-s3-wagon), [AWS CodeArtifact](https://aws.amazon.com/codeartifact/) or [Azure Artifacts](https://azure.microsoft.com/en-us/services/devops/artifacts/).

        ```python
        import pulumi
        import pulumi_databricks as databricks

        deequ = databricks.Library("deequ",
            cluster_id=this["id"],
            maven={
                "coordinates": "com.amazon.deequ:deequ:1.0.4",
                "exclusions": ["org.apache.avro:avro"],
            })
        ```

        ## Python PyPI

        Installing Python PyPI artifacts. You can optionally also specify the `repo` parameter for a custom PyPI mirror, which should be accessible without any authentication for the network that cluster runs in.

        > `repo` host should be accessible from the Internet by Databricks control plane. If connectivity to custom PyPI repositories is required, please modify cluster-node `/etc/pip.conf` through databricks_global_init_script.

        ```python
        import pulumi
        import pulumi_databricks as databricks

        fbprophet = databricks.Library("fbprophet",
            cluster_id=this["id"],
            pypi={
                "package": "fbprophet==0.6",
            })
        ```

        ## Python requirements files

        Installing Python libraries listed in the `requirements.txt` file.  Only Workspace paths and Unity Catalog Volumes paths are supported.  Requires a cluster with DBR 15.0+.

        ```python
        import pulumi
        import pulumi_databricks as databricks

        libraries = databricks.Library("libraries",
            cluster_id=this["id"],
            requirements="/Workspace/path/to/requirements.txt")
        ```

        ## R CRan

        Installing artifacts from CRan. You can also optionally specify a `repo` parameter for a custom cran mirror.

        ```python
        import pulumi
        import pulumi_databricks as databricks

        rkeops = databricks.Library("rkeops",
            cluster_id=this["id"],
            cran={
                "package": "rkeops",
            })
        ```

        ## Related Resources

        The following resources are often used in the same context:

        * End to end workspace management guide.
        * get_clusters data to retrieve a list of Cluster ids.
        * Cluster to create [Databricks Clusters](https://docs.databricks.com/clusters/index.html).
        * ClusterPolicy to create a Cluster policy, which limits the ability to create clusters based on a set of rules.
        * GlobalInitScript to manage [global init scripts](https://docs.databricks.com/clusters/init-scripts.html#global-init-scripts), which are run on all Cluster and databricks_job.
        * Job to manage [Databricks Jobs](https://docs.databricks.com/jobs.html) to run non-interactive code in a databricks_cluster.
        * Pipeline to deploy [Lakeflow Declarative Pipelines](https://docs.databricks.com/aws/en/dlt).
        * Repo to manage [Databricks Repos](https://docs.databricks.com/repos.html).

        ## Import

        !> Importing this resource is not currently supported.

        :param str resource_name: The name of the resource.
        :param LibraryArgs args: The arguments to use to populate this resource's properties.
        :param pulumi.ResourceOptions opts: Options for the resource.
        """
        ...
    def __init__(__self__, resource_name: str, *args, **kwargs):
        resource_args, opts = _utilities.get_resource_args_opts(LibraryArgs, pulumi.ResourceOptions, *args, **kwargs)
        if resource_args is not None:
            __self__._internal_init(resource_name, opts, **resource_args.__dict__)
        else:
            __self__._internal_init(resource_name, *args, **kwargs)

    def _internal_init(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 cluster_id: Optional[pulumi.Input[_builtins.str]] = None,
                 cran: Optional[pulumi.Input[Union['LibraryCranArgs', 'LibraryCranArgsDict']]] = None,
                 egg: Optional[pulumi.Input[_builtins.str]] = None,
                 jar: Optional[pulumi.Input[_builtins.str]] = None,
                 library_id: Optional[pulumi.Input[_builtins.str]] = None,
                 maven: Optional[pulumi.Input[Union['LibraryMavenArgs', 'LibraryMavenArgsDict']]] = None,
                 provider_config: Optional[pulumi.Input[Union['LibraryProviderConfigArgs', 'LibraryProviderConfigArgsDict']]] = None,
                 pypi: Optional[pulumi.Input[Union['LibraryPypiArgs', 'LibraryPypiArgsDict']]] = None,
                 requirements: Optional[pulumi.Input[_builtins.str]] = None,
                 whl: Optional[pulumi.Input[_builtins.str]] = None,
                 __props__=None):
        opts = pulumi.ResourceOptions.merge(_utilities.get_resource_opts_defaults(), opts)
        if not isinstance(opts, pulumi.ResourceOptions):
            raise TypeError('Expected resource options to be a ResourceOptions instance')
        if opts.id is None:
            if __props__ is not None:
                raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
            __props__ = LibraryArgs.__new__(LibraryArgs)

            if cluster_id is None and not opts.urn:
                raise TypeError("Missing required property 'cluster_id'")
            __props__.__dict__["cluster_id"] = cluster_id
            __props__.__dict__["cran"] = cran
            __props__.__dict__["egg"] = egg
            __props__.__dict__["jar"] = jar
            __props__.__dict__["library_id"] = library_id
            __props__.__dict__["maven"] = maven
            __props__.__dict__["provider_config"] = provider_config
            __props__.__dict__["pypi"] = pypi
            __props__.__dict__["requirements"] = requirements
            __props__.__dict__["whl"] = whl
        super(Library, __self__).__init__(
            'databricks:index/library:Library',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            cluster_id: Optional[pulumi.Input[_builtins.str]] = None,
            cran: Optional[pulumi.Input[Union['LibraryCranArgs', 'LibraryCranArgsDict']]] = None,
            egg: Optional[pulumi.Input[_builtins.str]] = None,
            jar: Optional[pulumi.Input[_builtins.str]] = None,
            library_id: Optional[pulumi.Input[_builtins.str]] = None,
            maven: Optional[pulumi.Input[Union['LibraryMavenArgs', 'LibraryMavenArgsDict']]] = None,
            provider_config: Optional[pulumi.Input[Union['LibraryProviderConfigArgs', 'LibraryProviderConfigArgsDict']]] = None,
            pypi: Optional[pulumi.Input[Union['LibraryPypiArgs', 'LibraryPypiArgsDict']]] = None,
            requirements: Optional[pulumi.Input[_builtins.str]] = None,
            whl: Optional[pulumi.Input[_builtins.str]] = None) -> 'Library':
        """
        Get an existing Library resource's state with the given name, id, and optional extra
        properties used to qualify the lookup.

        :param str resource_name: The unique name of the resulting resource.
        :param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[_builtins.str] cluster_id: ID of the Cluster to install the library on.
               
               You must specify exactly **one** of the following library types:
        :param pulumi.Input[Union['LibraryCranArgs', 'LibraryCranArgsDict']] cran: Configuration block for a CRAN library. The block consists of the following fields:
        :param pulumi.Input[_builtins.str] egg: Path to the EGG library. Installing Python egg files is deprecated and is not supported in Databricks Runtime 14.0 and above. Use `whl` or `pypi` instead.
        :param pulumi.Input[_builtins.str] jar: Path to the JAR library. Supported URIs include Workspace paths, Unity Catalog Volumes paths, and S3 URIs. For example: `/Workspace/path/to/library.jar`, `/Volumes/path/to/library.jar` or `s3://my-bucket/library.jar`. If S3 is used, make sure the cluster has read access to the library. You may need to launch the cluster with an IAM role to access the S3 URI.
        :param pulumi.Input[Union['LibraryMavenArgs', 'LibraryMavenArgsDict']] maven: Configuration block for a Maven library. The block consists of the following fields:
        :param pulumi.Input[Union['LibraryProviderConfigArgs', 'LibraryProviderConfigArgsDict']] provider_config: Configuration block for management through the account provider. This block consists of the following fields:
        :param pulumi.Input[Union['LibraryPypiArgs', 'LibraryPypiArgsDict']] pypi: Configuration block for a PyPI library. The block consists of the following fields:
        :param pulumi.Input[_builtins.str] requirements: Path to the requirements.txt file. Only Workspace paths and Unity Catalog Volumes paths are supported. For example: `/Workspace/path/to/requirements.txt` or `/Volumes/path/to/requirements.txt`. Requires a cluster with DBR 15.0+.
        :param pulumi.Input[_builtins.str] whl: Path to the wheel library. Supported URIs include Workspace paths, Unity Catalog Volumes paths, and S3 URIs. For example: `/Workspace/path/to/library.whl`, `/Volumes/path/to/library.whl` or `s3://my-bucket/library.whl`. If S3 is used, make sure the cluster has read access to the library. You may need to launch the cluster with an IAM role to access the S3 URI.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _LibraryState.__new__(_LibraryState)

        __props__.__dict__["cluster_id"] = cluster_id
        __props__.__dict__["cran"] = cran
        __props__.__dict__["egg"] = egg
        __props__.__dict__["jar"] = jar
        __props__.__dict__["library_id"] = library_id
        __props__.__dict__["maven"] = maven
        __props__.__dict__["provider_config"] = provider_config
        __props__.__dict__["pypi"] = pypi
        __props__.__dict__["requirements"] = requirements
        __props__.__dict__["whl"] = whl
        return Library(resource_name, opts=opts, __props__=__props__)

    @_builtins.property
    @pulumi.getter(name="clusterId")
    def cluster_id(self) -> pulumi.Output[_builtins.str]:
        """
        ID of the Cluster to install the library on.

        You must specify exactly **one** of the following library types:
        """
        return pulumi.get(self, "cluster_id")

    @_builtins.property
    @pulumi.getter
    def cran(self) -> pulumi.Output[Optional['outputs.LibraryCran']]:
        """
        Configuration block for a CRAN library. The block consists of the following fields:
        """
        return pulumi.get(self, "cran")

    @_builtins.property
    @pulumi.getter
    @_utilities.deprecated("""The `egg` library type is deprecated. Please use `whl` or `pypi` instead.""")
    def egg(self) -> pulumi.Output[Optional[_builtins.str]]:
        """
        Path to the EGG library. Installing Python egg files is deprecated and is not supported in Databricks Runtime 14.0 and above. Use `whl` or `pypi` instead.
        """
        return pulumi.get(self, "egg")

    @_builtins.property
    @pulumi.getter
    def jar(self) -> pulumi.Output[Optional[_builtins.str]]:
        """
        Path to the JAR library. Supported URIs include Workspace paths, Unity Catalog Volumes paths, and S3 URIs. For example: `/Workspace/path/to/library.jar`, `/Volumes/path/to/library.jar` or `s3://my-bucket/library.jar`. If S3 is used, make sure the cluster has read access to the library. You may need to launch the cluster with an IAM role to access the S3 URI.
        """
        return pulumi.get(self, "jar")

    @_builtins.property
    @pulumi.getter(name="libraryId")
    def library_id(self) -> pulumi.Output[_builtins.str]:
        return pulumi.get(self, "library_id")

    @_builtins.property
    @pulumi.getter
    def maven(self) -> pulumi.Output[Optional['outputs.LibraryMaven']]:
        """
        Configuration block for a Maven library. The block consists of the following fields:
        """
        return pulumi.get(self, "maven")

    @_builtins.property
    @pulumi.getter(name="providerConfig")
    def provider_config(self) -> pulumi.Output[Optional['outputs.LibraryProviderConfig']]:
        """
        Configuration block for management through the account provider. This block consists of the following fields:
        """
        return pulumi.get(self, "provider_config")

    @_builtins.property
    @pulumi.getter
    def pypi(self) -> pulumi.Output[Optional['outputs.LibraryPypi']]:
        """
        Configuration block for a PyPI library. The block consists of the following fields:
        """
        return pulumi.get(self, "pypi")

    @_builtins.property
    @pulumi.getter
    def requirements(self) -> pulumi.Output[Optional[_builtins.str]]:
        """
        Path to the requirements.txt file. Only Workspace paths and Unity Catalog Volumes paths are supported. For example: `/Workspace/path/to/requirements.txt` or `/Volumes/path/to/requirements.txt`. Requires a cluster with DBR 15.0+.
        """
        return pulumi.get(self, "requirements")

    @_builtins.property
    @pulumi.getter
    def whl(self) -> pulumi.Output[Optional[_builtins.str]]:
        """
        Path to the wheel library. Supported URIs include Workspace paths, Unity Catalog Volumes paths, and S3 URIs. For example: `/Workspace/path/to/library.whl`, `/Volumes/path/to/library.whl` or `s3://my-bucket/library.whl`. If S3 is used, make sure the cluster has read access to the library. You may need to launch the cluster with an IAM role to access the S3 URI.
        """
        return pulumi.get(self, "whl")

