-
Notifications
You must be signed in to change notification settings - Fork 5
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 new services namespacegroup, namespace #13
Conversation
✅ Why it is requiredThe Developer Certificate of Origin (DCO) is a lightweight way for contributors to certify that they wrote or otherwise have the right to submit the code they are contributing to the project. Here is the full text of the DCO. Contributors sign-off that they adhere to these requirements by adding a
Git even has a
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, @kang2453
Please review the additional comments I've left.
|
||
def create(self, request, context): | ||
params, metadata = self.parse_request(request, context) | ||
namespacegroup_svc = NamespaceGroupService(metadata) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our convention is namepsace_group_svc
@append_query_filter( | ||
[ | ||
"namespace_group_id", | ||
"is_managed", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case append_query_filter need worksapce_id
permission="inventory-v2:NamespaceGroup.read", | ||
role_types=["DOMAIN_ADMIN", "WORKSPACE_OWNER", "WORKSPACE_MEMBER"], | ||
) | ||
@append_query_filter(["domain_id"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case append_query_filter need worksapce_id
role_types=["DOMAIN_ADMIN", "WORKSPACE_OWNER", "WORKSPACE_MEMBER"], | ||
) | ||
@append_query_filter(["domain_id"]) | ||
@append_keyword_filter(["namespace_group_id", "name"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stat api also need @change_value_by_rule("APPEND", "workspace_id","*")
decorator
'namespace_id': 'str', # required | ||
'name': 'str', | ||
'icon': 'str', | ||
'tags': 'dict', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to explain that params has workspace_id
class NamespaceGroupGetRequest(BaseModel): | ||
namespace_group_id: str | ||
resource_group: ResourceGroup | ||
workspace_id: Union[str,None] = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
workspace_id: Union[str,None] = None | |
workspace_id: Union[list,str,None] = None |
# def get_namespaces_in_namespace_group( | ||
# self, | ||
# namespace_group_id: str, | ||
# ) -> NamespaceResponse: | ||
|
||
# namespace_vos = self.namespace_model.filter( | ||
# namespace_group_id=namespace_group_id | ||
# ) | ||
# namespaces = [namespace_vo.namespace_id for namespace_vo in namespace_vos] | ||
|
||
# child_namespace_groups = self.namespace_group_model.filter( | ||
# parent_group_id=namespace_group_id | ||
# ) | ||
# for child_namespace_group in child_namespace_groups: | ||
# parent_group_id = child_namespace_group.namespace_group_id | ||
# namespaces.extend( | ||
# self.get_namespaces_in_namespace_group(parent_group_id) | ||
# ) | ||
# return list(set(namespaces)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# def get_namespaces_in_namespace_group( | |
# self, | |
# namespace_group_id: str, | |
# ) -> NamespaceResponse: | |
# namespace_vos = self.namespace_model.filter( | |
# namespace_group_id=namespace_group_id | |
# ) | |
# namespaces = [namespace_vo.namespace_id for namespace_vo in namespace_vos] | |
# child_namespace_groups = self.namespace_group_model.filter( | |
# parent_group_id=namespace_group_id | |
# ) | |
# for child_namespace_group in child_namespace_groups: | |
# parent_group_id = child_namespace_group.namespace_group_id | |
# namespaces.extend( | |
# self.get_namespaces_in_namespace_group(parent_group_id) | |
# ) | |
# return list(set(namespaces)) |
Please check this commented code is neccesary
self.identity_mgr.check_workspace(workspace_id, domain_id) | ||
else: | ||
params.workspace_id = "*" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before create namespace, i think we have to check namespace_group
object with namespace_group_id
value at params.
name: Union[str, None] = None | ||
icon: Union[str, None] = None | ||
tags: Union[Dict, None] = None | ||
workspace_id: Union[list,str,None] = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
workspace_id: Union[list,str,None] = None | |
workspace_id: Union[str,None] = None |
|
||
class NamespaceDeleteRequest(BaseModel): | ||
namespace_id: str | ||
workspace_id:Union[list,str,None] = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
workspace_id:Union[list,str,None] = None | |
workspace_id: Union[str,None] = None |
Category
Description
Known issue