Example #1
0
    def sub_key_list_with_http_info(self, **kwargs):  # noqa: E501
        """Get a list of sub keys.  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.sub_key_list_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param int per_page: The amount of results per page.
        :param int page: The page to load.
        :param str sort_order: The order to sort.
        :param str sort_field: The field to sort on.
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(SubKeyListBody, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['per_page', 'page', 'sort_order', 'sort_field']
        all_params.extend([
            'async_req', '_return_http_data_only', '_preload_content',
            '_request_timeout'
        ])

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

        if self.api_client.client_side_validation and 'per_page' in local_var_params and local_var_params[
                'per_page'] > 1000:  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `per_page` when calling `sub_key_list`, must be a value less than or equal to `1000`"
            )  # noqa: E501
        if self.api_client.client_side_validation and 'per_page' in local_var_params and local_var_params[
                'per_page'] < 10:  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `per_page` when calling `sub_key_list`, must be a value greater than or equal to `10`"
            )  # noqa: E501
        if self.api_client.client_side_validation and 'page' in local_var_params and local_var_params[
                'page'] < 1:  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `page` when calling `sub_key_list`, must be a value greater than or equal to `1`"
            )  # noqa: E501
        collection_formats = {}

        path_params = {}

        query_params = []
        if 'per_page' in local_var_params and local_var_params[
                'per_page'] is not None:  # noqa: E501
            query_params.append(
                ('per_page', local_var_params['per_page']))  # noqa: E501
        if 'page' in local_var_params and local_var_params[
                'page'] is not None:  # noqa: E501
            query_params.append(
                ('page', local_var_params['page']))  # noqa: E501
        if 'sort_order' in local_var_params and local_var_params[
                'sort_order'] is not None:  # noqa: E501
            query_params.append(
                ('sort_order', local_var_params['sort_order']))  # noqa: E501
        if 'sort_field' in local_var_params and local_var_params[
                'sort_field'] is not None:  # noqa: E501
            query_params.append(
                ('sort_field', local_var_params['sort_field']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = ['APIKeyHeader', 'APIKeyQueryParam']  # noqa: E501

        return self.api_client.call_api(
            '/subKey',
            'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='SubKeyListBody',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get(
                '_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)
Example #2
0
    def update_sub_key_with_http_info(self, sub_key_id,
                                      **kwargs):  # noqa: E501
        """Update the sub key.  # 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_sub_key_with_http_info(sub_key_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str sub_key_id: The ID of the sub key. (required)
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(UpdateSubKeyBody, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['sub_key_id']
        all_params.extend([
            'async_req', '_return_http_data_only', '_preload_content',
            '_request_timeout'
        ])

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

        collection_formats = {}

        path_params = {}
        if 'sub_key_id' in local_var_params:
            path_params['SubKeyID'] = local_var_params[
                'sub_key_id']  # noqa: E501

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

        # Authentication setting
        auth_settings = ['APIKeyHeader', 'APIKeyQueryParam']  # noqa: E501

        return self.api_client.call_api(
            '/subKey/{SubKeyID}',
            'PATCH',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='UpdateSubKeyBody',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get(
                '_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)
Example #3
0
 def request(self,
             method,
             url,
             query_params=None,
             headers=None,
             post_params=None,
             body=None,
             _preload_content=True,
             _request_timeout=None):
     """Makes the HTTP request using RESTClient."""
     if method == "GET":
         return self.rest_client.GET(url,
                                     query_params=query_params,
                                     _preload_content=_preload_content,
                                     _request_timeout=_request_timeout,
                                     headers=headers)
     elif method == "HEAD":
         return self.rest_client.HEAD(url,
                                      query_params=query_params,
                                      _preload_content=_preload_content,
                                      _request_timeout=_request_timeout,
                                      headers=headers)
     elif method == "OPTIONS":
         return self.rest_client.OPTIONS(url,
                                         query_params=query_params,
                                         headers=headers,
                                         _preload_content=_preload_content,
                                         _request_timeout=_request_timeout)
     elif method == "POST":
         return self.rest_client.POST(url,
                                      query_params=query_params,
                                      headers=headers,
                                      post_params=post_params,
                                      _preload_content=_preload_content,
                                      _request_timeout=_request_timeout,
                                      body=body)
     elif method == "PUT":
         return self.rest_client.PUT(url,
                                     query_params=query_params,
                                     headers=headers,
                                     post_params=post_params,
                                     _preload_content=_preload_content,
                                     _request_timeout=_request_timeout,
                                     body=body)
     elif method == "PATCH":
         return self.rest_client.PATCH(url,
                                       query_params=query_params,
                                       headers=headers,
                                       post_params=post_params,
                                       _preload_content=_preload_content,
                                       _request_timeout=_request_timeout,
                                       body=body)
     elif method == "DELETE":
         return self.rest_client.DELETE(url,
                                        query_params=query_params,
                                        headers=headers,
                                        _preload_content=_preload_content,
                                        _request_timeout=_request_timeout,
                                        body=body)
     else:
         raise ApiValueError("http method must be `GET`, `HEAD`, `OPTIONS`,"
                             " `POST`, `PATCH`, `PUT` or `DELETE`.")