v0.0.23 | NHN Cloud 프로젝트에 dns_appkey 필드 추가
Some checks failed
Build And Test / build-and-push (push) Failing after 36s
Some checks failed
Build And Test / build-and-push (push) Failing after 36s
- NHNCloudProject 모델에 dns_appkey 필드 추가 - 프로젝트 CRUD API에서 dns_appkey 처리 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
18
users/migrations/0011_add_dns_appkey_to_nhncloudproject.py
Normal file
18
users/migrations/0011_add_dns_appkey_to_nhncloudproject.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 4.2.14 on 2026-01-14 15:18
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('users', '0010_nhncloudproject'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='nhncloudproject',
|
||||||
|
name='dns_appkey',
|
||||||
|
field=models.CharField(blank=True, max_length=64, null=True, verbose_name='DNS Plus Appkey'),
|
||||||
|
),
|
||||||
|
]
|
||||||
@ -163,6 +163,7 @@ class NHNCloudProject(models.Model):
|
|||||||
username = models.EmailField(verbose_name="NHN Cloud Username")
|
username = models.EmailField(verbose_name="NHN Cloud Username")
|
||||||
encrypted_password = models.BinaryField(verbose_name="NHN Cloud API Password (암호화)")
|
encrypted_password = models.BinaryField(verbose_name="NHN Cloud API Password (암호화)")
|
||||||
storage_account = models.CharField(max_length=128, blank=True, null=True, verbose_name="Storage Account")
|
storage_account = models.CharField(max_length=128, blank=True, null=True, verbose_name="Storage Account")
|
||||||
|
dns_appkey = models.CharField(max_length=64, blank=True, null=True, verbose_name="DNS Plus Appkey")
|
||||||
is_active = models.BooleanField(default=False, verbose_name="활성 프로젝트")
|
is_active = models.BooleanField(default=False, verbose_name="활성 프로젝트")
|
||||||
created_at = models.DateTimeField(auto_now_add=True)
|
created_at = models.DateTimeField(auto_now_add=True)
|
||||||
updated_at = models.DateTimeField(auto_now=True)
|
updated_at = models.DateTimeField(auto_now=True)
|
||||||
|
|||||||
@ -455,6 +455,7 @@ class NHNCloudProjectListView(APIView):
|
|||||||
"tenant_id": p.tenant_id,
|
"tenant_id": p.tenant_id,
|
||||||
"username": p.username,
|
"username": p.username,
|
||||||
"storage_account": p.storage_account or "",
|
"storage_account": p.storage_account or "",
|
||||||
|
"dns_appkey": p.dns_appkey or "",
|
||||||
"is_active": p.is_active,
|
"is_active": p.is_active,
|
||||||
"created_at": p.created_at.isoformat(),
|
"created_at": p.created_at.isoformat(),
|
||||||
} for p in projects]
|
} for p in projects]
|
||||||
@ -471,6 +472,7 @@ class NHNCloudProjectListView(APIView):
|
|||||||
username = request.data.get("username")
|
username = request.data.get("username")
|
||||||
password = request.data.get("password")
|
password = request.data.get("password")
|
||||||
storage_account = request.data.get("storage_account", "")
|
storage_account = request.data.get("storage_account", "")
|
||||||
|
dns_appkey = request.data.get("dns_appkey", "")
|
||||||
|
|
||||||
if not name or not tenant_id or not username or not password:
|
if not name or not tenant_id or not username or not password:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
@ -501,6 +503,7 @@ class NHNCloudProjectListView(APIView):
|
|||||||
tenant_id=tenant_id,
|
tenant_id=tenant_id,
|
||||||
username=username,
|
username=username,
|
||||||
storage_account=storage_account,
|
storage_account=storage_account,
|
||||||
|
dns_appkey=dns_appkey,
|
||||||
is_active=is_first,
|
is_active=is_first,
|
||||||
)
|
)
|
||||||
# 암호화된 비밀번호 설정 후 저장
|
# 암호화된 비밀번호 설정 후 저장
|
||||||
@ -518,6 +521,7 @@ class NHNCloudProjectListView(APIView):
|
|||||||
"tenant_id": project.tenant_id,
|
"tenant_id": project.tenant_id,
|
||||||
"username": project.username,
|
"username": project.username,
|
||||||
"storage_account": project.storage_account or "",
|
"storage_account": project.storage_account or "",
|
||||||
|
"dns_appkey": project.dns_appkey or "",
|
||||||
"is_active": project.is_active,
|
"is_active": project.is_active,
|
||||||
"created_at": project.created_at.isoformat(),
|
"created_at": project.created_at.isoformat(),
|
||||||
}, status=status.HTTP_201_CREATED)
|
}, status=status.HTTP_201_CREATED)
|
||||||
@ -557,6 +561,7 @@ class NHNCloudProjectDetailView(APIView):
|
|||||||
"tenant_id": project.tenant_id,
|
"tenant_id": project.tenant_id,
|
||||||
"username": project.username,
|
"username": project.username,
|
||||||
"storage_account": project.storage_account or "",
|
"storage_account": project.storage_account or "",
|
||||||
|
"dns_appkey": project.dns_appkey or "",
|
||||||
"is_active": project.is_active,
|
"is_active": project.is_active,
|
||||||
"created_at": project.created_at.isoformat(),
|
"created_at": project.created_at.isoformat(),
|
||||||
})
|
})
|
||||||
@ -579,6 +584,7 @@ class NHNCloudProjectDetailView(APIView):
|
|||||||
username = request.data.get("username")
|
username = request.data.get("username")
|
||||||
password = request.data.get("password") # 비어있으면 변경 안함
|
password = request.data.get("password") # 비어있으면 변경 안함
|
||||||
storage_account = request.data.get("storage_account")
|
storage_account = request.data.get("storage_account")
|
||||||
|
dns_appkey = request.data.get("dns_appkey")
|
||||||
|
|
||||||
# 필수 필드 검증
|
# 필수 필드 검증
|
||||||
if not name or not tenant_id or not username:
|
if not name or not tenant_id or not username:
|
||||||
@ -602,6 +608,8 @@ class NHNCloudProjectDetailView(APIView):
|
|||||||
project.username = username
|
project.username = username
|
||||||
if storage_account is not None:
|
if storage_account is not None:
|
||||||
project.storage_account = storage_account
|
project.storage_account = storage_account
|
||||||
|
if dns_appkey is not None:
|
||||||
|
project.dns_appkey = dns_appkey
|
||||||
|
|
||||||
# 비밀번호가 제공된 경우에만 변경
|
# 비밀번호가 제공된 경우에만 변경
|
||||||
if password:
|
if password:
|
||||||
@ -620,6 +628,7 @@ class NHNCloudProjectDetailView(APIView):
|
|||||||
"tenant_id": project.tenant_id,
|
"tenant_id": project.tenant_id,
|
||||||
"username": project.username,
|
"username": project.username,
|
||||||
"storage_account": project.storage_account or "",
|
"storage_account": project.storage_account or "",
|
||||||
|
"dns_appkey": project.dns_appkey or "",
|
||||||
"is_active": project.is_active,
|
"is_active": project.is_active,
|
||||||
"created_at": project.created_at.isoformat(),
|
"created_at": project.created_at.isoformat(),
|
||||||
})
|
})
|
||||||
@ -724,6 +733,7 @@ class NHNCloudProjectPasswordView(APIView):
|
|||||||
"username": project.username,
|
"username": project.username,
|
||||||
"password": decrypted_password,
|
"password": decrypted_password,
|
||||||
"storage_account": project.storage_account or "",
|
"storage_account": project.storage_account or "",
|
||||||
|
"dns_appkey": project.dns_appkey or "",
|
||||||
})
|
})
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.exception(
|
logger.exception(
|
||||||
|
|||||||
Reference in New Issue
Block a user