# 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

__all__ = [
    'GetProjectSecureFileResult',
    'AwaitableGetProjectSecureFileResult',
    'get_project_secure_file',
    'get_project_secure_file_output',
]

@pulumi.output_type
class GetProjectSecureFileResult:
    """
    A collection of values returned by getProjectSecureFile.
    """
    def __init__(__self__, checksum=None, checksum_algorithm=None, content=None, created_at=None, expires_at=None, id=None, metadata=None, name=None, project=None, secure_file_id=None):
        if checksum and not isinstance(checksum, str):
            raise TypeError("Expected argument 'checksum' to be a str")
        pulumi.set(__self__, "checksum", checksum)
        if checksum_algorithm and not isinstance(checksum_algorithm, str):
            raise TypeError("Expected argument 'checksum_algorithm' to be a str")
        pulumi.set(__self__, "checksum_algorithm", checksum_algorithm)
        if content and not isinstance(content, str):
            raise TypeError("Expected argument 'content' to be a str")
        pulumi.set(__self__, "content", content)
        if created_at and not isinstance(created_at, str):
            raise TypeError("Expected argument 'created_at' to be a str")
        pulumi.set(__self__, "created_at", created_at)
        if expires_at and not isinstance(expires_at, str):
            raise TypeError("Expected argument 'expires_at' to be a str")
        pulumi.set(__self__, "expires_at", expires_at)
        if id and not isinstance(id, str):
            raise TypeError("Expected argument 'id' to be a str")
        pulumi.set(__self__, "id", id)
        if metadata and not isinstance(metadata, dict):
            raise TypeError("Expected argument 'metadata' to be a dict")
        pulumi.set(__self__, "metadata", metadata)
        if name and not isinstance(name, str):
            raise TypeError("Expected argument 'name' to be a str")
        pulumi.set(__self__, "name", name)
        if project and not isinstance(project, str):
            raise TypeError("Expected argument 'project' to be a str")
        pulumi.set(__self__, "project", project)
        if secure_file_id and not isinstance(secure_file_id, int):
            raise TypeError("Expected argument 'secure_file_id' to be a int")
        pulumi.set(__self__, "secure_file_id", secure_file_id)

    @_builtins.property
    @pulumi.getter
    def checksum(self) -> _builtins.str:
        """
        The checksum of the file
        """
        return pulumi.get(self, "checksum")

    @_builtins.property
    @pulumi.getter(name="checksumAlgorithm")
    def checksum_algorithm(self) -> _builtins.str:
        """
        The checksum algorithm used
        """
        return pulumi.get(self, "checksum_algorithm")

    @_builtins.property
    @pulumi.getter
    def content(self) -> _builtins.str:
        """
        The contents of the secure file
        """
        return pulumi.get(self, "content")

    @_builtins.property
    @pulumi.getter(name="createdAt")
    def created_at(self) -> _builtins.str:
        """
        The time the secure file was uploaded
        """
        return pulumi.get(self, "created_at")

    @_builtins.property
    @pulumi.getter(name="expiresAt")
    def expires_at(self) -> _builtins.str:
        """
        The time the secure file will expire
        """
        return pulumi.get(self, "expires_at")

    @_builtins.property
    @pulumi.getter
    def id(self) -> _builtins.str:
        """
        The ID of this data source. In the format `<project:id>`
        """
        return pulumi.get(self, "id")

    @_builtins.property
    @pulumi.getter
    def metadata(self) -> 'outputs.GetProjectSecureFileMetadataResult':
        """
        metadata returned by the gitlab api about the secure file
        """
        return pulumi.get(self, "metadata")

    @_builtins.property
    @pulumi.getter
    def name(self) -> Optional[_builtins.str]:
        """
        The name for the secure file, unique per project
        """
        return pulumi.get(self, "name")

    @_builtins.property
    @pulumi.getter
    def project(self) -> _builtins.str:
        """
        The ID or full path of the project the secure file resides.
        """
        return pulumi.get(self, "project")

    @_builtins.property
    @pulumi.getter(name="secureFileId")
    def secure_file_id(self) -> _builtins.int:
        """
        The id of the secure file in gitlab
        """
        return pulumi.get(self, "secure_file_id")


