Ejemplo n.º 1
0
    def patch_access_resource_with_http_info(self, owner, access_resource_uuid,
                                             body, **kwargs):  # noqa: E501
        """Patch access resource  # noqa: E501

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

        :param async_req bool: execute request asynchronously
        :param str owner: Owner of the namespace (required)
        :param str access_resource_uuid: UUID (required)
        :param V1AccessResource body: Artifact store body (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(V1AccessResource, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ["owner", "access_resource_uuid", "body"]
        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 patch_access_resource" % key)
            local_var_params[key] = val
        del local_var_params["kwargs"]
        # verify the required parameter 'owner' is set
        if self.api_client.client_side_validation and (
                "owner" not in local_var_params
                or local_var_params["owner"] is None  # noqa: E501
        ):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `owner` when calling `patch_access_resource`"
            )  # noqa: E501
        # verify the required parameter 'access_resource_uuid' is set
        if self.api_client.client_side_validation and (
                "access_resource_uuid" not in local_var_params or
                local_var_params["access_resource_uuid"] is None  # noqa: E501
        ):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `access_resource_uuid` when calling `patch_access_resource`"
            )  # noqa: E501
        # verify the required parameter 'body' is set
        if self.api_client.client_side_validation and (
                "body" not in local_var_params
                or local_var_params["body"] is None  # noqa: E501
        ):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `body` when calling `patch_access_resource`"
            )  # noqa: E501

        collection_formats = {}

        path_params = {}
        if "owner" in local_var_params:
            path_params["owner"] = local_var_params["owner"]  # noqa: E501
        if "access_resource_uuid" in local_var_params:
            path_params["access_resource.uuid"] = local_var_params[
                "access_resource_uuid"]  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if "body" in local_var_params:
            body_params = local_var_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 = ["ApiKey"]  # noqa: E501

        return self.api_client.call_api(
            "/api/v1/orgs/{owner}/access_resources/{access_resource.uuid}",
            "PATCH",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="V1AccessResource",  # 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,
        )
Ejemplo n.º 2
0
    def get_compatibility_with_http_info(self, uuid, version, service, **kwargs):  # noqa: E501
        """Get compatibility versions  # 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_compatibility_with_http_info(uuid, version, service, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str uuid: UUid (required)
        :param str version: Version (required)
        :param str service: Service (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(V1Compatibility, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = [
            'uuid',
            'version',
            'service'
        ]
        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 get_compatibility" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'uuid' is set
        if self.api_client.client_side_validation and ('uuid' not in local_var_params or  # noqa: E501
                                                        local_var_params['uuid'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `uuid` when calling `get_compatibility`")  # noqa: E501
        # verify the required parameter 'version' is set
        if self.api_client.client_side_validation and ('version' not in local_var_params or  # noqa: E501
                                                        local_var_params['version'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `version` when calling `get_compatibility`")  # noqa: E501
        # verify the required parameter 'service' is set
        if self.api_client.client_side_validation and ('service' not in local_var_params or  # noqa: E501
                                                        local_var_params['service'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `service` when calling `get_compatibility`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'uuid' in local_var_params:
            path_params['uuid'] = local_var_params['uuid']  # noqa: E501
        if 'version' in local_var_params:
            path_params['version'] = local_var_params['version']  # noqa: E501
        if 'service' in local_var_params:
            path_params['service'] = local_var_params['service']  # 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 = ['ApiKey']  # noqa: E501

        return self.api_client.call_api(
            '/api/v1/compatibility/{uuid}/{version}/{service}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='V1Compatibility',  # 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)
Ejemplo n.º 3
0
    def list_access_resources_with_http_info(self, owner,
                                             **kwargs):  # noqa: E501
        """List access resources  # 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_access_resources_with_http_info(owner, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str owner: Owner of the namespace (required)
        :param int offset: Pagination offset.
        :param int limit: Limit size.
        :param str sort: Sort to order the search.
        :param str query: Query filter the search search.
        :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(V1ListAccessResourcesResponse, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ["owner", "offset", "limit", "sort", "query"]
        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 list_access_resources" % key)
            local_var_params[key] = val
        del local_var_params["kwargs"]
        # verify the required parameter 'owner' is set
        if self.api_client.client_side_validation and (
                "owner" not in local_var_params
                or local_var_params["owner"] is None  # noqa: E501
        ):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `owner` when calling `list_access_resources`"
            )  # noqa: E501

        collection_formats = {}

        path_params = {}
        if "owner" in local_var_params:
            path_params["owner"] = local_var_params["owner"]  # noqa: E501

        query_params = []
        if ("offset" in local_var_params
                and local_var_params["offset"] is not None):  # noqa: E501
            query_params.append(
                ("offset", local_var_params["offset"]))  # noqa: E501
        if ("limit" in local_var_params
                and local_var_params["limit"] is not None):  # noqa: E501
            query_params.append(
                ("limit", local_var_params["limit"]))  # noqa: E501
        if ("sort" in local_var_params
                and local_var_params["sort"] is not None):  # noqa: E501
            query_params.append(
                ("sort", local_var_params["sort"]))  # noqa: E501
        if ("query" in local_var_params
                and local_var_params["query"] is not None):  # noqa: E501
            query_params.append(
                ("query", local_var_params["query"]))  # 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 = ["ApiKey"]  # noqa: E501

        return self.api_client.call_api(
            "/api/v1/orgs/{owner}/access_resources",
            "GET",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="V1ListAccessResourcesResponse",  # 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,
        )
Ejemplo n.º 4
0
    def change_password_with_http_info(self, body, **kwargs):  # noqa: E501
        """Change password  # noqa: E501

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

        :param async_req bool: execute request asynchronously
        :param V1PasswordChange body: (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: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['body']
        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 change_password" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'body' is set
        if self.api_client.client_side_validation and (
                'body' not in local_var_params or  # noqa: E501
                local_var_params['body'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `body` when calling `change_password`"
            )  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'body' in local_var_params:
            body_params = local_var_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 = ['ApiKey']  # noqa: E501

        return self.api_client.call_api(
            '/api/v1/auth/change-password',
            '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=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)
Ejemplo n.º 5
0
    def request(self,
                method,
                url,
                query_params=None,
                headers=None,
                body=None,
                post_params=None,
                _preload_content=True,
                _request_timeout=None):
        """Perform requests.

        :param method: http request method
        :param url: http request url
        :param query_params: query parameters in the url
        :param headers: http request headers
        :param body: request json body, for `application/json`
        :param post_params: request post parameters,
                            `application/x-www-form-urlencoded`
                            and `multipart/form-data`
        :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.
        """
        method = method.upper()
        assert method in [
            'GET', 'HEAD', 'DELETE', 'POST', 'PUT', 'PATCH', 'OPTIONS'
        ]

        if post_params and body:
            raise ApiValueError(
                "body parameter cannot be used with post_params parameter.")

        post_params = post_params or {}
        headers = headers or {}

        timeout = None
        if _request_timeout:
            if isinstance(_request_timeout, (int, ) if six.PY3 else
                          (int, long)):  # noqa: E501,F821
                timeout = urllib3.Timeout(total=_request_timeout)
            elif (isinstance(_request_timeout, tuple)
                  and len(_request_timeout) == 2):
                timeout = urllib3.Timeout(connect=_request_timeout[0],
                                          read=_request_timeout[1])

        if 'Content-Type' not in headers:
            headers['Content-Type'] = 'application/json'

        try:
            # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
            if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']:
                if query_params:
                    url += '?' + urlencode(query_params)
                if re.search('json', headers['Content-Type'], re.IGNORECASE):
                    request_body = None
                    if body is not None:
                        request_body = json.dumps(body)
                    r = self.pool_manager.request(
                        method,
                        url,
                        body=request_body,
                        preload_content=_preload_content,
                        timeout=timeout,
                        headers=headers)
                elif headers[
                        'Content-Type'] == 'application/x-www-form-urlencoded':  # noqa: E501
                    r = self.pool_manager.request(
                        method,
                        url,
                        fields=post_params,
                        encode_multipart=False,
                        preload_content=_preload_content,
                        timeout=timeout,
                        headers=headers)
                elif headers['Content-Type'] == 'multipart/form-data':
                    # must del headers['Content-Type'], or the correct
                    # Content-Type which generated by urllib3 will be
                    # overwritten.
                    del headers['Content-Type']
                    r = self.pool_manager.request(
                        method,
                        url,
                        fields=post_params,
                        encode_multipart=True,
                        preload_content=_preload_content,
                        timeout=timeout,
                        headers=headers)
                # Pass a `string` parameter directly in the body to support
                # other content types than Json when `body` argument is
                # provided in serialized form
                elif isinstance(body, str) or isinstance(body, bytes):
                    request_body = body
                    r = self.pool_manager.request(
                        method,
                        url,
                        body=request_body,
                        preload_content=_preload_content,
                        timeout=timeout,
                        headers=headers)
                else:
                    # Cannot generate the request from given parameters
                    msg = """Cannot prepare a request message for provided
                             arguments. Please check that your arguments match
                             declared content type."""
                    raise ApiException(status=0, reason=msg)
            # For `GET`, `HEAD`
            else:
                r = self.pool_manager.request(method,
                                              url,
                                              fields=query_params,
                                              preload_content=_preload_content,
                                              timeout=timeout,
                                              headers=headers)
        except urllib3.exceptions.SSLError as e:
            msg = "{0}\n{1}".format(type(e).__name__, str(e))
            raise ApiException(status=0, reason=msg)

        if _preload_content:
            r = RESTResponse(r)

            # log response body
            logger.debug("response body: %s", r.data)

        if not 200 <= r.status <= 299:
            raise ApiException(http_resp=r)

        return r
Ejemplo n.º 6
0
    def update_search_with_http_info(self, owner, search_uuid, body,
                                     **kwargs):  # noqa: E501
        """Update search  # 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_search_with_http_info(owner, search_uuid, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str owner: Owner of the namespace (required)
        :param str search_uuid: UUID (required)
        :param V1Search body: Search body (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(V1Search, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['owner', 'search_uuid', 'body']
        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_search" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'owner' is set
        if self.api_client.client_side_validation and (
                'owner' not in local_var_params or  # noqa: E501
                local_var_params['owner'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `owner` when calling `update_search`"
            )  # noqa: E501
        # verify the required parameter 'search_uuid' is set
        if self.api_client.client_side_validation and (
                'search_uuid' not in local_var_params or  # noqa: E501
                local_var_params['search_uuid'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `search_uuid` when calling `update_search`"
            )  # noqa: E501
        # verify the required parameter 'body' is set
        if self.api_client.client_side_validation and (
                'body' not in local_var_params or  # noqa: E501
                local_var_params['body'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `body` when calling `update_search`"
            )  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'owner' in local_var_params:
            path_params['owner'] = local_var_params['owner']  # noqa: E501
        if 'search_uuid' in local_var_params:
            path_params['search.uuid'] = local_var_params[
                'search_uuid']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'body' in local_var_params:
            body_params = local_var_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 = ['ApiKey']  # noqa: E501

        return self.api_client.call_api(
            '/api/v1/orgs/{owner}/searches/{search.uuid}',
            'PUT',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='V1Search',  # 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)
Ejemplo n.º 7
0
    def get_token_with_http_info(self, uuid, **kwargs):  # noqa: E501
        """Get token  # 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_token_with_http_info(uuid, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str uuid: UUid of the namespace (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(V1Token, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ["uuid"]
        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 get_token" % key
                )
            local_var_params[key] = val
        del local_var_params["kwargs"]
        # verify the required parameter 'uuid' is set
        if self.api_client.client_side_validation and (
            "uuid" not in local_var_params
            or local_var_params["uuid"] is None  # noqa: E501
        ):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `uuid` when calling `get_token`"
            )  # noqa: E501

        collection_formats = {}

        path_params = {}
        if "uuid" in local_var_params:
            path_params["uuid"] = local_var_params["uuid"]  # 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 = ["ApiKey"]  # noqa: E501

        return self.api_client.call_api(
            "/api/v1/users/tokens/{uuid}",
            "GET",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="V1Token",  # 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,
        )
Ejemplo n.º 8
0
    def upload_artifact_with_http_info(self, owner, uuid, uploadfile,
                                       **kwargs):  # noqa: E501
        """Upload artifact to a store  # noqa: E501

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

        :param async_req bool: execute request asynchronously
        :param str owner: Owner of the namespace (required)
        :param str uuid: Unique integer identifier of the entity (required)
        :param file uploadfile: The file to upload. (required)
        :param str path: File path query params.
        :param bool overwrite: File path query params.
        :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: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ["owner", "uuid", "uploadfile", "path", "overwrite"]
        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 upload_artifact" % key)
            local_var_params[key] = val
        del local_var_params["kwargs"]
        # verify the required parameter 'owner' is set
        if self.api_client.client_side_validation and (
                "owner" not in local_var_params
                or local_var_params["owner"] is None  # noqa: E501
        ):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `owner` when calling `upload_artifact`"
            )  # noqa: E501
        # verify the required parameter 'uuid' is set
        if self.api_client.client_side_validation and (
                "uuid" not in local_var_params
                or local_var_params["uuid"] is None  # noqa: E501
        ):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `uuid` when calling `upload_artifact`"
            )  # noqa: E501
        # verify the required parameter 'uploadfile' is set
        if self.api_client.client_side_validation and (
                "uploadfile" not in local_var_params
                or local_var_params["uploadfile"] is None  # noqa: E501
        ):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `uploadfile` when calling `upload_artifact`"
            )  # noqa: E501

        collection_formats = {}

        path_params = {}
        if "owner" in local_var_params:
            path_params["owner"] = local_var_params["owner"]  # noqa: E501
        if "uuid" in local_var_params:
            path_params["uuid"] = local_var_params["uuid"]  # noqa: E501

        query_params = []
        if ("path" in local_var_params
                and local_var_params["path"] is not None):  # noqa: E501
            query_params.append(
                ("path", local_var_params["path"]))  # noqa: E501
        if ("overwrite" in local_var_params
                and local_var_params["overwrite"] is not None):  # noqa: E501
            query_params.append(
                ("overwrite", local_var_params["overwrite"]))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}
        if "uploadfile" in local_var_params:
            local_var_files["uploadfile"] = local_var_params[
                "uploadfile"]  # noqa: E501

        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
                ["multipart/form-data"])  # noqa: E501

        # Authentication setting
        auth_settings = ["ApiKey"]  # noqa: E501

        return self.api_client.call_api(
            "/api/v1/catalogs/{owner}/artifacts/{uuid}/upload",
            "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=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,
        )
Ejemplo n.º 9
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`.")
Ejemplo n.º 10
0
    def list_dashboards_with_http_info(self, owner, **kwargs):  # noqa: E501
        """List dashboards  # 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_dashboards_with_http_info(owner, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str owner: Owner of the namespace (required)
        :param int offset: Pagination offset.
        :param int limit: Limit size.
        :param str sort: Sort to order the search.
        :param str query: Query filter the search.
        :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(V1ListDashboardsResponse, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['owner', 'offset', 'limit', 'sort', 'query']
        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 list_dashboards" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'owner' is set
        if self.api_client.client_side_validation and (
                'owner' not in local_var_params or  # noqa: E501
                local_var_params['owner'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `owner` when calling `list_dashboards`"
            )  # noqa: E501

        collection_formats = {}

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

        query_params = []
        if 'offset' in local_var_params and local_var_params[
                'offset'] is not None:  # noqa: E501
            query_params.append(
                ('offset', local_var_params['offset']))  # noqa: E501
        if 'limit' in local_var_params and local_var_params[
                'limit'] is not None:  # noqa: E501
            query_params.append(
                ('limit', local_var_params['limit']))  # noqa: E501
        if 'sort' in local_var_params and local_var_params[
                'sort'] is not None:  # noqa: E501
            query_params.append(
                ('sort', local_var_params['sort']))  # noqa: E501
        if 'query' in local_var_params and local_var_params[
                'query'] is not None:  # noqa: E501
            query_params.append(
                ('query', local_var_params['query']))  # 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 = ['ApiKey']  # noqa: E501

        return self.api_client.call_api(
            '/api/v1/orgs/{owner}/dashboards',
            'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='V1ListDashboardsResponse',  # 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)
Ejemplo n.º 11
0
    def delete_preset_with_http_info(self, owner, uuid,
                                     **kwargs):  # noqa: E501
        """Delete scheduling preset  # 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_preset_with_http_info(owner, uuid, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str owner: Owner of the namespace (required)
        :param str uuid: Uuid identifier of the sub-entity (required)
        :param str entity: Entity: project name, hub name, registry name, ...
        :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: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['owner', 'uuid', 'entity']
        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 delete_preset" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'owner' is set
        if self.api_client.client_side_validation and (
                'owner' not in local_var_params or  # noqa: E501
                local_var_params['owner'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `owner` when calling `delete_preset`"
            )  # noqa: E501
        # verify the required parameter 'uuid' is set
        if self.api_client.client_side_validation and (
                'uuid' not in local_var_params or  # noqa: E501
                local_var_params['uuid'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `uuid` when calling `delete_preset`"
            )  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'owner' in local_var_params:
            path_params['owner'] = local_var_params['owner']  # noqa: E501
        if 'uuid' in local_var_params:
            path_params['uuid'] = local_var_params['uuid']  # noqa: E501

        query_params = []
        if 'entity' in local_var_params and local_var_params[
                'entity'] is not None:  # noqa: E501
            query_params.append(
                ('entity', local_var_params['entity']))  # 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 = ['ApiKey']  # noqa: E501

        return self.api_client.call_api(
            '/api/v1/orgs/{owner}/presets/{uuid}',
            '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=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)
Ejemplo n.º 12
0
    def signup_with_http_info(self, body, **kwargs):  # noqa: E501
        """Signup  # noqa: E501

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

        :param async_req bool: execute request asynchronously
        :param V1UserSingup body: (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: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ["body"]
        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 signup" % key)
            local_var_params[key] = val
        del local_var_params["kwargs"]
        # verify the required parameter 'body' is set
        if self.api_client.client_side_validation and (
                "body" not in local_var_params
                or local_var_params["body"] is None  # noqa: E501
        ):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `body` when calling `signup`"
            )  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if "body" in local_var_params:
            body_params = local_var_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 = ["ApiKey"]  # noqa: E501

        return self.api_client.call_api(
            "/api/v1/auth/signup",
            "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=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,
        )