# Protocol

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

## Protocol

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

| Method                               | Request                                                     | Response                                                                                                           |
| ------------------------------------ | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| [**create**](#create)                | [CreateProtocolRequest](#createprotocolrequest)             | [ProtocolInfo](#protocolinfo)                                                                                      |
| [**update**](#update)                | [UpdateProtocolRequest](#updateprotocolrequest)             | [ProtocolInfo](#protocolinfo)                                                                                      |
| [**update\_plugin**](#update_plugin) | [UpdateProtocolPluginRequest](#updateprotocolpluginrequest) | [ProtocolInfo](#protocolinfo)                                                                                      |
| [**enable**](#enable)                | [ProtocolRequest](#protocolrequest)                         | [ProtocolInfo](#protocolinfo)                                                                                      |
| [**disable**](#disable)              | [ProtocolRequest](#protocolrequest)                         | [ProtocolInfo](#protocolinfo)                                                                                      |
| [**delete**](#delete)                | [ProtocolRequest](#protocolrequest)                         | [google.protobuf.Empty](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/empty.proto)   |
| [**get**](#get)                      | [GetProtocolRequest](#getprotocolrequest)                   | [ProtocolInfo](#protocolinfo)                                                                                      |
| [**list**](#list)                    | [ProtocolQuery](#protocolquery)                             | [ProtocolsInfo](#protocolsinfo)                                                                                    |
| [**stat**](#stat)                    | [ProtocolStatQuery](#protocolstatquery)                     | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |

### create

> **POST** /notification/v1/protocols

> Creates a new Protocol.Protocol is the definition of which method to use when dispatching the Notifications through a Channel.When creating a protocol, you must specify the plugins provided from the repository, and you must also set the credentials to be set in the plugin if necessary.

| Type     | Message                                         |
| -------- | ----------------------------------------------- |
| Request  | [CreateProtocolRequest](#createprotocolrequest) |
| Response | [ProtocolInfo](#protocolinfo)                   |

### update

> **PUT** /notification/v1/protocol/{protocol\_id}

> Updates a Protocol information.Update methods can update name, tags only. If you want to update plugin version or options, you can use update\_plugin method.

| Type     | Message                                         |
| -------- | ----------------------------------------------- |
| Request  | [UpdateProtocolRequest](#updateprotocolrequest) |
| Response | [ProtocolInfo](#protocolinfo)                   |

### update\_plugin

> **PUT** /notification/v1/protocol/{protocol\_id}/plugin

> Updates a plugin for Protocol.This method is usually used when redeploying a deployed plugin container to a new version.

| Type     | Message                                                     |
| -------- | ----------------------------------------------------------- |
| Request  | [UpdateProtocolPluginRequest](#updateprotocolpluginrequest) |
| Response | [ProtocolInfo](#protocolinfo)                               |

### enable

> **PUT** /notification/v1/protocol/{protocol\_id}/enable

> Enables a Protocol.If the disabled Protocol is enabled, the Protocol can be used again and the notification can be dispatched.

| Type     | Message                             |
| -------- | ----------------------------------- |
| Request  | [ProtocolRequest](#protocolrequest) |
| Response | [ProtocolInfo](#protocolinfo)       |

### disable

> **PUT** /notification/v1/protocol/{protocol\_id}/disable

> Disables a Protocol.If you disable the Protocol, the notification will not be dispatched, even if they are created.

| Type     | Message                             |
| -------- | ----------------------------------- |
| Request  | [ProtocolRequest](#protocolrequest) |
| Response | [ProtocolInfo](#protocolinfo)       |

### delete

> **DELETE** /notification/v1/protocol/{protocol\_id}

> Delete the protocol.If there is even one channel using the protocol, it cannot be deleted.

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

### get

> **GET** /notification/v1/protocol/{protocol\_id}

> Gets a single Protocol.

| Type     | Message                                   |
| -------- | ----------------------------------------- |
| Request  | [GetProtocolRequest](#getprotocolrequest) |
| Response | [ProtocolInfo](#protocolinfo)             |

### list

> **GET** /notification/v1/protocols
>
> **POST** /notification/v1/protocols/search

> Lists the specified Protocols.Can search information using the query format provided by SpaceONE.Detailed information about Query format can be checked in the Search Query pages.

| Type     | Message                         |
| -------- | ------------------------------- |
| Request  | [ProtocolQuery](#protocolquery) |
| Response | [ProtocolsInfo](#protocolsinfo) |

### stat

> **POST** /notification/v1/protocols/stat

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

##

## Message

### CreateProtocolRequest

| Field        | Type                                                                                                               | Required | Description                                                                                            |
| ------------ | ------------------------------------------------------------------------------------------------------------------ | :------: | ------------------------------------------------------------------------------------------------------ |
| name         | string                                                                                                             |     ✔    | The name of Protocol. It can have a maximum of 255 characters.                                         |
| plugin\_info | [PluginRequest](#pluginrequest)                                                                                    |     ✔    | Describe a Plugin information for protocol that include was used plugin, specific version, schema etc. |
| tags         | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |     ✘    | The tags for protocol.                                                                                 |
| domain\_id   | string                                                                                                             |     ✔    | The ID of domain to which the Protocol belongs.                                                        |

### GetProtocolRequest

| Field        | Type           | Required | Description                                                                                                    |
| ------------ | -------------- | :------: | -------------------------------------------------------------------------------------------------------------- |
| protocol\_id | string         |     ✔    | The ID of Protocol.                                                                                            |
| domain\_id   | string         |     ✔    | The ID of domain to which the Protocol belongs.                                                                |
| only         | list of string |     ✘    | The list of the Protocol information column you want to be returned. It must be specified in the ProtocolInfo. |

### PluginInfo

| Field         | Type                                                                                                               | Description                                                                                                                                                                         |
| ------------- | ------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| plugin\_id    | string                                                                                                             | The ID of plugin set in the Protocol.                                                                                                                                               |
| version       | string                                                                                                             | The version of plugin.                                                                                                                                                              |
| options       | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) | The Options that contains information about using plugin.                                                                                                                           |
| secret\_id    | string                                                                                                             | The ID of the Secret containing encrypted data to be used in the plugin.                                                                                                            |
| metadata      | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) | The metadata of plugin. It includes schema for the data that must be set for the Channel when creating the Channel using a Protocol.The schema follows the JSON Schema format.      |
| upgrade\_mode | <ul><li>NONE</li><li>AUTO</li><li>MANUAL</li></ul>                                                                 | Auto upgrade for plugin.If the upgrade\_mode is AUTO, check the latest plugin version when running the plugin, and if a new version is existed, replace the plugin and then run it. |

### PluginRequest

| Field         | Type                                                                                                               | Required | Description                                                                                                                                                                                |
| ------------- | ------------------------------------------------------------------------------------------------------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| plugin\_id    | string                                                                                                             | ✔        | The ID of plugin.                                                                                                                                                                          |
| version       | string                                                                                                             | ✔        | The version of plugin.                                                                                                                                                                     |
| options       | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) | ✘        | The Options that contains information about using plugin.                                                                                                                                  |
| secret\_data  | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) | ✘        | The data for using plugin if necessary. This data is encrypted and stored in the Secret service.                                                                                           |
| schema        | string                                                                                                             | ✔        | The name of schema.When the secret\_data is stored in the Secret service, it can be set with schema if the schema is existed.The schema is provided through the Repository service.        |
| upgrade\_mode | <ul><li>NONE</li><li>AUTO</li><li>MANUAL</li></ul>                                                                 | ✔        | Auto upgrade feature for plugin.If the upgrade mode is AUTO, check the latest plugin version when running the plugin, and if a new version is existed, replace the plugin and then run it. |

### ProtocolInfo

| Field          | Type                                                                                                               | Description                                                                                 |
| -------------- | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------- |
| protocol\_id   | string                                                                                                             | The ID of Protocol.                                                                         |
| name           | string                                                                                                             | The name of Protocol.                                                                       |
| state          | <ul><li>NONE</li><li>ENABLED</li><li>DISABLED</li></ul>                                                            | The state of Protocol.ENABLED or DISABLED only.                                             |
| protocol\_type | <ul><li>PROTOCOL\_TYPE\_NONE</li><li>INTERNAL</li><li>EXTERNAL</li></ul>                                           | {}                                                                                          |
| resource\_type | string                                                                                                             | Resource type for Protocol. Currently only identity.Project or identity.User can be set.    |
| capability     | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) | The capability information for the Protocol. It included supported schema for the Protocol. |
| plugin\_info   | [PluginInfo](#plugininfo)                                                                                          | the plugin information set in Protocol.                                                     |
| tags           | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) | The tags for protocol.                                                                      |
| domain\_id     | string                                                                                                             | The ID of domain to which the Protocol belongs.                                             |
| created\_at    | string                                                                                                             | Protocol creation time.                                                                     |

### ProtocolQuery

| Field          | Type                                                                                               | Required | Description                                                                    |
| -------------- | -------------------------------------------------------------------------------------------------- | -------- | ------------------------------------------------------------------------------ |
| query          | [spaceone.api.core.v1.Query](https://spaceone-dev.gitbook.io/api-reference/common-v1/search-query) | ✘        | Query format provided by SpaceONE. Please check the link for more information. |
| protocol\_id   | string                                                                                             | ✘        | The ID of Protocol.                                                            |
| name           | string                                                                                             | ✘        | The name of Protocol.                                                          |
| state          | <ul><li>NONE</li><li>ENABLED</li><li>DISABLED</li></ul>                                            | ✘        | The state of Protocol. ENABLED or DISABLED only.                               |
| protocol\_type | <ul><li>PROTOCOL\_TYPE\_NONE</li><li>INTERNAL</li><li>EXTERNAL</li></ul>                           | ✘        | The type of Protocol. INTERNAL or EXTERNAL only.                               |
| domain\_id     | string                                                                                             | ✔        | The ID of domain to which the Protocol belongs.                                |

### ProtocolRequest

| Field        | Type   | Required | Description                                     |
| ------------ | ------ | :------: | ----------------------------------------------- |
| protocol\_id | string |     ✔    | The ID of Protocol.                             |
| domain\_id   | string |     ✔    | The ID of domain to which the Protocol belongs. |

### ProtocolStatQuery

| Field      | Type                                                                                                             | Required | Description                                                                               |
| ---------- | ---------------------------------------------------------------------------------------------------------------- | :------: | ----------------------------------------------------------------------------------------- |
| query      | [spaceone.api.core.v1.StatisticsQuery](https://spaceone-dev.gitbook.io/api-reference/common-v1/statistics-query) |     ✔    | Statistics Query format provided by SpaceONE. Please check the link for more information. |
| domain\_id | string                                                                                                           |     ✔    | The ID of domain to which the Protocol belongs.                                           |

### ProtocolsInfo

| Field        | Type                                                                                            | Description                        |
| ------------ | ----------------------------------------------------------------------------------------------- | ---------------------------------- |
| results      | [list of ProtocolInfo](#protocolinfo)                                                           | List of queried protocols.         |
| total\_count | [int32](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/type.proto) | Total counts of queried Protocols. |

### UpdateProtocolPluginRequest

| Field        | Type                                                                                                               | Required | Description                                                                                                                          |
| ------------ | ------------------------------------------------------------------------------------------------------------------ | :------: | ------------------------------------------------------------------------------------------------------------------------------------ |
| protocol\_id | string                                                                                                             |     ✔    | The ID of Protocol.                                                                                                                  |
| version      | string                                                                                                             |     ✘    | The version of plugin you want to update. Version means the tags of plugin container image in repository that specific market place. |
| options      | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |     ✘    | The Options that contains information about using plugin.                                                                            |
| domain\_id   | string                                                                                                             |     ✔    | The ID of domain to which the Protocol belongs.                                                                                      |

### UpdateProtocolRequest

| Field        | Type                                                                                                               | Required | Description                                                                                                 |
| ------------ | ------------------------------------------------------------------------------------------------------------------ | :------: | ----------------------------------------------------------------------------------------------------------- |
| protocol\_id | string                                                                                                             |     ✔    | The ID of Protocol.                                                                                         |
| name         | string                                                                                                             |     ✘    | The Name of Protocol. It can have a maximum of 255 characters.                                              |
| tags         | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |     ✘    | The tags for protocol. When updating, existing tag information is deleted all and will be updated with new. |
| domain\_id   | string                                                                                                             |     ✔    | The ID of domain to which the Protocol belongs.                                                             |
