# coding=utf-8
# *** WARNING: this file was generated by pulumigen. ***
# *** 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 ._enums import *

__all__ = ['RecoverPostgresArgs', 'RecoverPostgres']

@pulumi.input_type
class RecoverPostgresArgs:
    def __init__(__self__, *,
                 restore_time: pulumi.Input[str],
                 datadog_api_key: Optional[pulumi.Input[str]] = None,
                 environment_id: Optional[pulumi.Input[str]] = None,
                 plan: Optional[pulumi.Input[str]] = None,
                 postgres_id: Optional[pulumi.Input[str]] = None,
                 restore_name: Optional[pulumi.Input[str]] = None):
        """
        The set of arguments for constructing a RecoverPostgres resource.
        :param pulumi.Input[str] restore_time: The point in time to restore the database to. See `/recovery-info` for restore availability
        :param pulumi.Input[str] datadog_api_key: Datadog API key to use for monitoring the new database. Defaults to the API key of the original database. Use an empty string to prevent copying of the API key to the new database.
        :param pulumi.Input[str] environment_id: The environment to create the new database in. Defaults to the environment of the original database.
        :param pulumi.Input[str] plan: The plan to use for the new database. Defaults to the same plan as the original database. Cannot be a lower tier plan than the original database.
        :param pulumi.Input[str] restore_name: Name of the new database.
        """
        pulumi.set(__self__, "restore_time", restore_time)
        if datadog_api_key is not None:
            pulumi.set(__self__, "datadog_api_key", datadog_api_key)
        if environment_id is not None:
            pulumi.set(__self__, "environment_id", environment_id)
        if plan is not None:
            pulumi.set(__self__, "plan", plan)
        if postgres_id is not None:
            pulumi.set(__self__, "postgres_id", postgres_id)
        if restore_name is not None:
            pulumi.set(__self__, "restore_name", restore_name)

    @property
    @pulumi.getter(name="restoreTime")
    def restore_time(self) -> pulumi.Input[str]:
        """
        The point in time to restore the database to. See `/recovery-info` for restore availability
        """
        return pulumi.get(self, "restore_time")

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

    @property
    @pulumi.getter(name="datadogApiKey")
    def datadog_api_key(self) -> Optional[pulumi.Input[str]]:
        """
        Datadog API key to use for monitoring the new database. Defaults to the API key of the original database. Use an empty string to prevent copying of the API key to the new database.
        """
        return pulumi.get(self, "datadog_api_key")

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

    @property
    @pulumi.getter(name="environmentId")
    def environment_id(self) -> Optional[pulumi.Input[str]]:
        """
        The environment to create the new database in. Defaults to the environment of the original database.
        """
        return pulumi.get(self, "environment_id")

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

    @property
    @pulumi.getter
    def plan(self) -> Optional[pulumi.Input[str]]:
        """
        The plan to use for the new database. Defaults to the same plan as the original database. Cannot be a lower tier plan than the original database.
        """
        return pulumi.get(self, "plan")

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

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

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

    @property
    @pulumi.getter(name="restoreName")
    def restore_name(self) -> Optional[pulumi.Input[str]]:
        """
        Name of the new database.
        """
        return pulumi.get(self, "restore_name")

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


