# 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

__all__ = ['RedirectArgs', 'Redirect']

@pulumi.input_type
class RedirectArgs:
    def __init__(__self__, *,
                 destination_path: pulumi.Input[_builtins.str],
                 site_id: pulumi.Input[_builtins.str],
                 source_path: pulumi.Input[_builtins.str],
                 status_code: pulumi.Input[_builtins.int]):
        """
        The set of arguments for constructing a Redirect resource.
        :param pulumi.Input[_builtins.str] destination_path: The URL path to redirect to (e.g., '/new-page', '/home'). Must start with '/' and contain only valid URL characters. This is the location where users will be redirected when they visit the source path.
        :param pulumi.Input[_builtins.str] site_id: The Webflow site ID (24-character lowercase hexadecimal string, e.g., '5f0c8c9e1c9d440000e8d8c3'). You can find your site ID in the Webflow dashboard under Site Settings. This field will be validated before making any API calls.
        :param pulumi.Input[_builtins.str] source_path: The URL path to redirect from (e.g., '/old-page', '/blog/2023'). Must start with '/' and contain only valid URL characters (letters, numbers, hyphens, underscores, slashes, dots). Query strings and fragments are not allowed in the source path.
        :param pulumi.Input[_builtins.int] status_code: The HTTP status code for the redirect. Must be either 301 or 302. 301 = permanent redirect (use when a page has moved permanently; search engines update their index). 302 = temporary redirect (use for maintenance or temporary page moves).
        """
        pulumi.set(__self__, "destination_path", destination_path)
        pulumi.set(__self__, "site_id", site_id)
        pulumi.set(__self__, "source_path", source_path)
        pulumi.set(__self__, "status_code", status_code)

    @_builtins.property
    @pulumi.getter(name="destinationPath")
    def destination_path(self) -> pulumi.Input[_builtins.str]:
        """
        The URL path to redirect to (e.g., '/new-page', '/home'). Must start with '/' and contain only valid URL characters. This is the location where users will be redirected when they visit the source path.
        """
        return pulumi.get(self, "destination_path")

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

    @_builtins.property
    @pulumi.getter(name="siteId")
    def site_id(self) -> pulumi.Input[_builtins.str]:
        """
        The Webflow site ID (24-character lowercase hexadecimal string, e.g., '5f0c8c9e1c9d440000e8d8c3'). You can find your site ID in the Webflow dashboard under Site Settings. This field will be validated before making any API calls.
        """
        return pulumi.get(self, "site_id")

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

    @_builtins.property
    @pulumi.getter(name="sourcePath")
    def source_path(self) -> pulumi.Input[_builtins.str]:
        """
        The URL path to redirect from (e.g., '/old-page', '/blog/2023'). Must start with '/' and contain only valid URL characters (letters, numbers, hyphens, underscores, slashes, dots). Query strings and fragments are not allowed in the source path.
        """
        return pulumi.get(self, "source_path")

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

    @_builtins.property
    @pulumi.getter(name="statusCode")
    def status_code(self) -> pulumi.Input[_builtins.int]:
        """
        The HTTP status code for the redirect. Must be either 301 or 302. 301 = permanent redirect (use when a page has moved permanently; search engines update their index). 302 = temporary redirect (use for maintenance or temporary page moves).
        """
        return pulumi.get(self, "status_code")

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


