# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import copy
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import _utilities
from . import outputs
from ._inputs import *

__all__ = ['SqlWidgetArgs', 'SqlWidget']

@pulumi.input_type
class SqlWidgetArgs:
    def __init__(__self__, *,
                 dashboard_id: pulumi.Input[str],
                 description: Optional[pulumi.Input[str]] = None,
                 parameters: Optional[pulumi.Input[Sequence[pulumi.Input['SqlWidgetParameterArgs']]]] = None,
                 position: Optional[pulumi.Input['SqlWidgetPositionArgs']] = None,
                 text: Optional[pulumi.Input[str]] = None,
                 title: Optional[pulumi.Input[str]] = None,
                 visualization_id: Optional[pulumi.Input[str]] = None,
                 widget_id: Optional[pulumi.Input[str]] = None):
        """
        The set of arguments for constructing a SqlWidget resource.
        """
        pulumi.set(__self__, "dashboard_id", dashboard_id)
        if description is not None:
            pulumi.set(__self__, "description", description)
        if parameters is not None:
            pulumi.set(__self__, "parameters", parameters)
        if position is not None:
            pulumi.set(__self__, "position", position)
        if text is not None:
            pulumi.set(__self__, "text", text)
        if title is not None:
            pulumi.set(__self__, "title", title)
        if visualization_id is not None:
            pulumi.set(__self__, "visualization_id", visualization_id)
        if widget_id is not None:
            pulumi.set(__self__, "widget_id", widget_id)

    @property
    @pulumi.getter(name="dashboardId")
    def dashboard_id(self) -> pulumi.Input[str]:
        return pulumi.get(self, "dashboard_id")

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

    @property
    @pulumi.getter
    def description(self) -> Optional[pulumi.Input[str]]:
        return pulumi.get(self, "description")

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

    @property
    @pulumi.getter
    def parameters(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['SqlWidgetParameterArgs']]]]:
        return pulumi.get(self, "parameters")

    @parameters.setter
    def parameters(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['SqlWidgetParameterArgs']]]]):
        pulumi.set(self, "parameters", value)

    @property
    @pulumi.getter
    def position(self) -> Optional[pulumi.Input['SqlWidgetPositionArgs']]:
        return pulumi.get(self, "position")

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

    @property
    @pulumi.getter
    def text(self) -> Optional[pulumi.Input[str]]:
        return pulumi.get(self, "text")

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

    @property
    @pulumi.getter
    def title(self) -> Optional[pulumi.Input[str]]:
        return pulumi.get(self, "title")

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

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

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

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

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


@pulumi.input_type
class _SqlWidgetState:
    def __init__(__self__, *,
                 dashboard_id: Optional[pulumi.Input[str]] = None,
                 description: Optional[pulumi.Input[str]] = None,
                 parameters: Optional[pulumi.Input[Sequence[pulumi.Input['SqlWidgetParameterArgs']]]] = None,
                 position: Optional[pulumi.Input['SqlWidgetPositionArgs']] = None,
                 text: Optional[pulumi.Input[str]] = None,
                 title: Optional[pulumi.Input[str]] = None,
                 visualization_id: Optional[pulumi.Input[str]] = None,
                 widget_id: Optional[pulumi.Input[str]] = None):
        """
        Input properties used for looking up and filtering SqlWidget resources.
        """
        if dashboard_id is not None:
            pulumi.set(__self__, "dashboard_id", dashboard_id)
        if description is not None:
            pulumi.set(__self__, "description", description)
        if parameters is not None:
            pulumi.set(__self__, "parameters", parameters)
        if position is not None:
            pulumi.set(__self__, "position", position)
        if text is not None:
            pulumi.set(__self__, "text", text)
        if title is not None:
            pulumi.set(__self__, "title", title)
        if visualization_id is not None:
            pulumi.set(__self__, "visualization_id", visualization_id)
        if widget_id is not None:
            pulumi.set(__self__, "widget_id", widget_id)

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

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

    @property
    @pulumi.getter
    def description(self) -> Optional[pulumi.Input[str]]:
        return pulumi.get(self, "description")

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

    @property
    @pulumi.getter
    def parameters(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['SqlWidgetParameterArgs']]]]:
        return pulumi.get(self, "parameters")

    @parameters.setter
    def parameters(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['SqlWidgetParameterArgs']]]]):
        pulumi.set(self, "parameters", value)

    @property
    @pulumi.getter
    def position(self) -> Optional[pulumi.Input['SqlWidgetPositionArgs']]:
        return pulumi.get(self, "position")

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

    @property
    @pulumi.getter
    def text(self) -> Optional[pulumi.Input[str]]:
        return pulumi.get(self, "text")

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

    @property
    @pulumi.getter
    def title(self) -> Optional[pulumi.Input[str]]:
        return pulumi.get(self, "title")

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

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

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

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

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


