Exemplo n.º 1
0
 def delete_cluster_by_cluster_id(self, cluster_id):
     uri = f"{self._cluster_uri}/{cluster_id}"
     response = self._client._do_request_prim(
         shared_constants.RequestMethod.DELETE,
         uri,
         self._client._session,
         media_type='application/json',
         accept_type='application/json')
     return def_models.DefEntity(**response_processor.process_response(response))  # noqa: E501
Exemplo n.º 2
0
 def delete_nfs_node_by_node_name(self, cluster_id: str, node_name: str):
     uri = f"{self._cluster_uri}/{cluster_id}/nfs/{node_name}"
     response = self._client._do_request_prim(
         shared_constants.RequestMethod.DELETE,
         uri,
         self._client._session,
         media_type='application/json',
         accept_type='application/json')
     return def_models.DefEntity(
         **response_processor.process_response(response))
Exemplo n.º 3
0
 def update_cluster_by_cluster_id(self, cluster_id, cluster_entity_definition: def_models.ClusterEntity):  # noqa: E501
     cluster_entity_dict = asdict(cluster_entity_definition)
     uri = f"{self._cluster_uri}/{cluster_id}"
     response = self._client._do_request_prim(
         shared_constants.RequestMethod.PUT,
         uri,
         self._client._session,
         contents=cluster_entity_dict,
         media_type='application/json',
         accept_type='application/json')
     return def_models.DefEntity(
         **response_processor.process_response(response))
Exemplo n.º 4
0
 def upgrade_cluster_by_cluster_id(self, cluster_id: str,
                                   cluster_upgrade_definition: def_models.DefEntity):  # noqa: E501
     uri = f'{self._uri}/cluster/{cluster_id}/action/upgrade'
     entity_dict = asdict(cluster_upgrade_definition.entity)
     response = self._client._do_request_prim(
         shared_constants.RequestMethod.POST,
         uri,
         self._client._session,
         contents=entity_dict,
         media_type='application/json',
         accept_type='application/json')
     return def_models.DefEntity(
         **response_processor.process_response(response))
Exemplo n.º 5
0
    def upgrade_cluster_by_cluster_id(self, cluster_id, cluster_def_entity,
                                      **kwargs):  # noqa: E501
        """Get the upgrade plan for give cluster id.

        :param str cluster_id: unique id of the cluster
        :param dict cluster_def_entity: defined entity
        :return: string containing upgrade cluster task href
        :rtype: str
        """
        # TODO: check if we really need to decode-encode-decode-encode
        cluster_upgrade_definition = def_models.DefEntity(**cluster_def_entity)
        cluster_def_entity = \
            self._native_cluster_api.upgrade_cluster_by_cluster_id(
                cluster_id, cluster_upgrade_definition)
        return client_utils.construct_task_console_message(
            cluster_def_entity.entity.status.task_href)  # noqa: E501