-
Notifications
You must be signed in to change notification settings - Fork 6
feat: get flavors #42
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
Conversation
| class ServerFlavor(BaseModel): | ||
| id: str | None = Field(default=None, exclude=True) | ||
| name: str = Field(validation_alias="original_name") | ||
| model_config = ConfigDict(validate_by_name=True) |
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.
Flavor가 Nova에 포함된 리소스긴 하지만 Server라고 접두사를 붙이지 않아도 충분히 전달이 되지 않을까 의견 드립니다.
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.
ServerFlavor와 Flavor 속성이 달라 구분이 필요
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.
실제 API 반환을 보니 구조가 달라 구분 및 공통화를 했다는점 이해했습니다.
다만 필드가 디르면 의미가 다르다고 생각이 드는데 Inner class 를 활용하면 어떨까 의견 드렸습니다 (온라인)
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.
넵 제안주신 대로 inner class로 바꿨습니다 ~ 좋은 의견 감사합니다
729a1ca to
bb453bc
Compare
| class Server(BaseModel): | ||
| class Flavor(BaseModel): | ||
| id: str | None = Field(default=None, exclude=True) | ||
| name: str = Field(validation_alias="original_name") | ||
| model_config = ConfigDict(validate_by_name=True) | ||
|
|
||
| model_config = ConfigDict(validate_by_name=True) | ||
| class Image(BaseModel): | ||
| id: str | ||
|
|
||
| class IPAddress(BaseModel): | ||
| addr: str | ||
| version: int | ||
| type: str = Field(validation_alias="OS-EXT-IPS:type") | ||
|
|
||
| class ServerSecurityGroup(BaseModel): | ||
| name: str | ||
| model_config = ConfigDict(validate_by_name=True) | ||
|
|
||
| class SecurityGroup(BaseModel): | ||
| name: str | ||
|
|
||
| class Server(BaseModel): | ||
| id: str | ||
| name: str | ||
| status: str | None = None | ||
| flavor: Flavor | None = None | ||
| image: Image | None = None | ||
| addresses: dict[str, list[ServerIp]] | None = None | ||
| addresses: dict[str, list[IPAddress]] | None = None | ||
| key_name: str | None = None | ||
| security_groups: list[ServerSecurityGroup] | None = None | ||
| security_groups: list[SecurityGroup] | 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.
LGTM ❤️
halucinor
left a comment
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.
LGTM
* feat: get flavors * fix: to inner class * fix: format
* feat: get flavors * fix: to inner class * fix: format
Overview
Add
get_flavorstools for compute tools.Key Changes
Flavormodel toServerFlavorcompute_toolsRelated Issues
Additional context
server 조회시 flavor 응답 예시
flavor 리스트 조회시 응답 예시
original_name <-> name이 달라 별도의 response 객체로 분리하였습니다