# Event

> **Package : spaceone.api.monitoring.v1**

## Event

{% hint style="info" %}
**Event Methods:**
{% endhint %}

| Method                | Request                                   | Response                                                                                                           |
| --------------------- | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| [**create**](#create) | [CreateEventRequest](#createeventrequest) | [google.protobuf.Empty](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/empty.proto)   |
| [**get**](#get)       | [GetEventRequest](#geteventrequest)       | [EventInfo](#eventinfo)                                                                                            |
| [**list**](#list)     | [EventQuery](#eventquery)                 | [EventsInfo](#eventsinfo)                                                                                          |
| [**stat**](#stat)     | [EventStatQuery](#eventstatquery)         | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |

### create

> **POST** /monitoring/v1/webhook/{webhook\_id}/{access\_key}/events

> Creates a new Event. The Event creation process starts with validation checking whether the input data is from a webhook or not. After the input data is validated, the data is processed and used to create the Event.

| Type     | Message                                                                                                          |
| -------- | ---------------------------------------------------------------------------------------------------------------- |
| Request  | [CreateEventRequest](#createeventrequest)                                                                        |
| Response | [google.protobuf.Empty](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/empty.proto) |

### get

> **GET** /monitoring/v1/event/{event\_id}

> Gets a specific Event matching the input parameters, `event_id` and `domain_id`. Prints detailed information about the Event.

| Type     | Message                             |
| -------- | ----------------------------------- |
| Request  | [GetEventRequest](#geteventrequest) |
| Response | [EventInfo](#eventinfo)             |

{% tabs %}
{% tab title="Request Example" %}

```
{
    "event_id": "event-4e16ba3bd384",
    "domain_id": "domain-58010aa2e451"
}
```

{% endtab %}

{% tab title="Response Example" %}

```
{
    "event_id": "event-4e16ba3bd384",
    "event_key": "cfbdd0cee08f0f2664dbef297c370017",
    "event_type": "ALERT",
    "title": "Notification of access to the SpaceONE bastion Host",
    "description": "SSH Access to stargate-dev-kubectl-amzl2 from spaceoneadm",
    "severity": "INFO",
    "resource": {
        "resource_id": "server-1187737cc0d9",
        "resource_type": "inventory.Server",
        "name": "stargate-dev-kubectl-amzl2"
    },
    "raw_data": {
        "resource": {
            "name": "stargate-dev-kubectl-amzl2",
            "resource_id": "server-1187737cc0d9",
            "resource_type": "inventory.Server"
        },
        "event_key": "cfbdd0cee08f0f2664dbef297c370017",
        "title": "Notification of access to the SpaceONE bastion Host",
        "severity": "INFO",
        "description": "SSH Access to stargate-dev-kubectl-amzl2 from spaceoneadm",
        "event_type": "ALERT",
        "additional_info": {
            "host": [],
            "user": "spaceoneadm"
        }
    },
    "additional_info": {
        "host": "[]",
        "user": "spaceoneadm"
    },
    "alert_id": "alert-06462f6cb54e",
    "webhook_id": "webhook-ff9e2eda678a",
    "project_id": "project-18655561c535",
    "domain_id": "domain-58010aa2e451",
    "created_at": "2022-06-21T00:34:58.034Z"
}
```

{% endtab %}
{% endtabs %}

### list

> **GET** /monitoring/v1/events
>
> **POST** /monitoring/v1/events/search

> Gets a list of all Events. You must specify the `domain_id`. You can use a query to get a filtered list of Events.

| Type     | Message                   |
| -------- | ------------------------- |
| Request  | [EventQuery](#eventquery) |
| Response | [EventsInfo](#eventsinfo) |

{% tabs %}
{% tab title="Request Example" %}

```
{
    "query": {},
    "domain_id": "domain-58010aa2e451"
}
```

{% endtab %}

{% tab title="Response Example" %}

```
{
    "results": [
        {
            "event_id": "event-4e16ba3bd384",
            "event_key": "cfbdd0cee08f0f2664dbef297c370017",
            "event_type": "ALERT",
            "title": "Notification of access to the SpaceONE bastion Host",
            "description": "SSH Access to stargate-dev-kubectl-amzl2 from spaceoneadm",
            "severity": "INFO",
            "resource": {
                "resource_id": "server-1187737cc0d9",
                "resource_type": "inventory.Server",
                "name": "stargate-dev-kubectl-amzl2"
            },
            "raw_data": {
                "resource": {
                    "name": "stargate-dev-kubectl-amzl2",
                    "resource_type": "inventory.Server",
                    "resource_id": "server-1187737cc0d9"
                },
                "event_key": "cfbdd0cee08f0f2664dbef297c370017",
                "additional_info": {
                    "user": "spaceoneadm",
                    "host": []
                },
                "severity": "INFO",
                "description": "SSH Access to stargate-dev-kubectl-amzl2 from spaceoneadm",
                "title": "Notification of access to the SpaceONE bastion Host",
                "event_type": "ALERT"
            },
            "additional_info": {
                "user": "spaceoneadm",
                "host": "[]"
            },
            "alert_id": "alert-06462f6cb54e",
            "webhook_id": "webhook-ff9e2eda678a",
            "project_id": "project-18655561c535",
            "domain_id": "domain-58010aa2e451",
            "created_at": "2022-06-21T00:34:58.034Z"
        },
        {
            "event_id": "event-b178e1b71daf",
            "event_key": "abc16e5455c26ab7611bf8aa8d1020cc",
            "event_type": "ALERT",
            "title": "Notification of access to the SpaceONE bastion Host",
            "description": "SSH Access to stargate-dev-kubectl-amzl2 from glee@mz.co.kr",
            "severity": "INFO",
            "resource": {
                "resource_id": "server-1187737cc0d9",
                "resource_type": "inventory.Server",
                "name": "stargate-dev-kubectl-amzl2"
            },
            "raw_data": {
                "additional_info": {
                    "host": [
                        "125.131.104.40"
                    ],
                    "user": "glee@mz.co.kr"
                },
                "description": "SSH Access to stargate-dev-kubectl-amzl2 from glee@mz.co.kr",
                "severity": "INFO",
                "event_type": "ALERT",
                "title": "Notification of access to the SpaceONE bastion Host",
                "resource": {
                    "resource_type": "inventory.Server",
                    "name": "stargate-dev-kubectl-amzl2",
                    "resource_id": "server-1187737cc0d9"
                },
                "event_key": "abc16e5455c26ab7611bf8aa8d1020cc"
            },
            "additional_info": {
                "user": "glee@mz.co.kr",
                "host": "['125.131.104.40']"
            },
            "alert_id": "alert-332617cf2894",
            "webhook_id": "webhook-ff9e2eda678a",
            "project_id": "project-18655561c535",
            "domain_id": "domain-58010aa2e451",
            "created_at": "2022-06-21T00:34:52.822Z"
        }
    ],
    "total_count": 2
}
```

{% endtab %}
{% endtabs %}

### stat

> **POST** /monitoring/v1/events/stat

| Type     | Message                                                                                                            |
| -------- | ------------------------------------------------------------------------------------------------------------------ |
| Request  | [EventStatQuery](#eventstatquery)                                                                                  |
| Response | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |

##

## Message

### CreateEventRequest

| Field       | Type                                                                                                               | Required | Description |
| ----------- | ------------------------------------------------------------------------------------------------------------------ | :------: | ----------- |
| webhook\_id | string                                                                                                             |     ✔    |             |
| access\_key | string                                                                                                             |     ✔    |             |
| data        | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |     ✔    |             |

### EventInfo

| Field            | Type                                                                                                               | Description |
| ---------------- | ------------------------------------------------------------------------------------------------------------------ | ----------- |
| event\_id        | string                                                                                                             |             |
| event\_key       | string                                                                                                             |             |
| event\_type      | string                                                                                                             |             |
| title            | string                                                                                                             |             |
| description      | string                                                                                                             |             |
| severity         | string                                                                                                             |             |
| rule             | string                                                                                                             |             |
| resource         | [EventResource](#eventresource)                                                                                    |             |
| provider         | string                                                                                                             |             |
| account          | string                                                                                                             |             |
| image\_url       | string                                                                                                             |             |
| raw\_data        | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |             |
| additional\_info | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |             |
| alert\_id        | string                                                                                                             |             |
| webhook\_id      | string                                                                                                             |             |
| project\_id      | string                                                                                                             |             |
| domain\_id       | string                                                                                                             |             |
| created\_at      | string                                                                                                             |             |
| occurred\_at     | string                                                                                                             |             |

### EventQuery

| Field        | Type                                                                                               | Required | Description |
| ------------ | -------------------------------------------------------------------------------------------------- | :------: | ----------- |
| query        | [spaceone.api.core.v1.Query](https://spaceone-dev.gitbook.io/api-reference/common-v1/search-query) |     ✘    |             |
| event\_id    | string                                                                                             |     ✘    |             |
| event\_key   | string                                                                                             |     ✘    |             |
| event\_type  | string                                                                                             |     ✘    |             |
| severity     | string                                                                                             |     ✘    |             |
| resource\_id | string                                                                                             |     ✘    |             |
| provider     | string                                                                                             |     ✘    |             |
| account      | string                                                                                             |     ✘    |             |
| alert\_id    | string                                                                                             |     ✘    |             |
| webhook\_id  | string                                                                                             |     ✘    |             |
| project\_id  | string                                                                                             |     ✘    |             |
| domain\_id   | string                                                                                             |     ✘    |             |

### EventResource

| Field          | Type   | Description |
| -------------- | ------ | ----------- |
| resource\_id   | string |             |
| resource\_type | string |             |
| name           | string |             |

### EventStatQuery

| Field      | Type                                                                                                             | Required | Description |
| ---------- | ---------------------------------------------------------------------------------------------------------------- | :------: | ----------- |
| query      | [spaceone.api.core.v1.StatisticsQuery](https://spaceone-dev.gitbook.io/api-reference/common-v1/statistics-query) |     ✔    |             |
| domain\_id | string                                                                                                           |     ✔    |             |

### EventsInfo

| Field        | Type                                                                                            | Description |
| ------------ | ----------------------------------------------------------------------------------------------- | ----------- |
| results      | [list of EventInfo](#eventinfo)                                                                 |             |
| total\_count | [int32](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/type.proto) |             |

### GetEventRequest

| Field      | Type           | Required | Description |
| ---------- | -------------- | :------: | ----------- |
| event\_id  | string         |     ✔    |             |
| domain\_id | string         |     ✔    |             |
| only       | list of string |     ✘    |             |
