# coding: utf-8
"""
Fortanix DSM REST API
This is a set of REST APIs for accessing the Fortanix Data Security Manager. This includes APIs for managing accounts, and for performing cryptographic and key management operations.
OpenAPI spec version: 1.0.0-20200608
Contact: support@fortanix.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from __future__ import absolute_import
import sys
import os
import re
# python 2 and python 3 compatibility library
from six import iteritems
from ..api_client import ApiClient
# NOTE: This class is auto generated by the swagger code generator program.
# Do not edit the class manually.
# Ref: https://github.com/swagger-api/swagger-codegen
[docs]class PluginsApi(object):
[docs] def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
[docs] def create_plugin(self, body, async_call=False, **kwargs):
"""
Create a new plugin with the specified properties.
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type body: `PluginRequest`
:param body: Properties of plugin to create (required)
:rtype: `Plugin`
:return:
If the method is called asynchronously, returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if async_call:
return self.create_plugin_with_http_info(body, async_call=async_call, **kwargs)
else:
(data) = self.create_plugin_with_http_info(body, async_call=async_call, **kwargs)
return data
def create_plugin_with_http_info(self, body, async_call=False, **kwargs):
"""
Create a new plugin with the specified properties.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_call=True::
>>> thread = api.create_plugin_with_http_info(body, async_call=True)
>>> result = thread.get()
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type body: `PluginRequest`
:param body: Properties of plugin to create (required)
:rtype: `Plugin`
:return:
If the method is called asynchronously, returns the request thread.
"""
all_params = ['body']
all_params.append('async_call')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method create_plugin" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if ('body' not in params) or (params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `create_plugin`")
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
# Authentication setting
auth_settings = ['bearerToken']
return self.api_client.call_api('/sys/v1/plugins', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='Plugin',
auth_settings=auth_settings,
async_call=params.get('async_call'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
[docs] def delete_plugin(self, plugin_id, async_call=False, **kwargs):
"""
Remove a plugin from SDKMS.
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type plugin_id: `str`
:param plugin_id: Plugin Identifier (required)
:rtype: None
:return:
If the method is called asynchronously, returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if async_call:
return self.delete_plugin_with_http_info(plugin_id, async_call=async_call, **kwargs)
else:
(data) = self.delete_plugin_with_http_info(plugin_id, async_call=async_call, **kwargs)
return data
def delete_plugin_with_http_info(self, plugin_id, async_call=False, **kwargs):
"""
Remove a plugin from SDKMS.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_call=True::
>>> thread = api.delete_plugin_with_http_info(plugin_id, async_call=True)
>>> result = thread.get()
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type plugin_id: `str`
:param plugin_id: Plugin Identifier (required)
:rtype: None
:return:
If the method is called asynchronously, returns the request thread.
"""
all_params = ['plugin_id']
all_params.append('async_call')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method delete_plugin" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'plugin_id' is set
if ('plugin_id' not in params) or (params['plugin_id'] is None):
raise ValueError("Missing the required parameter `plugin_id` when calling `delete_plugin`")
collection_formats = {}
path_params = {}
if 'plugin_id' in params:
path_params['plugin-id'] = params['plugin_id']
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
# Authentication setting
auth_settings = ['bearerToken']
return self.api_client.call_api('/sys/v1/plugins/{plugin-id}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=None,
auth_settings=auth_settings,
async_call=params.get('async_call'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
[docs] def get_plugin(self, plugin_id, async_call=False, **kwargs):
"""
Look up plugin by plugin ID.
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type plugin_id: `str`
:param plugin_id: Plugin Identifier (required)
:rtype: `Plugin`
:return:
If the method is called asynchronously, returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if async_call:
return self.get_plugin_with_http_info(plugin_id, async_call=async_call, **kwargs)
else:
(data) = self.get_plugin_with_http_info(plugin_id, async_call=async_call, **kwargs)
return data
def get_plugin_with_http_info(self, plugin_id, async_call=False, **kwargs):
"""
Look up plugin by plugin ID.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_call=True::
>>> thread = api.get_plugin_with_http_info(plugin_id, async_call=True)
>>> result = thread.get()
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type plugin_id: `str`
:param plugin_id: Plugin Identifier (required)
:rtype: `Plugin`
:return:
If the method is called asynchronously, returns the request thread.
"""
all_params = ['plugin_id']
all_params.append('async_call')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_plugin" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'plugin_id' is set
if ('plugin_id' not in params) or (params['plugin_id'] is None):
raise ValueError("Missing the required parameter `plugin_id` when calling `get_plugin`")
collection_formats = {}
path_params = {}
if 'plugin_id' in params:
path_params['plugin-id'] = params['plugin_id']
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
# Authentication setting
auth_settings = ['bearerToken']
return self.api_client.call_api('/sys/v1/plugins/{plugin-id}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='Plugin',
auth_settings=auth_settings,
async_call=params.get('async_call'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
[docs] def get_plugins(self, group_id=None, sort=None, start=None, limit=None, offset=None, async_call=False, **kwargs):
"""
Get details of all plugins the current user has access to.
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type group_id: `str`
:param group_id: Only retrieve plugins in the specified group.
:type sort: `str`
:param sort: This specifies the property (`plugin_id` only, for now) and order (ascending or descending) with which to sort the apps. By default, plugins are sorted by `plugin_id` in ascending order. The syntax is \"<property>:[asc|desc]\" (e.g. \"plugin_id:desc\") or just \"<property>\" (ascending order by default).
:type start: `str`
:param start: If provided, this must be a value of the property specified in `sort`. Returned apps will begin just above or just below this value (for asc/desc order resp.).
:type limit: `int`
:param limit: Maximum number of apps to return. If not provided, the limit is 100.
:type offset: `int`
:param offset: Number of apps past `start` to skip.
:rtype: list[`Plugin`]
:return:
If the method is called asynchronously, returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if async_call:
return self.get_plugins_with_http_info(group_id=group_id, sort=sort, start=start, limit=limit, offset=offset, async_call=async_call, **kwargs)
else:
(data) = self.get_plugins_with_http_info(group_id=group_id, sort=sort, start=start, limit=limit, offset=offset, async_call=async_call, **kwargs)
return data
def get_plugins_with_http_info(self, group_id=None, sort=None, start=None, limit=None, offset=None, async_call=False, **kwargs):
"""
Get details of all plugins the current user has access to.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_call=True::
>>> thread = api.get_plugins_with_http_info(async_call=True)
>>> result = thread.get()
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type group_id: `str`
:param group_id: Only retrieve plugins in the specified group.
:type sort: `str`
:param sort: This specifies the property (`plugin_id` only, for now) and order (ascending or descending) with which to sort the apps. By default, plugins are sorted by `plugin_id` in ascending order. The syntax is \"<property>:[asc|desc]\" (e.g. \"plugin_id:desc\") or just \"<property>\" (ascending order by default).
:type start: `str`
:param start: If provided, this must be a value of the property specified in `sort`. Returned apps will begin just above or just below this value (for asc/desc order resp.).
:type limit: `int`
:param limit: Maximum number of apps to return. If not provided, the limit is 100.
:type offset: `int`
:param offset: Number of apps past `start` to skip.
:rtype: list[`Plugin`]
:return:
If the method is called asynchronously, returns the request thread.
"""
all_params = ['group_id', 'sort', 'start', 'limit', 'offset']
all_params.append('async_call')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_plugins" % key
)
params[key] = val
del params['kwargs']
collection_formats = {}
path_params = {}
query_params = []
if 'group_id' in params:
query_params.append(('group_id', params['group_id']))
if 'sort' in params:
query_params.append(('sort', params['sort']))
if 'start' in params:
query_params.append(('start', params['start']))
if 'limit' in params:
query_params.append(('limit', params['limit']))
if 'offset' in params:
query_params.append(('offset', params['offset']))
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
# Authentication setting
auth_settings = ['bearerToken']
return self.api_client.call_api('/sys/v1/plugins', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='list[Plugin]',
auth_settings=auth_settings,
async_call=params.get('async_call'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
[docs] def invoke_plugin(self, plugin_id, body, async_call=False, **kwargs):
"""
Invokes a plugin execution with the provided request body as input to the plugin.
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type plugin_id: `str`
:param plugin_id: Plugin Identifier (required)
:type body: `PluginInvokeRequest`
:param body: Object to be passed to plugin as input (required)
:rtype: `PluginInvokeResponse`
:return:
If the method is called asynchronously, returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if async_call:
return self.invoke_plugin_with_http_info(plugin_id, body, async_call=async_call, **kwargs)
else:
(data) = self.invoke_plugin_with_http_info(plugin_id, body, async_call=async_call, **kwargs)
return data
def invoke_plugin_with_http_info(self, plugin_id, body, async_call=False, **kwargs):
"""
Invokes a plugin execution with the provided request body as input to the plugin.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_call=True::
>>> thread = api.invoke_plugin_with_http_info(plugin_id, body, async_call=True)
>>> result = thread.get()
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type plugin_id: `str`
:param plugin_id: Plugin Identifier (required)
:type body: `PluginInvokeRequest`
:param body: Object to be passed to plugin as input (required)
:rtype: `PluginInvokeResponse`
:return:
If the method is called asynchronously, returns the request thread.
"""
all_params = ['plugin_id', 'body']
all_params.append('async_call')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method invoke_plugin" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'plugin_id' is set
if ('plugin_id' not in params) or (params['plugin_id'] is None):
raise ValueError("Missing the required parameter `plugin_id` when calling `invoke_plugin`")
# verify the required parameter 'body' is set
if ('body' not in params) or (params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `invoke_plugin`")
collection_formats = {}
path_params = {}
if 'plugin_id' in params:
path_params['plugin-id'] = params['plugin_id']
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
# Authentication setting
auth_settings = ['bearerToken']
return self.api_client.call_api('/sys/v1/plugins/{plugin-id}', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='PluginInvokeResponse',
auth_settings=auth_settings,
async_call=params.get('async_call'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
[docs] def sys_v1_plugins_invoke_plugin_id_get(self, plugin_id, async_call=False, **kwargs):
"""
Invokes a plugin with empty input.
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type plugin_id: `str`
:param plugin_id: Plugin Identifier (required)
:rtype: `PluginInvokeResponse`
:return:
If the method is called asynchronously, returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if async_call:
return self.sys_v1_plugins_invoke_plugin_id_get_with_http_info(plugin_id, async_call=async_call, **kwargs)
else:
(data) = self.sys_v1_plugins_invoke_plugin_id_get_with_http_info(plugin_id, async_call=async_call, **kwargs)
return data
def sys_v1_plugins_invoke_plugin_id_get_with_http_info(self, plugin_id, async_call=False, **kwargs):
"""
Invokes a plugin with empty input.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_call=True::
>>> thread = api.sys_v1_plugins_invoke_plugin_id_get_with_http_info(plugin_id, async_call=True)
>>> result = thread.get()
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type plugin_id: `str`
:param plugin_id: Plugin Identifier (required)
:rtype: `PluginInvokeResponse`
:return:
If the method is called asynchronously, returns the request thread.
"""
all_params = ['plugin_id']
all_params.append('async_call')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method sys_v1_plugins_invoke_plugin_id_get" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'plugin_id' is set
if ('plugin_id' not in params) or (params['plugin_id'] is None):
raise ValueError("Missing the required parameter `plugin_id` when calling `sys_v1_plugins_invoke_plugin_id_get`")
collection_formats = {}
path_params = {}
if 'plugin_id' in params:
path_params['plugin-id'] = params['plugin_id']
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
# Authentication setting
auth_settings = ['bearerToken']
return self.api_client.call_api('/sys/v1/plugins/invoke/{plugin-id}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='PluginInvokeResponse',
auth_settings=auth_settings,
async_call=params.get('async_call'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
[docs] def update_plugin(self, plugin_id, body, async_call=False, **kwargs):
"""
Change a plugin's properties, such as name, description, code, or group membership.
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type plugin_id: `str`
:param plugin_id: Plugin Identifier (required)
:type body: `PluginRequest`
:param body: Properties of plugin to create (required)
:rtype: `App`
:return:
If the method is called asynchronously, returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if async_call:
return self.update_plugin_with_http_info(plugin_id, body, async_call=async_call, **kwargs)
else:
(data) = self.update_plugin_with_http_info(plugin_id, body, async_call=async_call, **kwargs)
return data
def update_plugin_with_http_info(self, plugin_id, body, async_call=False, **kwargs):
"""
Change a plugin's properties, such as name, description, code, or group membership.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_call=True::
>>> thread = api.update_plugin_with_http_info(plugin_id, body, async_call=True)
>>> result = thread.get()
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type plugin_id: `str`
:param plugin_id: Plugin Identifier (required)
:type body: `PluginRequest`
:param body: Properties of plugin to create (required)
:rtype: `App`
:return:
If the method is called asynchronously, returns the request thread.
"""
all_params = ['plugin_id', 'body']
all_params.append('async_call')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method update_plugin" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'plugin_id' is set
if ('plugin_id' not in params) or (params['plugin_id'] is None):
raise ValueError("Missing the required parameter `plugin_id` when calling `update_plugin`")
# verify the required parameter 'body' is set
if ('body' not in params) or (params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `update_plugin`")
collection_formats = {}
path_params = {}
if 'plugin_id' in params:
path_params['plugin-id'] = params['plugin_id']
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
# Authentication setting
auth_settings = ['bearerToken']
return self.api_client.call_api('/sys/v1/plugins/{plugin-id}', 'PATCH',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='App',
auth_settings=auth_settings,
async_call=params.get('async_call'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)