# 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__ = [
    'GetEventResult',
    'AwaitableGetEventResult',
    'get_event',
    'get_event_output',
]

@pulumi.output_type
class GetEventResult:
    """
    A collection of values returned by getEvent.
    """
    def __init__(__self__, events=None, id=None, method_name=None, order_by=None, organization_id=None, principal_id=None, product_name=None, project_id=None, recorded_after=None, recorded_before=None, region=None, resource_id=None, resource_type=None, service_name=None, source_ip=None, status=None):
        if events and not isinstance(events, list):
            raise TypeError("Expected argument 'events' to be a list")
        pulumi.set(__self__, "events", events)
        if id and not isinstance(id, str):
            raise TypeError("Expected argument 'id' to be a str")
        pulumi.set(__self__, "id", id)
        if method_name and not isinstance(method_name, str):
            raise TypeError("Expected argument 'method_name' to be a str")
        pulumi.set(__self__, "method_name", method_name)
        if order_by and not isinstance(order_by, str):
            raise TypeError("Expected argument 'order_by' to be a str")
        pulumi.set(__self__, "order_by", order_by)
        if organization_id and not isinstance(organization_id, str):
            raise TypeError("Expected argument 'organization_id' to be a str")
        pulumi.set(__self__, "organization_id", organization_id)
        if principal_id and not isinstance(principal_id, str):
            raise TypeError("Expected argument 'principal_id' to be a str")
        pulumi.set(__self__, "principal_id", principal_id)
        if product_name and not isinstance(product_name, str):
            raise TypeError("Expected argument 'product_name' to be a str")
        pulumi.set(__self__, "product_name", product_name)
        if project_id and not isinstance(project_id, str):
            raise TypeError("Expected argument 'project_id' to be a str")
        pulumi.set(__self__, "project_id", project_id)
        if recorded_after and not isinstance(recorded_after, str):
            raise TypeError("Expected argument 'recorded_after' to be a str")
        pulumi.set(__self__, "recorded_after", recorded_after)
        if recorded_before and not isinstance(recorded_before, str):
            raise TypeError("Expected argument 'recorded_before' to be a str")
        pulumi.set(__self__, "recorded_before", recorded_before)
        if region and not isinstance(region, str):
            raise TypeError("Expected argument 'region' to be a str")
        pulumi.set(__self__, "region", region)
        if resource_id and not isinstance(resource_id, str):
            raise TypeError("Expected argument 'resource_id' to be a str")
        pulumi.set(__self__, "resource_id", resource_id)
        if resource_type and not isinstance(resource_type, str):
            raise TypeError("Expected argument 'resource_type' to be a str")
        pulumi.set(__self__, "resource_type", resource_type)
        if service_name and not isinstance(service_name, str):
            raise TypeError("Expected argument 'service_name' to be a str")
        pulumi.set(__self__, "service_name", service_name)
        if source_ip and not isinstance(source_ip, str):
            raise TypeError("Expected argument 'source_ip' to be a str")
        pulumi.set(__self__, "source_ip", source_ip)
        if status and not isinstance(status, int):
            raise TypeError("Expected argument 'status' to be a int")
        pulumi.set(__self__, "status", status)

    @_builtins.property
    @pulumi.getter
    def events(self) -> Sequence['outputs.GetEventEventResult']:
        """
        List of Audit Trail events matching the requested criteria.
        """
        return pulumi.get(self, "events")

    @_builtins.property
    @pulumi.getter
    def id(self) -> _builtins.str:
        """
        The provider-assigned unique ID for this managed resource.
        """
        return pulumi.get(self, "id")

    @_builtins.property
    @pulumi.getter(name="methodName")
    def method_name(self) -> Optional[_builtins.str]:
        """
        API method called to trigger the event.
        """
        return pulumi.get(self, "method_name")

    @_builtins.property
    @pulumi.getter(name="orderBy")
    def order_by(self) -> Optional[_builtins.str]:
        return pulumi.get(self, "order_by")

    @_builtins.property
    @pulumi.getter(name="organizationId")
    def organization_id(self) -> _builtins.str:
        """
        ID of the Organization containing the Audit Trail events. (UUID format)
        """
        return pulumi.get(self, "organization_id")

    @_builtins.property
    @pulumi.getter(name="principalId")
    def principal_id(self) -> Optional[_builtins.str]:
        """
        ID of the user or IAM application at the origin of the event.
        """
        return pulumi.get(self, "principal_id")

    @_builtins.property
    @pulumi.getter(name="productName")
    def product_name(self) -> Optional[_builtins.str]:
        """
        Scaleway product associated with the listed events in a hyphenated format. Possible values are: `secret-manager`, `key-manager`, `iam`, `kubernetes`, `account`, `apple-silicon`, `instance`, `baremetal`, `load-balancer`, or `edge-services`.
        """
        return pulumi.get(self, "product_name")

    @_builtins.property
    @pulumi.getter(name="projectId")
    def project_id(self) -> Optional[_builtins.str]:
        """
        Project of the resource attached to the event. (UUID format)
        """
        return pulumi.get(self, "project_id")

    @_builtins.property
    @pulumi.getter(name="recordedAfter")
    def recorded_after(self) -> Optional[_builtins.str]:
        return pulumi.get(self, "recorded_after")

    @_builtins.property
    @pulumi.getter(name="recordedBefore")
    def recorded_before(self) -> Optional[_builtins.str]:
        return pulumi.get(self, "recorded_before")

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

    @_builtins.property
    @pulumi.getter(name="resourceId")
    def resource_id(self) -> Optional[_builtins.str]:
        return pulumi.get(self, "resource_id")

    @_builtins.property
    @pulumi.getter(name="resourceType")
    def resource_type(self) -> Optional[_builtins.str]:
        return pulumi.get(self, "resource_type")

    @_builtins.property
    @pulumi.getter(name="serviceName")
    def service_name(self) -> Optional[_builtins.str]:
        """
        API name called to trigger the event. Possible values are: `scaleway.secret_manager.v1beta1.Api`, `scaleway.key_manager.v1alpha1.Api`, `scaleway.iam.v1alpha1.Api`, `scaleway.iam.v1alpha1.UnauthenticatedApi`, `scaleway.k8s.v1.Api`, `scaleway.account.v3.UserApi`, `scaleway.account.v3.OrganizationApi`, `scaleway.account.v2.GDPRApi`, `scaleway.apple_silicon.v1alpha1.Api`, `scaleway.instance.v1.Api`, `scaleway.baremetal.v1.Api`, or `scaleway.lb.v1.ZonedApi`.
        """
        return pulumi.get(self, "service_name")

    @_builtins.property
    @pulumi.getter(name="sourceIp")
    def source_ip(self) -> Optional[_builtins.str]:
        """
        IP address at the origin of the event. (IP address)
        """
        return pulumi.get(self, "source_ip")

    @_builtins.property
    @pulumi.getter
    def status(self) -> Optional[_builtins.int]:
        return pulumi.get(self, "status")


