# coding: utf-8

"""
    Harbor API

    These APIs provide services for manipulating Harbor project.  # noqa: E501

    OpenAPI spec version: 2.0
    
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""


from __future__ import absolute_import

import re  # noqa: F401

# python 2 and python 3 compatibility library
import six

from harbor_client.api_client import ApiClient


class RetentionApi(object):
    """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
    """

    def __init__(self, api_client=None):
        if api_client is None:
            api_client = ApiClient()
        self.api_client = api_client

    def create_retention(self, policy, **kwargs):  # noqa: E501
        """Create Retention Policy  # noqa: E501

        Create Retention Policy, you can reference metadatas API for the policy model. You can check project metadatas to find whether a retention policy is already binded. This method should only be called when no retention policy binded to project yet.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.create_retention(policy, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param RetentionPolicy policy: Create Retention Policy successfully. (required)
        :param str x_request_id: An unique ID for the request
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.create_retention_with_http_info(policy, **kwargs)  # noqa: E501
        else:
            (data) = self.create_retention_with_http_info(policy, **kwargs)  # noqa: E501
            return data

    def create_retention_with_http_info(self, policy, **kwargs):  # noqa: E501
        """Create Retention Policy  # noqa: E501

        Create Retention Policy, you can reference metadatas API for the policy model. You can check project metadatas to find whether a retention policy is already binded. This method should only be called when no retention policy binded to project yet.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.create_retention_with_http_info(policy, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param RetentionPolicy policy: Create Retention Policy successfully. (required)
        :param str x_request_id: An unique ID for the request
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['policy', 'x_request_id']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method create_retention" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'policy' is set
        if self.api_client.client_side_validation and ('policy' not in params or
                                                       params['policy'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `policy` when calling `create_retention`")  # noqa: E501

        if self.api_client.client_side_validation and ('x_request_id' in params and
                                                       len(params['x_request_id']) < 1):
            raise ValueError("Invalid value for parameter `x_request_id` when calling `create_retention`, length must be greater than or equal to `1`")  # noqa: E501
        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}
        if 'x_request_id' in params:
            header_params['X-Request-Id'] = params['x_request_id']  # noqa: E501

        form_params = []
        local_var_files = {}

        body_params = None
        if 'policy' in params:
            body_params = params['policy']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = ['basic']  # noqa: E501

        return self.api_client.call_api(
            '/retentions', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type=None,  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _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)

    def delete_retention(self, id, **kwargs):  # noqa: E501
        """Delete Retention Policy  # noqa: E501

        Delete Retention Policy, you can reference metadatas API for the policy model. You can check project metadatas to find whether a retention policy is already binded. This method should only be called when retention policy has already binded to project.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.delete_retention(id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int id: Retention ID. (required)
        :param str x_request_id: An unique ID for the request
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.delete_retention_with_http_info(id, **kwargs)  # noqa: E501
        else:
            (data) = self.delete_retention_with_http_info(id, **kwargs)  # noqa: E501
            return data

    def delete_retention_with_http_info(self, id, **kwargs):  # noqa: E501
        """Delete Retention Policy  # noqa: E501

        Delete Retention Policy, you can reference metadatas API for the policy model. You can check project metadatas to find whether a retention policy is already binded. This method should only be called when retention policy has already binded to project.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.delete_retention_with_http_info(id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int id: Retention ID. (required)
        :param str x_request_id: An unique ID for the request
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['id', 'x_request_id']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method delete_retention" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'id' is set
        if self.api_client.client_side_validation and ('id' not in params or
                                                       params['id'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `id` when calling `delete_retention`")  # noqa: E501

        if self.api_client.client_side_validation and ('x_request_id' in params and
                                                       len(params['x_request_id']) < 1):
            raise ValueError("Invalid value for parameter `x_request_id` when calling `delete_retention`, length must be greater than or equal to `1`")  # noqa: E501
        collection_formats = {}

        path_params = {}
        if 'id' in params:
            path_params['id'] = params['id']  # noqa: E501

        query_params = []

        header_params = {}
        if 'x_request_id' in params:
            header_params['X-Request-Id'] = params['x_request_id']  # noqa: E501

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = ['basic']  # noqa: E501

        return self.api_client.call_api(
            '/retentions/{id}', 'DELETE',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type=None,  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _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)

    def get_rentenition_metadata(self, **kwargs):  # noqa: E501
        """Get Retention Metadatas  # noqa: E501

        Get Retention Metadatas.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_rentenition_metadata(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str x_request_id: An unique ID for the request
        :return: RetentionMetadata
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_rentenition_metadata_with_http_info(**kwargs)  # noqa: E501
        else:
            (data) = self.get_rentenition_metadata_with_http_info(**kwargs)  # noqa: E501
            return data

    def get_rentenition_metadata_with_http_info(self, **kwargs):  # noqa: E501
        """Get Retention Metadatas  # noqa: E501

        Get Retention Metadatas.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_rentenition_metadata_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str x_request_id: An unique ID for the request
        :return: RetentionMetadata
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['x_request_id']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_rentenition_metadata" % key
                )
            params[key] = val
        del params['kwargs']

        if self.api_client.client_side_validation and ('x_request_id' in params and
                                                       len(params['x_request_id']) < 1):
            raise ValueError("Invalid value for parameter `x_request_id` when calling `get_rentenition_metadata`, length must be greater than or equal to `1`")  # noqa: E501
        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}
        if 'x_request_id' in params:
            header_params['X-Request-Id'] = params['x_request_id']  # noqa: E501

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = ['basic']  # noqa: E501

        return self.api_client.call_api(
            '/retentions/metadatas', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='RetentionMetadata',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _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)

    def get_retention(self, id, **kwargs):  # noqa: E501
        """Get Retention Policy  # noqa: E501

        Get Retention Policy.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_retention(id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int id: Retention ID. (required)
        :param str x_request_id: An unique ID for the request
        :return: RetentionPolicy
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_retention_with_http_info(id, **kwargs)  # noqa: E501
        else:
            (data) = self.get_retention_with_http_info(id, **kwargs)  # noqa: E501
            return data

    def get_retention_with_http_info(self, id, **kwargs):  # noqa: E501
        """Get Retention Policy  # noqa: E501

        Get Retention Policy.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_retention_with_http_info(id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int id: Retention ID. (required)
        :param str x_request_id: An unique ID for the request
        :return: RetentionPolicy
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['id', 'x_request_id']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_retention" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'id' is set
        if self.api_client.client_side_validation and ('id' not in params or
                                                       params['id'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `id` when calling `get_retention`")  # noqa: E501

        if self.api_client.client_side_validation and ('x_request_id' in params and
                                                       len(params['x_request_id']) < 1):
            raise ValueError("Invalid value for parameter `x_request_id` when calling `get_retention`, length must be greater than or equal to `1`")  # noqa: E501
        collection_formats = {}

        path_params = {}
        if 'id' in params:
            path_params['id'] = params['id']  # noqa: E501

        query_params = []

        header_params = {}
        if 'x_request_id' in params:
            header_params['X-Request-Id'] = params['x_request_id']  # noqa: E501

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = ['basic']  # noqa: E501

        return self.api_client.call_api(
            '/retentions/{id}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='RetentionPolicy',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _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)

    def get_retention_task_log(self, id, eid, tid, **kwargs):  # noqa: E501
        """Get Retention job task log  # noqa: E501

        Get Retention job task log, tags ratain or deletion detail will be shown in a table.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_retention_task_log(id, eid, tid, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int id: Retention ID. (required)
        :param int eid: Retention execution ID. (required)
        :param int tid: Retention execution ID. (required)
        :param str x_request_id: An unique ID for the request
        :return: str
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_retention_task_log_with_http_info(id, eid, tid, **kwargs)  # noqa: E501
        else:
            (data) = self.get_retention_task_log_with_http_info(id, eid, tid, **kwargs)  # noqa: E501
            return data

    def get_retention_task_log_with_http_info(self, id, eid, tid, **kwargs):  # noqa: E501
        """Get Retention job task log  # noqa: E501

        Get Retention job task log, tags ratain or deletion detail will be shown in a table.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_retention_task_log_with_http_info(id, eid, tid, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int id: Retention ID. (required)
        :param int eid: Retention execution ID. (required)
        :param int tid: Retention execution ID. (required)
        :param str x_request_id: An unique ID for the request
        :return: str
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['id', 'eid', 'tid', 'x_request_id']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_retention_task_log" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'id' is set
        if self.api_client.client_side_validation and ('id' not in params or
                                                       params['id'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `id` when calling `get_retention_task_log`")  # noqa: E501
        # verify the required parameter 'eid' is set
        if self.api_client.client_side_validation and ('eid' not in params or
                                                       params['eid'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `eid` when calling `get_retention_task_log`")  # noqa: E501
        # verify the required parameter 'tid' is set
        if self.api_client.client_side_validation and ('tid' not in params or
                                                       params['tid'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `tid` when calling `get_retention_task_log`")  # noqa: E501

        if self.api_client.client_side_validation and ('x_request_id' in params and
                                                       len(params['x_request_id']) < 1):
            raise ValueError("Invalid value for parameter `x_request_id` when calling `get_retention_task_log`, length must be greater than or equal to `1`")  # noqa: E501
        collection_formats = {}

        path_params = {}
        if 'id' in params:
            path_params['id'] = params['id']  # noqa: E501
        if 'eid' in params:
            path_params['eid'] = params['eid']  # noqa: E501
        if 'tid' in params:
            path_params['tid'] = params['tid']  # noqa: E501

        query_params = []

        header_params = {}
        if 'x_request_id' in params:
            header_params['X-Request-Id'] = params['x_request_id']  # noqa: E501

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = ['basic']  # noqa: E501

        return self.api_client.call_api(
            '/retentions/{id}/executions/{eid}/tasks/{tid}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='str',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _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)

    def list_retention_executions(self, id, **kwargs):  # noqa: E501
        """Get Retention executions  # noqa: E501

        Get Retention executions, execution status may be delayed before job service schedule it up.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.list_retention_executions(id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int id: Retention ID. (required)
        :param str x_request_id: An unique ID for the request
        :param int page: The page number.
        :param int page_size: The size of per page.
        :return: list[RetentionExecution]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.list_retention_executions_with_http_info(id, **kwargs)  # noqa: E501
        else:
            (data) = self.list_retention_executions_with_http_info(id, **kwargs)  # noqa: E501
            return data

    def list_retention_executions_with_http_info(self, id, **kwargs):  # noqa: E501
        """Get Retention executions  # noqa: E501

        Get Retention executions, execution status may be delayed before job service schedule it up.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.list_retention_executions_with_http_info(id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int id: Retention ID. (required)
        :param str x_request_id: An unique ID for the request
        :param int page: The page number.
        :param int page_size: The size of per page.
        :return: list[RetentionExecution]
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['id', 'x_request_id', 'page', 'page_size']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method list_retention_executions" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'id' is set
        if self.api_client.client_side_validation and ('id' not in params or
                                                       params['id'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `id` when calling `list_retention_executions`")  # noqa: E501

        if self.api_client.client_side_validation and ('x_request_id' in params and
                                                       len(params['x_request_id']) < 1):
            raise ValueError("Invalid value for parameter `x_request_id` when calling `list_retention_executions`, length must be greater than or equal to `1`")  # noqa: E501
        collection_formats = {}

        path_params = {}
        if 'id' in params:
            path_params['id'] = params['id']  # noqa: E501

        query_params = []
        if 'page' in params:
            query_params.append(('page', params['page']))  # noqa: E501
        if 'page_size' in params:
            query_params.append(('page_size', params['page_size']))  # noqa: E501

        header_params = {}
        if 'x_request_id' in params:
            header_params['X-Request-Id'] = params['x_request_id']  # noqa: E501

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = ['basic']  # noqa: E501

        return self.api_client.call_api(
            '/retentions/{id}/executions', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[RetentionExecution]',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _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)

    def list_retention_tasks(self, id, eid, **kwargs):  # noqa: E501
        """Get Retention tasks  # noqa: E501

        Get Retention tasks, each repository as a task.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.list_retention_tasks(id, eid, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int id: Retention ID. (required)
        :param int eid: Retention execution ID. (required)
        :param str x_request_id: An unique ID for the request
        :param int page: The page number.
        :param int page_size: The size of per page.
        :return: list[RetentionExecutionTask]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.list_retention_tasks_with_http_info(id, eid, **kwargs)  # noqa: E501
        else:
            (data) = self.list_retention_tasks_with_http_info(id, eid, **kwargs)  # noqa: E501
            return data

    def list_retention_tasks_with_http_info(self, id, eid, **kwargs):  # noqa: E501
        """Get Retention tasks  # noqa: E501

        Get Retention tasks, each repository as a task.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.list_retention_tasks_with_http_info(id, eid, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int id: Retention ID. (required)
        :param int eid: Retention execution ID. (required)
        :param str x_request_id: An unique ID for the request
        :param int page: The page number.
        :param int page_size: The size of per page.
        :return: list[RetentionExecutionTask]
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['id', 'eid', 'x_request_id', 'page', 'page_size']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method list_retention_tasks" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'id' is set
        if self.api_client.client_side_validation and ('id' not in params or
                                                       params['id'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `id` when calling `list_retention_tasks`")  # noqa: E501
        # verify the required parameter 'eid' is set
        if self.api_client.client_side_validation and ('eid' not in params or
                                                       params['eid'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `eid` when calling `list_retention_tasks`")  # noqa: E501

        if self.api_client.client_side_validation and ('x_request_id' in params and
                                                       len(params['x_request_id']) < 1):
            raise ValueError("Invalid value for parameter `x_request_id` when calling `list_retention_tasks`, length must be greater than or equal to `1`")  # noqa: E501
        collection_formats = {}

        path_params = {}
        if 'id' in params:
            path_params['id'] = params['id']  # noqa: E501
        if 'eid' in params:
            path_params['eid'] = params['eid']  # noqa: E501

        query_params = []
        if 'page' in params:
            query_params.append(('page', params['page']))  # noqa: E501
        if 'page_size' in params:
            query_params.append(('page_size', params['page_size']))  # noqa: E501

        header_params = {}
        if 'x_request_id' in params:
            header_params['X-Request-Id'] = params['x_request_id']  # noqa: E501

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = ['basic']  # noqa: E501

        return self.api_client.call_api(
            '/retentions/{id}/executions/{eid}/tasks', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[RetentionExecutionTask]',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _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)

    def operate_retention_execution(self, id, eid, body, **kwargs):  # noqa: E501
        """Stop a Retention execution  # noqa: E501

        Stop a Retention execution, only support \"stop\" action now.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.operate_retention_execution(id, eid, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int id: Retention ID. (required)
        :param int eid: Retention execution ID. (required)
        :param Body1 body: The action, only support \"stop\" now. (required)
        :param str x_request_id: An unique ID for the request
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.operate_retention_execution_with_http_info(id, eid, body, **kwargs)  # noqa: E501
        else:
            (data) = self.operate_retention_execution_with_http_info(id, eid, body, **kwargs)  # noqa: E501
            return data

    def operate_retention_execution_with_http_info(self, id, eid, body, **kwargs):  # noqa: E501
        """Stop a Retention execution  # noqa: E501

        Stop a Retention execution, only support \"stop\" action now.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.operate_retention_execution_with_http_info(id, eid, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int id: Retention ID. (required)
        :param int eid: Retention execution ID. (required)
        :param Body1 body: The action, only support \"stop\" now. (required)
        :param str x_request_id: An unique ID for the request
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['id', 'eid', 'body', 'x_request_id']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method operate_retention_execution" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'id' is set
        if self.api_client.client_side_validation and ('id' not in params or
                                                       params['id'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `id` when calling `operate_retention_execution`")  # noqa: E501
        # verify the required parameter 'eid' is set
        if self.api_client.client_side_validation and ('eid' not in params or
                                                       params['eid'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `eid` when calling `operate_retention_execution`")  # noqa: E501
        # verify the required parameter 'body' is set
        if self.api_client.client_side_validation and ('body' not in params or
                                                       params['body'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `body` when calling `operate_retention_execution`")  # noqa: E501

        if self.api_client.client_side_validation and ('x_request_id' in params and
                                                       len(params['x_request_id']) < 1):
            raise ValueError("Invalid value for parameter `x_request_id` when calling `operate_retention_execution`, length must be greater than or equal to `1`")  # noqa: E501
        collection_formats = {}

        path_params = {}
        if 'id' in params:
            path_params['id'] = params['id']  # noqa: E501
        if 'eid' in params:
            path_params['eid'] = params['eid']  # noqa: E501

        query_params = []

        header_params = {}
        if 'x_request_id' in params:
            header_params['X-Request-Id'] = params['x_request_id']  # noqa: E501

        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'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = ['basic']  # noqa: E501

        return self.api_client.call_api(
            '/retentions/{id}/executions/{eid}', 'PATCH',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type=None,  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _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)

    def trigger_retention_execution(self, id, body, **kwargs):  # noqa: E501
        """Trigger a Retention Execution  # noqa: E501

        Trigger a Retention Execution, if dry_run is True, nothing would be deleted actually.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.trigger_retention_execution(id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int id: Retention ID. (required)
        :param Body body: (required)
        :param str x_request_id: An unique ID for the request
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.trigger_retention_execution_with_http_info(id, body, **kwargs)  # noqa: E501
        else:
            (data) = self.trigger_retention_execution_with_http_info(id, body, **kwargs)  # noqa: E501
            return data

    def trigger_retention_execution_with_http_info(self, id, body, **kwargs):  # noqa: E501
        """Trigger a Retention Execution  # noqa: E501

        Trigger a Retention Execution, if dry_run is True, nothing would be deleted actually.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.trigger_retention_execution_with_http_info(id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int id: Retention ID. (required)
        :param Body body: (required)
        :param str x_request_id: An unique ID for the request
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['id', 'body', 'x_request_id']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method trigger_retention_execution" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'id' is set
        if self.api_client.client_side_validation and ('id' not in params or
                                                       params['id'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `id` when calling `trigger_retention_execution`")  # noqa: E501
        # verify the required parameter 'body' is set
        if self.api_client.client_side_validation and ('body' not in params or
                                                       params['body'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `body` when calling `trigger_retention_execution`")  # noqa: E501

        if self.api_client.client_side_validation and ('x_request_id' in params and
                                                       len(params['x_request_id']) < 1):
            raise ValueError("Invalid value for parameter `x_request_id` when calling `trigger_retention_execution`, length must be greater than or equal to `1`")  # noqa: E501
        collection_formats = {}

        path_params = {}
        if 'id' in params:
            path_params['id'] = params['id']  # noqa: E501

        query_params = []

        header_params = {}
        if 'x_request_id' in params:
            header_params['X-Request-Id'] = params['x_request_id']  # noqa: E501

        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(
            ['text/plain'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = ['basic']  # noqa: E501

        return self.api_client.call_api(
            '/retentions/{id}/executions', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type=None,  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _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)

    def update_retention(self, id, policy, **kwargs):  # noqa: E501
        """Update Retention Policy  # noqa: E501

        Update Retention Policy, you can reference metadatas API for the policy model. You can check project metadatas to find whether a retention policy is already binded. This method should only be called when retention policy has already binded to project.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.update_retention(id, policy, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int id: Retention ID. (required)
        :param RetentionPolicy policy: (required)
        :param str x_request_id: An unique ID for the request
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.update_retention_with_http_info(id, policy, **kwargs)  # noqa: E501
        else:
            (data) = self.update_retention_with_http_info(id, policy, **kwargs)  # noqa: E501
            return data

    def update_retention_with_http_info(self, id, policy, **kwargs):  # noqa: E501
        """Update Retention Policy  # noqa: E501

        Update Retention Policy, you can reference metadatas API for the policy model. You can check project metadatas to find whether a retention policy is already binded. This method should only be called when retention policy has already binded to project.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.update_retention_with_http_info(id, policy, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int id: Retention ID. (required)
        :param RetentionPolicy policy: (required)
        :param str x_request_id: An unique ID for the request
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['id', 'policy', 'x_request_id']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method update_retention" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'id' is set
        if self.api_client.client_side_validation and ('id' not in params or
                                                       params['id'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `id` when calling `update_retention`")  # noqa: E501
        # verify the required parameter 'policy' is set
        if self.api_client.client_side_validation and ('policy' not in params or
                                                       params['policy'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `policy` when calling `update_retention`")  # noqa: E501

        if self.api_client.client_side_validation and ('x_request_id' in params and
                                                       len(params['x_request_id']) < 1):
            raise ValueError("Invalid value for parameter `x_request_id` when calling `update_retention`, length must be greater than or equal to `1`")  # noqa: E501
        collection_formats = {}

        path_params = {}
        if 'id' in params:
            path_params['id'] = params['id']  # noqa: E501

        query_params = []

        header_params = {}
        if 'x_request_id' in params:
            header_params['X-Request-Id'] = params['x_request_id']  # noqa: E501

        form_params = []
        local_var_files = {}

        body_params = None
        if 'policy' in params:
            body_params = params['policy']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = ['basic']  # noqa: E501

        return self.api_client.call_api(
            '/retentions/{id}', 'PUT',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type=None,  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _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)