class AwaitableGetProjectSecureFileResult(GetProjectSecureFileResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetProjectSecureFileResult(
            checksum=self.checksum,
            checksum_algorithm=self.checksum_algorithm,
            content=self.content,
            created_at=self.created_at,
            expires_at=self.expires_at,
            id=self.id,
            metadata=self.metadata,
            name=self.name,
            project=self.project,
            secure_file_id=self.secure_file_id)


def get_project_secure_file(name: Optional[_builtins.str] = None,
                            project: Optional[_builtins.str] = None,
                            secure_file_id: Optional[_builtins.int] = None,
                            opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetProjectSecureFileResult:
    """
    The `ProjectSecureFile` data source allows the contents of a secure file to be retrieved by either Name or ID.

    **Upstream API**: [GitLab REST API docs](https://docs.gitlab.com/api/secure_files/)

    ## Example Usage

    ```python
    import pulumi
    import pulumi_gitlab as gitlab

    by_id = gitlab.get_project_secure_file(project="123",
        secure_file_id=123)
    by_name = gitlab.get_project_secure_file(project="123",
        name="secret.pem")
    ```


    :param _builtins.str name: The name for the secure file, unique per project
    :param _builtins.str project: The ID or full path of the project the secure file resides.
    :param _builtins.int secure_file_id: The id of the secure file in gitlab
    """
    __args__ = dict()
    __args__['name'] = name
    __args__['project'] = project
    __args__['secureFileId'] = secure_file_id
    opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke('gitlab:index/getProjectSecureFile:getProjectSecureFile', __args__, opts=opts, typ=GetProjectSecureFileResult).value

    return AwaitableGetProjectSecureFileResult(
        checksum=pulumi.get(__ret__, 'checksum'),
        checksum_algorithm=pulumi.get(__ret__, 'checksum_algorithm'),
        content=pulumi.get(__ret__, 'content'),
        created_at=pulumi.get(__ret__, 'created_at'),
        expires_at=pulumi.get(__ret__, 'expires_at'),
        id=pulumi.get(__ret__, 'id'),
        metadata=pulumi.get(__ret__, 'metadata'),
        name=pulumi.get(__ret__, 'name'),
        project=pulumi.get(__ret__, 'project'),
        secure_file_id=pulumi.get(__ret__, 'secure_file_id'))
def get_project_secure_file_output(name: Optional[pulumi.Input[Optional[_builtins.str]]] = None,
                                   project: Optional[pulumi.Input[_builtins.str]] = None,
                                   secure_file_id: Optional[pulumi.Input[Optional[_builtins.int]]] = None,
                                   opts: Optional[Union[pulumi.InvokeOptions, pulumi.InvokeOutputOptions]] = None) -> pulumi.Output[GetProjectSecureFileResult]:
    """
    The `ProjectSecureFile` data source allows the contents of a secure file to be retrieved by either Name or ID.

    **Upstream API**: [GitLab REST API docs](https://docs.gitlab.com/api/secure_files/)

    ## Example Usage

    ```python
    import pulumi
    import pulumi_gitlab as gitlab

    by_id = gitlab.get_project_secure_file(project="123",
        secure_file_id=123)
    by_name = gitlab.get_project_secure_file(project="123",
        name="secret.pem")
    ```


    :param _builtins.str name: The name for the secure file, unique per project
    :param _builtins.str project: The ID or full path of the project the secure file resides.
    :param _builtins.int secure_file_id: The id of the secure file in gitlab
    """
    __args__ = dict()
    __args__['name'] = name
    __args__['project'] = project
    __args__['secureFileId'] = secure_file_id
    opts = pulumi.InvokeOutputOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke_output('gitlab:index/getProjectSecureFile:getProjectSecureFile', __args__, opts=opts, typ=GetProjectSecureFileResult)
    return __ret__.apply(lambda __response__: GetProjectSecureFileResult(
        checksum=pulumi.get(__response__, 'checksum'),
        checksum_algorithm=pulumi.get(__response__, 'checksum_algorithm'),
        content=pulumi.get(__response__, 'content'),
        created_at=pulumi.get(__response__, 'created_at'),
        expires_at=pulumi.get(__response__, 'expires_at'),
        id=pulumi.get(__response__, 'id'),
        metadata=pulumi.get(__response__, 'metadata'),
        name=pulumi.get(__response__, 'name'),
        project=pulumi.get(__response__, 'project'),
        secure_file_id=pulumi.get(__response__, 'secure_file_id')))