class AwaitableGetEventResult(GetEventResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetEventResult(
            events=self.events,
            id=self.id,
            method_name=self.method_name,
            order_by=self.order_by,
            organization_id=self.organization_id,
            principal_id=self.principal_id,
            product_name=self.product_name,
            project_id=self.project_id,
            recorded_after=self.recorded_after,
            recorded_before=self.recorded_before,
            region=self.region,
            resource_id=self.resource_id,
            resource_type=self.resource_type,
            service_name=self.service_name,
            source_ip=self.source_ip,
            status=self.status)


def get_event(method_name: Optional[_builtins.str] = None,
              order_by: Optional[_builtins.str] = None,
              organization_id: Optional[_builtins.str] = None,
              principal_id: Optional[_builtins.str] = None,
              product_name: Optional[_builtins.str] = None,
              project_id: Optional[_builtins.str] = None,
              recorded_after: Optional[_builtins.str] = None,
              recorded_before: Optional[_builtins.str] = None,
              region: Optional[_builtins.str] = None,
              resource_id: Optional[_builtins.str] = None,
              resource_type: Optional[_builtins.str] = None,
              service_name: Optional[_builtins.str] = None,
              source_ip: Optional[_builtins.str] = None,
              status: Optional[_builtins.int] = None,
              opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetEventResult:
    """
    The `audittrail_get_event` data source is used to retrieve information about existing Audit Trail events.

    Refer to the Audit Trail [documentation](https://www.scaleway.com/en/docs/audit-trail/) and [API documentation](https://www.scaleway.com/en/developers/api/audit-trail/) for more information.

    ## Example Usage

    ```python
    import pulumi
    import pulumi_scaleway as scaleway

    # Retrieve audit trail for a specific resource
    find_by_resource_id = scaleway.audittrail.get_event(resource_id="11111111-1111-1111-1111-111111111111")
    ```

    ```python
    import pulumi
    import pulumi_scaleway as scaleway

    # Retrieve all audit trail events on the default organization
    find_all = scaleway.audittrail.get_event()
    ```

    ```python
    import pulumi
    import pulumi_scaleway as scaleway

    # Retrieve audit trail for a specific Scaleway product
    find_by_product_name = scaleway.audittrail.get_event(product_name="secret-manager")
    ```

    ```python
    import pulumi
    import pulumi_scaleway as scaleway

    # Retrieve audit trail events with various filtering
    find_with_filters = scaleway.audittrail.get_event(region="fr-par",
        service_name="instance",
        method_name="CreateServer",
        principal_id="11111111-1111-1111-1111-111111111111",
        source_ip="192.0.2.1",
        status=200,
        recorded_after="2025-10-01T00:00:00Z",
        recorded_before="2025-12-31T23:59:59Z",
        order_by="recorded_at_desc")
    ```

    ```python
    import pulumi
    import pulumi_scaleway as scaleway

    # Retrieve audit trail events on a specific organization
    find_by_org = scaleway.audittrail.get_event(organization_id="11111111-1111-1111-1111-111111111111")
    ```

    ```python
    import pulumi
    import pulumi_scaleway as scaleway

    # Retrieve audit trail events on a specific project
    find_by_project = scaleway.audittrail.get_event(project_id="11111111-1111-1111-1111-111111111111")
    ```

    ```python
    import pulumi
    import pulumi_scaleway as scaleway

    # Retrieve audit trail events for a specific type of resource
    find_by_resource_type = scaleway.audittrail.get_event(resource_type="instance_server")
    ```


    :param _builtins.str method_name: Name of the method of the API call performed.
    :param _builtins.str order_by: Defines the order in which events are returned. Possible values are `recorded_at_asc` and `recorded_at_desc`. Default value: `recorded_at_desc`.
    :param _builtins.str organization_id: `organization_id`) ID of the Organization containing the Audit Trail events.
    :param _builtins.str principal_id: ID of the User or IAM application at the origin of the event.
    :param _builtins.str product_name: Name of the Scaleway product in a hyphenated format.
    :param _builtins.str project_id: ID of the Project containing the Audit Trail events.
    :param _builtins.str recorded_after: The `recorded_after` parameter defines the earliest timestamp from which Audit Trail events are retrieved. Returns `one hour ago` by default (Format ISO 8601).
    :param _builtins.str recorded_before: The `recorded_before` parameter defines the latest timestamp up to which Audit Trail events are retrieved. Must be later than recorded_after. Returns `now` by default (Format ISO 8601).
    :param _builtins.str region: The region you want to target. Defaults to the region specified in the provider configuration.
    :param _builtins.str resource_id: ID of the Scaleway resource associated with the listed events.
    :param _builtins.str resource_type: Type of the scaleway resources associated with the listed events. Possible values are: `secm_secret`, `secm_secret_version`, `kube_cluster`, `kube_pool`, `kube_node`, `kube_acl`, `keym_key`, `iam_user`, `iam_application`, `iam_group`, `iam_policy`, `iam_api_key`, `iam_ssh_key`, `iam_rule`, `iam_saml`, `iam_saml_certificate`, `secret_manager_secret`, `secret_manager_version`, `key_manager_key`, `account_user`, `account_organization`, `account_project`, `instance_server`, `instance_placement_group`, `instance_security_group`, `instance_volume`, `instance_snapshot`, `instance_image`, `apple_silicon_server`, `baremetal_server`, `baremetal_setting`, `ipam_ip`, `sbs_volume`, `sbs_snapshot`, `load_balancer_lb`, `load_balancer_ip`, `load_balancer_frontend`, `load_balancer_backend`, `load_balancer_route`, `load_balancer_acl`, `load_balancer_certificate`, `sfs_filesystem`, or `vpc_private_network`.
    :param _builtins.str service_name: Name of the service of the API call performed.
    :param _builtins.str source_ip: IP address at the origin of the event.
    :param _builtins.int status: HTTP status code of the request.
    """
    __args__ = dict()
    __args__['methodName'] = method_name
    __args__['orderBy'] = order_by
    __args__['organizationId'] = organization_id
    __args__['principalId'] = principal_id
    __args__['productName'] = product_name
    __args__['projectId'] = project_id
    __args__['recordedAfter'] = recorded_after
    __args__['recordedBefore'] = recorded_before
    __args__['region'] = region
    __args__['resourceId'] = resource_id
    __args__['resourceType'] = resource_type
    __args__['serviceName'] = service_name
    __args__['sourceIp'] = source_ip
    __args__['status'] = status
    opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke('scaleway:audittrail/getEvent:getEvent', __args__, opts=opts, typ=GetEventResult).value

    return AwaitableGetEventResult(
        events=pulumi.get(__ret__, 'events'),
        id=pulumi.get(__ret__, 'id'),
        method_name=pulumi.get(__ret__, 'method_name'),
        order_by=pulumi.get(__ret__, 'order_by'),
        organization_id=pulumi.get(__ret__, 'organization_id'),
        principal_id=pulumi.get(__ret__, 'principal_id'),
        product_name=pulumi.get(__ret__, 'product_name'),
        project_id=pulumi.get(__ret__, 'project_id'),
        recorded_after=pulumi.get(__ret__, 'recorded_after'),
        recorded_before=pulumi.get(__ret__, 'recorded_before'),
        region=pulumi.get(__ret__, 'region'),
        resource_id=pulumi.get(__ret__, 'resource_id'),
        resource_type=pulumi.get(__ret__, 'resource_type'),
        service_name=pulumi.get(__ret__, 'service_name'),
        source_ip=pulumi.get(__ret__, 'source_ip'),
        status=pulumi.get(__ret__, 'status'))
def get_event_output(method_name: Optional[pulumi.Input[Optional[_builtins.str]]] = None,
                     order_by: Optional[pulumi.Input[Optional[_builtins.str]]] = None,
                     organization_id: Optional[pulumi.Input[Optional[_builtins.str]]] = None,
                     principal_id: Optional[pulumi.Input[Optional[_builtins.str]]] = None,
                     product_name: Optional[pulumi.Input[Optional[_builtins.str]]] = None,
                     project_id: Optional[pulumi.Input[Optional[_builtins.str]]] = None,
                     recorded_after: Optional[pulumi.Input[Optional[_builtins.str]]] = None,
                     recorded_before: Optional[pulumi.Input[Optional[_builtins.str]]] = None,
                     region: Optional[pulumi.Input[Optional[_builtins.str]]] = None,
                     resource_id: Optional[pulumi.Input[Optional[_builtins.str]]] = None,
                     resource_type: Optional[pulumi.Input[Optional[_builtins.str]]] = None,
                     service_name: Optional[pulumi.Input[Optional[_builtins.str]]] = None,
                     source_ip: Optional[pulumi.Input[Optional[_builtins.str]]] = None,
                     status: Optional[pulumi.Input[Optional[_builtins.int]]] = None,
                     opts: Optional[Union[pulumi.InvokeOptions, pulumi.InvokeOutputOptions]] = None) -> pulumi.Output[GetEventResult]:
    """
    The `audittrail_get_event` data source is used to retrieve information about existing Audit Trail events.

    Refer to the Audit Trail [documentation](https://www.scaleway.com/en/docs/audit-trail/) and [API documentation](https://www.scaleway.com/en/developers/api/audit-trail/) for more information.

    ## Example Usage

    ```python
    import pulumi
    import pulumi_scaleway as scaleway

    # Retrieve audit trail for a specific resource
    find_by_resource_id = scaleway.audittrail.get_event(resource_id="11111111-1111-1111-1111-111111111111")
    ```

    ```python
    import pulumi
    import pulumi_scaleway as scaleway

    # Retrieve all audit trail events on the default organization
    find_all = scaleway.audittrail.get_event()
    ```

    ```python
    import pulumi
    import pulumi_scaleway as scaleway

    # Retrieve audit trail for a specific Scaleway product
    find_by_product_name = scaleway.audittrail.get_event(product_name="secret-manager")
    ```

    ```python
    import pulumi
    import pulumi_scaleway as scaleway

    # Retrieve audit trail events with various filtering
    find_with_filters = scaleway.audittrail.get_event(region="fr-par",
        service_name="instance",
        method_name="CreateServer",
        principal_id="11111111-1111-1111-1111-111111111111",
        source_ip="192.0.2.1",
        status=200,
        recorded_after="2025-10-01T00:00:00Z",
        recorded_before="2025-12-31T23:59:59Z",
        order_by="recorded_at_desc")
    ```

    ```python
    import pulumi
    import pulumi_scaleway as scaleway

    # Retrieve audit trail events on a specific organization
    find_by_org = scaleway.audittrail.get_event(organization_id="11111111-1111-1111-1111-111111111111")
    ```

    ```python
    import pulumi
    import pulumi_scaleway as scaleway

    # Retrieve audit trail events on a specific project
    find_by_project = scaleway.audittrail.get_event(project_id="11111111-1111-1111-1111-111111111111")
    ```

    ```python
    import pulumi
    import pulumi_scaleway as scaleway

    # Retrieve audit trail events for a specific type of resource
    find_by_resource_type = scaleway.audittrail.get_event(resource_type="instance_server")
    ```


    :param _builtins.str method_name: Name of the method of the API call performed.
    :param _builtins.str order_by: Defines the order in which events are returned. Possible values are `recorded_at_asc` and `recorded_at_desc`. Default value: `recorded_at_desc`.
    :param _builtins.str organization_id: `organization_id`) ID of the Organization containing the Audit Trail events.
    :param _builtins.str principal_id: ID of the User or IAM application at the origin of the event.
    :param _builtins.str product_name: Name of the Scaleway product in a hyphenated format.
    :param _builtins.str project_id: ID of the Project containing the Audit Trail events.
    :param _builtins.str recorded_after: The `recorded_after` parameter defines the earliest timestamp from which Audit Trail events are retrieved. Returns `one hour ago` by default (Format ISO 8601).
    :param _builtins.str recorded_before: The `recorded_before` parameter defines the latest timestamp up to which Audit Trail events are retrieved. Must be later than recorded_after. Returns `now` by default (Format ISO 8601).
    :param _builtins.str region: The region you want to target. Defaults to the region specified in the provider configuration.
    :param _builtins.str resource_id: ID of the Scaleway resource associated with the listed events.
    :param _builtins.str resource_type: Type of the scaleway resources associated with the listed events. Possible values are: `secm_secret`, `secm_secret_version`, `kube_cluster`, `kube_pool`, `kube_node`, `kube_acl`, `keym_key`, `iam_user`, `iam_application`, `iam_group`, `iam_policy`, `iam_api_key`, `iam_ssh_key`, `iam_rule`, `iam_saml`, `iam_saml_certificate`, `secret_manager_secret`, `secret_manager_version`, `key_manager_key`, `account_user`, `account_organization`, `account_project`, `instance_server`, `instance_placement_group`, `instance_security_group`, `instance_volume`, `instance_snapshot`, `instance_image`, `apple_silicon_server`, `baremetal_server`, `baremetal_setting`, `ipam_ip`, `sbs_volume`, `sbs_snapshot`, `load_balancer_lb`, `load_balancer_ip`, `load_balancer_frontend`, `load_balancer_backend`, `load_balancer_route`, `load_balancer_acl`, `load_balancer_certificate`, `sfs_filesystem`, or `vpc_private_network`.
    :param _builtins.str service_name: Name of the service of the API call performed.
    :param _builtins.str source_ip: IP address at the origin of the event.
    :param _builtins.int status: HTTP status code of the request.
    """
    __args__ = dict()
    __args__['methodName'] = method_name
    __args__['orderBy'] = order_by
    __args__['organizationId'] = organization_id
    __args__['principalId'] = principal_id
    __args__['productName'] = product_name
    __args__['projectId'] = project_id
    __args__['recordedAfter'] = recorded_after
    __args__['recordedBefore'] = recorded_before
    __args__['region'] = region
    __args__['resourceId'] = resource_id
    __args__['resourceType'] = resource_type
    __args__['serviceName'] = service_name
    __args__['sourceIp'] = source_ip
    __args__['status'] = status
    opts = pulumi.InvokeOutputOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke_output('scaleway:audittrail/getEvent:getEvent', __args__, opts=opts, typ=GetEventResult)
    return __ret__.apply(lambda __response__: GetEventResult(
        events=pulumi.get(__response__, 'events'),
        id=pulumi.get(__response__, 'id'),
        method_name=pulumi.get(__response__, 'method_name'),
        order_by=pulumi.get(__response__, 'order_by'),
        organization_id=pulumi.get(__response__, 'organization_id'),
        principal_id=pulumi.get(__response__, 'principal_id'),
        product_name=pulumi.get(__response__, 'product_name'),
        project_id=pulumi.get(__response__, 'project_id'),
        recorded_after=pulumi.get(__response__, 'recorded_after'),
        recorded_before=pulumi.get(__response__, 'recorded_before'),
        region=pulumi.get(__response__, 'region'),
        resource_id=pulumi.get(__response__, 'resource_id'),
        resource_type=pulumi.get(__response__, 'resource_type'),
        service_name=pulumi.get(__response__, 'service_name'),
        source_ip=pulumi.get(__response__, 'source_ip'),
        status=pulumi.get(__response__, 'status')))