class SqlWidget(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 dashboard_id: Optional[pulumi.Input[str]] = None,
                 description: Optional[pulumi.Input[str]] = None,
                 parameters: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['SqlWidgetParameterArgs']]]]] = None,
                 position: Optional[pulumi.Input[pulumi.InputType['SqlWidgetPositionArgs']]] = None,
                 text: Optional[pulumi.Input[str]] = None,
                 title: Optional[pulumi.Input[str]] = None,
                 visualization_id: Optional[pulumi.Input[str]] = None,
                 widget_id: Optional[pulumi.Input[str]] = None,
                 __props__=None):
        """
        To manage [SQLA resources](https://docs.databricks.com/sql/get-started/concepts.html) you must have `databricks_sql_access` on your Group or databricks_user.

        **Note:** documentation for this resource is a work in progress.

        A widget is always tied to a dashboard. Every dashboard may have one or more widgets.

        ## Example Usage

        ```python
        import pulumi
        import pulumi_databricks as databricks

        d1w1 = databricks.SqlWidget("d1w1",
            dashboard_id=databricks_sql_dashboard["d1"]["id"],
            text="Hello! I'm a **text widget**!",
            position=databricks.SqlWidgetPositionArgs(
                size_x=3,
                size_y=4,
                pos_x=0,
                pos_y=0,
            ))
        d1w2 = databricks.SqlWidget("d1w2",
            dashboard_id=databricks_sql_dashboard["d1"]["id"],
            visualization_id=databricks_sql_visualization["q1v1"]["id"],
            position=databricks.SqlWidgetPositionArgs(
                size_x=3,
                size_y=4,
                pos_x=3,
                pos_y=0,
            ))
        ```
        ## Related Resources

        The following resources are often used in the same context:

        * End to end workspace management guide.
        * SqlDashboard to manage Databricks SQL [Dashboards](https://docs.databricks.com/sql/user/dashboards/index.html).
        * SqlEndpoint to manage Databricks SQL [Endpoints](https://docs.databricks.com/sql/admin/sql-endpoints.html).
        * SqlGlobalConfig to configure the security policy, databricks_instance_profile, and [data access properties](https://docs.databricks.com/sql/admin/data-access-configuration.html) for all SqlEndpoint of workspace.
        * SqlPermissions to manage data object access control lists in Databricks workspaces for things like tables, views, databases, and [more](https://docs.databricks.com/security/access-control/table-acls/object-privileges.html).

        ## Import

        You can import a `databricks_sql_widget` resource with ID like the followingbash

        ```sh
         $ pulumi import databricks:index/sqlWidget:SqlWidget this <dashboard-id>/<widget-id>
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: SqlWidgetArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        To manage [SQLA resources](https://docs.databricks.com/sql/get-started/concepts.html) you must have `databricks_sql_access` on your Group or databricks_user.

        **Note:** documentation for this resource is a work in progress.

        A widget is always tied to a dashboard. Every dashboard may have one or more widgets.

        ## Example Usage

        ```python
        import pulumi
        import pulumi_databricks as databricks

        d1w1 = databricks.SqlWidget("d1w1",
            dashboard_id=databricks_sql_dashboard["d1"]["id"],
            text="Hello! I'm a **text widget**!",
            position=databricks.SqlWidgetPositionArgs(
                size_x=3,
                size_y=4,
                pos_x=0,
                pos_y=0,
            ))
        d1w2 = databricks.SqlWidget("d1w2",
            dashboard_id=databricks_sql_dashboard["d1"]["id"],
            visualization_id=databricks_sql_visualization["q1v1"]["id"],
            position=databricks.SqlWidgetPositionArgs(
                size_x=3,
                size_y=4,
                pos_x=3,
                pos_y=0,
            ))
        ```
        ## Related Resources

        The following resources are often used in the same context:

        * End to end workspace management guide.
        * SqlDashboard to manage Databricks SQL [Dashboards](https://docs.databricks.com/sql/user/dashboards/index.html).
        * SqlEndpoint to manage Databricks SQL [Endpoints](https://docs.databricks.com/sql/admin/sql-endpoints.html).
        * SqlGlobalConfig to configure the security policy, databricks_instance_profile, and [data access properties](https://docs.databricks.com/sql/admin/data-access-configuration.html) for all SqlEndpoint of workspace.
        * SqlPermissions to manage data object access control lists in Databricks workspaces for things like tables, views, databases, and [more](https://docs.databricks.com/security/access-control/table-acls/object-privileges.html).

        ## Import

        You can import a `databricks_sql_widget` resource with ID like the followingbash

        ```sh
         $ pulumi import databricks:index/sqlWidget:SqlWidget this <dashboard-id>/<widget-id>
        ```

        :param str resource_name: The name of the resource.
        :param SqlWidgetArgs 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(SqlWidgetArgs, 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,
                 dashboard_id: Optional[pulumi.Input[str]] = None,
                 description: Optional[pulumi.Input[str]] = None,
                 parameters: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['SqlWidgetParameterArgs']]]]] = None,
                 position: Optional[pulumi.Input[pulumi.InputType['SqlWidgetPositionArgs']]] = None,
                 text: Optional[pulumi.Input[str]] = None,
                 title: Optional[pulumi.Input[str]] = None,
                 visualization_id: Optional[pulumi.Input[str]] = None,
                 widget_id: Optional[pulumi.Input[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__ = SqlWidgetArgs.__new__(SqlWidgetArgs)

            if dashboard_id is None and not opts.urn:
                raise TypeError("Missing required property 'dashboard_id'")
            __props__.__dict__["dashboard_id"] = dashboard_id
            __props__.__dict__["description"] = description
            __props__.__dict__["parameters"] = parameters
            __props__.__dict__["position"] = position
            __props__.__dict__["text"] = text
            __props__.__dict__["title"] = title
            __props__.__dict__["visualization_id"] = visualization_id
            __props__.__dict__["widget_id"] = widget_id
        super(SqlWidget, __self__).__init__(
            'databricks:index/sqlWidget:SqlWidget',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            dashboard_id: Optional[pulumi.Input[str]] = None,
            description: Optional[pulumi.Input[str]] = None,
            parameters: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['SqlWidgetParameterArgs']]]]] = None,
            position: Optional[pulumi.Input[pulumi.InputType['SqlWidgetPositionArgs']]] = None,
            text: Optional[pulumi.Input[str]] = None,
            title: Optional[pulumi.Input[str]] = None,
            visualization_id: Optional[pulumi.Input[str]] = None,
            widget_id: Optional[pulumi.Input[str]] = None) -> 'SqlWidget':
        """
        Get an existing SqlWidget 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.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _SqlWidgetState.__new__(_SqlWidgetState)

        __props__.__dict__["dashboard_id"] = dashboard_id
        __props__.__dict__["description"] = description
        __props__.__dict__["parameters"] = parameters
        __props__.__dict__["position"] = position
        __props__.__dict__["text"] = text
        __props__.__dict__["title"] = title
        __props__.__dict__["visualization_id"] = visualization_id
        __props__.__dict__["widget_id"] = widget_id
        return SqlWidget(resource_name, opts=opts, __props__=__props__)

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

    @property
    @pulumi.getter
    def description(self) -> pulumi.Output[Optional[str]]:
        return pulumi.get(self, "description")

    @property
    @pulumi.getter
    def parameters(self) -> pulumi.Output[Optional[Sequence['outputs.SqlWidgetParameter']]]:
        return pulumi.get(self, "parameters")

    @property
    @pulumi.getter
    def position(self) -> pulumi.Output[Optional['outputs.SqlWidgetPosition']]:
        return pulumi.get(self, "position")

    @property
    @pulumi.getter
    def text(self) -> pulumi.Output[Optional[str]]:
        return pulumi.get(self, "text")

    @property
    @pulumi.getter
    def title(self) -> pulumi.Output[Optional[str]]:
        return pulumi.get(self, "title")

    @property
    @pulumi.getter(name="visualizationId")
    def visualization_id(self) -> pulumi.Output[Optional[str]]:
        return pulumi.get(self, "visualization_id")

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

