コード例 #1
0
ファイル: lowlevel_tests.py プロジェクト: wnojopra/fiss
 def test_update_workspace_attributes(self):
     """Test update_workspace_attributes()."""
     updates = [fapi._attr_set("key1", "value1")]
     r = fapi.update_workspace_attributes(self.project, self.workspace,
                                          updates)
     print(r.status_code, r.content)
     self.assertEqual(r.status_code, 200)
コード例 #2
0
ファイル: workspace.py プロジェクト: MicahR-Y/TAG-fiss
    def remove_attribute(self, attr):
        """Remove attribute from a workspace.

        Args:
            attr (str): attribute name
        """
        update = [fapi._attr_rem(attr)]
        r = fapi.update_workspace_attributes(self.namespace, self.name,
                                                update, self.api_url)
        self.data["workspace"]["attributes"].pop(attr, None)
        fapi._check_response_code(r, 200)
コード例 #3
0
ファイル: update_workspace.py プロジェクト: deflaux/horsefish
def update_attributes(workspace_name, workspace_project, replace_this,
                      with_this):
    ## update workspace data attributes
    print("Updating ATTRIBUTES for " + workspace_name)

    # get data attributes
    response = call_fiss(fapi.get_workspace, 200, workspace_project,
                         workspace_name)
    attributes = response['workspace']['attributes']

    attrs_list = []
    for attr in attributes.keys():
        value = attributes[attr]
        updated_attr = find_and_replace(attr, value, replace_this, with_this)
        if updated_attr:
            attrs_list.append(updated_attr)

    if len(attrs_list) > 0:
        response = fapi.update_workspace_attributes(workspace_project,
                                                    workspace_name, attrs_list)
        if response.status_code == 200:
            print('Updated attributes:')
            for attr in attrs_list:
                print(attr)
コード例 #4
0
ファイル: workspace.py プロジェクト: MicahR-Y/TAG-fiss
 def update_attribute(self, attr, value):
     """Set the value of a workspace attribute."""
     update = [fapi._attr_up(attr, value)]
     r = fapi.update_workspace_attributes(self.namespace, self.name,
                                          update, self.api_url)
     fapi._check_response_code(r, 200)