class RecoverPostgres(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 datadog_api_key: Optional[pulumi.Input[str]] = None,
                 environment_id: Optional[pulumi.Input[str]] = None,
                 plan: Optional[pulumi.Input[str]] = None,
                 postgres_id: Optional[pulumi.Input[str]] = None,
                 restore_name: Optional[pulumi.Input[str]] = None,
                 restore_time: Optional[pulumi.Input[str]] = None,
                 __props__=None):
        """
        Create a RecoverPostgres resource with the given unique name, props, and options.
        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] datadog_api_key: Datadog API key to use for monitoring the new database. Defaults to the API key of the original database. Use an empty string to prevent copying of the API key to the new database.
        :param pulumi.Input[str] environment_id: The environment to create the new database in. Defaults to the environment of the original database.
        :param pulumi.Input[str] plan: The plan to use for the new database. Defaults to the same plan as the original database. Cannot be a lower tier plan than the original database.
        :param pulumi.Input[str] restore_name: Name of the new database.
        :param pulumi.Input[str] restore_time: The point in time to restore the database to. See `/recovery-info` for restore availability
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: RecoverPostgresArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        Create a RecoverPostgres resource with the given unique name, props, and options.
        :param str resource_name: The name of the resource.
        :param RecoverPostgresArgs 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(RecoverPostgresArgs, 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,
                 datadog_api_key: Optional[pulumi.Input[str]] = None,
                 environment_id: Optional[pulumi.Input[str]] = None,
                 plan: Optional[pulumi.Input[str]] = None,
                 postgres_id: Optional[pulumi.Input[str]] = None,
                 restore_name: Optional[pulumi.Input[str]] = None,
                 restore_time: 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__ = RecoverPostgresArgs.__new__(RecoverPostgresArgs)

            __props__.__dict__["datadog_api_key"] = datadog_api_key
            __props__.__dict__["environment_id"] = environment_id
            __props__.__dict__["plan"] = plan
            __props__.__dict__["postgres_id"] = postgres_id
            __props__.__dict__["restore_name"] = restore_name
            if restore_time is None and not opts.urn:
                raise TypeError("Missing required property 'restore_time'")
            __props__.__dict__["restore_time"] = restore_time
            __props__.__dict__["created_at"] = None
            __props__.__dict__["dashboard_url"] = None
            __props__.__dict__["database_name"] = None
            __props__.__dict__["database_user"] = None
            __props__.__dict__["disk_size_gb"] = None
            __props__.__dict__["expires_at"] = None
            __props__.__dict__["high_availability_enabled"] = None
            __props__.__dict__["ip_allow_list"] = None
            __props__.__dict__["maintenance"] = None
            __props__.__dict__["name"] = None
            __props__.__dict__["owner"] = None
            __props__.__dict__["primary_postgres_id"] = None
            __props__.__dict__["read_replicas"] = None
            __props__.__dict__["region"] = None
            __props__.__dict__["role"] = None
            __props__.__dict__["status"] = None
            __props__.__dict__["suspended"] = None
            __props__.__dict__["suspenders"] = None
            __props__.__dict__["updated_at"] = None
            __props__.__dict__["version"] = None
        super(RecoverPostgres, __self__).__init__(
            'render:postgres:RecoverPostgres',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None) -> 'RecoverPostgres':
        """
        Get an existing RecoverPostgres 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__ = RecoverPostgresArgs.__new__(RecoverPostgresArgs)

        __props__.__dict__["created_at"] = None
        __props__.__dict__["dashboard_url"] = None
        __props__.__dict__["database_name"] = None
        __props__.__dict__["database_user"] = None
        __props__.__dict__["datadog_api_key"] = None
        __props__.__dict__["disk_size_gb"] = None
        __props__.__dict__["environment_id"] = None
        __props__.__dict__["expires_at"] = None
        __props__.__dict__["high_availability_enabled"] = None
        __props__.__dict__["ip_allow_list"] = None
        __props__.__dict__["maintenance"] = None
        __props__.__dict__["name"] = None
        __props__.__dict__["owner"] = None
        __props__.__dict__["plan"] = None
        __props__.__dict__["primary_postgres_id"] = None
        __props__.__dict__["read_replicas"] = None
        __props__.__dict__["region"] = None
        __props__.__dict__["restore_name"] = None
        __props__.__dict__["restore_time"] = None
        __props__.__dict__["role"] = None
        __props__.__dict__["status"] = None
        __props__.__dict__["suspended"] = None
        __props__.__dict__["suspenders"] = None
        __props__.__dict__["updated_at"] = None
        __props__.__dict__["version"] = None
        return RecoverPostgres(resource_name, opts=opts, __props__=__props__)

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

    @property
    @pulumi.getter(name="dashboardUrl")
    def dashboard_url(self) -> pulumi.Output[str]:
        """
        The URL to view the PostgreSQL instance in the Render Dashboard
        """
        return pulumi.get(self, "dashboard_url")

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

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

    @property
    @pulumi.getter(name="datadogApiKey")
    def datadog_api_key(self) -> pulumi.Output[Optional[str]]:
        """
        Datadog API key to use for monitoring the new database. Defaults to the API key of the original database. Use an empty string to prevent copying of the API key to the new database.
        """
        return pulumi.get(self, "datadog_api_key")

    @property
    @pulumi.getter(name="diskSizeGB")
    def disk_size_gb(self) -> pulumi.Output[Optional[int]]:
        return pulumi.get(self, "disk_size_gb")

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

    @property
    @pulumi.getter(name="expiresAt")
    def expires_at(self) -> pulumi.Output[Optional[str]]:
        """
        The time at which the database will be expire. Applies to free tier databases only.
        """
        return pulumi.get(self, "expires_at")

    @property
    @pulumi.getter(name="highAvailabilityEnabled")
    def high_availability_enabled(self) -> pulumi.Output[bool]:
        return pulumi.get(self, "high_availability_enabled")

    @property
    @pulumi.getter(name="ipAllowList")
    def ip_allow_list(self) -> pulumi.Output[Sequence['outputs.CidrBlockAndDescription']]:
        return pulumi.get(self, "ip_allow_list")

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

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

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

    @property
    @pulumi.getter
    def plan(self) -> pulumi.Output['Plan']:
        return pulumi.get(self, "plan")

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

    @property
    @pulumi.getter(name="readReplicas")
    def read_replicas(self) -> pulumi.Output[Sequence['outputs.ReadReplica']]:
        return pulumi.get(self, "read_replicas")

    @property
    @pulumi.getter
    def region(self) -> pulumi.Output['Region']:
        """
        Defaults to "oregon"
        """
        return pulumi.get(self, "region")

    @property
    @pulumi.getter(name="restoreName")
    def restore_name(self) -> pulumi.Output[Optional[str]]:
        """
        Name of the new database.
        """
        return pulumi.get(self, "restore_name")

    @property
    @pulumi.getter(name="restoreTime")
    def restore_time(self) -> pulumi.Output[str]:
        """
        The point in time to restore the database to. See `/recovery-info` for restore availability
        """
        return pulumi.get(self, "restore_time")

    @property
    @pulumi.getter
    def role(self) -> pulumi.Output['Role']:
        return pulumi.get(self, "role")

    @property
    @pulumi.getter
    def status(self) -> pulumi.Output['Status']:
        return pulumi.get(self, "status")

    @property
    @pulumi.getter
    def suspended(self) -> pulumi.Output['RecoverPostgresSuspended']:
        return pulumi.get(self, "suspended")

    @property
    @pulumi.getter
    def suspenders(self) -> pulumi.Output[Sequence['SuspendersItem']]:
        return pulumi.get(self, "suspenders")

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

    @property
    @pulumi.getter
    def version(self) -> pulumi.Output['Version']:
        """
        The PostgreSQL version
        """
        return pulumi.get(self, "version")

