Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add organization edit command [EH-389] #344

Merged
merged 1 commit into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions aiven/client/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1418,11 +1418,9 @@ def service__backup_list(self) -> None:
self.print_response(backups, json=self.args.json, table_layout=layout)

def _get_project_ca(self) -> str:

return self.client.get_project_ca(project=self.get_project())["certificate"]

def _get_store_from_args(self) -> Store:

if self.args.overwrite:
store = Store.overwrite
elif self.args.write:
Expand Down Expand Up @@ -5550,6 +5548,21 @@ def organization__list(self) -> None:
]
self.print_response(organizations, json=self.args.json, table_layout=layout)

@arg.json
@arg.positional_organization_id
@arg("-n", "--name", required=True, help="New name for the organization")
def organization__update(self) -> None:
"""Update an organization"""
layout = [
"organization_name",
"organization_id",
"account_id",
"create_time",
"update_time",
]
organization = self.client.update_organization(self.args.organization_id, self.args.name)
self.print_response(organization, json=self.args.json, single_item=True, table_layout=layout)

@arg.positional_organization_id
@arg.force
def organization__delete(self) -> None:
Expand Down
5 changes: 5 additions & 0 deletions aiven/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2497,6 +2497,11 @@ def delete_organization(self, organization_id: str) -> None:
organization = self.verify(self.get, self.build_path("organization", organization_id))
self.delete_account(account_id=organization["account_id"])

def update_organization(self, organization_id: str, organization_name: str) -> Dict[str, Any]:
organization = self.verify(self.get, self.build_path("organization", organization_id))
self.update_account(account_id=organization["account_id"], account_name=organization_name)
return self.verify(self.get, self.build_path("organization", organization_id))

def list_organization_users(self, organization_id: str) -> Sequence[Dict[str, Any]]:
return self.verify(
self.get,
Expand Down