@pulumi.type_token("webflow:index:Redirect")
class Redirect(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 destination_path: Optional[pulumi.Input[_builtins.str]] = None,
                 site_id: Optional[pulumi.Input[_builtins.str]] = None,
                 source_path: Optional[pulumi.Input[_builtins.str]] = None,
                 status_code: Optional[pulumi.Input[_builtins.int]] = None,
                 __props__=None):
        """
        Manages HTTP redirects for a Webflow site. This resource allows you to define redirect rules for old URLs to new locations, supporting both permanent (301) and temporary (302) redirects.

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[_builtins.str] destination_path: The URL path to redirect to (e.g., '/new-page', '/home'). Must start with '/' and contain only valid URL characters. This is the location where users will be redirected when they visit the source path.
        :param pulumi.Input[_builtins.str] site_id: The Webflow site ID (24-character lowercase hexadecimal string, e.g., '5f0c8c9e1c9d440000e8d8c3'). You can find your site ID in the Webflow dashboard under Site Settings. This field will be validated before making any API calls.
        :param pulumi.Input[_builtins.str] source_path: The URL path to redirect from (e.g., '/old-page', '/blog/2023'). Must start with '/' and contain only valid URL characters (letters, numbers, hyphens, underscores, slashes, dots). Query strings and fragments are not allowed in the source path.
        :param pulumi.Input[_builtins.int] status_code: The HTTP status code for the redirect. Must be either 301 or 302. 301 = permanent redirect (use when a page has moved permanently; search engines update their index). 302 = temporary redirect (use for maintenance or temporary page moves).
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: RedirectArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        Manages HTTP redirects for a Webflow site. This resource allows you to define redirect rules for old URLs to new locations, supporting both permanent (301) and temporary (302) redirects.

        :param str resource_name: The name of the resource.
        :param RedirectArgs 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(RedirectArgs, 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,
                 destination_path: Optional[pulumi.Input[_builtins.str]] = None,
                 site_id: Optional[pulumi.Input[_builtins.str]] = None,
                 source_path: Optional[pulumi.Input[_builtins.str]] = None,
                 status_code: Optional[pulumi.Input[_builtins.int]] = 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__ = RedirectArgs.__new__(RedirectArgs)

            if destination_path is None and not opts.urn:
                raise TypeError("Missing required property 'destination_path'")
            __props__.__dict__["destination_path"] = destination_path
            if site_id is None and not opts.urn:
                raise TypeError("Missing required property 'site_id'")
            __props__.__dict__["site_id"] = site_id
            if source_path is None and not opts.urn:
                raise TypeError("Missing required property 'source_path'")
            __props__.__dict__["source_path"] = source_path
            if status_code is None and not opts.urn:
                raise TypeError("Missing required property 'status_code'")
            __props__.__dict__["status_code"] = status_code
            __props__.__dict__["created_on"] = None
        super(Redirect, __self__).__init__(
            'webflow:index:Redirect',
            resource_name,
            __props__,
            opts)

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

        __props__.__dict__["created_on"] = None
        __props__.__dict__["destination_path"] = None
        __props__.__dict__["site_id"] = None
        __props__.__dict__["source_path"] = None
        __props__.__dict__["status_code"] = None
        return Redirect(resource_name, opts=opts, __props__=__props__)

    @_builtins.property
    @pulumi.getter(name="createdOn")
    def created_on(self) -> pulumi.Output[Optional[_builtins.str]]:
        """
        The timestamp when the redirect was created (RFC3339 format). This is automatically set when the redirect is created and is read-only.
        """
        return pulumi.get(self, "created_on")

    @_builtins.property
    @pulumi.getter(name="destinationPath")
    def destination_path(self) -> pulumi.Output[_builtins.str]:
        """
        The URL path to redirect to (e.g., '/new-page', '/home'). Must start with '/' and contain only valid URL characters. This is the location where users will be redirected when they visit the source path.
        """
        return pulumi.get(self, "destination_path")

    @_builtins.property
    @pulumi.getter(name="siteId")
    def site_id(self) -> pulumi.Output[_builtins.str]:
        """
        The Webflow site ID (24-character lowercase hexadecimal string, e.g., '5f0c8c9e1c9d440000e8d8c3'). You can find your site ID in the Webflow dashboard under Site Settings. This field will be validated before making any API calls.
        """
        return pulumi.get(self, "site_id")

    @_builtins.property
    @pulumi.getter(name="sourcePath")
    def source_path(self) -> pulumi.Output[_builtins.str]:
        """
        The URL path to redirect from (e.g., '/old-page', '/blog/2023'). Must start with '/' and contain only valid URL characters (letters, numbers, hyphens, underscores, slashes, dots). Query strings and fragments are not allowed in the source path.
        """
        return pulumi.get(self, "source_path")

    @_builtins.property
    @pulumi.getter(name="statusCode")
    def status_code(self) -> pulumi.Output[_builtins.int]:
        """
        The HTTP status code for the redirect. Must be either 301 or 302. 301 = permanent redirect (use when a page has moved permanently; search engines update their index). 302 = temporary redirect (use for maintenance or temporary page moves).
        """
        return pulumi.get(self, "status_code")

