# Plugin

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

## Plugin

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

| Method                             | Request                                                   | Response                                                                                                           |
| ---------------------------------- | --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| [**register**](#register)          | [CreatePluginRequest](#createpluginrequest)               | [PluginInfo](#plugininfo)                                                                                          |
| [**update**](#update)              | [UpdatePluginRequest](#updatepluginrequest)               | [PluginInfo](#plugininfo)                                                                                          |
| [**deregister**](#deregister)      | [PluginRequest](#pluginrequest)                           | [google.protobuf.Empty](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/empty.proto)   |
| [**enable**](#enable)              | [PluginRequest](#pluginrequest)                           | [PluginInfo](#plugininfo)                                                                                          |
| [**disable**](#disable)            | [PluginRequest](#pluginrequest)                           | [PluginInfo](#plugininfo)                                                                                          |
| [**get\_versions**](#get_versions) | [RepositoryPluginRequest](#repositorypluginrequest)       | [VersionsInfo](#versionsinfo)                                                                                      |
| [**get**](#get)                    | [GetRepositoryPluginRequest](#getrepositorypluginrequest) | [PluginInfo](#plugininfo)                                                                                          |
| [**list**](#list)                  | [PluginQuery](#pluginquery)                               | [PluginsInfo](#pluginsinfo)                                                                                        |
| [**stat**](#stat)                  | [PluginStatQuery](#pluginstatquery)                       | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |

### register

> **POST** /repository/v1/plugins

> Registers a Plugin. The parameter `registry_type`, meaning container registry type, can be either `DOCKER_HUB` or `AWS_PUBLIC_ECR`. The default value of the `registry_type` is `DOCKER_HUB`. The parameter `registry_url` is required if the `registry_type` is not `DOCKER_HUB`. The parameter `image` is limited to 40 characters.

| Type     | Message                                     |
| -------- | ------------------------------------------- |
| Request  | [CreatePluginRequest](#createpluginrequest) |
| Response | [PluginInfo](#plugininfo)                   |

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

```
{
    "name": "JIRA Issue notification",
    "service_type": "notification.Procotol",
    "image": "pyengine/plugin-jira-noti-protocol",
    "registry_type": "DOCKER_HUB",
    "registry_config": {},
    "provider": "atlassian",
    "capability": {
        "supported_schema": [
            "atlassian_jira"
        ]
    },
    "template": {
        "options": {
            "schema": {
                "type": "object",
                "required": [],
                "properties": {
                    "project_id": {
                        "type": "string",
                        "title": "Project ID",
                        "minLength": 4.0
                    },
                    "sa_name": {
                        "title": "Service Account",
                        "type": "string",
                        "minLength": 4.0
                    }
                }
            }
        }
    },
    "labels": [
        "jira",
        "atlassian",
        "notification"
    ],
    "tags": {
        "description": "Atlassian JIRA Issue notification",
        "icon": "https://icon-path/jira-icon.png"
    }
}
```

{% endtab %}

{% tab title="Response Example" %}

```
{
    "plugin_id": "plugin-jira-noti-protocol",
    "name": "JIRA Issue notification",
    "image": "pyengine/plugin-jira-noti-protocol",
    "registry_url": "registry.hub.docker.com",
    "state": "ENABLED",
    "service_type": "notification.Procotol",
    "provider": "atlassian",
    "registry_type": "DOCKER_HUB",
    "registry_config": {},
    "capability": {
        "supported_schema": [
            "atlassian_jira"
        ]
    },
    "template": {
        "options": {
            "schema": {
                "type": "object",
                "required": [],
                "properties": {
                    "project_id": {
                        "type": "string",
                        "title": "Project ID",
                        "minLength": 4.0
                    },
                    "sa_name": {
                        "title": "Service Account",
                        "type": "string",
                        "minLength": 4.0
                    }
                }
            }
        }
    },
    "labels": [
        "jira",
        "atlassian",
        "notification"
    ],
    "tags": {
        "description": "Atlassian JIRA Issue notification",
        "icon": "https://icon-path/jira-icon.png"
    },
    "repository_info": {
        "repository_id": "repo-123456789012",
        "name": "Marketplace",
        "repository_type": "remote"
    },
    "domain_id": "domain-123456789012",
    "created_at": "2022-01-01T08:02:38.094Z",
    "updated_at": "2022-01-01T08:02:38.094Z"
}
```

{% endtab %}
{% endtabs %}

### update

> **PUT** /repository/v1/plugin/{plugin\_id}

> Updates a specific Plugin registered. A Plugin can be updated only if its Repository's `repository_type` is `local`. You can make changes in Plugin settings, including `template` and its options, `schema`.

| Type     | Message                                     |
| -------- | ------------------------------------------- |
| Request  | [UpdatePluginRequest](#updatepluginrequest) |
| Response | [PluginInfo](#plugininfo)                   |

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

```
{
    "name": "JIRA Issue notification",
    "capability": {
        "supported_schema": [
            "atlassian_jira"
        ]
    },
    "template": {
        "options": {
            "schema": {
                "type": "object",
                "required": [],
                "properties": {
                    "project_id": {
                        "type": "string",
                        "title": "Project ID",
                        "minLength": 4.0
                    },
                    "sa_name": {
                        "title": "Service Account",
                        "type": "string",
                        "minLength": 4.0
                    }
                }
            }
        }
    },
    "labels": [
        "jira",
        "atlassian",
        "notification"
    ],
    "tags": {
        "description": "Atlassian JIRA Issue notification",
        "icon": "https://icon-path/jira-icon.png"
    }
}
```

{% endtab %}

{% tab title="Response Example" %}

```
{
    "plugin_id": "plugin-jira-noti-protocol",
    "name": "JIRA Issue notification",
    "image": "pyengine/plugin-jira-noti-protocol",
    "registry_url": "registry.hub.docker.com",
    "state": "ENABLED",
    "service_type": "notification.Procotol",
    "provider": "atlassian",
    "registry_type": "DOCKER_HUB",
    "registry_config": {},
    "capability": {
        "supported_schema": [
            "atlassian_jira"
        ]
    },
    "template": {
        "options": {
            "schema": {
                "type": "object",
                "required": [],
                "properties": {
                    "project_id": {
                        "type": "string",
                        "title": "Project ID",
                        "minLength": 4.0
                    },
                    "sa_name": {
                        "title": "Service Account",
                        "type": "string",
                        "minLength": 4.0
                    }
                }
            }
        }
    },
    "labels": [
        "jira",
        "atlassian",
        "notification"
    ],
    "tags": {
        "description": "Atlassian JIRA Issue notification",
        "spaceone:plugin_name": "plugin-jira-noti-protocol",
        "icon": "https://icon-path/jira-icon.png"
    },
    "repository_info": {
        "repository_id": "repo-123456789012",
        "name": "Marketplace",
        "repository_type": "remote"
    },
    "domain_id": "domain-123456789012",
    "created_at": "2022-01-01T08:02:38.094Z",
    "updated_at": "2022-01-01T08:02:38.094Z"
}
```

{% endtab %}
{% endtabs %}

### deregister

> **DELETE** /repository/v1/plugin/{plugin\_id}

> Deregisters and deletes a specific Plugin. You must specify the `plugin_id` of the Plugin to deregister.

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

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

```
{
    "plugin_id": "plugin-aws-sns-mon-webhook",
    "domain_id": "domain-123456789012"
}
```

{% endtab %}

{% tab title="Response Example" %}

```
{
    "plugin_id": "plugin-aws-sns-mon-webhook",
    "name": "AWS SNS Webhook",
    "image": "pyengine/plugin-aws-sns-mon-webhook",
    "registry_url": "registry.hub.docker.com",
    "state": "ENABLED",
    "service_type": "monitoring.Webhook",
    "registry_type": "DOCKER_HUB",
    "registry_config": {},
    "capability": {},
    "template": {},
    "labels": [],
    "tags": {
        "icon": "https://icon-path/Amazon-SNS.svg"
    },
    "repository_info": {
        "repository_id": "repo-123456789012",
        "name": "Marketplace",
        "repository_type": "remote"
    },
    "domain_id": "domain-987654321098",
    "created_at": "2022-01-01T08:14:23.175Z",
    "updated_at": "2022-01-01T08:14:23.175Z"
}
```

{% endtab %}
{% endtabs %}

### enable

> **PUT** /repository/v1/plugin/{plugin\_id}/enable

> Enables a specific Plugin. If the Plugin is enabled, the Plugin can be used as its parameter `state` becomes `ENABLED`.

| Type     | Message                         |
| -------- | ------------------------------- |
| Request  | [PluginRequest](#pluginrequest) |
| Response | [PluginInfo](#plugininfo)       |

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

```
{
    "plugin_id": "plugin-aws-sns-mon-webhook",
    "domain_id": "domain-123456789012"
}
```

{% endtab %}

{% tab title="Response Example" %}

```
{
    "plugin_id": "plugin-aws-sns-mon-webhook",
    "name": "AWS SNS Webhook",
    "image": "pyengine/plugin-aws-sns-mon-webhook",
    "registry_url": "registry.hub.docker.com",
    "state": "ENABLED",
    "service_type": "monitoring.Webhook",
    "registry_type": "DOCKER_HUB",
    "registry_config": {},
    "capability": {},
    "template": {},
    "labels": [],
    "tags": {
        "icon": "https://icon-path/Amazon-SNS.svg"
    },
    "repository_info": {
        "repository_id": "repo-123456789012",
        "name": "Marketplace",
        "repository_type": "remote"
    },
    "domain_id": "domain-987654321098",
    "created_at": "2022-01-01T08:14:23.175Z",
    "updated_at": "2022-01-01T08:14:23.175Z"
}
```

{% endtab %}
{% endtabs %}

### disable

> **PUT** /repository/v1/plugin/{plugin\_id}/disable

> Disables a specific Plugin. If the Plugin is disabled, the Plugin cannot be used as its parameter `state` becomes `DISABLED`.

| Type     | Message                         |
| -------- | ------------------------------- |
| Request  | [PluginRequest](#pluginrequest) |
| Response | [PluginInfo](#plugininfo)       |

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

```
{
    "plugin_id": "plugin-aws-sns-mon-webhook",
    "domain_id": "domain-123456789012"
}
```

{% endtab %}

{% tab title="Response Example" %}

```
{
    "plugin_id": "plugin-aws-sns-mon-webhook",
    "name": "AWS SNS Webhook",
    "image": "pyengine/plugin-aws-sns-mon-webhook",
    "registry_url": "registry.hub.docker.com",
    "state": "ENABLED",
    "service_type": "monitoring.Webhook",
    "registry_type": "DOCKER_HUB",
    "registry_config": {},
    "capability": {},
    "template": {},
    "labels": [],
    "tags": {
        "icon": "https://icon-path/Amazon-SNS.svg"
    },
    "repository_info": {
        "repository_id": "repo-123456789012",
        "name": "Marketplace",
        "repository_type": "remote"
    },
    "domain_id": "domain-987654321098",
    "created_at": "2022-01-01T08:14:23.175Z",
    "updated_at": "2022-01-01T08:14:23.175Z"
}
```

{% endtab %}
{% endtabs %}

### get\_versions

> **GET** /repository/v1/plugins/{plugin\_id}/versions

| Type     | Message                                             |
| -------- | --------------------------------------------------- |
| Request  | [RepositoryPluginRequest](#repositorypluginrequest) |
| Response | [VersionsInfo](#versionsinfo)                       |

### get

> **GET** /repository/v1/plugins/{plugin\_id}

> Gets a specific Plugin. Prints detailed information about the Plugin, including `image`, `registry_url`, and `state`.

| Type     | Message                                                   |
| -------- | --------------------------------------------------------- |
| Request  | [GetRepositoryPluginRequest](#getrepositorypluginrequest) |
| Response | [PluginInfo](#plugininfo)                                 |

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

```
{
    "plugin_id": "plugin-aws-sns-mon-webhook",
    "domain_id": "domain-123456789012"
}
```

{% endtab %}

{% tab title="Response Example" %}

```
{
    "plugin_id": "plugin-aws-sns-mon-webhook",
    "name": "AWS SNS Webhook",
    "image": "pyengine/plugin-aws-sns-mon-webhook",
    "registry_url": "registry.hub.docker.com",
    "state": "ENABLED",
    "service_type": "monitoring.Webhook",
    "registry_type": "DOCKER_HUB",
    "registry_config": {},
    "capability": {},
    "template": {},
    "labels": [],
    "tags": {
        "icon": "https://icon-url/Amazon-SNS.svg"
    },
    "repository_info": {
        "repository_id": "repo-123456789012",
        "name": "Marketplace",
        "repository_type": "remote"
    },
    "domain_id": "domain-987654321098",
    "created_at": "2021-06-14T08:14:23.175Z",
    "updated_at": "2021-06-14T08:14:23.175Z"
}
```

{% endtab %}
{% endtabs %}

### list

> **GET** /repository/v1/plugins
>
> **POST** /repository/v1/plugins/search

| Type     | Message                     |
| -------- | --------------------------- |
| Request  | [PluginQuery](#pluginquery) |
| Response | [PluginsInfo](#pluginsinfo) |

### stat

> **POST** /repository/v1/plugins/stat

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

##

## Message

### CreatePluginRequest

| Field            | Type                                                                                                               | Required | Description |
| ---------------- | ------------------------------------------------------------------------------------------------------------------ | -------- | ----------- |
| name             | string                                                                                                             | ✔        |             |
| service\_type    | string                                                                                                             | ✔        |             |
| image            | string                                                                                                             | ✔        |             |
| provider         | string                                                                                                             | ✘        |             |
| registry\_type   | <ul><li>NONE\_REGISTRY\_TYPE</li><li>DOCKER\_HUB</li><li>AWS\_PUBLIC\_ECR</li></ul>                                | ✘        |             |
| registry\_config | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) | ✘        |             |
| capability       | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) | ✘        |             |
| template         | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) | ✘        |             |
| labels           | [google.protobuf.ListValue](https://developers.google.com/protocol-buffers/docs/reference/overview)                | ✘        |             |
| tags             | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) | ✘        |             |
| project\_id      | string                                                                                                             | ✘        |             |
| domain\_id       | string                                                                                                             | ✔        |             |

### GetRepositoryPluginRequest

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

### PluginInfo

| Field            | Type                                                                                                               | Description |
| ---------------- | ------------------------------------------------------------------------------------------------------------------ | ----------- |
| plugin\_id       | string                                                                                                             |             |
| name             | string                                                                                                             |             |
| image            | string                                                                                                             |             |
| registry\_url    | string                                                                                                             |             |
| state            | <ul><li>NONE</li><li>ENABLED</li><li>DISABLED</li></ul>                                                            |             |
| service\_type    | string                                                                                                             |             |
| provider         | string                                                                                                             |             |
| registry\_type   | <ul><li>NONE\_REGISTRY\_TYPE</li><li>DOCKER\_HUB</li><li>AWS\_PUBLIC\_ECR</li></ul>                                |             |
| registry\_config | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |             |
| capability       | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |             |
| template         | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |             |
| labels           | [google.protobuf.ListValue](https://developers.google.com/protocol-buffers/docs/reference/overview)                |             |
| tags             | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |             |
| repository\_info | [RepositoryInfo](#repositoryinfo)                                                                                  |             |
| project\_id      | string                                                                                                             |             |
| domain\_id       | string                                                                                                             |             |
| created\_at      | string                                                                                                             |             |
| updated\_at      | string                                                                                                             |             |

### PluginQuery

| Field          | Type                                                                                               | Required | Description |
| -------------- | -------------------------------------------------------------------------------------------------- | -------- | ----------- |
| query          | [spaceone.api.core.v1.Query](https://spaceone-dev.gitbook.io/api-reference/common-v1/search-query) | ✘        |             |
| plugin\_id     | string                                                                                             | ✘        |             |
| name           | string                                                                                             | ✘        |             |
| state          | <ul><li>NONE</li><li>ENABLED</li><li>DISABLED</li></ul>                                            | ✘        |             |
| service\_type  | string                                                                                             | ✘        |             |
| provider       | string                                                                                             | ✘        |             |
| repository\_id | string                                                                                             | ✔        |             |
| domain\_id     | string                                                                                             | ✔        |             |
| registry\_type | <ul><li>NONE\_REGISTRY\_TYPE</li><li>DOCKER\_HUB</li><li>AWS\_PUBLIC\_ECR</li></ul>                | ✘        |             |

### PluginRequest

| Field      | Type   | Required | Description |
| ---------- | ------ | :------: | ----------- |
| plugin\_id | string |     ✔    |             |
| domain\_id | string |     ✔    |             |

### PluginStatQuery

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

### PluginsInfo

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

### RepositoryPluginRequest

| Field          | Type   | Required | Description |
| -------------- | ------ | :------: | ----------- |
| plugin\_id     | string |     ✔    |             |
| domain\_id     | string |     ✔    |             |
| repository\_id | string |     ✘    |             |

### UpdatePluginRequest

| Field      | Type                                                                                                               | Required | Description |
| ---------- | ------------------------------------------------------------------------------------------------------------------ | :------: | ----------- |
| plugin\_id | string                                                                                                             |     ✔    |             |
| name       | string                                                                                                             |     ✘    |             |
| capability | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |     ✘    |             |
| template   | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |     ✘    |             |
| labels     | [google.protobuf.ListValue](https://developers.google.com/protocol-buffers/docs/reference/overview)                |     ✘    |             |
| tags       | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |     ✘    |             |
| domain\_id | string                                                                                                             |     ✔    |             |

### VersionsInfo

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