Exemplo n.º 1
0
 def test_get_pvc(self, query, check_pvc):
     query.__enter__.return_value = True
     check_pvc.__enter__.return_value = 2
     try:
         pvc = PvcService.get_pvc(self.namespace, 'modelDev', self.ou_id)
     except Exception as e:
         print(e)
Exemplo n.º 2
0
 def test_delete_pvc(self, delete, delete_pvc):
     delete.__enter__.return_value = True
     delete_pvc.__enter__.return_value = 2
     try:
         pvc = PvcService.delete_pvc(self.namespace, [self.pvc_name],
                                     self.ou_id)
     except Exception as e:
         print(e)
Exemplo n.º 3
0
 def test_create_pvc(self, insert, create_pvc):
     insert.__enter__.return_value = True
     create_pvc.__enter__.return_value = 2
     try:
         pvc = PvcService.create_pvc(self.pvc, self.ou_id, self.ou_name)
         print(pvc)
     except Exception as e:
         print(e)
def get_pvc_mount(namespace, pvc_name):  # noqa: E501
    """Get config.

     # noqa: E501

        :param pvc_name:
        :param namespace:
                :type namespace: str
        :param name:
                :type name: str

    :rtype: object
    """
    data = PvcService.get_pvc_mount(namespace=namespace, pvc_list=pvc_name)
    return ApiStatus(code=0, msg='success', data=data)
def create_pvc(body):  # noqa: E501
    """Create a pvc.

     # noqa: E501

        :param body:
            :type body: dict | bytes

    :rtype: None
    """
    if connexion.request.is_json:
        pvc = Pvc.from_dict(connexion.request.get_json())  # noqa: E501
        ou_name = util.get_user(request=connexion.request)
        ou_id = util.get_ou_id(request=connexion.request)
        data = PvcService.create_pvc(pvc=pvc, ou_id=ou_id, ou_name=ou_name)
        return ApiStatus(code=0, msg='success', data=data)
def delete_pvc(namespace, pvc_name):  # noqa: E501
    """Create a pvc.

     # noqa: E501

        :param namespace:
                :type namespace: str
        :param pvc_name:
                    :type pvc_name: List[str]

    :rtype: None
    """
    ou_id = util.get_ou_id(request=connexion.request)
    data = PvcService.delete_pvc(namespace=namespace,
                                 pvc_list=pvc_name,
                                 ou_id=ou_id)
    return ApiStatus(code=0, msg='success', data=data)
def list_pvc(storage_type=None, namespace=None, module=None):  # noqa: E501
    """Find all pvc under the namespace or ou.

     # noqa: E501

        :param storage_type:
        :param namespace:
                :type namespace: str
        :param module:
                    :type module: List[str]

    :rtype: object
    """
    ou_id = util.get_ou_id(request=connexion.request)
    rows = PvcService.get_pvc(storage_type=storage_type,
                              namespace=namespace,
                              module=module,
                              ou_id=ou_id)
    return ApiStatus(code=0, msg='success', data=rows)
Exemplo n.º 8
0
 def test_get_mount(self, mount):
     mount.__enter__.return_value = True
     try:
         pvc = PvcService.namespace_list(self.namespace, ['test'])
     except Exception as e:
         print(e)
Exemplo n.º 9
0
 def test_get_pvc(self, namespace_list):
     namespace_list.__enter__.return_value = True
     try:
         pvc = PvcService.namespace_list(self.ou_id)
     except Exception as e:
         print(e)