Skip to content

Commit

Permalink
feat(SecurityGroup):added method to retrieve security group id by name
Browse files Browse the repository at this point in the history
  • Loading branch information
dweinholz committed Oct 9, 2024
1 parent 3dcecec commit ce6932b
Show file tree
Hide file tree
Showing 7 changed files with 447 additions and 4 deletions.
7 changes: 7 additions & 0 deletions portal_client.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,11 @@ exception ServerNotFoundException {
2: string name_or_id
}

exception SecurityGroupNotFoundException {
/** Server not found. */
1: string message
2: string name_or_id
}
exception SecurityGroupRuleNotFoundException {
/** Server not found. */
1: string message
Expand Down Expand Up @@ -619,6 +624,8 @@ service VirtualMachineService {
**/
list<VM> get_servers_by_bibigrid_id(1:string bibigrid_id)


string get_security_group_id_by_name(1:string name) throws(1:SecurityGroupNotFoundException s)
map<string,list<string>> scale_up_cluster(1: string cluster_id,2: string image_name,3:string flavor_name,4:int count,
5:list<string>names,6:int start_idx,7:int batch_idx)

Expand Down
9 changes: 7 additions & 2 deletions simple_vm_client/VirtualMachineHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,8 +479,13 @@ def create_and_deploy_playbook(
def is_bibigrid_available(self) -> bool:
return self.bibigrid_connector.is_bibigrid_available()

def get_cluster_info(self, cluster_id: str) -> ClusterInfo:
return self.bibigrid_connector.get_cluster_info(cluster_id=cluster_id)
def get_security_group_id_by_name(self, security_group_name) -> str:
return self.openstack_connector.get_security_group_id_by_name(
security_group_name=security_group_name
)

def get_cluster_info(self, cluster_id) -> ClusterInfo:
return self.openstack_connector.get_cluster_info(cluster_id=cluster_id)

def get_cluster_status(self, cluster_id: str) -> dict[str, str]:
return self.bibigrid_connector.get_cluster_status(cluster_id=cluster_id)
Expand Down
1 change: 1 addition & 0 deletions simple_vm_client/VirtualMachineServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def catch_shutdown(signal: int, frame: object) -> None:
click.echo(f"Server is running on port {PORT}")
handler = VirtualMachineHandler(CONFIG_FILE)
processor = Processor(handler)

if USE_SSL:
click.echo("Use SSL")
ssl_context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
Expand Down
11 changes: 11 additions & 0 deletions simple_vm_client/VirtualMachineService-remote
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ if len(sys.argv) <= 1 or sys.argv[1] == "--help":
print(" get_servers()")
print(" get_servers_by_ids( server_ids)")
print(" get_servers_by_bibigrid_id(string bibigrid_id)")
print(" string get_security_group_id_by_name(string name)")
print(
" scale_up_cluster(string cluster_id, string image_name, string flavor_name, int count, names, int start_idx, int batch_idx)"
)
Expand Down Expand Up @@ -651,6 +652,16 @@ elif cmd == "get_servers_by_bibigrid_id":
)
)

elif cmd == "get_security_group_id_by_name":
if len(args) != 1:
print("get_security_group_id_by_name requires 1 args")
sys.exit(1)
pp.pprint(
client.get_security_group_id_by_name(
args[0],
)
)

elif cmd == "scale_up_cluster":
if len(args) != 7:
print("scale_up_cluster requires 7 args")
Expand Down
269 changes: 269 additions & 0 deletions simple_vm_client/VirtualMachineService.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ce6932b

Please sign in to comment.