# 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 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

__all__ = ['RdbSnapshotArgs', 'RdbSnapshot']

@pulumi.input_type
class RdbSnapshotArgs:
    def __init__(__self__, *,
                 instance_id: pulumi.Input[str],
                 expires_at: Optional[pulumi.Input[str]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 region: Optional[pulumi.Input[str]] = None):
        """
        The set of arguments for constructing a RdbSnapshot resource.
        :param pulumi.Input[str] instance_id: The UUID of the database instance for which the snapshot is created.
        :param pulumi.Input[str] expires_at: Expiration date of the snapshot in ISO 8601 format (e.g., `2025-01-31T00:00:00Z`). If not set, the snapshot will not expire automatically.
        :param pulumi.Input[str] name: The name of the snapshot.
        :param pulumi.Input[str] region: The region where the snapshot is stored. Defaults to the region set in the provider configuration.
        """
        pulumi.set(__self__, "instance_id", instance_id)
        if expires_at is not None:
            pulumi.set(__self__, "expires_at", expires_at)
        if name is not None:
            pulumi.set(__self__, "name", name)
        if region is not None:
            pulumi.set(__self__, "region", region)

    @property
    @pulumi.getter(name="instanceId")
    def instance_id(self) -> pulumi.Input[str]:
        """
        The UUID of the database instance for which the snapshot is created.
        """
        return pulumi.get(self, "instance_id")

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

    @property
    @pulumi.getter(name="expiresAt")
    def expires_at(self) -> Optional[pulumi.Input[str]]:
        """
        Expiration date of the snapshot in ISO 8601 format (e.g., `2025-01-31T00:00:00Z`). If not set, the snapshot will not expire automatically.
        """
        return pulumi.get(self, "expires_at")

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

    @property
    @pulumi.getter
    def name(self) -> Optional[pulumi.Input[str]]:
        """
        The name of the snapshot.
        """
        return pulumi.get(self, "name")

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

    @property
    @pulumi.getter
    def region(self) -> Optional[pulumi.Input[str]]:
        """
        The region where the snapshot is stored. Defaults to the region set in the provider configuration.
        """
        return pulumi.get(self, "region")

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


@pulumi.input_type
class _RdbSnapshotState:
    def __init__(__self__, *,
                 created_at: Optional[pulumi.Input[str]] = None,
                 expires_at: Optional[pulumi.Input[str]] = None,
                 instance_id: Optional[pulumi.Input[str]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 node_type: Optional[pulumi.Input[str]] = None,
                 region: Optional[pulumi.Input[str]] = None,
                 size: Optional[pulumi.Input[int]] = None,
                 status: Optional[pulumi.Input[str]] = None,
                 updated_at: Optional[pulumi.Input[str]] = None,
                 volume_type: Optional[pulumi.Input[str]] = None):
        """
        Input properties used for looking up and filtering RdbSnapshot resources.
        :param pulumi.Input[str] created_at: The timestamp when the snapshot was created, in ISO 8601 format.
        :param pulumi.Input[str] expires_at: Expiration date of the snapshot in ISO 8601 format (e.g., `2025-01-31T00:00:00Z`). If not set, the snapshot will not expire automatically.
        :param pulumi.Input[str] instance_id: The UUID of the database instance for which the snapshot is created.
        :param pulumi.Input[str] name: The name of the snapshot.
        :param pulumi.Input[str] node_type: The type of the database instance for which the snapshot was created.
        :param pulumi.Input[str] region: The region where the snapshot is stored. Defaults to the region set in the provider configuration.
        :param pulumi.Input[int] size: The size of the snapshot in bytes.
        :param pulumi.Input[str] status: The current status of the snapshot (e.g., `ready`, `creating`, `error`).
        :param pulumi.Input[str] updated_at: The timestamp when the snapshot was last updated, in ISO 8601 format.
        :param pulumi.Input[str] volume_type: The type of volume used by the snapshot.
        """
        if created_at is not None:
            pulumi.set(__self__, "created_at", created_at)
        if expires_at is not None:
            pulumi.set(__self__, "expires_at", expires_at)
        if instance_id is not None:
            pulumi.set(__self__, "instance_id", instance_id)
        if name is not None:
            pulumi.set(__self__, "name", name)
        if node_type is not None:
            pulumi.set(__self__, "node_type", node_type)
        if region is not None:
            pulumi.set(__self__, "region", region)
        if size is not None:
            pulumi.set(__self__, "size", size)
        if status is not None:
            pulumi.set(__self__, "status", status)
        if updated_at is not None:
            pulumi.set(__self__, "updated_at", updated_at)
        if volume_type is not None:
            pulumi.set(__self__, "volume_type", volume_type)

    @property
    @pulumi.getter(name="createdAt")
    def created_at(self) -> Optional[pulumi.Input[str]]:
        """
        The timestamp when the snapshot was created, in ISO 8601 format.
        """
        return pulumi.get(self, "created_at")

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

    @property
    @pulumi.getter(name="expiresAt")
    def expires_at(self) -> Optional[pulumi.Input[str]]:
        """
        Expiration date of the snapshot in ISO 8601 format (e.g., `2025-01-31T00:00:00Z`). If not set, the snapshot will not expire automatically.
        """
        return pulumi.get(self, "expires_at")

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

    @property
    @pulumi.getter(name="instanceId")
    def instance_id(self) -> Optional[pulumi.Input[str]]:
        """
        The UUID of the database instance for which the snapshot is created.
        """
        return pulumi.get(self, "instance_id")

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

    @property
    @pulumi.getter
    def name(self) -> Optional[pulumi.Input[str]]:
        """
        The name of the snapshot.
        """
        return pulumi.get(self, "name")

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

    @property
    @pulumi.getter(name="nodeType")
    def node_type(self) -> Optional[pulumi.Input[str]]:
        """
        The type of the database instance for which the snapshot was created.
        """
        return pulumi.get(self, "node_type")

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

    @property
    @pulumi.getter
    def region(self) -> Optional[pulumi.Input[str]]:
        """
        The region where the snapshot is stored. Defaults to the region set in the provider configuration.
        """
        return pulumi.get(self, "region")

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

    @property
    @pulumi.getter
    def size(self) -> Optional[pulumi.Input[int]]:
        """
        The size of the snapshot in bytes.
        """
        return pulumi.get(self, "size")

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

    @property
    @pulumi.getter
    def status(self) -> Optional[pulumi.Input[str]]:
        """
        The current status of the snapshot (e.g., `ready`, `creating`, `error`).
        """
        return pulumi.get(self, "status")

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

    @property
    @pulumi.getter(name="updatedAt")
    def updated_at(self) -> Optional[pulumi.Input[str]]:
        """
        The timestamp when the snapshot was last updated, in ISO 8601 format.
        """
        return pulumi.get(self, "updated_at")

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

    @property
    @pulumi.getter(name="volumeType")
    def volume_type(self) -> Optional[pulumi.Input[str]]:
        """
        The type of volume used by the snapshot.
        """
        return pulumi.get(self, "volume_type")

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


class RdbSnapshot(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 expires_at: Optional[pulumi.Input[str]] = None,
                 instance_id: Optional[pulumi.Input[str]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 region: Optional[pulumi.Input[str]] = None,
                 __props__=None):
        """
        Creates and manages Scaleway RDB (Relational Database) Snapshots.
        Snapshots are point-in-time backups of a database instance that can be used for recovery or duplication.
        For more information, refer to [the API documentation](https://www.scaleway.com/en/developers/api/managed-database-postgre-mysql/).

        ## Example Usage

        ### Example Basic Snapshot

        ```python
        import pulumi
        import pulumiverse_scaleway as scaleway

        main = scaleway.DatabaseInstance("main",
            name="test-rdb-instance",
            node_type="db-dev-s",
            engine="PostgreSQL-15",
            is_ha_cluster=False,
            disable_backup=True,
            user_name="my_initial_user",
            password="thiZ_is_v&ry_s3cret",
            tags=[
                "terraform-test",
                "scaleway_rdb_instance",
                "minimal",
            ],
            volume_type="bssd",
            volume_size_in_gb=10)
        test = scaleway.RdbSnapshot("test",
            name="initial-snapshot",
            instance_id=main.id,
            opts = pulumi.ResourceOptions(depends_on=[main]))
        ```

        ### Example with Expiration

        ```python
        import pulumi
        import pulumiverse_scaleway as scaleway

        snapshot_with_expiration = scaleway.RdbSnapshot("snapshot_with_expiration",
            name="snapshot-with-expiration",
            instance_id=main["id"],
            expires_at="2025-01-31T00:00:00Z")
        ```

        ### Example with Multiple Snapshots

        ```python
        import pulumi
        import pulumiverse_scaleway as scaleway

        snapshot_a = scaleway.RdbSnapshot("snapshot_a",
            name="snapshot_a",
            instance_id=main["id"],
            opts = pulumi.ResourceOptions(depends_on=[main]))
        snapshot_b = scaleway.RdbSnapshot("snapshot_b",
            name="snapshot_b",
            instance_id=main["id"],
            expires_at="2025-02-07T00:00:00Z",
            opts = pulumi.ResourceOptions(depends_on=[main]))
        ```

        ## Limitations

        - Snapshots are tied to the database instance and region where they are created.
        - Expired snapshots are automatically deleted and cannot be restored.

        ## Notes

        - Ensure the `instance_id` corresponds to an existing database instance.
        - Use the `depends_on` argument when creating snapshots right after creating an instance to ensure proper dependency management.

        ## Import

        RDB Snapshots can be imported using the `{region}/{snapshot_id}` format.

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] expires_at: Expiration date of the snapshot in ISO 8601 format (e.g., `2025-01-31T00:00:00Z`). If not set, the snapshot will not expire automatically.
        :param pulumi.Input[str] instance_id: The UUID of the database instance for which the snapshot is created.
        :param pulumi.Input[str] name: The name of the snapshot.
        :param pulumi.Input[str] region: The region where the snapshot is stored. Defaults to the region set in the provider configuration.
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: RdbSnapshotArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        Creates and manages Scaleway RDB (Relational Database) Snapshots.
        Snapshots are point-in-time backups of a database instance that can be used for recovery or duplication.
        For more information, refer to [the API documentation](https://www.scaleway.com/en/developers/api/managed-database-postgre-mysql/).

        ## Example Usage

        ### Example Basic Snapshot

        ```python
        import pulumi
        import pulumiverse_scaleway as scaleway

        main = scaleway.DatabaseInstance("main",
            name="test-rdb-instance",
            node_type="db-dev-s",
            engine="PostgreSQL-15",
            is_ha_cluster=False,
            disable_backup=True,
            user_name="my_initial_user",
            password="thiZ_is_v&ry_s3cret",
            tags=[
                "terraform-test",
                "scaleway_rdb_instance",
                "minimal",
            ],
            volume_type="bssd",
            volume_size_in_gb=10)
        test = scaleway.RdbSnapshot("test",
            name="initial-snapshot",
            instance_id=main.id,
            opts = pulumi.ResourceOptions(depends_on=[main]))
        ```

        ### Example with Expiration

        ```python
        import pulumi
        import pulumiverse_scaleway as scaleway

        snapshot_with_expiration = scaleway.RdbSnapshot("snapshot_with_expiration",
            name="snapshot-with-expiration",
            instance_id=main["id"],
            expires_at="2025-01-31T00:00:00Z")
        ```

        ### Example with Multiple Snapshots

        ```python
        import pulumi
        import pulumiverse_scaleway as scaleway

        snapshot_a = scaleway.RdbSnapshot("snapshot_a",
            name="snapshot_a",
            instance_id=main["id"],
            opts = pulumi.ResourceOptions(depends_on=[main]))
        snapshot_b = scaleway.RdbSnapshot("snapshot_b",
            name="snapshot_b",
            instance_id=main["id"],
            expires_at="2025-02-07T00:00:00Z",
            opts = pulumi.ResourceOptions(depends_on=[main]))
        ```

        ## Limitations

        - Snapshots are tied to the database instance and region where they are created.
        - Expired snapshots are automatically deleted and cannot be restored.

        ## Notes

        - Ensure the `instance_id` corresponds to an existing database instance.
        - Use the `depends_on` argument when creating snapshots right after creating an instance to ensure proper dependency management.

        ## Import

        RDB Snapshots can be imported using the `{region}/{snapshot_id}` format.

        :param str resource_name: The name of the resource.
        :param RdbSnapshotArgs 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(RdbSnapshotArgs, 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,
                 expires_at: Optional[pulumi.Input[str]] = None,
                 instance_id: Optional[pulumi.Input[str]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 region: 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__ = RdbSnapshotArgs.__new__(RdbSnapshotArgs)

            __props__.__dict__["expires_at"] = expires_at
            if instance_id is None and not opts.urn:
                raise TypeError("Missing required property 'instance_id'")
            __props__.__dict__["instance_id"] = instance_id
            __props__.__dict__["name"] = name
            __props__.__dict__["region"] = region
            __props__.__dict__["created_at"] = None
            __props__.__dict__["node_type"] = None
            __props__.__dict__["size"] = None
            __props__.__dict__["status"] = None
            __props__.__dict__["updated_at"] = None
            __props__.__dict__["volume_type"] = None
        super(RdbSnapshot, __self__).__init__(
            'scaleway:index/rdbSnapshot:RdbSnapshot',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            created_at: Optional[pulumi.Input[str]] = None,
            expires_at: Optional[pulumi.Input[str]] = None,
            instance_id: Optional[pulumi.Input[str]] = None,
            name: Optional[pulumi.Input[str]] = None,
            node_type: Optional[pulumi.Input[str]] = None,
            region: Optional[pulumi.Input[str]] = None,
            size: Optional[pulumi.Input[int]] = None,
            status: Optional[pulumi.Input[str]] = None,
            updated_at: Optional[pulumi.Input[str]] = None,
            volume_type: Optional[pulumi.Input[str]] = None) -> 'RdbSnapshot':
        """
        Get an existing RdbSnapshot 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[str] created_at: The timestamp when the snapshot was created, in ISO 8601 format.
        :param pulumi.Input[str] expires_at: Expiration date of the snapshot in ISO 8601 format (e.g., `2025-01-31T00:00:00Z`). If not set, the snapshot will not expire automatically.
        :param pulumi.Input[str] instance_id: The UUID of the database instance for which the snapshot is created.
        :param pulumi.Input[str] name: The name of the snapshot.
        :param pulumi.Input[str] node_type: The type of the database instance for which the snapshot was created.
        :param pulumi.Input[str] region: The region where the snapshot is stored. Defaults to the region set in the provider configuration.
        :param pulumi.Input[int] size: The size of the snapshot in bytes.
        :param pulumi.Input[str] status: The current status of the snapshot (e.g., `ready`, `creating`, `error`).
        :param pulumi.Input[str] updated_at: The timestamp when the snapshot was last updated, in ISO 8601 format.
        :param pulumi.Input[str] volume_type: The type of volume used by the snapshot.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _RdbSnapshotState.__new__(_RdbSnapshotState)

        __props__.__dict__["created_at"] = created_at
        __props__.__dict__["expires_at"] = expires_at
        __props__.__dict__["instance_id"] = instance_id
        __props__.__dict__["name"] = name
        __props__.__dict__["node_type"] = node_type
        __props__.__dict__["region"] = region
        __props__.__dict__["size"] = size
        __props__.__dict__["status"] = status
        __props__.__dict__["updated_at"] = updated_at
        __props__.__dict__["volume_type"] = volume_type
        return RdbSnapshot(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter(name="createdAt")
    def created_at(self) -> pulumi.Output[str]:
        """
        The timestamp when the snapshot was created, in ISO 8601 format.
        """
        return pulumi.get(self, "created_at")

    @property
    @pulumi.getter(name="expiresAt")
    def expires_at(self) -> pulumi.Output[str]:
        """
        Expiration date of the snapshot in ISO 8601 format (e.g., `2025-01-31T00:00:00Z`). If not set, the snapshot will not expire automatically.
        """
        return pulumi.get(self, "expires_at")

    @property
    @pulumi.getter(name="instanceId")
    def instance_id(self) -> pulumi.Output[str]:
        """
        The UUID of the database instance for which the snapshot is created.
        """
        return pulumi.get(self, "instance_id")

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

    @property
    @pulumi.getter(name="nodeType")
    def node_type(self) -> pulumi.Output[str]:
        """
        The type of the database instance for which the snapshot was created.
        """
        return pulumi.get(self, "node_type")

    @property
    @pulumi.getter
    def region(self) -> pulumi.Output[str]:
        """
        The region where the snapshot is stored. Defaults to the region set in the provider configuration.
        """
        return pulumi.get(self, "region")

    @property
    @pulumi.getter
    def size(self) -> pulumi.Output[int]:
        """
        The size of the snapshot in bytes.
        """
        return pulumi.get(self, "size")

    @property
    @pulumi.getter
    def status(self) -> pulumi.Output[str]:
        """
        The current status of the snapshot (e.g., `ready`, `creating`, `error`).
        """
        return pulumi.get(self, "status")

    @property
    @pulumi.getter(name="updatedAt")
    def updated_at(self) -> pulumi.Output[str]:
        """
        The timestamp when the snapshot was last updated, in ISO 8601 format.
        """
        return pulumi.get(self, "updated_at")

    @property
    @pulumi.getter(name="volumeType")
    def volume_type(self) -> pulumi.Output[str]:
        """
        The type of volume used by the snapshot.
        """
        return pulumi.get(self, "volume_type")

